@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,25 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
3
|
+
var chunkNK5Q7UNE_cjs = require('./chunk-NK5Q7UNE.cjs');
|
|
4
|
+
var chunkXNLIZYRZ_cjs = require('./chunk-XNLIZYRZ.cjs');
|
|
5
|
+
var chunkXMQSEJCF_cjs = require('./chunk-XMQSEJCF.cjs');
|
|
6
|
+
var chunkPWLJ77UV_cjs = require('./chunk-PWLJ77UV.cjs');
|
|
7
|
+
var chunkBSFJMMV3_cjs = require('./chunk-BSFJMMV3.cjs');
|
|
8
|
+
var chunkNFCVHQ5P_cjs = require('./chunk-NFCVHQ5P.cjs');
|
|
9
|
+
var chunkCXBHOOIQ_cjs = require('./chunk-CXBHOOIQ.cjs');
|
|
10
|
+
var chunkE4WNQBEF_cjs = require('./chunk-E4WNQBEF.cjs');
|
|
11
|
+
var chunkQ7Q4WSLJ_cjs = require('./chunk-Q7Q4WSLJ.cjs');
|
|
12
|
+
var chunkU63GDNRC_cjs = require('./chunk-U63GDNRC.cjs');
|
|
10
13
|
var chunkZY4GXIVN_cjs = require('./chunk-ZY4GXIVN.cjs');
|
|
11
|
-
var
|
|
14
|
+
var chunkVCRRKBLN_cjs = require('./chunk-VCRRKBLN.cjs');
|
|
12
15
|
var chunkHAHNRASW_cjs = require('./chunk-HAHNRASW.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
16
|
+
var chunk7BQXPCGN_cjs = require('./chunk-7BQXPCGN.cjs');
|
|
17
|
+
var chunkXUO3KQFO_cjs = require('./chunk-XUO3KQFO.cjs');
|
|
18
|
+
var chunkNI72YOJB_cjs = require('./chunk-NI72YOJB.cjs');
|
|
19
|
+
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
17
20
|
var zod = require('zod');
|
|
18
21
|
|
|
19
22
|
// src/ontology/core-meta-edges.ts
|
|
20
23
|
function createMetaEdge(name, properties) {
|
|
21
24
|
return Object.freeze({
|
|
22
|
-
[
|
|
25
|
+
[chunkNK5Q7UNE_cjs.META_EDGE_BRAND]: true,
|
|
23
26
|
name,
|
|
24
27
|
properties: {
|
|
25
28
|
transitive: properties.transitive ?? false,
|
|
@@ -31,7 +34,7 @@ function createMetaEdge(name, properties) {
|
|
|
31
34
|
}
|
|
32
35
|
});
|
|
33
36
|
}
|
|
34
|
-
var subClassOfMetaEdge = createMetaEdge(
|
|
37
|
+
var subClassOfMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_SUB_CLASS_OF, {
|
|
35
38
|
transitive: true,
|
|
36
39
|
inference: "subsumption",
|
|
37
40
|
description: "Type inheritance (Podcast subClassOf Media)"
|
|
@@ -43,9 +46,9 @@ function subClassOf(child, parent) {
|
|
|
43
46
|
to: parent
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
|
-
var broaderMetaEdge = createMetaEdge(
|
|
49
|
+
var broaderMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_BROADER, {
|
|
47
50
|
transitive: true,
|
|
48
|
-
inverse:
|
|
51
|
+
inverse: chunkXUO3KQFO_cjs.META_EDGE_NARROWER,
|
|
49
52
|
inference: "hierarchy",
|
|
50
53
|
description: "Broader concept (ML broader AI)"
|
|
51
54
|
});
|
|
@@ -56,9 +59,9 @@ function broader(narrowerConcept, broaderConcept) {
|
|
|
56
59
|
to: broaderConcept
|
|
57
60
|
};
|
|
58
61
|
}
|
|
59
|
-
var narrowerMetaEdge = createMetaEdge(
|
|
62
|
+
var narrowerMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_NARROWER, {
|
|
60
63
|
transitive: true,
|
|
61
|
-
inverse:
|
|
64
|
+
inverse: chunkXUO3KQFO_cjs.META_EDGE_BROADER,
|
|
62
65
|
inference: "hierarchy",
|
|
63
66
|
description: "Narrower concept (AI narrower ML)"
|
|
64
67
|
});
|
|
@@ -69,7 +72,7 @@ function narrower(broaderConcept, narrowerConcept) {
|
|
|
69
72
|
to: narrowerConcept
|
|
70
73
|
};
|
|
71
74
|
}
|
|
72
|
-
var relatedToMetaEdge = createMetaEdge(
|
|
75
|
+
var relatedToMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_RELATED_TO, {
|
|
73
76
|
symmetric: true,
|
|
74
77
|
inference: "association",
|
|
75
78
|
description: "Non-hierarchical association"
|
|
@@ -81,7 +84,7 @@ function relatedTo(conceptA, conceptB) {
|
|
|
81
84
|
to: conceptB
|
|
82
85
|
};
|
|
83
86
|
}
|
|
84
|
-
var equivalentToMetaEdge = createMetaEdge(
|
|
87
|
+
var equivalentToMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_EQUIVALENT_TO, {
|
|
85
88
|
symmetric: true,
|
|
86
89
|
transitive: true,
|
|
87
90
|
inference: "substitution",
|
|
@@ -94,11 +97,11 @@ function equivalentTo(kindA, kindBOrIri) {
|
|
|
94
97
|
to: kindBOrIri
|
|
95
98
|
};
|
|
96
99
|
}
|
|
97
|
-
var sameAsMetaEdge = createMetaEdge(
|
|
100
|
+
var sameAsMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_SAME_AS, {
|
|
98
101
|
symmetric: true,
|
|
99
102
|
transitive: true,
|
|
100
103
|
inference: "substitution",
|
|
101
|
-
description: "
|
|
104
|
+
description: "Deprecated type-level equivalence alias"
|
|
102
105
|
});
|
|
103
106
|
function sameAs(kindA, kindBOrIri) {
|
|
104
107
|
return {
|
|
@@ -107,10 +110,10 @@ function sameAs(kindA, kindBOrIri) {
|
|
|
107
110
|
to: kindBOrIri
|
|
108
111
|
};
|
|
109
112
|
}
|
|
110
|
-
var differentFromMetaEdge = createMetaEdge(
|
|
113
|
+
var differentFromMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_DIFFERENT_FROM, {
|
|
111
114
|
symmetric: true,
|
|
112
115
|
inference: "constraint",
|
|
113
|
-
description: "
|
|
116
|
+
description: "Deprecated decorative type-level non-identity relation"
|
|
114
117
|
});
|
|
115
118
|
function differentFrom(kindA, kindB) {
|
|
116
119
|
return {
|
|
@@ -119,7 +122,7 @@ function differentFrom(kindA, kindB) {
|
|
|
119
122
|
to: kindB
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
|
-
var disjointWithMetaEdge = createMetaEdge(
|
|
125
|
+
var disjointWithMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_DISJOINT_WITH, {
|
|
123
126
|
symmetric: true,
|
|
124
127
|
inference: "constraint",
|
|
125
128
|
description: "Mutually exclusive types"
|
|
@@ -131,9 +134,9 @@ function disjointWith(kindA, kindB) {
|
|
|
131
134
|
to: kindB
|
|
132
135
|
};
|
|
133
136
|
}
|
|
134
|
-
var partOfMetaEdge = createMetaEdge(
|
|
137
|
+
var partOfMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_PART_OF, {
|
|
135
138
|
transitive: true,
|
|
136
|
-
inverse:
|
|
139
|
+
inverse: chunkXUO3KQFO_cjs.META_EDGE_HAS_PART,
|
|
137
140
|
inference: "composition",
|
|
138
141
|
description: "X is part of Y"
|
|
139
142
|
});
|
|
@@ -144,9 +147,9 @@ function partOf(part, whole) {
|
|
|
144
147
|
to: whole
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
|
-
var hasPartMetaEdge = createMetaEdge(
|
|
150
|
+
var hasPartMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_HAS_PART, {
|
|
148
151
|
transitive: true,
|
|
149
|
-
inverse:
|
|
152
|
+
inverse: chunkXUO3KQFO_cjs.META_EDGE_PART_OF,
|
|
150
153
|
inference: "composition",
|
|
151
154
|
description: "Y has part X"
|
|
152
155
|
});
|
|
@@ -157,12 +160,12 @@ function hasPart(whole, part) {
|
|
|
157
160
|
to: part
|
|
158
161
|
};
|
|
159
162
|
}
|
|
160
|
-
var inverseOfMetaEdge = createMetaEdge(
|
|
163
|
+
var inverseOfMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_INVERSE_OF, {
|
|
161
164
|
symmetric: true,
|
|
162
165
|
inference: "none",
|
|
163
166
|
description: "Edge A is inverse of edge B"
|
|
164
167
|
});
|
|
165
|
-
var impliesMetaEdge = createMetaEdge(
|
|
168
|
+
var impliesMetaEdge = createMetaEdge(chunkXUO3KQFO_cjs.META_EDGE_IMPLIES, {
|
|
166
169
|
transitive: true,
|
|
167
170
|
inference: "none",
|
|
168
171
|
description: "Edge A implies edge B exists"
|
|
@@ -201,7 +204,9 @@ var core = {
|
|
|
201
204
|
narrower,
|
|
202
205
|
relatedTo,
|
|
203
206
|
equivalentTo,
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility member until the next major
|
|
204
208
|
sameAs,
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility member until the next major
|
|
205
210
|
differentFrom,
|
|
206
211
|
disjointWith,
|
|
207
212
|
partOf,
|
|
@@ -215,6 +220,7 @@ function computeSchemaDiff(before, after) {
|
|
|
215
220
|
const nodeChanges = diffNodes(before.nodes, after.nodes);
|
|
216
221
|
const edgeChanges = diffEdges(before.edges, after.edges);
|
|
217
222
|
const ontologyChanges = diffOntology(before.ontology, after.ontology);
|
|
223
|
+
const identityChange = diffIdentity(before.identity, after.identity);
|
|
218
224
|
const indexChanges = diffIndexes(before.indexes, after.indexes);
|
|
219
225
|
const extensionChange = diffExtension(before.extension, after.extension);
|
|
220
226
|
const deprecatedKindsChange = diffDeprecatedKinds(
|
|
@@ -227,14 +233,13 @@ function computeSchemaDiff(before, after) {
|
|
|
227
233
|
...ontologyChanges,
|
|
228
234
|
...indexChanges
|
|
229
235
|
];
|
|
230
|
-
const hasBreakingChanges = allChanges.some(
|
|
231
|
-
|
|
232
|
-
);
|
|
233
|
-
const hasChanges = allChanges.length > 0 || extensionChange !== void 0 || deprecatedKindsChange !== void 0;
|
|
236
|
+
const hasBreakingChanges = allChanges.some((change) => change.severity === "breaking") || identityChange?.severity === "breaking";
|
|
237
|
+
const hasChanges = allChanges.length > 0 || identityChange !== void 0 || extensionChange !== void 0 || deprecatedKindsChange !== void 0;
|
|
234
238
|
const summary = generateSummary(
|
|
235
239
|
nodeChanges,
|
|
236
240
|
edgeChanges,
|
|
237
241
|
ontologyChanges,
|
|
242
|
+
identityChange,
|
|
238
243
|
indexChanges,
|
|
239
244
|
extensionChange,
|
|
240
245
|
deprecatedKindsChange
|
|
@@ -245,6 +250,7 @@ function computeSchemaDiff(before, after) {
|
|
|
245
250
|
nodes: nodeChanges,
|
|
246
251
|
edges: edgeChanges,
|
|
247
252
|
ontology: ontologyChanges,
|
|
253
|
+
...identityChange === void 0 ? {} : { identity: identityChange },
|
|
248
254
|
indexes: indexChanges,
|
|
249
255
|
...extensionChange === void 0 ? {} : { extension: extensionChange },
|
|
250
256
|
...deprecatedKindsChange === void 0 ? {} : { deprecatedKinds: deprecatedKindsChange },
|
|
@@ -254,6 +260,29 @@ function computeSchemaDiff(before, after) {
|
|
|
254
260
|
summary
|
|
255
261
|
};
|
|
256
262
|
}
|
|
263
|
+
function diffIdentity(before, after) {
|
|
264
|
+
if (before === void 0 && after === void 0) return;
|
|
265
|
+
if (before === void 0) {
|
|
266
|
+
return {
|
|
267
|
+
type: "added",
|
|
268
|
+
severity: "safe",
|
|
269
|
+
details: "Operational Identity enabled"
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
if (after === void 0) {
|
|
273
|
+
return {
|
|
274
|
+
type: "removed",
|
|
275
|
+
severity: "breaking",
|
|
276
|
+
details: "Operational Identity disabled"
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
if (before.sameIdAcrossKinds === after.sameIdAcrossKinds) return;
|
|
280
|
+
return {
|
|
281
|
+
type: "modified",
|
|
282
|
+
severity: "breaking",
|
|
283
|
+
details: `Operational Identity sameIdAcrossKinds changed from "${before.sameIdAcrossKinds}" to "${after.sameIdAcrossKinds}"`
|
|
284
|
+
};
|
|
285
|
+
}
|
|
257
286
|
function diffNodes(before, after) {
|
|
258
287
|
const changes = [];
|
|
259
288
|
const beforeNames = new Set(Object.keys(before));
|
|
@@ -282,8 +311,8 @@ function diffNodes(before, after) {
|
|
|
282
311
|
}
|
|
283
312
|
for (const name of beforeNames) {
|
|
284
313
|
if (afterNames.has(name)) {
|
|
285
|
-
const nodeBefore =
|
|
286
|
-
const nodeAfter =
|
|
314
|
+
const nodeBefore = chunkN66HCGCY_cjs.requireDefined(before[name]);
|
|
315
|
+
const nodeAfter = chunkN66HCGCY_cjs.requireDefined(after[name]);
|
|
287
316
|
const nodeChanges = diffNodeDef(name, nodeBefore, nodeAfter);
|
|
288
317
|
changes.push(...nodeChanges);
|
|
289
318
|
}
|
|
@@ -317,11 +346,11 @@ var SUBSCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
317
346
|
]);
|
|
318
347
|
var DEPENDENT_REQUIRED_KEYWORD = "dependentRequired";
|
|
319
348
|
function canonicalKey(value) {
|
|
320
|
-
return JSON.stringify(value,
|
|
349
|
+
return JSON.stringify(value, chunkPWLJ77UV_cjs.sortedReplacer);
|
|
321
350
|
}
|
|
322
351
|
function sortedByCanonicalForm(items) {
|
|
323
352
|
return items.toSorted(
|
|
324
|
-
(left, right) =>
|
|
353
|
+
(left, right) => chunkXMQSEJCF_cjs.compareStrings(canonicalKey(left), canonicalKey(right))
|
|
325
354
|
);
|
|
326
355
|
}
|
|
327
356
|
function orderNormalizedSchema(value) {
|
|
@@ -329,7 +358,7 @@ function orderNormalizedSchema(value) {
|
|
|
329
358
|
return value.map((item) => orderNormalizedSchema(item));
|
|
330
359
|
}
|
|
331
360
|
if (value !== null && typeof value === "object") {
|
|
332
|
-
const normalized =
|
|
361
|
+
const normalized = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
333
362
|
for (const [key, entry] of Object.entries(value)) {
|
|
334
363
|
normalized[key] = normalizedKeywordValue(key, entry);
|
|
335
364
|
}
|
|
@@ -352,7 +381,7 @@ function normalizedDependentRequired(value) {
|
|
|
352
381
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
353
382
|
return value;
|
|
354
383
|
}
|
|
355
|
-
const normalized =
|
|
384
|
+
const normalized = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
356
385
|
for (const [name, required] of Object.entries(value)) {
|
|
357
386
|
normalized[name] = Array.isArray(required) ? sortedByCanonicalForm(required) : required;
|
|
358
387
|
}
|
|
@@ -362,20 +391,20 @@ function normalizedSubschemaMap(value) {
|
|
|
362
391
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
363
392
|
return orderNormalizedSchema(value);
|
|
364
393
|
}
|
|
365
|
-
const normalized =
|
|
394
|
+
const normalized = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
366
395
|
for (const [name, subschema] of Object.entries(value)) {
|
|
367
396
|
normalized[name] = orderNormalizedSchema(subschema);
|
|
368
397
|
}
|
|
369
398
|
return normalized;
|
|
370
399
|
}
|
|
371
400
|
function propertySchemasEqual(before, after) {
|
|
372
|
-
return
|
|
401
|
+
return chunkPWLJ77UV_cjs.canonicalEqual(
|
|
373
402
|
orderNormalizedSchema(before),
|
|
374
403
|
orderNormalizedSchema(after)
|
|
375
404
|
);
|
|
376
405
|
}
|
|
377
406
|
function endpointKindsEqual(before, after) {
|
|
378
|
-
return
|
|
407
|
+
return chunkPWLJ77UV_cjs.canonicalEqual(before?.toSorted(), after?.toSorted());
|
|
379
408
|
}
|
|
380
409
|
function diffNodeDef(name, before, after) {
|
|
381
410
|
const changes = [];
|
|
@@ -404,7 +433,7 @@ function diffNodeDef(name, before, after) {
|
|
|
404
433
|
after
|
|
405
434
|
});
|
|
406
435
|
}
|
|
407
|
-
if (!
|
|
436
|
+
if (!chunkPWLJ77UV_cjs.canonicalEqual(before.uniqueConstraints, after.uniqueConstraints)) {
|
|
408
437
|
changes.push({
|
|
409
438
|
type: "modified",
|
|
410
439
|
kind: name,
|
|
@@ -442,7 +471,7 @@ var NON_CONSTRAINING_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
442
471
|
"$schema"
|
|
443
472
|
]);
|
|
444
473
|
function stripSchemaMetadata(schema) {
|
|
445
|
-
const stripped =
|
|
474
|
+
const stripped = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
446
475
|
for (const [key, value] of Object.entries(schema)) {
|
|
447
476
|
if (!NON_CONSTRAINING_KEYWORDS.has(key)) stripped[key] = value;
|
|
448
477
|
}
|
|
@@ -472,7 +501,7 @@ function isBreakingObjectSchemaChange(before, after) {
|
|
|
472
501
|
const beforeRequired = new Set(before.required);
|
|
473
502
|
const afterRequired = new Set(after.required);
|
|
474
503
|
for (const key of Object.keys(beforeProps)) {
|
|
475
|
-
if (!(key
|
|
504
|
+
if (!chunkN66HCGCY_cjs.hasOwnKey(afterProps, key)) return true;
|
|
476
505
|
}
|
|
477
506
|
for (const key of afterRequired) {
|
|
478
507
|
if (!beforeRequired.has(key)) return true;
|
|
@@ -489,14 +518,20 @@ function classifyPropertyChanges(kind, before, after) {
|
|
|
489
518
|
const afterProps = after.properties ?? {};
|
|
490
519
|
const beforeRequired = new Set(before.required);
|
|
491
520
|
const afterRequired = new Set(after.required);
|
|
492
|
-
const removed = Object.keys(beforeProps).filter(
|
|
493
|
-
|
|
494
|
-
|
|
521
|
+
const removed = Object.keys(beforeProps).filter(
|
|
522
|
+
(property) => !chunkN66HCGCY_cjs.hasOwnKey(afterProps, property)
|
|
523
|
+
);
|
|
524
|
+
const added = Object.keys(afterProps).filter(
|
|
525
|
+
(property) => !chunkN66HCGCY_cjs.hasOwnKey(beforeProps, property)
|
|
526
|
+
);
|
|
527
|
+
const newRequired = [...afterRequired].filter(
|
|
528
|
+
(property) => !beforeRequired.has(property)
|
|
529
|
+
);
|
|
495
530
|
const breakingProps = [];
|
|
496
531
|
for (const [property, beforeProperty] of Object.entries(beforeProps)) {
|
|
497
532
|
const afterProperty = afterProps[property];
|
|
498
533
|
if (afterProperty === void 0) continue;
|
|
499
|
-
if (
|
|
534
|
+
if (chunkPWLJ77UV_cjs.canonicalEqual(beforeProperty, afterProperty)) continue;
|
|
500
535
|
if (isBreakingPropertyChange(beforeProperty, afterProperty)) {
|
|
501
536
|
breakingProps.push(property);
|
|
502
537
|
}
|
|
@@ -555,8 +590,8 @@ function diffEdges(before, after) {
|
|
|
555
590
|
}
|
|
556
591
|
for (const name of beforeNames) {
|
|
557
592
|
if (afterNames.has(name)) {
|
|
558
|
-
const edgeBefore =
|
|
559
|
-
const edgeAfter =
|
|
593
|
+
const edgeBefore = chunkN66HCGCY_cjs.requireDefined(before[name]);
|
|
594
|
+
const edgeAfter = chunkN66HCGCY_cjs.requireDefined(after[name]);
|
|
560
595
|
const edgeChanges = diffEdgeDef(name, edgeBefore, edgeAfter);
|
|
561
596
|
changes.push(...edgeChanges);
|
|
562
597
|
}
|
|
@@ -625,7 +660,7 @@ function diffEdgeDef(name, before, after) {
|
|
|
625
660
|
function annotationsChanged(before, after) {
|
|
626
661
|
if (before === void 0 && after === void 0) return false;
|
|
627
662
|
if (before === void 0 || after === void 0) return true;
|
|
628
|
-
return !
|
|
663
|
+
return !chunkPWLJ77UV_cjs.canonicalEqual(before, after);
|
|
629
664
|
}
|
|
630
665
|
function diffOntology(before, after) {
|
|
631
666
|
const changes = [];
|
|
@@ -724,7 +759,7 @@ function diffIndexes(before, after) {
|
|
|
724
759
|
for (const [name, beforeIndex] of beforeByName) {
|
|
725
760
|
const afterIndex = afterByName.get(name);
|
|
726
761
|
if (!afterIndex) continue;
|
|
727
|
-
if (!
|
|
762
|
+
if (!chunkPWLJ77UV_cjs.canonicalEqual(beforeIndex, afterIndex)) {
|
|
728
763
|
changes.push({
|
|
729
764
|
type: "modified",
|
|
730
765
|
name,
|
|
@@ -754,7 +789,7 @@ function diffExtension(before, after) {
|
|
|
754
789
|
details: "Graph extension document was removed"
|
|
755
790
|
};
|
|
756
791
|
}
|
|
757
|
-
if (
|
|
792
|
+
if (chunkPWLJ77UV_cjs.canonicalEqual(before, after)) return void 0;
|
|
758
793
|
return {
|
|
759
794
|
type: "modified",
|
|
760
795
|
severity: "safe",
|
|
@@ -785,7 +820,7 @@ function diffDeprecatedKinds(before, after) {
|
|
|
785
820
|
details: `Deprecated kinds: ${parts.join("; ")}`
|
|
786
821
|
};
|
|
787
822
|
}
|
|
788
|
-
function generateSummary(nodeChanges, edgeChanges, ontologyChanges, indexChanges, extensionChange, deprecatedKindsChange) {
|
|
823
|
+
function generateSummary(nodeChanges, edgeChanges, ontologyChanges, identityChange, indexChanges, extensionChange, deprecatedKindsChange) {
|
|
789
824
|
const parts = [];
|
|
790
825
|
const nodeAdded = nodeChanges.filter((c) => c.type === "added").length;
|
|
791
826
|
const nodeRemoved = nodeChanges.filter((c) => c.type === "removed").length;
|
|
@@ -812,6 +847,9 @@ function generateSummary(nodeChanges, edgeChanges, ontologyChanges, indexChanges
|
|
|
812
847
|
if (ontologyAdded > 0 || ontologyRemoved > 0) {
|
|
813
848
|
parts.push(`Ontology: ${ontologyAdded} added, ${ontologyRemoved} removed`);
|
|
814
849
|
}
|
|
850
|
+
if (identityChange !== void 0) {
|
|
851
|
+
parts.push(`Identity: ${identityChange.type}`);
|
|
852
|
+
}
|
|
815
853
|
const indexAdded = indexChanges.filter((c) => c.type === "added").length;
|
|
816
854
|
const indexRemoved = indexChanges.filter((c) => c.type === "removed").length;
|
|
817
855
|
const indexModified = indexChanges.filter(
|
|
@@ -860,419 +898,30 @@ function getMigrationActions(diff) {
|
|
|
860
898
|
actions.push(`DELETE data for removed edge kind "${change.kind}"`);
|
|
861
899
|
}
|
|
862
900
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
nodeKinds;
|
|
870
|
-
edgeKinds;
|
|
871
|
-
// === Subsumption (subClassOf) ===
|
|
872
|
-
// Transitive closure for inheritance
|
|
873
|
-
subClassAncestors;
|
|
874
|
-
subClassDescendants;
|
|
875
|
-
// === Hierarchy (broader/narrower) ===
|
|
876
|
-
// Transitive closure for concept hierarchy (separate from subClassOf!)
|
|
877
|
-
broaderClosure;
|
|
878
|
-
narrowerClosure;
|
|
879
|
-
// === Equivalence ===
|
|
880
|
-
equivalenceSets;
|
|
881
|
-
iriToKind;
|
|
882
|
-
// === Constraints ===
|
|
883
|
-
disjointPairs;
|
|
884
|
-
// Normalized pairs: "Organization|Person"
|
|
885
|
-
// === Composition ===
|
|
886
|
-
partOfClosure;
|
|
887
|
-
hasPartClosure;
|
|
888
|
-
// === Edge Relationships ===
|
|
889
|
-
edgeInverses;
|
|
890
|
-
edgeImplicationsClosure;
|
|
891
|
-
edgeImplyingClosure;
|
|
892
|
-
constructor(nodeKinds, edgeKinds, closures) {
|
|
893
|
-
this.nodeKinds = nodeKinds;
|
|
894
|
-
this.edgeKinds = edgeKinds;
|
|
895
|
-
this.subClassAncestors = closures.subClassAncestors;
|
|
896
|
-
this.subClassDescendants = closures.subClassDescendants;
|
|
897
|
-
this.broaderClosure = closures.broaderClosure;
|
|
898
|
-
this.narrowerClosure = closures.narrowerClosure;
|
|
899
|
-
this.equivalenceSets = closures.equivalenceSets;
|
|
900
|
-
this.iriToKind = closures.iriToKind;
|
|
901
|
-
this.disjointPairs = closures.disjointPairs;
|
|
902
|
-
this.partOfClosure = closures.partOfClosure;
|
|
903
|
-
this.hasPartClosure = closures.hasPartClosure;
|
|
904
|
-
this.edgeInverses = closures.edgeInverses;
|
|
905
|
-
this.edgeImplicationsClosure = closures.edgeImplicationsClosure;
|
|
906
|
-
this.edgeImplyingClosure = closures.edgeImplyingClosure;
|
|
907
|
-
}
|
|
908
|
-
// === Subsumption Methods ===
|
|
909
|
-
/**
|
|
910
|
-
* Checks if child is a subclass of parent (directly or transitively).
|
|
911
|
-
*/
|
|
912
|
-
isSubClassOf(child, parent) {
|
|
913
|
-
return chunkQYWINYEA_cjs.isReachable(this.subClassAncestors, child, parent);
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* Expands a kind to include all its subclasses.
|
|
917
|
-
* Returns [kind, ...subclasses].
|
|
918
|
-
*/
|
|
919
|
-
expandSubClasses(kind) {
|
|
920
|
-
const descendants = this.subClassDescendants.get(kind) ?? /* @__PURE__ */ new Set();
|
|
921
|
-
return [kind, ...descendants];
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Gets all ancestors of a kind (via subClassOf).
|
|
925
|
-
*/
|
|
926
|
-
getAncestors(kind) {
|
|
927
|
-
return this.subClassAncestors.get(kind) ?? /* @__PURE__ */ new Set();
|
|
928
|
-
}
|
|
929
|
-
/**
|
|
930
|
-
* Gets all descendants of a kind (via subClassOf).
|
|
931
|
-
*/
|
|
932
|
-
getDescendants(kind) {
|
|
933
|
-
return this.subClassDescendants.get(kind) ?? /* @__PURE__ */ new Set();
|
|
934
|
-
}
|
|
935
|
-
// === Hierarchy Methods ===
|
|
936
|
-
/**
|
|
937
|
-
* Checks if narrowerConcept is narrower than broaderConcept.
|
|
938
|
-
*/
|
|
939
|
-
isNarrowerThan(narrowerConcept, broaderConcept) {
|
|
940
|
-
return chunkQYWINYEA_cjs.isReachable(this.broaderClosure, narrowerConcept, broaderConcept);
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Checks if broaderConcept is broader than narrowerConcept.
|
|
944
|
-
*/
|
|
945
|
-
isBroaderThan(broaderConcept, narrowerConcept) {
|
|
946
|
-
return chunkQYWINYEA_cjs.isReachable(this.narrowerClosure, broaderConcept, narrowerConcept);
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Expands to include all narrower concepts.
|
|
950
|
-
*/
|
|
951
|
-
expandNarrower(kind) {
|
|
952
|
-
const narrower2 = this.narrowerClosure.get(kind) ?? /* @__PURE__ */ new Set();
|
|
953
|
-
return [kind, ...narrower2];
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Expands to include all broader concepts.
|
|
957
|
-
*/
|
|
958
|
-
expandBroader(kind) {
|
|
959
|
-
const broader2 = this.broaderClosure.get(kind) ?? /* @__PURE__ */ new Set();
|
|
960
|
-
return [kind, ...broader2];
|
|
961
|
-
}
|
|
962
|
-
// === Equivalence Methods ===
|
|
963
|
-
/**
|
|
964
|
-
* Checks if two kinds are equivalent.
|
|
965
|
-
*/
|
|
966
|
-
areEquivalent(a, b) {
|
|
967
|
-
const equivalents = this.equivalenceSets.get(a);
|
|
968
|
-
return equivalents?.has(b) ?? false;
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* Gets all equivalents of a kind (including external IRIs).
|
|
972
|
-
*/
|
|
973
|
-
getEquivalents(kind) {
|
|
974
|
-
const equivalents = this.equivalenceSets.get(kind);
|
|
975
|
-
return equivalents ? [...equivalents] : [];
|
|
976
|
-
}
|
|
977
|
-
/**
|
|
978
|
-
* Resolves an external IRI to an internal kind name.
|
|
979
|
-
*/
|
|
980
|
-
resolveIri(iri) {
|
|
981
|
-
return this.iriToKind.get(iri);
|
|
982
|
-
}
|
|
983
|
-
// === Constraint Methods ===
|
|
984
|
-
/**
|
|
985
|
-
* Checks if two kinds are disjoint.
|
|
986
|
-
*/
|
|
987
|
-
areDisjoint(a, b) {
|
|
988
|
-
const normalizedPair = a < b ? `${a}|${b}` : `${b}|${a}`;
|
|
989
|
-
return this.disjointPairs.has(normalizedPair);
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Gets all kinds that are disjoint with the given kind.
|
|
993
|
-
*/
|
|
994
|
-
getDisjointKinds(kind) {
|
|
995
|
-
const result = [];
|
|
996
|
-
for (const pair of this.disjointPairs) {
|
|
997
|
-
const parts = pair.split("|");
|
|
998
|
-
const firstKind = chunk764JHTLT_cjs.requireDefined(parts[0]);
|
|
999
|
-
const secondKind = chunk764JHTLT_cjs.requireDefined(parts[1]);
|
|
1000
|
-
if (firstKind === kind) result.push(secondKind);
|
|
1001
|
-
else if (secondKind === kind) result.push(firstKind);
|
|
1002
|
-
}
|
|
1003
|
-
return result;
|
|
1004
|
-
}
|
|
1005
|
-
// === Composition Methods ===
|
|
1006
|
-
/**
|
|
1007
|
-
* Checks if part is part of whole (directly or transitively).
|
|
1008
|
-
*/
|
|
1009
|
-
isPartOf(part, whole) {
|
|
1010
|
-
return chunkQYWINYEA_cjs.isReachable(this.partOfClosure, part, whole);
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Gets all wholes that contain this part.
|
|
1014
|
-
*/
|
|
1015
|
-
getWholes(part) {
|
|
1016
|
-
const wholes = this.partOfClosure.get(part);
|
|
1017
|
-
return wholes ? [...wholes] : [];
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Gets all parts of this whole.
|
|
1021
|
-
*/
|
|
1022
|
-
getParts(whole) {
|
|
1023
|
-
const parts = this.hasPartClosure.get(whole);
|
|
1024
|
-
return parts ? [...parts] : [];
|
|
1025
|
-
}
|
|
1026
|
-
// === Edge Relationship Methods ===
|
|
1027
|
-
/**
|
|
1028
|
-
* Gets the inverse edge kind for a given edge kind.
|
|
1029
|
-
* If edgeA inverseOf edgeB, then getInverseEdge("edgeA") returns "edgeB".
|
|
1030
|
-
*/
|
|
1031
|
-
getInverseEdge(edgeKind) {
|
|
1032
|
-
return this.edgeInverses.get(edgeKind);
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Gets all edges implied by a given edge (transitively).
|
|
1036
|
-
* If A implies B and B implies C, then getImpliedEdges("A") returns ["B", "C"].
|
|
1037
|
-
*/
|
|
1038
|
-
getImpliedEdges(edgeKind) {
|
|
1039
|
-
const implied = this.edgeImplicationsClosure.get(edgeKind);
|
|
1040
|
-
return implied ? [...implied] : [];
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* Gets all edges that imply a given edge (transitively).
|
|
1044
|
-
* If A implies B and B implies C, then getImplyingEdges("C") returns ["A", "B"].
|
|
1045
|
-
* Used for query-time expansion: when querying for C, also include A and B edges.
|
|
1046
|
-
*/
|
|
1047
|
-
getImplyingEdges(edgeKind) {
|
|
1048
|
-
const implying = this.edgeImplyingClosure.get(edgeKind);
|
|
1049
|
-
return implying ? [...implying] : [];
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Expands an edge kind to include all edges that imply it.
|
|
1053
|
-
* Returns [edgeKind, ...implyingEdges].
|
|
1054
|
-
*/
|
|
1055
|
-
expandImplyingEdges(edgeKind) {
|
|
1056
|
-
const implying = this.edgeImplyingClosure.get(edgeKind) ?? /* @__PURE__ */ new Set();
|
|
1057
|
-
return [edgeKind, ...implying];
|
|
1058
|
-
}
|
|
1059
|
-
// === Edge Endpoint Validation ===
|
|
1060
|
-
/**
|
|
1061
|
-
* Checks if a concrete kind is assignable to a target kind.
|
|
1062
|
-
* Uses subsumption: Company is assignable to Organization if Company subClassOf Organization.
|
|
1063
|
-
*/
|
|
1064
|
-
isAssignableTo(concreteKind, targetKind) {
|
|
1065
|
-
if (concreteKind === targetKind) return true;
|
|
1066
|
-
return this.isSubClassOf(concreteKind, targetKind);
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Checks if a concrete kind is assignable to at least one of the given
|
|
1070
|
-
* target kinds. Shared by every "is this kind usable where one of these
|
|
1071
|
-
* kinds is expected" check (edge endpoint validation, ontology relation
|
|
1072
|
-
* endpoint compatibility) so they can't independently drift.
|
|
1073
|
-
*/
|
|
1074
|
-
isAssignableToAny(concreteKind, targetKinds) {
|
|
1075
|
-
return targetKinds.some(
|
|
1076
|
-
(targetKind) => this.isAssignableTo(concreteKind, targetKind)
|
|
1077
|
-
);
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Validates that a kind exists in the registry.
|
|
1081
|
-
*/
|
|
1082
|
-
hasNodeType(name) {
|
|
1083
|
-
return this.nodeKinds.has(name);
|
|
1084
|
-
}
|
|
1085
|
-
/**
|
|
1086
|
-
* Validates that an edge kind exists in the registry.
|
|
1087
|
-
*/
|
|
1088
|
-
hasEdgeType(name) {
|
|
1089
|
-
return this.edgeKinds.has(name);
|
|
1090
|
-
}
|
|
1091
|
-
/**
|
|
1092
|
-
* Gets a node kind by name.
|
|
1093
|
-
*/
|
|
1094
|
-
getNodeType(name) {
|
|
1095
|
-
return this.nodeKinds.get(name);
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* Gets an edge kind by name.
|
|
1099
|
-
*/
|
|
1100
|
-
getEdgeType(name) {
|
|
1101
|
-
return this.edgeKinds.get(name);
|
|
1102
|
-
}
|
|
1103
|
-
};
|
|
1104
|
-
function createEmptyClosures() {
|
|
1105
|
-
return {
|
|
1106
|
-
subClassAncestors: /* @__PURE__ */ new Map(),
|
|
1107
|
-
subClassDescendants: /* @__PURE__ */ new Map(),
|
|
1108
|
-
broaderClosure: /* @__PURE__ */ new Map(),
|
|
1109
|
-
narrowerClosure: /* @__PURE__ */ new Map(),
|
|
1110
|
-
equivalenceSets: /* @__PURE__ */ new Map(),
|
|
1111
|
-
iriToKind: /* @__PURE__ */ new Map(),
|
|
1112
|
-
disjointPairs: /* @__PURE__ */ new Set(),
|
|
1113
|
-
partOfClosure: /* @__PURE__ */ new Map(),
|
|
1114
|
-
hasPartClosure: /* @__PURE__ */ new Map(),
|
|
1115
|
-
edgeInverses: /* @__PURE__ */ new Map(),
|
|
1116
|
-
edgeImplicationsClosure: /* @__PURE__ */ new Map(),
|
|
1117
|
-
edgeImplyingClosure: /* @__PURE__ */ new Map()
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
function computeClosuresFromOntology(ontology) {
|
|
1121
|
-
const subClassRelations = [];
|
|
1122
|
-
const broaderRelations = [];
|
|
1123
|
-
const equivalentRelations = [];
|
|
1124
|
-
const disjointRelations = [];
|
|
1125
|
-
const partOfRelations = [];
|
|
1126
|
-
const inverseOfRelations = [];
|
|
1127
|
-
const impliesRelations = [];
|
|
1128
|
-
for (const relation of ontology) {
|
|
1129
|
-
const fromName = getKindName(relation.from);
|
|
1130
|
-
const toName = getKindName(relation.to);
|
|
1131
|
-
switch (relation.metaEdge.name) {
|
|
1132
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_SUB_CLASS_OF: {
|
|
1133
|
-
subClassRelations.push([fromName, toName]);
|
|
1134
|
-
break;
|
|
1135
|
-
}
|
|
1136
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_BROADER: {
|
|
1137
|
-
broaderRelations.push([fromName, toName]);
|
|
1138
|
-
break;
|
|
1139
|
-
}
|
|
1140
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_NARROWER: {
|
|
1141
|
-
broaderRelations.push([toName, fromName]);
|
|
1142
|
-
break;
|
|
1143
|
-
}
|
|
1144
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_EQUIVALENT_TO:
|
|
1145
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_SAME_AS: {
|
|
1146
|
-
equivalentRelations.push([fromName, toName]);
|
|
901
|
+
if (diff.identity !== void 0) {
|
|
902
|
+
switch (diff.identity.type) {
|
|
903
|
+
case "added": {
|
|
904
|
+
actions.push(
|
|
905
|
+
`BUILD Operational Identity closure: ${diff.identity.details} (materializes the closure table, running a same-id fold scan when sameIdAcrossKinds is "fold")`
|
|
906
|
+
);
|
|
1147
907
|
break;
|
|
1148
908
|
}
|
|
1149
|
-
case
|
|
1150
|
-
|
|
909
|
+
case "modified": {
|
|
910
|
+
actions.push(
|
|
911
|
+
`REBUILD Operational Identity closure: ${diff.identity.details} (every areSame/membersOf/includeIdentityMembers answer is recomputed under the new profile)`
|
|
912
|
+
);
|
|
1151
913
|
break;
|
|
1152
914
|
}
|
|
1153
|
-
case
|
|
1154
|
-
|
|
915
|
+
case "removed": {
|
|
916
|
+
actions.push(
|
|
917
|
+
`DISABLE Operational Identity: ${diff.identity.details} (the materialized closure is left in place, unread; the identity API becomes unavailable)`
|
|
918
|
+
);
|
|
1155
919
|
break;
|
|
1156
920
|
}
|
|
1157
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_HAS_PART: {
|
|
1158
|
-
partOfRelations.push([toName, fromName]);
|
|
1159
|
-
break;
|
|
1160
|
-
}
|
|
1161
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_INVERSE_OF: {
|
|
1162
|
-
inverseOfRelations.push([fromName, toName]);
|
|
1163
|
-
break;
|
|
1164
|
-
}
|
|
1165
|
-
case chunkSVJ5GEXW_cjs.META_EDGE_IMPLIES: {
|
|
1166
|
-
impliesRelations.push([fromName, toName]);
|
|
1167
|
-
break;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
const subClassAncestors = chunkQYWINYEA_cjs.computeTransitiveClosure(subClassRelations);
|
|
1172
|
-
const subClassDescendants = chunkQYWINYEA_cjs.invertClosure(subClassAncestors);
|
|
1173
|
-
const broaderClosure = chunkQYWINYEA_cjs.computeTransitiveClosure(broaderRelations);
|
|
1174
|
-
const narrowerClosure = chunkQYWINYEA_cjs.invertClosure(broaderClosure);
|
|
1175
|
-
const equivalenceSets = computeEquivalenceSets(equivalentRelations);
|
|
1176
|
-
const iriToKind = computeIriMapping(equivalentRelations);
|
|
1177
|
-
const disjointPairs = computeDisjointPairs(disjointRelations);
|
|
1178
|
-
const partOfClosure = chunkQYWINYEA_cjs.computeTransitiveClosure(partOfRelations);
|
|
1179
|
-
const hasPartClosure = chunkQYWINYEA_cjs.invertClosure(partOfClosure);
|
|
1180
|
-
const edgeInverses = computeEdgeInverses(inverseOfRelations);
|
|
1181
|
-
const edgeImplicationsClosure = chunkQYWINYEA_cjs.computeTransitiveClosure(impliesRelations);
|
|
1182
|
-
const edgeImplyingClosure = chunkQYWINYEA_cjs.invertClosure(edgeImplicationsClosure);
|
|
1183
|
-
return {
|
|
1184
|
-
subClassAncestors,
|
|
1185
|
-
subClassDescendants,
|
|
1186
|
-
broaderClosure,
|
|
1187
|
-
narrowerClosure,
|
|
1188
|
-
equivalenceSets,
|
|
1189
|
-
iriToKind,
|
|
1190
|
-
disjointPairs,
|
|
1191
|
-
partOfClosure,
|
|
1192
|
-
hasPartClosure,
|
|
1193
|
-
edgeInverses,
|
|
1194
|
-
edgeImplicationsClosure,
|
|
1195
|
-
edgeImplyingClosure
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1198
|
-
function getKindName(kindOrIri) {
|
|
1199
|
-
if (typeof kindOrIri === "string") {
|
|
1200
|
-
return kindOrIri;
|
|
1201
|
-
}
|
|
1202
|
-
return kindOrIri.kind;
|
|
1203
|
-
}
|
|
1204
|
-
function isExternalIri(value) {
|
|
1205
|
-
return value.startsWith("http://") || value.startsWith("https://");
|
|
1206
|
-
}
|
|
1207
|
-
function computeEquivalenceSets(relations) {
|
|
1208
|
-
const parent = /* @__PURE__ */ new Map();
|
|
1209
|
-
function find(x) {
|
|
1210
|
-
if (!parent.has(x)) {
|
|
1211
|
-
parent.set(x, x);
|
|
1212
|
-
return x;
|
|
1213
|
-
}
|
|
1214
|
-
const parentNode = chunk764JHTLT_cjs.requireDefined(parent.get(x));
|
|
1215
|
-
if (parentNode === x) return x;
|
|
1216
|
-
const root = find(parentNode);
|
|
1217
|
-
parent.set(x, root);
|
|
1218
|
-
return root;
|
|
1219
|
-
}
|
|
1220
|
-
function union(a, b) {
|
|
1221
|
-
const rootA = find(a);
|
|
1222
|
-
const rootB = find(b);
|
|
1223
|
-
if (rootA !== rootB) {
|
|
1224
|
-
parent.set(rootA, rootB);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
for (const [a, b] of relations) {
|
|
1228
|
-
union(a, b);
|
|
1229
|
-
}
|
|
1230
|
-
const classes = /* @__PURE__ */ new Map();
|
|
1231
|
-
for (const key of parent.keys()) {
|
|
1232
|
-
const root = find(key);
|
|
1233
|
-
const existing = classes.get(root) ?? /* @__PURE__ */ new Set();
|
|
1234
|
-
existing.add(key);
|
|
1235
|
-
classes.set(root, existing);
|
|
1236
|
-
}
|
|
1237
|
-
const result = /* @__PURE__ */ new Map();
|
|
1238
|
-
for (const members of classes.values()) {
|
|
1239
|
-
for (const member of members) {
|
|
1240
|
-
const others = new Set(members);
|
|
1241
|
-
others.delete(member);
|
|
1242
|
-
result.set(member, others);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
return result;
|
|
1246
|
-
}
|
|
1247
|
-
function computeIriMapping(relations) {
|
|
1248
|
-
const result = /* @__PURE__ */ new Map();
|
|
1249
|
-
for (const [a, b] of relations) {
|
|
1250
|
-
if (isExternalIri(a) && !isExternalIri(b)) {
|
|
1251
|
-
result.set(a, b);
|
|
1252
|
-
} else if (isExternalIri(b) && !isExternalIri(a)) {
|
|
1253
|
-
result.set(b, a);
|
|
1254
921
|
}
|
|
1255
922
|
}
|
|
1256
|
-
return
|
|
1257
|
-
}
|
|
1258
|
-
function computeDisjointPairs(relations) {
|
|
1259
|
-
const result = /* @__PURE__ */ new Set();
|
|
1260
|
-
for (const [a, b] of relations) {
|
|
1261
|
-
const normalized = a < b ? `${a}|${b}` : `${b}|${a}`;
|
|
1262
|
-
result.add(normalized);
|
|
1263
|
-
}
|
|
1264
|
-
return result;
|
|
1265
|
-
}
|
|
1266
|
-
function computeEdgeInverses(relations) {
|
|
1267
|
-
const result = /* @__PURE__ */ new Map();
|
|
1268
|
-
for (const [a, b] of relations) {
|
|
1269
|
-
result.set(a, b);
|
|
1270
|
-
result.set(b, a);
|
|
1271
|
-
}
|
|
1272
|
-
return result;
|
|
923
|
+
return actions;
|
|
1273
924
|
}
|
|
1274
|
-
|
|
1275
|
-
// src/schema/serializer.ts
|
|
1276
925
|
function serializeSchema(graph, version) {
|
|
1277
926
|
const nodes = serializeNodes(graph);
|
|
1278
927
|
const edges = serializeEdges(graph);
|
|
@@ -1283,7 +932,7 @@ function serializeSchema(graph, version) {
|
|
|
1283
932
|
return {
|
|
1284
933
|
graphId: graph.id,
|
|
1285
934
|
version,
|
|
1286
|
-
generatedAt:
|
|
935
|
+
generatedAt: chunkQ7Q4WSLJ_cjs.nowIso(),
|
|
1287
936
|
nodes,
|
|
1288
937
|
edges,
|
|
1289
938
|
ontology,
|
|
@@ -1291,6 +940,7 @@ function serializeSchema(graph, version) {
|
|
|
1291
940
|
onNodeDelete: graph.defaults.onNodeDelete,
|
|
1292
941
|
temporalMode: graph.defaults.temporalMode
|
|
1293
942
|
},
|
|
943
|
+
...graph.identity === void 0 ? {} : { identity: graph.identity },
|
|
1294
944
|
// `serializeIndexes` collapses both absent and empty inputs to
|
|
1295
945
|
// `undefined` (see the helper's docstring); omit the field entirely
|
|
1296
946
|
// in that case so legacy graphs hash byte-identically to the
|
|
@@ -1314,7 +964,7 @@ function serializeDeprecatedKinds(set) {
|
|
|
1314
964
|
function canonicalExtension(document) {
|
|
1315
965
|
if (document === void 0) return void 0;
|
|
1316
966
|
if (document.version === void 0) return document;
|
|
1317
|
-
if (document.version !==
|
|
967
|
+
if (document.version !== chunk7BQXPCGN_cjs.LEGACY_GRAPH_EXTENSION_VERSION) return document;
|
|
1318
968
|
const { version: _omit, ...rest } = document;
|
|
1319
969
|
return rest;
|
|
1320
970
|
}
|
|
@@ -1399,13 +1049,13 @@ function serializeEdgeIndexDeclaration(declaration) {
|
|
|
1399
1049
|
};
|
|
1400
1050
|
}
|
|
1401
1051
|
function serializeNodes(graph) {
|
|
1402
|
-
const result =
|
|
1403
|
-
for (const kindName of
|
|
1052
|
+
const result = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1053
|
+
for (const kindName of chunkCXBHOOIQ_cjs.getNodeKinds(graph)) {
|
|
1404
1054
|
const registration = graph.nodes[kindName];
|
|
1405
1055
|
if (registration === void 0) continue;
|
|
1406
1056
|
result[kindName] = serializeNodeDef(registration);
|
|
1407
1057
|
}
|
|
1408
|
-
return result;
|
|
1058
|
+
return { ...result };
|
|
1409
1059
|
}
|
|
1410
1060
|
function serializeNodeDef(registration) {
|
|
1411
1061
|
const node = registration.type;
|
|
@@ -1429,26 +1079,16 @@ function serializeUniqueConstraints(constraints) {
|
|
|
1429
1079
|
}));
|
|
1430
1080
|
}
|
|
1431
1081
|
function serializeWherePredicate(whereFunction) {
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
field,
|
|
1440
|
-
op: "isNull"
|
|
1441
|
-
}),
|
|
1442
|
-
isNotNull: () => ({
|
|
1443
|
-
__type: "unique_predicate",
|
|
1444
|
-
field,
|
|
1445
|
-
op: "isNotNull"
|
|
1446
|
-
})
|
|
1447
|
-
};
|
|
1082
|
+
const predicate = chunkE4WNQBEF_cjs.captureWherePredicate(whereFunction);
|
|
1083
|
+
if (predicate === void 0) {
|
|
1084
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
1085
|
+
`A unique constraint's \`where\` callback did not return a predicate, so it cannot be persisted.`,
|
|
1086
|
+
{},
|
|
1087
|
+
{
|
|
1088
|
+
suggestion: `Return a field predicate, e.g. \`where: (fields) => fields.someField.isNotNull()\`.`
|
|
1448
1089
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
const predicate = whereFunction(builder);
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1452
1092
|
return JSON.stringify({ field: predicate.field, op: predicate.op });
|
|
1453
1093
|
}
|
|
1454
1094
|
function deserializeWherePredicate(serialized) {
|
|
@@ -1467,13 +1107,13 @@ function deserializeWherePredicate(serialized) {
|
|
|
1467
1107
|
};
|
|
1468
1108
|
}
|
|
1469
1109
|
function serializeEdges(graph) {
|
|
1470
|
-
const result =
|
|
1471
|
-
for (const kindName of
|
|
1110
|
+
const result = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1111
|
+
for (const kindName of chunkCXBHOOIQ_cjs.getEdgeKinds(graph)) {
|
|
1472
1112
|
const registration = graph.edges[kindName];
|
|
1473
1113
|
if (registration === void 0) continue;
|
|
1474
1114
|
result[kindName] = serializeEdgeDef(registration);
|
|
1475
1115
|
}
|
|
1476
|
-
return result;
|
|
1116
|
+
return { ...result };
|
|
1477
1117
|
}
|
|
1478
1118
|
function serializeEdgeDef(registration) {
|
|
1479
1119
|
const edge = registration.type;
|
|
@@ -1497,7 +1137,7 @@ function serializeOntology(relations) {
|
|
|
1497
1137
|
metaEdgeMap.set(metaEdge.name, metaEdge);
|
|
1498
1138
|
}
|
|
1499
1139
|
}
|
|
1500
|
-
const metaEdges =
|
|
1140
|
+
const metaEdges = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1501
1141
|
for (const [name, metaEdge] of metaEdgeMap) {
|
|
1502
1142
|
metaEdges[name] = serializeMetaEdge(metaEdge);
|
|
1503
1143
|
}
|
|
@@ -1506,7 +1146,7 @@ function serializeOntology(relations) {
|
|
|
1506
1146
|
);
|
|
1507
1147
|
const closures = serializeClosures(relations);
|
|
1508
1148
|
return {
|
|
1509
|
-
metaEdges,
|
|
1149
|
+
metaEdges: { ...metaEdges },
|
|
1510
1150
|
relations: serializedRelations,
|
|
1511
1151
|
closures
|
|
1512
1152
|
};
|
|
@@ -1525,8 +1165,8 @@ function serializeMetaEdge(metaEdge) {
|
|
|
1525
1165
|
function serializeOntologyRelation(relation) {
|
|
1526
1166
|
return {
|
|
1527
1167
|
metaEdge: relation.metaEdge.name,
|
|
1528
|
-
from:
|
|
1529
|
-
to:
|
|
1168
|
+
from: chunkNK5Q7UNE_cjs.getTypeName(relation.from),
|
|
1169
|
+
to: chunkNK5Q7UNE_cjs.getTypeName(relation.to)
|
|
1530
1170
|
};
|
|
1531
1171
|
}
|
|
1532
1172
|
function serializeClosures(relations) {
|
|
@@ -1546,7 +1186,7 @@ function serializeClosures(relations) {
|
|
|
1546
1186
|
edgeImplyingClosure: {}
|
|
1547
1187
|
};
|
|
1548
1188
|
}
|
|
1549
|
-
const computed = computeClosuresFromOntology(relations);
|
|
1189
|
+
const computed = chunk7BQXPCGN_cjs.computeClosuresFromOntology(relations);
|
|
1550
1190
|
return {
|
|
1551
1191
|
subClassAncestors: mapToRecord(computed.subClassAncestors),
|
|
1552
1192
|
subClassDescendants: mapToRecord(computed.subClassDescendants),
|
|
@@ -1563,11 +1203,11 @@ function serializeClosures(relations) {
|
|
|
1563
1203
|
};
|
|
1564
1204
|
}
|
|
1565
1205
|
function mapToRecord(map) {
|
|
1566
|
-
const result =
|
|
1206
|
+
const result = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1567
1207
|
for (const [key, values] of map) {
|
|
1568
1208
|
result[key] = [...values];
|
|
1569
1209
|
}
|
|
1570
|
-
return result;
|
|
1210
|
+
return { ...result };
|
|
1571
1211
|
}
|
|
1572
1212
|
function mapToSimpleRecord(map) {
|
|
1573
1213
|
return Object.fromEntries(map);
|
|
@@ -1608,11 +1248,12 @@ async function computeSchemaHash(schema) {
|
|
|
1608
1248
|
edges: schema.edges,
|
|
1609
1249
|
ontology: schema.ontology,
|
|
1610
1250
|
defaults: schema.defaults,
|
|
1251
|
+
...schema.identity === void 0 ? {} : { identity: schema.identity },
|
|
1611
1252
|
...schema.indexes === void 0 ? {} : { indexes: schema.indexes },
|
|
1612
1253
|
...schema.extension === void 0 ? {} : { extension: schema.extension },
|
|
1613
1254
|
...schema.deprecatedKinds === void 0 ? {} : { deprecatedKinds: schema.deprecatedKinds }
|
|
1614
1255
|
};
|
|
1615
|
-
const json = JSON.stringify(hashable,
|
|
1256
|
+
const json = JSON.stringify(hashable, chunkPWLJ77UV_cjs.sortedReplacer);
|
|
1616
1257
|
return chunkZY4GXIVN_cjs.sha256Hex(json);
|
|
1617
1258
|
}
|
|
1618
1259
|
var COMPILE_NODE_CACHE = /* @__PURE__ */ new Map();
|
|
@@ -1659,9 +1300,9 @@ function compileNodeCached(kindName, document) {
|
|
|
1659
1300
|
}
|
|
1660
1301
|
function compileNode(kindName, document) {
|
|
1661
1302
|
const schema = buildObjectSchema(document.properties);
|
|
1662
|
-
const type =
|
|
1303
|
+
const type = chunkNK5Q7UNE_cjs.defineNode(
|
|
1663
1304
|
kindName,
|
|
1664
|
-
|
|
1305
|
+
chunkN66HCGCY_cjs.compactUndefined({
|
|
1665
1306
|
schema,
|
|
1666
1307
|
description: document.description,
|
|
1667
1308
|
annotations: document.annotations
|
|
@@ -1685,7 +1326,7 @@ function compileEdge(kindName, document, nodeTypeByName) {
|
|
|
1685
1326
|
(name) => nodeTypeByName.get(name) ?? name
|
|
1686
1327
|
);
|
|
1687
1328
|
return Object.freeze(
|
|
1688
|
-
|
|
1329
|
+
chunkN66HCGCY_cjs.compactUndefined({
|
|
1689
1330
|
kindName,
|
|
1690
1331
|
schema,
|
|
1691
1332
|
description: document.description,
|
|
@@ -1696,7 +1337,7 @@ function compileEdge(kindName, document, nodeTypeByName) {
|
|
|
1696
1337
|
);
|
|
1697
1338
|
}
|
|
1698
1339
|
function buildObjectSchema(properties) {
|
|
1699
|
-
const shape =
|
|
1340
|
+
const shape = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1700
1341
|
for (const [propertyName, propertyType] of Object.entries(properties)) {
|
|
1701
1342
|
shape[propertyName] = applyOptional(
|
|
1702
1343
|
compileProperty(propertyType),
|
|
@@ -1819,7 +1460,7 @@ function makeWherePredicate(field, op) {
|
|
|
1819
1460
|
};
|
|
1820
1461
|
}
|
|
1821
1462
|
var META_EDGE_BY_NAME = Object.fromEntries(
|
|
1822
|
-
|
|
1463
|
+
chunkXUO3KQFO_cjs.ALL_META_EDGE_NAMES.map((name) => [name, core[`${name}MetaEdge`]])
|
|
1823
1464
|
);
|
|
1824
1465
|
function compileOntologyRelation(relation, nodeTypeByName) {
|
|
1825
1466
|
const metaEdge = META_EDGE_BY_NAME[relation.metaEdge];
|
|
@@ -1837,7 +1478,7 @@ function graphExtensionOntologyKey(entry) {
|
|
|
1837
1478
|
return `${entry.metaEdge}|${entry.from}|${entry.to}`;
|
|
1838
1479
|
}
|
|
1839
1480
|
function compileTimeOntologyKey(relation) {
|
|
1840
|
-
return `${relation.metaEdge.name}|${
|
|
1481
|
+
return `${relation.metaEdge.name}|${chunkNK5Q7UNE_cjs.getTypeName(relation.from)}|${chunkNK5Q7UNE_cjs.getTypeName(relation.to)}`;
|
|
1841
1482
|
}
|
|
1842
1483
|
function buildGraphExtensionOntologyKeySet(document) {
|
|
1843
1484
|
return new Set(
|
|
@@ -1855,10 +1496,10 @@ function extensionKindNames(document) {
|
|
|
1855
1496
|
function mergeGraphExtension(graph, document) {
|
|
1856
1497
|
const existingDocument = graph.extension ?? Object.freeze({});
|
|
1857
1498
|
const unionDocument = unionDocuments(existingDocument, document);
|
|
1858
|
-
if (graph.extension !== void 0 &&
|
|
1499
|
+
if (graph.extension !== void 0 && chunkPWLJ77UV_cjs.canonicalEqual(unionDocument, existingDocument)) {
|
|
1859
1500
|
return graph;
|
|
1860
1501
|
}
|
|
1861
|
-
const validatedUnion =
|
|
1502
|
+
const validatedUnion = chunk7BQXPCGN_cjs.unwrap(chunk7BQXPCGN_cjs.validateGraphExtension(unionDocument));
|
|
1862
1503
|
const compiled = compileGraphExtension(validatedUnion);
|
|
1863
1504
|
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = extensionKindNames(existingDocument);
|
|
1864
1505
|
const nodeKinds = /* @__PURE__ */ new Map();
|
|
@@ -1875,7 +1516,7 @@ function mergeGraphExtension(graph, document) {
|
|
|
1875
1516
|
);
|
|
1876
1517
|
nodeKinds.set(node.type.kind, node.type);
|
|
1877
1518
|
}
|
|
1878
|
-
const mergedNodes =
|
|
1519
|
+
const mergedNodes = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1879
1520
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
1880
1521
|
if (runtimeNodeNames.has(name)) continue;
|
|
1881
1522
|
mergedNodes[name] = registration;
|
|
@@ -1886,7 +1527,7 @@ function mergeGraphExtension(graph, document) {
|
|
|
1886
1527
|
...node.unique.length === 0 ? {} : { unique: [...node.unique] }
|
|
1887
1528
|
};
|
|
1888
1529
|
}
|
|
1889
|
-
const mergedEdges =
|
|
1530
|
+
const mergedEdges = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1890
1531
|
for (const [name, registration] of Object.entries(graph.edges)) {
|
|
1891
1532
|
if (runtimeEdgeNames.has(name)) continue;
|
|
1892
1533
|
mergedEdges[name] = registration;
|
|
@@ -1895,7 +1536,7 @@ function mergeGraphExtension(graph, document) {
|
|
|
1895
1536
|
assertNoCollision(
|
|
1896
1537
|
edge.kindName,
|
|
1897
1538
|
"edge",
|
|
1898
|
-
mergedEdges
|
|
1539
|
+
chunkN66HCGCY_cjs.hasOwnKey(mergedEdges, edge.kindName),
|
|
1899
1540
|
graph.id
|
|
1900
1541
|
);
|
|
1901
1542
|
const from = resolveEndpoints(edge.from, nodeKinds, {
|
|
@@ -1908,9 +1549,9 @@ function mergeGraphExtension(graph, document) {
|
|
|
1908
1549
|
edgeKind: edge.kindName,
|
|
1909
1550
|
side: "to"
|
|
1910
1551
|
});
|
|
1911
|
-
const type =
|
|
1552
|
+
const type = chunkNK5Q7UNE_cjs.defineEdge(
|
|
1912
1553
|
edge.kindName,
|
|
1913
|
-
|
|
1554
|
+
chunkN66HCGCY_cjs.compactUndefined({
|
|
1914
1555
|
schema: edge.schema,
|
|
1915
1556
|
description: edge.description,
|
|
1916
1557
|
annotations: edge.annotations,
|
|
@@ -1927,7 +1568,7 @@ function mergeGraphExtension(graph, document) {
|
|
|
1927
1568
|
const mergedOntology = [
|
|
1928
1569
|
...compileTimeOntology,
|
|
1929
1570
|
...compiled.ontology.map(
|
|
1930
|
-
(relation) => resolveOntologyEndpoints(relation, nodeKinds)
|
|
1571
|
+
(relation) => resolveOntologyEndpoints(relation, nodeKinds, mergedEdges, graph.id)
|
|
1931
1572
|
)
|
|
1932
1573
|
];
|
|
1933
1574
|
const runtimeVectorIndexes = deriveGraphExtensionVectorIndexes(compiled.nodes);
|
|
@@ -1944,8 +1585,8 @@ function mergeGraphExtension(graph, document) {
|
|
|
1944
1585
|
);
|
|
1945
1586
|
return Object.freeze({
|
|
1946
1587
|
...graph,
|
|
1947
|
-
nodes: mergedNodes,
|
|
1948
|
-
edges: mergedEdges,
|
|
1588
|
+
nodes: { ...mergedNodes },
|
|
1589
|
+
edges: { ...mergedEdges },
|
|
1949
1590
|
ontology: mergedOntology,
|
|
1950
1591
|
indexes: mergedIndexes,
|
|
1951
1592
|
extension: validatedUnion
|
|
@@ -1953,14 +1594,14 @@ function mergeGraphExtension(graph, document) {
|
|
|
1953
1594
|
}
|
|
1954
1595
|
function deriveGraphExtensionVectorIndexes(compiledNodes) {
|
|
1955
1596
|
if (compiledNodes.length === 0) return [];
|
|
1956
|
-
const registrations =
|
|
1597
|
+
const registrations = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1957
1598
|
for (const compiled of compiledNodes) {
|
|
1958
1599
|
registrations[compiled.type.kind] = {
|
|
1959
1600
|
type: compiled.type,
|
|
1960
1601
|
...compiled.unique.length === 0 ? {} : { unique: [...compiled.unique] }
|
|
1961
1602
|
};
|
|
1962
1603
|
}
|
|
1963
|
-
return
|
|
1604
|
+
return chunkCXBHOOIQ_cjs.autoDeriveVectorIndexes(registrations).map(
|
|
1964
1605
|
(index) => Object.freeze({ ...index, origin: "runtime" })
|
|
1965
1606
|
);
|
|
1966
1607
|
}
|
|
@@ -1978,7 +1619,7 @@ function mergeIndexesWithGraphExtension(existing, runtimeIndexes, graphId) {
|
|
|
1978
1619
|
const runtimeRelational = runtimeIndexes.filter(
|
|
1979
1620
|
(index) => index.entity !== "vector"
|
|
1980
1621
|
);
|
|
1981
|
-
const vectorMerged =
|
|
1622
|
+
const vectorMerged = chunkCXBHOOIQ_cjs.mergeVectorIndexes(compileTimeIndexes, runtimeVectors);
|
|
1982
1623
|
const merged = [...vectorMerged, ...runtimeRelational];
|
|
1983
1624
|
assertUniqueIndexNames(merged, graphId);
|
|
1984
1625
|
return merged;
|
|
@@ -1990,7 +1631,7 @@ function assertUniqueIndexNames(indexes, graphId) {
|
|
|
1990
1631
|
seen.add(index.name);
|
|
1991
1632
|
continue;
|
|
1992
1633
|
}
|
|
1993
|
-
throw new
|
|
1634
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
1994
1635
|
`Duplicate index name "${index.name}" after merging graph extension into graph "${graphId}". Index names must be unique within a graph.`,
|
|
1995
1636
|
{ graphId, indexName: index.name, code: "DUPLICATE_INDEX_NAME" },
|
|
1996
1637
|
{
|
|
@@ -2006,12 +1647,12 @@ function compileGraphExtensionRelationalIndexes(documents, nodeKinds, mergedEdge
|
|
|
2006
1647
|
if (document.entity === "node") {
|
|
2007
1648
|
const node = nodeKinds.get(document.kind);
|
|
2008
1649
|
if (node === void 0) {
|
|
2009
|
-
throw new
|
|
1650
|
+
throw new chunkNI72YOJB_cjs.KindNotFoundError(document.kind, "node", {
|
|
2010
1651
|
graphId,
|
|
2011
1652
|
suggestion: "Declare the kind under `nodes` in this graph extension, or remove the index from `indexes`."
|
|
2012
1653
|
});
|
|
2013
1654
|
}
|
|
2014
|
-
const declaration2 =
|
|
1655
|
+
const declaration2 = chunkU63GDNRC_cjs.defineNodeIndex(
|
|
2015
1656
|
node,
|
|
2016
1657
|
toNodeIndexConfig(document)
|
|
2017
1658
|
);
|
|
@@ -2020,12 +1661,12 @@ function compileGraphExtensionRelationalIndexes(documents, nodeKinds, mergedEdge
|
|
|
2020
1661
|
}
|
|
2021
1662
|
const edgeRegistration = mergedEdges[document.kind];
|
|
2022
1663
|
if (edgeRegistration === void 0) {
|
|
2023
|
-
throw new
|
|
1664
|
+
throw new chunkNI72YOJB_cjs.KindNotFoundError(document.kind, "edge", {
|
|
2024
1665
|
graphId,
|
|
2025
1666
|
suggestion: "Declare the edge under `edges` in this graph extension, or remove the index from `indexes`."
|
|
2026
1667
|
});
|
|
2027
1668
|
}
|
|
2028
|
-
const declaration =
|
|
1669
|
+
const declaration = chunkU63GDNRC_cjs.defineEdgeIndex(
|
|
2029
1670
|
edgeRegistration.type,
|
|
2030
1671
|
toEdgeIndexConfig(document)
|
|
2031
1672
|
);
|
|
@@ -2037,7 +1678,7 @@ function buildWhereCallback(where) {
|
|
|
2037
1678
|
return (props) => {
|
|
2038
1679
|
const builder = props[where.field];
|
|
2039
1680
|
if (builder === void 0) {
|
|
2040
|
-
throw new
|
|
1681
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2041
1682
|
`Graph-extension index \`where\` references unknown field "${where.field}".`,
|
|
2042
1683
|
{ field: where.field, code: "EXTENSION_INDEX_WHERE_UNKNOWN_FIELD" }
|
|
2043
1684
|
);
|
|
@@ -2046,7 +1687,7 @@ function buildWhereCallback(where) {
|
|
|
2046
1687
|
};
|
|
2047
1688
|
}
|
|
2048
1689
|
function toNodeIndexConfig(document) {
|
|
2049
|
-
return
|
|
1690
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
2050
1691
|
fields: document.fields,
|
|
2051
1692
|
coveringFields: document.coveringFields,
|
|
2052
1693
|
unique: document.unique,
|
|
@@ -2056,7 +1697,7 @@ function toNodeIndexConfig(document) {
|
|
|
2056
1697
|
});
|
|
2057
1698
|
}
|
|
2058
1699
|
function toEdgeIndexConfig(document) {
|
|
2059
|
-
return
|
|
1700
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
2060
1701
|
fields: document.fields,
|
|
2061
1702
|
coveringFields: document.coveringFields,
|
|
2062
1703
|
unique: document.unique,
|
|
@@ -2102,7 +1743,7 @@ function dedupBy(items, keyFunction, strategy = "first") {
|
|
|
2102
1743
|
seen.set(key, item);
|
|
2103
1744
|
}
|
|
2104
1745
|
}
|
|
2105
|
-
return order.map((key) =>
|
|
1746
|
+
return order.map((key) => chunkN66HCGCY_cjs.requireDefined(seen.get(key)));
|
|
2106
1747
|
}
|
|
2107
1748
|
function indexCompositeKey(entry) {
|
|
2108
1749
|
return `${entry.entity}|${entry.kind}|${entry.name ?? ""}|${entry.fields.join(",")}`;
|
|
@@ -2112,14 +1753,14 @@ function isEmptyExtension(extension) {
|
|
|
2112
1753
|
}
|
|
2113
1754
|
function assertNoCollision(kindName, entity, collides, graphId) {
|
|
2114
1755
|
if (!collides) return;
|
|
2115
|
-
throw new
|
|
1756
|
+
throw new chunk7BQXPCGN_cjs.KindCollisionError(kindName, entity, graphId);
|
|
2116
1757
|
}
|
|
2117
1758
|
function resolveEndpoints(entries, nodeKinds, context) {
|
|
2118
1759
|
return entries.map((entry) => {
|
|
2119
1760
|
if (typeof entry !== "string") return entry;
|
|
2120
1761
|
const resolved = nodeKinds.get(entry);
|
|
2121
1762
|
if (resolved === void 0) {
|
|
2122
|
-
throw new
|
|
1763
|
+
throw new chunk7BQXPCGN_cjs.GraphExtensionUnresolvedEndpointError(
|
|
2123
1764
|
context.edgeKind,
|
|
2124
1765
|
context.side,
|
|
2125
1766
|
entry,
|
|
@@ -2129,11 +1770,38 @@ function resolveEndpoints(entries, nodeKinds, context) {
|
|
|
2129
1770
|
return resolved;
|
|
2130
1771
|
});
|
|
2131
1772
|
}
|
|
2132
|
-
function resolveOntologyEndpoints(relation, nodeKinds) {
|
|
1773
|
+
function resolveOntologyEndpoints(relation, nodeKinds, edgeKinds, graphId) {
|
|
1774
|
+
if (relation.metaEdge.name === chunkXUO3KQFO_cjs.META_EDGE_INVERSE_OF || relation.metaEdge.name === chunkXUO3KQFO_cjs.META_EDGE_IMPLIES) {
|
|
1775
|
+
return {
|
|
1776
|
+
...relation,
|
|
1777
|
+
from: resolveOntologyEdgeEndpoint(
|
|
1778
|
+
relation.metaEdge.name,
|
|
1779
|
+
relation.from,
|
|
1780
|
+
edgeKinds,
|
|
1781
|
+
graphId
|
|
1782
|
+
),
|
|
1783
|
+
to: resolveOntologyEdgeEndpoint(
|
|
1784
|
+
relation.metaEdge.name,
|
|
1785
|
+
relation.to,
|
|
1786
|
+
edgeKinds,
|
|
1787
|
+
graphId
|
|
1788
|
+
)
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
2133
1791
|
const from = typeof relation.from === "string" ? nodeKinds.get(relation.from) ?? relation.from : relation.from;
|
|
2134
1792
|
const to = typeof relation.to === "string" ? nodeKinds.get(relation.to) ?? relation.to : relation.to;
|
|
2135
1793
|
return { ...relation, from, to };
|
|
2136
1794
|
}
|
|
1795
|
+
function resolveOntologyEdgeEndpoint(metaEdge, endpoint, edgeKinds, graphId) {
|
|
1796
|
+
if (typeof endpoint !== "string") return endpoint;
|
|
1797
|
+
if (Object.hasOwn(edgeKinds, endpoint)) return endpoint;
|
|
1798
|
+
if (chunk7BQXPCGN_cjs.isExternalIri(endpoint)) return endpoint;
|
|
1799
|
+
throw new chunk7BQXPCGN_cjs.GraphExtensionUnresolvedOntologyEndpointError(
|
|
1800
|
+
metaEdge,
|
|
1801
|
+
endpoint,
|
|
1802
|
+
graphId
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
2137
1805
|
|
|
2138
1806
|
// src/graph-extension/remove.ts
|
|
2139
1807
|
function planRemovals(graph, names) {
|
|
@@ -2151,10 +1819,10 @@ function planRemovals(graph, names) {
|
|
|
2151
1819
|
);
|
|
2152
1820
|
for (const name of namesSet) {
|
|
2153
1821
|
if (compileTimeNodeNames.has(name)) {
|
|
2154
|
-
throw new
|
|
1822
|
+
throw new chunk7BQXPCGN_cjs.RemoveCompileTimeKindError(name, "node", graph.id);
|
|
2155
1823
|
}
|
|
2156
1824
|
if (compileTimeEdgeNames.has(name)) {
|
|
2157
|
-
throw new
|
|
1825
|
+
throw new chunk7BQXPCGN_cjs.RemoveCompileTimeKindError(name, "edge", graph.id);
|
|
2158
1826
|
}
|
|
2159
1827
|
}
|
|
2160
1828
|
const removedNodeKinds = [...namesSet].filter(
|
|
@@ -2170,7 +1838,7 @@ function planRemovals(graph, names) {
|
|
|
2170
1838
|
for (const kindName of removedNodeKinds) {
|
|
2171
1839
|
const referents = referentsByKind.get(kindName);
|
|
2172
1840
|
if (referents !== void 0 && referents.length > 0) {
|
|
2173
|
-
throw new
|
|
1841
|
+
throw new chunk7BQXPCGN_cjs.KindHasReferentsError(kindName, referents, graph.id);
|
|
2174
1842
|
}
|
|
2175
1843
|
}
|
|
2176
1844
|
if (document === void 0) {
|
|
@@ -2183,7 +1851,7 @@ function planRemovals(graph, names) {
|
|
|
2183
1851
|
const removedNodeKindsSet = new Set(removedNodeKinds);
|
|
2184
1852
|
const explicitlyRemovedEdgeKindsSet = new Set(explicitlyRemovedEdgeKinds);
|
|
2185
1853
|
const cascadeEdges = /* @__PURE__ */ new Set();
|
|
2186
|
-
const updatedEdges =
|
|
1854
|
+
const updatedEdges = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
2187
1855
|
for (const [edgeName, edgeDocument] of Object.entries(document.edges ?? {})) {
|
|
2188
1856
|
if (explicitlyRemovedEdgeKindsSet.has(edgeName)) {
|
|
2189
1857
|
cascadeEdges.add(edgeName);
|
|
@@ -2205,7 +1873,7 @@ function planRemovals(graph, names) {
|
|
|
2205
1873
|
to: newTo
|
|
2206
1874
|
};
|
|
2207
1875
|
}
|
|
2208
|
-
const updatedNodes =
|
|
1876
|
+
const updatedNodes = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
2209
1877
|
for (const [nodeName, nodeDocument] of Object.entries(document.nodes ?? {})) {
|
|
2210
1878
|
if (removedNodeKindsSet.has(nodeName)) continue;
|
|
2211
1879
|
updatedNodes[nodeName] = nodeDocument;
|
|
@@ -2223,8 +1891,11 @@ function planRemovals(graph, names) {
|
|
|
2223
1891
|
);
|
|
2224
1892
|
const newDocument = Object.freeze({
|
|
2225
1893
|
...document.version === void 0 ? {} : { version: document.version },
|
|
2226
|
-
|
|
2227
|
-
|
|
1894
|
+
// Spread at the boundary: these land on the returned extension document,
|
|
1895
|
+
// which is public as `graph.extension`. See `createDataKeyedBag` in
|
|
1896
|
+
// ../utils/object.ts.
|
|
1897
|
+
...Object.keys(updatedNodes).length === 0 ? {} : { nodes: { ...updatedNodes } },
|
|
1898
|
+
...Object.keys(updatedEdges).length === 0 ? {} : { edges: { ...updatedEdges } },
|
|
2228
1899
|
...survivingOntology.length === 0 ? {} : { ontology: survivingOntology },
|
|
2229
1900
|
...survivingIndexes.length === 0 ? {} : { indexes: survivingIndexes }
|
|
2230
1901
|
});
|
|
@@ -2244,12 +1915,12 @@ function stripGraphExtension(graph) {
|
|
|
2244
1915
|
if (document === void 0) return graph;
|
|
2245
1916
|
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = extensionKindNames(document);
|
|
2246
1917
|
const runtimeOntologyKeys = buildGraphExtensionOntologyKeySet(document);
|
|
2247
|
-
const compileNodes =
|
|
1918
|
+
const compileNodes = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
2248
1919
|
for (const [name, registration] of Object.entries(graph.nodes)) {
|
|
2249
1920
|
if (runtimeNodeNames.has(name)) continue;
|
|
2250
1921
|
compileNodes[name] = registration;
|
|
2251
1922
|
}
|
|
2252
|
-
const compileEdges =
|
|
1923
|
+
const compileEdges = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
2253
1924
|
for (const [name, registration] of Object.entries(graph.edges)) {
|
|
2254
1925
|
if (runtimeEdgeNames.has(name)) continue;
|
|
2255
1926
|
compileEdges[name] = registration;
|
|
@@ -2262,8 +1933,8 @@ function stripGraphExtension(graph) {
|
|
|
2262
1933
|
);
|
|
2263
1934
|
return Object.freeze({
|
|
2264
1935
|
...graph,
|
|
2265
|
-
nodes: compileNodes,
|
|
2266
|
-
edges: compileEdges,
|
|
1936
|
+
nodes: { ...compileNodes },
|
|
1937
|
+
edges: { ...compileEdges },
|
|
2267
1938
|
ontology: compileOntology,
|
|
2268
1939
|
indexes: compileIndexes.length === 0 ? void 0 : compileIndexes,
|
|
2269
1940
|
extension: void 0
|
|
@@ -2300,8 +1971,8 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
|
|
|
2300
1971
|
);
|
|
2301
1972
|
for (const relation of graph.ontology) {
|
|
2302
1973
|
if (runtimeOntologyKeys.has(compileTimeOntologyKey(relation))) continue;
|
|
2303
|
-
const fromName =
|
|
2304
|
-
const toName =
|
|
1974
|
+
const fromName = chunkNK5Q7UNE_cjs.getTypeName(relation.from);
|
|
1975
|
+
const toName = chunkNK5Q7UNE_cjs.getTypeName(relation.to);
|
|
2305
1976
|
const referent = {
|
|
2306
1977
|
type: "compile-time-ontology",
|
|
2307
1978
|
name: `${relation.metaEdge.name}(${fromName}, ${toName})`
|
|
@@ -2312,6 +1983,244 @@ function buildCompileTimeReferentIndex(graph, runtimeEdgeNames) {
|
|
|
2312
1983
|
return index;
|
|
2313
1984
|
}
|
|
2314
1985
|
|
|
1986
|
+
// src/identity/schema-transition.ts
|
|
1987
|
+
function identityTableNames(schema) {
|
|
1988
|
+
return {
|
|
1989
|
+
identityAssertions: schema.tables.identityAssertions,
|
|
1990
|
+
recordedIdentityAssertions: schema.tables.recordedIdentityAssertions,
|
|
1991
|
+
identityClosure: schema.tables.identityClosure,
|
|
1992
|
+
identitySeparation: schema.tables.identitySeparation
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
var IDENTITY_SEPARATION_RELATION = "identitySeparation";
|
|
1996
|
+
var UPGRADEABLE_DERIVED_RELATIONS = /* @__PURE__ */ new Set([
|
|
1997
|
+
IDENTITY_SEPARATION_RELATION
|
|
1998
|
+
]);
|
|
1999
|
+
var NOTHING_OWED = { provisionInCommit: [] };
|
|
2000
|
+
async function ensureIdentitySchemaStorage(backend, schema, options) {
|
|
2001
|
+
const ensureIdentityTables = backend.ensureIdentityTables;
|
|
2002
|
+
if (ensureIdentityTables === void 0) return NOTHING_OWED;
|
|
2003
|
+
const tableNames = identityTableNames(schema);
|
|
2004
|
+
const missingTables = await ensureIdentityTables(tableNames, {
|
|
2005
|
+
provisionMissing: options.enablement
|
|
2006
|
+
});
|
|
2007
|
+
if (options.enablement) return NOTHING_OWED;
|
|
2008
|
+
assertIdentityStoragePresent(
|
|
2009
|
+
options.graphId,
|
|
2010
|
+
missingTables.filter((name) => !UPGRADEABLE_DERIVED_RELATIONS.has(name))
|
|
2011
|
+
);
|
|
2012
|
+
const separationMissing = missingTables.includes(
|
|
2013
|
+
IDENTITY_SEPARATION_RELATION
|
|
2014
|
+
);
|
|
2015
|
+
const rebuildRequired = await chunkXNLIZYRZ_cjs.separationRebuildRequired(
|
|
2016
|
+
backend,
|
|
2017
|
+
schema,
|
|
2018
|
+
options.graphId,
|
|
2019
|
+
{ relationExists: !separationMissing, registry: options.registry }
|
|
2020
|
+
);
|
|
2021
|
+
if (!separationMissing && !rebuildRequired) return NOTHING_OWED;
|
|
2022
|
+
const recompute = options.recomputeDerivedRelations;
|
|
2023
|
+
if (recompute === void 0) {
|
|
2024
|
+
return provisioningForCommit(backend, tableNames, options.graphId, {
|
|
2025
|
+
ensureIdentityTables,
|
|
2026
|
+
separationMissing,
|
|
2027
|
+
rebuildRequired
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
await provisionDerivedRelations(backend, tableNames, options.graphId, {
|
|
2031
|
+
ensureIdentityTables,
|
|
2032
|
+
recompute,
|
|
2033
|
+
separationMissing,
|
|
2034
|
+
rebuildRequired
|
|
2035
|
+
});
|
|
2036
|
+
return NOTHING_OWED;
|
|
2037
|
+
}
|
|
2038
|
+
async function provisioningForCommit(backend, tableNames, graphId, input) {
|
|
2039
|
+
if (!input.separationMissing) return NOTHING_OWED;
|
|
2040
|
+
const identityTableDdl = backend.identityTableDdl;
|
|
2041
|
+
if (identityTableDdl !== void 0) {
|
|
2042
|
+
return { provisionInCommit: identityTableDdl(tableNames) };
|
|
2043
|
+
}
|
|
2044
|
+
if (input.rebuildRequired) {
|
|
2045
|
+
throw identityDerivedUpgradeUnsupportedError(graphId, ["identityTableDdl"]);
|
|
2046
|
+
}
|
|
2047
|
+
await input.ensureIdentityTables(tableNames, { provisionMissing: true });
|
|
2048
|
+
return NOTHING_OWED;
|
|
2049
|
+
}
|
|
2050
|
+
async function provisionDerivedRelations(backend, tableNames, graphId, ports) {
|
|
2051
|
+
if (!ports.separationMissing) {
|
|
2052
|
+
await ports.recompute(backend);
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
if (!ports.rebuildRequired) {
|
|
2056
|
+
await ports.ensureIdentityTables(tableNames, { provisionMissing: true });
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
const fence = backend.schemaWriteTransaction;
|
|
2060
|
+
const identityTableDdl = backend.identityTableDdl;
|
|
2061
|
+
if (fence === void 0 || identityTableDdl === void 0) {
|
|
2062
|
+
throw identityDerivedUpgradeUnsupportedError(graphId, [
|
|
2063
|
+
...fence === void 0 ? ["schemaWriteTransaction"] : [],
|
|
2064
|
+
...identityTableDdl === void 0 ? ["identityTableDdl"] : []
|
|
2065
|
+
]);
|
|
2066
|
+
}
|
|
2067
|
+
await withIdentityDdlRaceRetry(
|
|
2068
|
+
async () => fence(graphId, async (target) => {
|
|
2069
|
+
await lockIdentityDdl(target);
|
|
2070
|
+
await executeIdentityDdl(
|
|
2071
|
+
(ddl) => target.executeSchemaDdl(ddl),
|
|
2072
|
+
identityTableDdl(tableNames)
|
|
2073
|
+
);
|
|
2074
|
+
await ports.recompute(target);
|
|
2075
|
+
})
|
|
2076
|
+
);
|
|
2077
|
+
}
|
|
2078
|
+
var IDENTITY_DDL_RACES = /* @__PURE__ */ new WeakSet();
|
|
2079
|
+
function markIdentityDdlRace(error) {
|
|
2080
|
+
if (typeof error === "object" && error !== null) {
|
|
2081
|
+
IDENTITY_DDL_RACES.add(error);
|
|
2082
|
+
}
|
|
2083
|
+
return error;
|
|
2084
|
+
}
|
|
2085
|
+
function isIdentityDdlRace(error) {
|
|
2086
|
+
for (const link of chunkBSFJMMV3_cjs.errorChain(error)) {
|
|
2087
|
+
if (typeof link === "object" && link !== null && IDENTITY_DDL_RACES.has(link)) {
|
|
2088
|
+
return true;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
return false;
|
|
2092
|
+
}
|
|
2093
|
+
async function executeIdentityDdl(execute, statements) {
|
|
2094
|
+
for (const statement of statements) {
|
|
2095
|
+
try {
|
|
2096
|
+
await execute(statement);
|
|
2097
|
+
} catch (error) {
|
|
2098
|
+
if (chunkBSFJMMV3_cjs.isPostgresConcurrentDdlRaceError(error)) {
|
|
2099
|
+
throw markIdentityDdlRace(error);
|
|
2100
|
+
}
|
|
2101
|
+
throw error;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
async function withIdentityDdlRaceRetry(attempt) {
|
|
2106
|
+
try {
|
|
2107
|
+
return await attempt();
|
|
2108
|
+
} catch (error) {
|
|
2109
|
+
if (!isIdentityDdlRace(error)) throw error;
|
|
2110
|
+
return attempt();
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
async function lockIdentityDdl(target) {
|
|
2114
|
+
if (target.dialect !== "postgres") return;
|
|
2115
|
+
await target.execute(
|
|
2116
|
+
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
2117
|
+
SELECT pg_advisory_xact_lock(hashtext(${IDENTITY_DDL_LOCK_KEY}), 0)
|
|
2118
|
+
`)
|
|
2119
|
+
);
|
|
2120
|
+
}
|
|
2121
|
+
var IDENTITY_DDL_LOCK_KEY = "typegraph:identity-ddl";
|
|
2122
|
+
function identityDerivedUpgradeUnsupportedError(graphId, missingPorts) {
|
|
2123
|
+
return new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2124
|
+
"This backend cannot publish an Operational Identity derived-relation upgrade atomically.",
|
|
2125
|
+
{
|
|
2126
|
+
code: "IDENTITY_UPGRADE_REQUIRES_ATOMIC_DDL",
|
|
2127
|
+
graphId,
|
|
2128
|
+
missingPorts,
|
|
2129
|
+
tables: [IDENTITY_SEPARATION_RELATION]
|
|
2130
|
+
},
|
|
2131
|
+
{
|
|
2132
|
+
suggestion: "Use a backend that implements schemaWriteTransaction and identityTableDdl (both bundled Drizzle backends do when transactions are enabled). Creating the separation relation and filling it as two steps would leave it readable and empty in between, where every pair reads as not separated. To upgrade out of band, create the relation with the standard TypeGraph DDL and run rebuildIdentityClosure(store) before serving traffic."
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
async function identityKindCascadeNeeded(backend, schema, graphId, droppedNodeKinds) {
|
|
2137
|
+
if (droppedNodeKinds.length === 0) return false;
|
|
2138
|
+
const ensureIdentityTables = backend.ensureIdentityTables;
|
|
2139
|
+
if (ensureIdentityTables === void 0) return false;
|
|
2140
|
+
const missingTables = await ensureIdentityTables(identityTableNames(schema), {
|
|
2141
|
+
provisionMissing: false
|
|
2142
|
+
});
|
|
2143
|
+
if (missingTables.length > 0) return false;
|
|
2144
|
+
return chunkXNLIZYRZ_cjs.hasAssertionsTouchingKinds(backend, schema, graphId, droppedNodeKinds);
|
|
2145
|
+
}
|
|
2146
|
+
function assertIdentityStoragePresent(graphId, missingTables) {
|
|
2147
|
+
if (missingTables.length === 0) return;
|
|
2148
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2149
|
+
"Operational Identity storage was missing from an already enabled graph.",
|
|
2150
|
+
{
|
|
2151
|
+
code: "IDENTITY_STORAGE_MISSING",
|
|
2152
|
+
graphId,
|
|
2153
|
+
tables: missingTables
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
suggestion: "Restore missing assertion-ledger tables from backup. If only the derived relations (closure, separation) are missing, recreate them with the standard TypeGraph DDL, open the Store, and run rebuildIdentityClosure() before serving traffic."
|
|
2157
|
+
}
|
|
2158
|
+
);
|
|
2159
|
+
}
|
|
2160
|
+
function identitySchemaCommitPreflight(ctx, options) {
|
|
2161
|
+
return async (target) => {
|
|
2162
|
+
await provisionDerivedRelationsInCommit(
|
|
2163
|
+
target,
|
|
2164
|
+
ctx.graphId,
|
|
2165
|
+
options.provisionDerivedRelations ?? []
|
|
2166
|
+
);
|
|
2167
|
+
await chunkXMQSEJCF_cjs.lockRecordedGraphWrite(target, ctx.graphId);
|
|
2168
|
+
await chunkXNLIZYRZ_cjs.lockIdentityGraph(target, ctx.graphId);
|
|
2169
|
+
if (options.enablement) {
|
|
2170
|
+
await chunkXNLIZYRZ_cjs.lockIdentityEnablementNodes(target, ctx.schema);
|
|
2171
|
+
await chunkXMQSEJCF_cjs.withRecordedIdentityMutationTarget(
|
|
2172
|
+
target,
|
|
2173
|
+
(rawTarget, touch) => chunkXNLIZYRZ_cjs.purgeAssertionsWithUnregisteredKinds(
|
|
2174
|
+
rawTarget,
|
|
2175
|
+
ctx.schema,
|
|
2176
|
+
ctx.graphId,
|
|
2177
|
+
new Set(ctx.registry.nodeKinds.keys()),
|
|
2178
|
+
touch
|
|
2179
|
+
)
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
const droppedNodeKinds = options.droppedNodeKinds ?? [];
|
|
2183
|
+
if (droppedNodeKinds.length > 0) {
|
|
2184
|
+
await chunkXMQSEJCF_cjs.withRecordedIdentityMutationTarget(
|
|
2185
|
+
target,
|
|
2186
|
+
(rawTarget, touch) => chunkXNLIZYRZ_cjs.deleteAssertionsTouchingKinds(
|
|
2187
|
+
rawTarget,
|
|
2188
|
+
ctx.schema,
|
|
2189
|
+
ctx.graphId,
|
|
2190
|
+
droppedNodeKinds,
|
|
2191
|
+
touch
|
|
2192
|
+
)
|
|
2193
|
+
);
|
|
2194
|
+
}
|
|
2195
|
+
await chunkXNLIZYRZ_cjs.rebuildIdentityClosureForContext({ ...ctx, backend: target });
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
async function provisionDerivedRelationsInCommit(target, graphId, ddl) {
|
|
2199
|
+
if (ddl.length === 0) return;
|
|
2200
|
+
const executeSchemaDdl = target.executeSchemaDdl;
|
|
2201
|
+
if (executeSchemaDdl === void 0) {
|
|
2202
|
+
throw identityDerivedUpgradeUnsupportedError(graphId, ["executeSchemaDdl"]);
|
|
2203
|
+
}
|
|
2204
|
+
await lockIdentityDdl(target);
|
|
2205
|
+
await executeIdentityDdl((statement) => executeSchemaDdl(statement), ddl);
|
|
2206
|
+
}
|
|
2207
|
+
function identityKindCascadePreflight(ctx, droppedNodeKinds) {
|
|
2208
|
+
return async (target) => {
|
|
2209
|
+
await chunkXMQSEJCF_cjs.lockRecordedGraphWrite(target, ctx.graphId);
|
|
2210
|
+
await chunkXNLIZYRZ_cjs.lockIdentityGraph(target, ctx.graphId);
|
|
2211
|
+
await chunkXMQSEJCF_cjs.withRecordedIdentityMutationTarget(
|
|
2212
|
+
target,
|
|
2213
|
+
(rawTarget, touch) => chunkXNLIZYRZ_cjs.deleteAssertionsTouchingKinds(
|
|
2214
|
+
rawTarget,
|
|
2215
|
+
ctx.schema,
|
|
2216
|
+
ctx.graphId,
|
|
2217
|
+
droppedNodeKinds,
|
|
2218
|
+
touch
|
|
2219
|
+
)
|
|
2220
|
+
);
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2315
2224
|
// src/registry/validate-implies.ts
|
|
2316
2225
|
function validateImpliesEndpointCompatibility(edgeEndpoints, registry) {
|
|
2317
2226
|
for (const [impliedEdgeKind, impliedEndpoints] of edgeEndpoints) {
|
|
@@ -2345,10 +2254,10 @@ function assertEndpointCompatible(side, implyingEdgeKind, implyingKinds, implied
|
|
|
2345
2254
|
(kind) => !registry.isAssignableToAny(kind, impliedKinds)
|
|
2346
2255
|
);
|
|
2347
2256
|
if (incompatibleKinds.length === 0) return;
|
|
2348
|
-
throw new
|
|
2257
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2349
2258
|
`implies("${implyingEdgeKind}", "${impliedEdgeKind}") is endpoint-incompatible: ${side} kind(s) [${incompatibleKinds.join(", ")}] declared on "${implyingEdgeKind}" cannot be assigned to any of "${impliedEdgeKind}"'s ${side} kind(s) [${impliedKinds.join(", ")}].`,
|
|
2350
2259
|
{
|
|
2351
|
-
metaEdge:
|
|
2260
|
+
metaEdge: chunkXUO3KQFO_cjs.META_EDGE_IMPLIES,
|
|
2352
2261
|
implyingEdge: implyingEdgeKind,
|
|
2353
2262
|
impliedEdge: impliedEdgeKind,
|
|
2354
2263
|
endpoint: side,
|
|
@@ -2361,17 +2270,132 @@ function assertEndpointCompatible(side, implyingEdgeKind, implyingKinds, implied
|
|
|
2361
2270
|
);
|
|
2362
2271
|
}
|
|
2363
2272
|
|
|
2273
|
+
// src/registry/validate-inverse.ts
|
|
2274
|
+
function validateInverseEndpointCompatibility(ontology, edgeEndpoints, registry) {
|
|
2275
|
+
for (const relation of ontology) {
|
|
2276
|
+
if (relation.metaEdge !== chunkXUO3KQFO_cjs.META_EDGE_INVERSE_OF) continue;
|
|
2277
|
+
const left = edgeEndpoints.get(relation.from);
|
|
2278
|
+
const right = edgeEndpoints.get(relation.to);
|
|
2279
|
+
if (left === void 0 || right === void 0) continue;
|
|
2280
|
+
assertInverseSideCompatible(
|
|
2281
|
+
relation.from,
|
|
2282
|
+
"from",
|
|
2283
|
+
left.from,
|
|
2284
|
+
relation.to,
|
|
2285
|
+
"to",
|
|
2286
|
+
right.to,
|
|
2287
|
+
registry
|
|
2288
|
+
);
|
|
2289
|
+
assertInverseSideCompatible(
|
|
2290
|
+
relation.from,
|
|
2291
|
+
"to",
|
|
2292
|
+
left.to,
|
|
2293
|
+
relation.to,
|
|
2294
|
+
"from",
|
|
2295
|
+
right.from,
|
|
2296
|
+
registry
|
|
2297
|
+
);
|
|
2298
|
+
if (relation.from === relation.to) continue;
|
|
2299
|
+
assertInverseSideCompatible(
|
|
2300
|
+
relation.to,
|
|
2301
|
+
"from",
|
|
2302
|
+
right.from,
|
|
2303
|
+
relation.from,
|
|
2304
|
+
"to",
|
|
2305
|
+
left.to,
|
|
2306
|
+
registry
|
|
2307
|
+
);
|
|
2308
|
+
assertInverseSideCompatible(
|
|
2309
|
+
relation.to,
|
|
2310
|
+
"to",
|
|
2311
|
+
right.to,
|
|
2312
|
+
relation.from,
|
|
2313
|
+
"from",
|
|
2314
|
+
left.from,
|
|
2315
|
+
registry
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
function assertInverseSideCompatible(sourceEdge, sourceSide, sourceKinds, inverseEdge, inverseSide, inverseKinds, registry) {
|
|
2320
|
+
const incompatibleKinds = sourceKinds.filter(
|
|
2321
|
+
(kind) => !registry.isAssignableToAny(kind, inverseKinds)
|
|
2322
|
+
);
|
|
2323
|
+
if (incompatibleKinds.length === 0) return;
|
|
2324
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2325
|
+
`inverseOf("${sourceEdge}", "${inverseEdge}") is endpoint-incompatible: ${sourceSide} kind(s) [${incompatibleKinds.join(", ")}] declared on "${sourceEdge}" cannot be assigned to any of "${inverseEdge}"'s ${inverseSide} kind(s) [${inverseKinds.join(", ")}].`,
|
|
2326
|
+
{
|
|
2327
|
+
metaEdge: chunkXUO3KQFO_cjs.META_EDGE_INVERSE_OF,
|
|
2328
|
+
sourceEdge,
|
|
2329
|
+
inverseEdge,
|
|
2330
|
+
sourceEndpoint: sourceSide,
|
|
2331
|
+
inverseEndpoint: inverseSide,
|
|
2332
|
+
incompatibleKinds,
|
|
2333
|
+
allowedKinds: inverseKinds
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
suggestion: "Make the inverse edge declarations exact reversals (allowing subClassOf assignability), or remove the inverseOf relation."
|
|
2337
|
+
}
|
|
2338
|
+
);
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
// src/registry/build-validated.ts
|
|
2342
|
+
function buildValidatedKindRegistry(input) {
|
|
2343
|
+
if (input.ontology.length === 0) {
|
|
2344
|
+
const registry2 = new chunk7BQXPCGN_cjs.KindRegistry(
|
|
2345
|
+
input.nodeKinds,
|
|
2346
|
+
input.edgeKinds,
|
|
2347
|
+
chunk7BQXPCGN_cjs.createEmptyClosures(),
|
|
2348
|
+
input.identity
|
|
2349
|
+
);
|
|
2350
|
+
validateImpliesEndpointCompatibility(input.edgeEndpoints, registry2);
|
|
2351
|
+
return registry2;
|
|
2352
|
+
}
|
|
2353
|
+
const issues = chunk7BQXPCGN_cjs.validateOntologyRelations(input.ontology);
|
|
2354
|
+
if (issues.length > 0) {
|
|
2355
|
+
const firstIssue = chunkN66HCGCY_cjs.requireDefined(issues[0]);
|
|
2356
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2357
|
+
`Ontology is incoherent: ${firstIssue.message}`,
|
|
2358
|
+
{
|
|
2359
|
+
code: firstIssue.code,
|
|
2360
|
+
issues
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
suggestion: "Correct the ontology relations before constructing or loading the graph registry."
|
|
2364
|
+
}
|
|
2365
|
+
);
|
|
2366
|
+
}
|
|
2367
|
+
const closures = chunk7BQXPCGN_cjs.computeClosuresFromNamedOntology(input.ontology);
|
|
2368
|
+
const registry = new chunk7BQXPCGN_cjs.KindRegistry(
|
|
2369
|
+
input.nodeKinds,
|
|
2370
|
+
input.edgeKinds,
|
|
2371
|
+
closures,
|
|
2372
|
+
input.identity
|
|
2373
|
+
);
|
|
2374
|
+
validateImpliesEndpointCompatibility(input.edgeEndpoints, registry);
|
|
2375
|
+
validateInverseEndpointCompatibility(
|
|
2376
|
+
input.ontology,
|
|
2377
|
+
input.edgeEndpoints,
|
|
2378
|
+
registry
|
|
2379
|
+
);
|
|
2380
|
+
return registry;
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2364
2383
|
// src/registry/builders.ts
|
|
2384
|
+
var EMPTY_NAMED_ONTOLOGY = [];
|
|
2365
2385
|
function buildKindRegistry(graph) {
|
|
2366
2386
|
const nodeTypes = extractNodeTypes(graph);
|
|
2367
2387
|
const edgeTypes = extractEdgeTypes(graph);
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2388
|
+
return buildValidatedKindRegistry({
|
|
2389
|
+
nodeKinds: nodeTypes,
|
|
2390
|
+
edgeKinds: edgeTypes,
|
|
2391
|
+
ontology: graph.ontology.length === 0 ? EMPTY_NAMED_ONTOLOGY : graph.ontology.map((relation) => ({
|
|
2392
|
+
metaEdge: relation.metaEdge.name,
|
|
2393
|
+
from: typeof relation.from === "string" ? relation.from : relation.from.kind,
|
|
2394
|
+
to: typeof relation.to === "string" ? relation.to : relation.to.kind
|
|
2395
|
+
})),
|
|
2396
|
+
edgeEndpoints: buildEdgeEndpointKinds(graph.edges),
|
|
2397
|
+
...graph.identity === void 0 ? {} : { identity: graph.identity }
|
|
2398
|
+
});
|
|
2375
2399
|
}
|
|
2376
2400
|
function buildEdgeEndpointKinds(edges) {
|
|
2377
2401
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -2385,7 +2409,7 @@ function buildEdgeEndpointKinds(edges) {
|
|
|
2385
2409
|
}
|
|
2386
2410
|
function extractNodeTypes(graph) {
|
|
2387
2411
|
const result = /* @__PURE__ */ new Map();
|
|
2388
|
-
for (const typeName of
|
|
2412
|
+
for (const typeName of chunkCXBHOOIQ_cjs.getNodeKinds(graph)) {
|
|
2389
2413
|
const registration = graph.nodes[typeName];
|
|
2390
2414
|
result.set(typeName, registration.type);
|
|
2391
2415
|
}
|
|
@@ -2393,7 +2417,7 @@ function extractNodeTypes(graph) {
|
|
|
2393
2417
|
}
|
|
2394
2418
|
function extractEdgeTypes(graph) {
|
|
2395
2419
|
const result = /* @__PURE__ */ new Map();
|
|
2396
|
-
for (const typeName of
|
|
2420
|
+
for (const typeName of chunkCXBHOOIQ_cjs.getEdgeKinds(graph)) {
|
|
2397
2421
|
const registration = graph.edges[typeName];
|
|
2398
2422
|
result.set(typeName, registration.type);
|
|
2399
2423
|
}
|
|
@@ -2697,6 +2721,7 @@ var serializedSchemaZod = zod.z.object({
|
|
|
2697
2721
|
onNodeDelete: deleteBehaviorZod,
|
|
2698
2722
|
temporalMode: temporalModeZod
|
|
2699
2723
|
}).loose(),
|
|
2724
|
+
identity: zod.z.object({ sameIdAcrossKinds: zod.z.enum(["fold", "ignore"]) }).readonly().optional(),
|
|
2700
2725
|
/**
|
|
2701
2726
|
* Index declarations attached to the graph.
|
|
2702
2727
|
*
|
|
@@ -2741,7 +2766,7 @@ function parseSerializedSchema(json) {
|
|
|
2741
2766
|
try {
|
|
2742
2767
|
parsed = JSON.parse(json);
|
|
2743
2768
|
} catch {
|
|
2744
|
-
throw new
|
|
2769
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2745
2770
|
"Stored schema document is not valid JSON",
|
|
2746
2771
|
{ operation: "select", entity: "schema" }
|
|
2747
2772
|
);
|
|
@@ -2749,12 +2774,12 @@ function parseSerializedSchema(json) {
|
|
|
2749
2774
|
const result = serializedSchemaZod.safeParse(parsed);
|
|
2750
2775
|
if (!result.success) {
|
|
2751
2776
|
const issues = result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
2752
|
-
throw new
|
|
2777
|
+
throw new chunkNI72YOJB_cjs.DatabaseOperationError(
|
|
2753
2778
|
`Stored schema document is malformed: ${issues}`,
|
|
2754
2779
|
{ operation: "select", entity: "schema" }
|
|
2755
2780
|
);
|
|
2756
2781
|
}
|
|
2757
|
-
const validated =
|
|
2782
|
+
const validated = chunkN66HCGCY_cjs.freezeDeep(result.data);
|
|
2758
2783
|
if (PARSE_CACHE.size >= PARSE_CACHE_LIMIT) {
|
|
2759
2784
|
const oldest = PARSE_CACHE.keys().next().value;
|
|
2760
2785
|
if (oldest !== void 0) PARSE_CACHE.delete(oldest);
|
|
@@ -2766,7 +2791,7 @@ async function loadActiveSchemaWithBootstrap(backend, graphId) {
|
|
|
2766
2791
|
try {
|
|
2767
2792
|
return await backend.getActiveSchema(graphId);
|
|
2768
2793
|
} catch (error) {
|
|
2769
|
-
if (backend.bootstrapTables &&
|
|
2794
|
+
if (backend.bootstrapTables && chunkBSFJMMV3_cjs.isMissingTableError(error)) {
|
|
2770
2795
|
await backend.bootstrapTables();
|
|
2771
2796
|
return await backend.getActiveSchema(graphId);
|
|
2772
2797
|
}
|
|
@@ -2812,7 +2837,9 @@ async function ensureSchema(backend, graph, options) {
|
|
|
2812
2837
|
const preloaded = options?.preloaded;
|
|
2813
2838
|
const activeSchema = preloaded === void 0 ? await loadActiveSchemaWithBootstrap(backend, graph.id) : preloaded.activeRow;
|
|
2814
2839
|
if (activeSchema === void 0) {
|
|
2815
|
-
const result = await initializeSchema(backend, graph
|
|
2840
|
+
const result = await initializeSchema(backend, graph, {
|
|
2841
|
+
...options?.schema === void 0 ? {} : { schema: options.schema }
|
|
2842
|
+
});
|
|
2816
2843
|
return {
|
|
2817
2844
|
status: "initialized",
|
|
2818
2845
|
version: result.version,
|
|
@@ -2839,10 +2866,15 @@ async function ensureSchema(backend, graph, options) {
|
|
|
2839
2866
|
diff
|
|
2840
2867
|
};
|
|
2841
2868
|
await options?.onBeforeMigrate?.(hookContext);
|
|
2842
|
-
const
|
|
2869
|
+
const preflight = graph.identity === void 0 ? void 0 : await prepareIdentitySchemaCommit(backend, graph, {
|
|
2870
|
+
enablement: storedSchema.identity === void 0,
|
|
2871
|
+
...options?.schema === void 0 ? {} : { schema: options.schema }
|
|
2872
|
+
});
|
|
2873
|
+
const committedRow = preflight === void 0 ? await commitNewSchemaVersion(backend, graph, activeSchema.version) : await commitNewSchemaVersionWithPreflight(
|
|
2843
2874
|
backend,
|
|
2844
2875
|
graph,
|
|
2845
|
-
activeSchema.version
|
|
2876
|
+
activeSchema.version,
|
|
2877
|
+
preflight
|
|
2846
2878
|
);
|
|
2847
2879
|
await options?.onAfterMigrate?.(hookContext);
|
|
2848
2880
|
return {
|
|
@@ -2864,7 +2896,7 @@ async function ensureSchema(backend, graph, options) {
|
|
|
2864
2896
|
const removesKind = [...diff.nodes, ...diff.edges].some(
|
|
2865
2897
|
(change) => change.type === "removed"
|
|
2866
2898
|
);
|
|
2867
|
-
throw new
|
|
2899
|
+
throw new chunkNI72YOJB_cjs.MigrationError(
|
|
2868
2900
|
`Schema migration required: ${diff.summary}. ${actions.length} migration action(s) needed. Use getSchemaChanges() to review, then migrateSchema() to apply.` + (removesKind ? ` This diff removes a kind: migrateSchema() refuses to drop one that still holds rows, so export or delete those rows first and retry.` : ""),
|
|
2869
2901
|
{
|
|
2870
2902
|
graphId: graph.id,
|
|
@@ -2917,7 +2949,7 @@ async function assertVectorContributionsInitialized(backend, graph) {
|
|
|
2917
2949
|
function schemaBehindError(graphId, fromVersion, diff) {
|
|
2918
2950
|
const actions = getMigrationActions(diff);
|
|
2919
2951
|
const qualifier = isBackwardsCompatible(diff) ? "safe auto-migration" : "breaking change";
|
|
2920
|
-
return new
|
|
2952
|
+
return new chunkNI72YOJB_cjs.MigrationError(
|
|
2921
2953
|
`Schema verification failed for graph "${graphId}": ${diff.summary} (${qualifier}). ${actions.length} migration action(s) needed. The least-privilege runtime cannot migrate \u2014 run createStoreWithSchema(graph, adminBackend) under a privileged role (after any generated migration SQL, if you manage DDL externally) before attaching with createStore() / createVerifiedStore().`,
|
|
2922
2954
|
{
|
|
2923
2955
|
graphId,
|
|
@@ -2937,7 +2969,7 @@ async function readActiveSchemaPure(backend, graphId) {
|
|
|
2937
2969
|
try {
|
|
2938
2970
|
activeRow = await backend.getActiveSchema(graphId);
|
|
2939
2971
|
} catch (error) {
|
|
2940
|
-
if (
|
|
2972
|
+
if (chunkBSFJMMV3_cjs.isMissingTableError(error)) {
|
|
2941
2973
|
throw schemaNotInitializedError(graphId, error);
|
|
2942
2974
|
}
|
|
2943
2975
|
throw error;
|
|
@@ -2948,7 +2980,7 @@ async function readActiveSchemaPure(backend, graphId) {
|
|
|
2948
2980
|
return activeRow;
|
|
2949
2981
|
}
|
|
2950
2982
|
function schemaNotInitializedError(graphId, cause) {
|
|
2951
|
-
return new
|
|
2983
|
+
return new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2952
2984
|
`Cannot verify graph "${graphId}": no schema has been initialized. Run createStoreWithSchema(graph, adminBackend) once under a privileged role (which commits the schema_versions row and materializes contribution markers) before attaching with createStore() / createVerifiedStore(). Generated migration SQL creates the tables but does not initialize the schema row.`,
|
|
2953
2985
|
{ graphId },
|
|
2954
2986
|
{
|
|
@@ -2957,17 +2989,39 @@ function schemaNotInitializedError(graphId, cause) {
|
|
|
2957
2989
|
}
|
|
2958
2990
|
);
|
|
2959
2991
|
}
|
|
2960
|
-
|
|
2992
|
+
function requireCommitWithPreflight(backend, graph) {
|
|
2993
|
+
const commitWithPreflight = backend.commitSchemaVersionWithPreflight;
|
|
2994
|
+
if (commitWithPreflight === void 0) {
|
|
2995
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
2996
|
+
"This backend cannot atomically commit identity data with a schema transition.",
|
|
2997
|
+
{
|
|
2998
|
+
code: "IDENTITY_REQUIRES_ATOMIC_BACKEND",
|
|
2999
|
+
graphId: graph.id
|
|
3000
|
+
}
|
|
3001
|
+
);
|
|
3002
|
+
}
|
|
3003
|
+
return commitWithPreflight;
|
|
3004
|
+
}
|
|
3005
|
+
async function initializeSchema(backend, graph, options) {
|
|
2961
3006
|
buildKindRegistry(graph);
|
|
2962
3007
|
const schema = serializeSchema(graph, 1);
|
|
2963
3008
|
const hash = await computeSchemaHash(schema);
|
|
2964
|
-
|
|
3009
|
+
const commit = {
|
|
2965
3010
|
graphId: graph.id,
|
|
2966
3011
|
expected: { kind: "initial" },
|
|
2967
3012
|
version: 1,
|
|
2968
3013
|
schemaHash: hash,
|
|
2969
3014
|
schemaDoc: schema
|
|
3015
|
+
};
|
|
3016
|
+
if (graph.identity === void 0) {
|
|
3017
|
+
return backend.commitSchemaVersion(commit);
|
|
3018
|
+
}
|
|
3019
|
+
const preflight = await prepareIdentitySchemaCommit(backend, graph, {
|
|
3020
|
+
enablement: true,
|
|
3021
|
+
...options?.schema === void 0 ? {} : { schema: options.schema }
|
|
2970
3022
|
});
|
|
3023
|
+
const commitWithPreflight = requireCommitWithPreflight(backend, graph);
|
|
3024
|
+
return withIdentityDdlRaceRetry(() => commitWithPreflight(commit, preflight));
|
|
2971
3025
|
}
|
|
2972
3026
|
async function migrateSchema(backend, graph, currentVersion, options) {
|
|
2973
3027
|
const {
|
|
@@ -2976,24 +3030,106 @@ async function migrateSchema(backend, graph, currentVersion, options) {
|
|
|
2976
3030
|
activeRow
|
|
2977
3031
|
} = await loadAndMergeGraphExtensionDocument(backend, graph);
|
|
2978
3032
|
if (activeRow !== void 0 && activeRow.version !== currentVersion) {
|
|
2979
|
-
throw new
|
|
3033
|
+
throw new chunkNI72YOJB_cjs.StaleVersionError({
|
|
2980
3034
|
graphId: graph.id,
|
|
2981
3035
|
expected: currentVersion,
|
|
2982
3036
|
actual: activeRow.version
|
|
2983
3037
|
});
|
|
2984
3038
|
}
|
|
2985
3039
|
const dropped = storedSchema === void 0 ? [] : [
|
|
2986
|
-
...droppedKinds(storedSchema.nodes,
|
|
2987
|
-
...droppedKinds(storedSchema.edges,
|
|
3040
|
+
...droppedKinds(storedSchema.nodes, chunkCXBHOOIQ_cjs.getNodeKinds(target), "node"),
|
|
3041
|
+
...droppedKinds(storedSchema.edges, chunkCXBHOOIQ_cjs.getEdgeKinds(target), "edge")
|
|
2988
3042
|
];
|
|
2989
|
-
const
|
|
3043
|
+
const guardedDrops = options?.discardDroppedKindRows === true ? [] : dropped;
|
|
3044
|
+
const droppedNodeKinds = dropped.filter((drop) => drop.entity === "node").map((drop) => drop.kind);
|
|
3045
|
+
const identityPreflight = activeRow === void 0 ? void 0 : target.identity === void 0 ? (
|
|
3046
|
+
// Identity being OFF in the target is not evidence the ledger is empty:
|
|
3047
|
+
// disabling retains the assertion rows. A drop committed here would
|
|
3048
|
+
// strand every assertion touching the kind — a later re-enablement
|
|
3049
|
+
// filters them out of the closure while raw ledger reads and merge
|
|
3050
|
+
// staging still see them.
|
|
3051
|
+
await prepareIdentityKindCascade(backend, target, {
|
|
3052
|
+
droppedNodeKinds,
|
|
3053
|
+
probeBeforeCascade: storedSchema?.identity === void 0,
|
|
3054
|
+
...options?.schema === void 0 ? {} : { schema: options.schema }
|
|
3055
|
+
})
|
|
3056
|
+
) : await prepareIdentitySchemaCommit(backend, target, {
|
|
3057
|
+
enablement: storedSchema?.identity === void 0,
|
|
3058
|
+
droppedNodeKinds,
|
|
3059
|
+
...options?.schema === void 0 ? {} : { schema: options.schema }
|
|
3060
|
+
});
|
|
3061
|
+
const committed = identityPreflight === void 0 ? guardedDrops.length > 0 ? await commitDroppedKindsOnlyWhenEmpty(
|
|
2990
3062
|
backend,
|
|
2991
3063
|
target,
|
|
2992
3064
|
currentVersion,
|
|
2993
|
-
|
|
2994
|
-
) : await commitNewSchemaVersion(backend, target, currentVersion)
|
|
3065
|
+
guardedDrops
|
|
3066
|
+
) : await commitNewSchemaVersion(backend, target, currentVersion) : await commitNewSchemaVersionWithPreflight(
|
|
3067
|
+
backend,
|
|
3068
|
+
target,
|
|
3069
|
+
currentVersion,
|
|
3070
|
+
async (transactionBackend) => {
|
|
3071
|
+
await assertDroppedKindsEmpty(
|
|
3072
|
+
transactionBackend,
|
|
3073
|
+
target.id,
|
|
3074
|
+
currentVersion,
|
|
3075
|
+
guardedDrops
|
|
3076
|
+
);
|
|
3077
|
+
await identityPreflight(transactionBackend);
|
|
3078
|
+
}
|
|
3079
|
+
);
|
|
2995
3080
|
return committed.version;
|
|
2996
3081
|
}
|
|
3082
|
+
async function prepareIdentityKindCascade(backend, target, options) {
|
|
3083
|
+
if (options.droppedNodeKinds.length === 0) return void 0;
|
|
3084
|
+
const schema = options.schema === void 0 ? chunkNFCVHQ5P_cjs.createSqlSchema(backend.tableNames) : chunkNFCVHQ5P_cjs.requireSqlSchema(options.schema, "The schema option");
|
|
3085
|
+
if (options.probeBeforeCascade) {
|
|
3086
|
+
const needed = await identityKindCascadeNeeded(
|
|
3087
|
+
backend,
|
|
3088
|
+
schema,
|
|
3089
|
+
target.id,
|
|
3090
|
+
options.droppedNodeKinds
|
|
3091
|
+
);
|
|
3092
|
+
if (!needed) return void 0;
|
|
3093
|
+
}
|
|
3094
|
+
return identityKindCascadePreflight(
|
|
3095
|
+
{ graphId: target.id, schema },
|
|
3096
|
+
options.droppedNodeKinds
|
|
3097
|
+
);
|
|
3098
|
+
}
|
|
3099
|
+
async function prepareIdentitySchemaCommit(backend, target, options) {
|
|
3100
|
+
const schema = options.schema === void 0 ? chunkNFCVHQ5P_cjs.createSqlSchema(backend.tableNames) : chunkNFCVHQ5P_cjs.requireSqlSchema(options.schema, "The schema option");
|
|
3101
|
+
const registry = buildKindRegistry(target);
|
|
3102
|
+
const provisioning = await ensureIdentitySchemaStorage(backend, schema, {
|
|
3103
|
+
graphId: target.id,
|
|
3104
|
+
enablement: options.enablement,
|
|
3105
|
+
registry
|
|
3106
|
+
});
|
|
3107
|
+
return identitySchemaCommitPreflight(
|
|
3108
|
+
{
|
|
3109
|
+
graphId: target.id,
|
|
3110
|
+
registry,
|
|
3111
|
+
schema,
|
|
3112
|
+
sameIdAcrossKinds: target.identity?.sameIdAcrossKinds ?? "ignore"
|
|
3113
|
+
},
|
|
3114
|
+
{
|
|
3115
|
+
enablement: options.enablement,
|
|
3116
|
+
droppedNodeKinds: options.droppedNodeKinds ?? [],
|
|
3117
|
+
provisionDerivedRelations: provisioning.provisionInCommit
|
|
3118
|
+
}
|
|
3119
|
+
);
|
|
3120
|
+
}
|
|
3121
|
+
async function assertDroppedKindsEmpty(backend, graphId, currentVersion, dropped) {
|
|
3122
|
+
const counts = await Promise.all(
|
|
3123
|
+
dropped.map(async (entry) => ({
|
|
3124
|
+
entity: entry.entity,
|
|
3125
|
+
kind: entry.kind,
|
|
3126
|
+
count: entry.entity === "node" ? await backend.countNodesByKind({ graphId, kind: entry.kind }) : await backend.countEdgesByKind({ graphId, kind: entry.kind })
|
|
3127
|
+
}))
|
|
3128
|
+
);
|
|
3129
|
+
const populated = counts.filter((entry) => entry.count > 0);
|
|
3130
|
+
if (populated.length === 0) return;
|
|
3131
|
+
throwPopulatedKindRemovalError(graphId, currentVersion, populated);
|
|
3132
|
+
}
|
|
2997
3133
|
async function commitDroppedKindsOnlyWhenEmpty(backend, graph, currentVersion, dropped) {
|
|
2998
3134
|
const result = await commitNewSchemaVersionIfKindsEmpty(
|
|
2999
3135
|
backend,
|
|
@@ -3006,7 +3142,7 @@ async function commitDroppedKindsOnlyWhenEmpty(backend, graph, currentVersion, d
|
|
|
3006
3142
|
}
|
|
3007
3143
|
function throwPopulatedKindRemovalError(graphId, currentVersion, populated) {
|
|
3008
3144
|
const named = populated.map((entry) => `${entry.entity} "${entry.kind}" (${String(entry.count)})`).join(", ");
|
|
3009
|
-
throw new
|
|
3145
|
+
throw new chunkNI72YOJB_cjs.MigrationError(
|
|
3010
3146
|
`Refusing to commit a schema for graph "${graphId}" that drops kinds still holding rows: ${named}. Committing would make those rows unreachable, and the next materializeRemovals() would delete them. Export or delete those rows, then retry. Pass { discardDroppedKindRows: true } if losing them is the intent.`,
|
|
3011
3147
|
{
|
|
3012
3148
|
graphId,
|
|
@@ -3032,7 +3168,7 @@ async function commitNewSchemaVersionIfKindsEmpty(backend, graph, currentVersion
|
|
|
3032
3168
|
const params = await buildNewSchemaVersionCommit(graph, currentVersion);
|
|
3033
3169
|
const commitIfKindsEmpty = backend.commitSchemaVersionIfKindsEmpty;
|
|
3034
3170
|
if (commitIfKindsEmpty === void 0) {
|
|
3035
|
-
throw new
|
|
3171
|
+
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
3036
3172
|
"This backend cannot atomically fence entity writes while checking schema kind emptiness.",
|
|
3037
3173
|
{
|
|
3038
3174
|
code: "SCHEMA_KIND_EMPTINESS_FENCE_UNSUPPORTED",
|
|
@@ -3055,10 +3191,18 @@ async function buildNewSchemaVersionCommit(graph, currentVersion) {
|
|
|
3055
3191
|
schemaDoc: schema
|
|
3056
3192
|
};
|
|
3057
3193
|
}
|
|
3194
|
+
async function commitNewSchemaVersionWithPreflight(backend, graph, currentVersion, preflight) {
|
|
3195
|
+
if (backend.commitSchemaVersionWithPreflight === void 0) {
|
|
3196
|
+
buildKindRegistry(graph);
|
|
3197
|
+
}
|
|
3198
|
+
const commitWithPreflight = requireCommitWithPreflight(backend, graph);
|
|
3199
|
+
const commit = await buildNewSchemaVersionCommit(graph, currentVersion);
|
|
3200
|
+
return withIdentityDdlRaceRetry(() => commitWithPreflight(commit, preflight));
|
|
3201
|
+
}
|
|
3058
3202
|
async function rollbackSchema(backend, graphId, targetVersion) {
|
|
3059
3203
|
const activeRow = await backend.getActiveSchema(graphId);
|
|
3060
3204
|
if (activeRow === void 0) {
|
|
3061
|
-
throw new
|
|
3205
|
+
throw new chunkNI72YOJB_cjs.MigrationError(
|
|
3062
3206
|
`Cannot rollback graph "${graphId}": no active schema version exists.`,
|
|
3063
3207
|
{
|
|
3064
3208
|
graphId,
|
|
@@ -3103,15 +3247,16 @@ async function getCommittedSchemaVersion(backend, graphId) {
|
|
|
3103
3247
|
return row?.version;
|
|
3104
3248
|
}
|
|
3105
3249
|
|
|
3106
|
-
exports.KindRegistry = KindRegistry;
|
|
3107
3250
|
exports.applyDeprecatedKinds = applyDeprecatedKinds;
|
|
3108
3251
|
exports.assertSchemaCurrent = assertSchemaCurrent;
|
|
3109
3252
|
exports.broader = broader;
|
|
3110
3253
|
exports.buildGraphExtensionOntologyKeySet = buildGraphExtensionOntologyKeySet;
|
|
3111
3254
|
exports.buildKindRegistry = buildKindRegistry;
|
|
3255
|
+
exports.buildValidatedKindRegistry = buildValidatedKindRegistry;
|
|
3112
3256
|
exports.classifySchemaChanges = classifySchemaChanges;
|
|
3113
3257
|
exports.commitNewSchemaVersion = commitNewSchemaVersion;
|
|
3114
3258
|
exports.commitNewSchemaVersionIfKindsEmpty = commitNewSchemaVersionIfKindsEmpty;
|
|
3259
|
+
exports.commitNewSchemaVersionWithPreflight = commitNewSchemaVersionWithPreflight;
|
|
3115
3260
|
exports.compileTimeOntologyKey = compileTimeOntologyKey;
|
|
3116
3261
|
exports.computeSchemaDiff = computeSchemaDiff;
|
|
3117
3262
|
exports.computeSchemaHash = computeSchemaHash;
|
|
@@ -3119,6 +3264,7 @@ exports.core = core;
|
|
|
3119
3264
|
exports.deserializeWherePredicate = deserializeWherePredicate;
|
|
3120
3265
|
exports.differentFrom = differentFrom;
|
|
3121
3266
|
exports.disjointWith = disjointWith;
|
|
3267
|
+
exports.ensureIdentitySchemaStorage = ensureIdentitySchemaStorage;
|
|
3122
3268
|
exports.ensureSchema = ensureSchema;
|
|
3123
3269
|
exports.equivalentTo = equivalentTo;
|
|
3124
3270
|
exports.extensionKindNames = extensionKindNames;
|
|
@@ -3127,6 +3273,8 @@ exports.getCommittedSchemaVersion = getCommittedSchemaVersion;
|
|
|
3127
3273
|
exports.getMigrationActions = getMigrationActions;
|
|
3128
3274
|
exports.getSchemaChanges = getSchemaChanges;
|
|
3129
3275
|
exports.hasPart = hasPart;
|
|
3276
|
+
exports.identityKindCascadeNeeded = identityKindCascadeNeeded;
|
|
3277
|
+
exports.identitySchemaCommitPreflight = identitySchemaCommitPreflight;
|
|
3130
3278
|
exports.implies = implies;
|
|
3131
3279
|
exports.initializeSchema = initializeSchema;
|
|
3132
3280
|
exports.inverseOf = inverseOf;
|
|
@@ -3150,6 +3298,5 @@ exports.serializeSchema = serializeSchema;
|
|
|
3150
3298
|
exports.serializeSchemaProperties = serializeSchemaProperties;
|
|
3151
3299
|
exports.stripGraphExtension = stripGraphExtension;
|
|
3152
3300
|
exports.subClassOf = subClassOf;
|
|
3153
|
-
|
|
3154
|
-
//# sourceMappingURL=chunk-
|
|
3155
|
-
//# sourceMappingURL=chunk-2VLBGQBY.cjs.map
|
|
3301
|
+
//# sourceMappingURL=chunk-N3257XE6.cjs.map
|
|
3302
|
+
//# sourceMappingURL=chunk-N3257XE6.cjs.map
|