@nicia-ai/typegraph 0.36.0 → 0.37.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/postgres/index.cjs +24 -24
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -11
- package/dist/backend/postgres/pglite.cjs +16 -16
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -11
- package/dist/backend/sqlite/index.cjs +22 -21
- package/dist/backend/sqlite/index.d.cts +11 -9
- package/dist/backend/sqlite/index.d.ts +11 -9
- package/dist/backend/sqlite/index.js +10 -9
- package/dist/backend/sqlite/libsql.cjs +15 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +11 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +30 -23
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-TCOCYN2P.cjs → chunk-27SSDCEP.cjs} +14 -14
- package/dist/{chunk-TCOCYN2P.cjs.map → chunk-27SSDCEP.cjs.map} +1 -1
- package/dist/{chunk-5AQIKK56.cjs → chunk-2N6EOBTH.cjs} +16 -16
- package/dist/{chunk-5AQIKK56.cjs.map → chunk-2N6EOBTH.cjs.map} +1 -1
- package/dist/{chunk-FN35DLCN.cjs → chunk-3C2RYI6L.cjs} +13 -107
- package/dist/chunk-3C2RYI6L.cjs.map +1 -0
- package/dist/{chunk-HW3LW7DH.cjs → chunk-3DS7Z4T4.cjs} +39 -39
- package/dist/{chunk-HW3LW7DH.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
- package/dist/{chunk-RSSQKPSZ.cjs → chunk-3GH67G4Z.cjs} +5 -5
- package/dist/{chunk-RSSQKPSZ.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
- package/dist/{chunk-M75SUBFG.js → chunk-3RWZPJKV.js} +24 -9
- package/dist/chunk-3RWZPJKV.js.map +1 -0
- package/dist/{chunk-SKCOUWAX.js → chunk-3SLPDKHQ.js} +4 -4
- package/dist/chunk-3SLPDKHQ.js.map +1 -0
- package/dist/{chunk-5A6FNS6N.cjs → chunk-3XXGYU62.cjs} +11 -11
- package/dist/{chunk-5A6FNS6N.cjs.map → chunk-3XXGYU62.cjs.map} +1 -1
- package/dist/{chunk-IU46OHVW.js → chunk-44TA22QT.js} +58 -11
- package/dist/chunk-44TA22QT.js.map +1 -0
- package/dist/{chunk-5DIPR3L3.js → chunk-552KNYQJ.js} +2392 -279
- package/dist/chunk-552KNYQJ.js.map +1 -0
- package/dist/{chunk-2THZ3TQI.cjs → chunk-5KEQ74YU.cjs} +14 -14
- package/dist/chunk-5KEQ74YU.cjs.map +1 -0
- package/dist/{chunk-Q5TEXCTB.js → chunk-5KPNWT6X.js} +3 -3
- package/dist/{chunk-Q5TEXCTB.js.map → chunk-5KPNWT6X.js.map} +1 -1
- package/dist/{chunk-WI7ISNQF.js → chunk-5PNMDJ7J.js} +94 -5
- package/dist/chunk-5PNMDJ7J.js.map +1 -0
- package/dist/{chunk-AW4A3P5A.cjs → chunk-5VQM6VWP.cjs} +2 -2
- package/dist/{chunk-AW4A3P5A.cjs.map → chunk-5VQM6VWP.cjs.map} +1 -1
- package/dist/{chunk-A3W7QG7K.js → chunk-5WWVZMVX.js} +2 -2
- package/dist/{chunk-A3W7QG7K.js.map → chunk-5WWVZMVX.js.map} +1 -1
- package/dist/{chunk-FACJJWGF.cjs → chunk-6EEO3OVU.cjs} +7 -7
- package/dist/{chunk-FACJJWGF.cjs.map → chunk-6EEO3OVU.cjs.map} +1 -1
- package/dist/{chunk-DIK74MXX.cjs → chunk-BVRDGYXQ.cjs} +97 -4
- package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
- package/dist/{chunk-4BCU6VFZ.cjs → chunk-DEFQM7JU.cjs} +7 -7
- package/dist/{chunk-4BCU6VFZ.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
- package/dist/{chunk-456Z2U7Y.cjs → chunk-DIQ3AV5W.cjs} +574 -268
- package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
- package/dist/{chunk-FPIZFYHE.js → chunk-EXU3RASM.js} +74 -15
- package/dist/chunk-EXU3RASM.js.map +1 -0
- package/dist/{chunk-H7YNSMA7.cjs → chunk-HAHNRASW.cjs} +20 -2
- package/dist/chunk-HAHNRASW.cjs.map +1 -0
- package/dist/{chunk-J3LEGNQB.cjs → chunk-IP3CGGPA.cjs} +8 -8
- package/dist/{chunk-J3LEGNQB.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
- package/dist/{chunk-X4JBT642.cjs → chunk-IPSVVTWT.cjs} +94 -35
- package/dist/chunk-IPSVVTWT.cjs.map +1 -0
- package/dist/{chunk-VQEXF5D4.js → chunk-IXGYRP2P.js} +184 -92
- package/dist/chunk-IXGYRP2P.js.map +1 -0
- package/dist/{chunk-BJVEU3ZL.js → chunk-J4IUSYFF.js} +251 -121
- package/dist/chunk-J4IUSYFF.js.map +1 -0
- package/dist/{chunk-JFMEONLG.cjs → chunk-JBNOGRKW.cjs} +318 -188
- package/dist/chunk-JBNOGRKW.cjs.map +1 -0
- package/dist/{chunk-4GX2JJXS.js → chunk-K3Q3LJY3.js} +520 -221
- package/dist/chunk-K3Q3LJY3.js.map +1 -0
- package/dist/{chunk-OR5ZA5WP.js → chunk-K5UBVGJN.js} +4 -4
- package/dist/{chunk-OR5ZA5WP.js.map → chunk-K5UBVGJN.js.map} +1 -1
- package/dist/{chunk-UZV3AZKF.js → chunk-KQJ54OG5.js} +3 -3
- package/dist/{chunk-UZV3AZKF.js.map → chunk-KQJ54OG5.js.map} +1 -1
- package/dist/{chunk-SXGE7ITL.js → chunk-L7HQ2OSI.js} +4 -4
- package/dist/{chunk-SXGE7ITL.js.map → chunk-L7HQ2OSI.js.map} +1 -1
- package/dist/{chunk-RAXU3RMB.js → chunk-M6VES7V6.js} +4 -4
- package/dist/{chunk-RAXU3RMB.js.map → chunk-M6VES7V6.js.map} +1 -1
- package/dist/{chunk-7BQLPXK6.cjs → chunk-NBP2WTJW.cjs} +3011 -898
- package/dist/chunk-NBP2WTJW.cjs.map +1 -0
- package/dist/{chunk-PWGX5DF5.cjs → chunk-NUIG3BCV.cjs} +100 -85
- package/dist/chunk-NUIG3BCV.cjs.map +1 -0
- package/dist/{chunk-ZAMFOJ5P.cjs → chunk-NXQFATMF.cjs} +269 -177
- package/dist/chunk-NXQFATMF.cjs.map +1 -0
- package/dist/{chunk-KBGQIPRQ.js → chunk-PC2UBAUB.js} +20 -3
- package/dist/chunk-PC2UBAUB.js.map +1 -0
- package/dist/chunk-QARBLBXT.cjs +219 -0
- package/dist/chunk-QARBLBXT.cjs.map +1 -0
- package/dist/{chunk-6FR2MMS6.js → chunk-QERAIDRJ.js} +45 -4
- package/dist/chunk-QERAIDRJ.js.map +1 -0
- package/dist/chunk-QSXTWU4U.cjs +12 -0
- package/dist/{chunk-4BMPGT35.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
- package/dist/{chunk-DN5VP4JC.js → chunk-RCVLFTCT.js} +9 -10
- package/dist/chunk-RCVLFTCT.js.map +1 -0
- package/dist/{chunk-ZIGXMKQQ.js → chunk-RRSNR3TP.js} +3 -3
- package/dist/{chunk-ZIGXMKQQ.js.map → chunk-RRSNR3TP.js.map} +1 -1
- package/dist/{chunk-4CAXEB2F.cjs → chunk-TGOMW4MB.cjs} +91 -92
- package/dist/chunk-TGOMW4MB.cjs.map +1 -0
- package/dist/{chunk-PZKNKG5M.js → chunk-TKT2XHED.js} +8 -8
- package/dist/{chunk-PZKNKG5M.js.map → chunk-TKT2XHED.js.map} +1 -1
- package/dist/{chunk-S5F7ZLP2.js → chunk-TPF25IG6.js} +3 -3
- package/dist/{chunk-S5F7ZLP2.js.map → chunk-TPF25IG6.js.map} +1 -1
- package/dist/{chunk-5SEGFTZX.js → chunk-UGZUAYAR.js} +3 -3
- package/dist/{chunk-5SEGFTZX.js.map → chunk-UGZUAYAR.js.map} +1 -1
- package/dist/{chunk-VHMPG6UL.js → chunk-UXLSNRYL.js} +11 -105
- package/dist/chunk-UXLSNRYL.js.map +1 -0
- package/dist/{chunk-FRV5Q5IO.js → chunk-UYQMBBWJ.js} +3 -3
- package/dist/{chunk-FRV5Q5IO.js.map → chunk-UYQMBBWJ.js.map} +1 -1
- package/dist/{chunk-UUT7UN2N.cjs → chunk-VGDDG3XJ.cjs} +7 -7
- package/dist/{chunk-UUT7UN2N.cjs.map → chunk-VGDDG3XJ.cjs.map} +1 -1
- package/dist/{chunk-5VTR2F2K.js → chunk-VKGKDOKR.js} +12 -10
- package/dist/chunk-VKGKDOKR.js.map +1 -0
- package/dist/{chunk-5W4L6DLF.cjs → chunk-VL2V6PEN.cjs} +11 -11
- package/dist/{chunk-5W4L6DLF.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
- package/dist/{chunk-ZUNQ5BEP.cjs → chunk-WOJMKB3N.cjs} +82 -80
- package/dist/chunk-WOJMKB3N.cjs.map +1 -0
- package/dist/{chunk-UMDVATGY.cjs → chunk-WWFHO375.cjs} +6 -6
- package/dist/{chunk-UMDVATGY.cjs.map → chunk-WWFHO375.cjs.map} +1 -1
- package/dist/{chunk-JFUPDJXD.js → chunk-XGPUQ56G.js} +3 -3
- package/dist/{chunk-JFUPDJXD.js.map → chunk-XGPUQ56G.js.map} +1 -1
- package/dist/{chunk-D7ZEOS56.cjs → chunk-XGU7DZDA.cjs} +74 -14
- package/dist/chunk-XGU7DZDA.cjs.map +1 -0
- package/dist/{chunk-S55OV6PW.cjs → chunk-XPCZADMT.cjs} +54 -11
- package/dist/chunk-XPCZADMT.cjs.map +1 -0
- package/dist/{chunk-T2WUSPDA.js → chunk-XWV4JT34.js} +3 -3
- package/dist/{chunk-T2WUSPDA.js.map → chunk-XWV4JT34.js.map} +1 -1
- package/dist/chunk-YTSN73ND.js +212 -0
- package/dist/chunk-YTSN73ND.js.map +1 -0
- package/dist/{ddl-CZz7a0E8.d.cts → ddl-BD-ZfKeX.d.cts} +3 -3
- package/dist/{ddl-C2rZ-Aen.d.ts → ddl-CS0KUVwB.d.ts} +3 -3
- package/dist/{extension-types-ixRpJVUp.d.ts → extension-types-BM2ACfYO.d.cts} +6 -1
- package/dist/{extension-types-ixRpJVUp.d.cts → extension-types-BM2ACfYO.d.ts} +6 -1
- package/dist/{fulltext-strategy-CDkSSYhq.d.cts → fulltext-strategy-C27vXaeB.d.cts} +127 -8
- package/dist/{fulltext-strategy-B57yvC5Q.d.ts → fulltext-strategy-DebsMrqg.d.ts} +127 -8
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +88 -88
- package/dist/graph-merge/index.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +19 -19
- package/dist/{index-BLtQWKRj.d.cts → index-BPM59vsg.d.cts} +52 -7
- package/dist/{index-BFvdmBPV.d.ts → index-BeacbPoe.d.ts} +52 -7
- package/dist/index.cjs +224 -187
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +53 -40
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +30 -21
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -7
- package/dist/interchange/index.cjs +207 -30
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +25 -8
- package/dist/interchange/index.d.ts +25 -8
- package/dist/interchange/index.js +190 -11
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-DwQi8eV0.d.cts → manager-D00_NXvT.d.ts} +11 -2
- package/dist/{manager-ejUCB52T.d.ts → manager-nU1vTJLy.d.cts} +11 -2
- package/dist/{materialize-indexes-B4e9360H.d.cts → materialize-indexes-CuR3gAZb.d.cts} +8 -2
- package/dist/{materialize-indexes-te9TPMMJ.d.ts → materialize-indexes-zK2J_flP.d.ts} +8 -2
- package/dist/{postgres-CfEqsRMp.d.cts → postgres-IaBA4RgE.d.ts} +1 -1
- package/dist/{postgres-DQ5R6rzV.d.ts → postgres-YrYmPlaU.d.cts} +1 -1
- package/dist/profiler/index.cjs +3 -3
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/provenance/index.cjs +32 -33
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +5 -5
- package/dist/provenance/index.d.ts +5 -5
- package/dist/provenance/index.js +5 -6
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +11 -11
- package/dist/{sqlite-DvQndLky.d.ts → sqlite-BUOHPx7p.d.ts} +1 -1
- package/dist/{sqlite-D7zBinNR.d.cts → sqlite-Pp8O19WE.d.cts} +1 -1
- package/dist/{store-view-DplHC3Nt.d.ts → store-view-ANL6mTph.d.ts} +213 -27
- package/dist/{store-view-9KDOpZzF.d.cts → store-view-X96Rd00T.d.cts} +213 -27
- package/dist/{types-Bv9DcS_E.d.cts → types-r-Zyq2Hz.d.cts} +2 -2
- package/dist/{types-CoxuV7EJ.d.ts → types-wsvuBgPK.d.ts} +2 -2
- package/dist/where-CJOpJj3a.d.ts +36 -0
- package/dist/where-K3uBP33l.d.cts +36 -0
- package/package.json +1 -1
- package/dist/chunk-2THZ3TQI.cjs.map +0 -1
- package/dist/chunk-456Z2U7Y.cjs.map +0 -1
- package/dist/chunk-4BMPGT35.cjs +0 -12
- package/dist/chunk-4CAXEB2F.cjs.map +0 -1
- package/dist/chunk-4GX2JJXS.js.map +0 -1
- package/dist/chunk-5DIPR3L3.js.map +0 -1
- package/dist/chunk-5VTR2F2K.js.map +0 -1
- package/dist/chunk-6FR2MMS6.js.map +0 -1
- package/dist/chunk-7BQLPXK6.cjs.map +0 -1
- package/dist/chunk-BJVEU3ZL.js.map +0 -1
- package/dist/chunk-D7ZEOS56.cjs.map +0 -1
- package/dist/chunk-DIK74MXX.cjs.map +0 -1
- package/dist/chunk-DN5VP4JC.js.map +0 -1
- package/dist/chunk-EOLERH7Y.cjs +0 -40
- package/dist/chunk-EOLERH7Y.cjs.map +0 -1
- package/dist/chunk-FN35DLCN.cjs.map +0 -1
- package/dist/chunk-FPIZFYHE.js.map +0 -1
- package/dist/chunk-H7YNSMA7.cjs.map +0 -1
- package/dist/chunk-IU46OHVW.js.map +0 -1
- package/dist/chunk-JFMEONLG.cjs.map +0 -1
- package/dist/chunk-KBGQIPRQ.js.map +0 -1
- package/dist/chunk-M75SUBFG.js.map +0 -1
- package/dist/chunk-PWGX5DF5.cjs.map +0 -1
- package/dist/chunk-S55OV6PW.cjs.map +0 -1
- package/dist/chunk-SKCOUWAX.js.map +0 -1
- package/dist/chunk-UT3S4SEN.js +0 -31
- package/dist/chunk-UT3S4SEN.js.map +0 -1
- package/dist/chunk-VHMPG6UL.js.map +0 -1
- package/dist/chunk-VQEXF5D4.js.map +0 -1
- package/dist/chunk-WI7ISNQF.js.map +0 -1
- package/dist/chunk-X4JBT642.cjs.map +0 -1
- package/dist/chunk-ZAMFOJ5P.cjs.map +0 -1
- package/dist/chunk-ZUNQ5BEP.cjs.map +0 -1
- package/dist/where-7RKFOsXt.d.ts +0 -11
- package/dist/where-DdMIXOtH.d.cts +0 -11
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { shortHash, quoteIdentifier } from './chunk-EXU3RASM.js';
|
|
2
|
+
|
|
3
|
+
// src/indexes/system.ts
|
|
4
|
+
var SYSTEM_INDEX_DECLARATIONS = [
|
|
5
|
+
// ---------------------------------------------------------- nodes
|
|
6
|
+
{ table: "nodes", suffix: "kind_idx", columns: ["graph_id", "kind"] },
|
|
7
|
+
// Listing shape: kind partition ordered by creation with the
|
|
8
|
+
// soft-delete column ahead of it so `deleted_at IS NULL` list queries
|
|
9
|
+
// stay index-served.
|
|
10
|
+
{
|
|
11
|
+
table: "nodes",
|
|
12
|
+
suffix: "kind_created_idx",
|
|
13
|
+
columns: ["graph_id", "kind", "deleted_at", "created_at"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
table: "nodes",
|
|
17
|
+
suffix: "deleted_idx",
|
|
18
|
+
columns: ["graph_id", "deleted_at"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
table: "nodes",
|
|
22
|
+
suffix: "valid_idx",
|
|
23
|
+
columns: ["graph_id", "valid_from", "valid_to"]
|
|
24
|
+
},
|
|
25
|
+
// Bare-id lookup: the primary key leads with `kind` (graph_id, kind,
|
|
26
|
+
// id), so a `WHERE graph_id = ? AND id = ?` probe that doesn't know the
|
|
27
|
+
// kind can't seek it — SQLite falls back to a graph_id-only scan of
|
|
28
|
+
// every node in the graph (~3M at LDBC SF1).
|
|
29
|
+
// `store.algorithms.degree`'s node-kind subquery does exactly that
|
|
30
|
+
// lookup (it resolves the seed's kind by id), so without this index
|
|
31
|
+
// degree is a full nodes scan (~95ms at SF1). See typegraph#280.
|
|
32
|
+
{ table: "nodes", suffix: "id_idx", columns: ["graph_id", "id"] },
|
|
33
|
+
// ---------------------------------------------------------- edges
|
|
34
|
+
{ table: "edges", suffix: "kind_idx", columns: ["graph_id", "kind"] },
|
|
35
|
+
// Directional traversal index (outgoing): supports endpoint lookups
|
|
36
|
+
// and extra filtering by edge kind / target kind. Includes every
|
|
37
|
+
// system column the compiled query's soft-delete/temporal-validity
|
|
38
|
+
// predicate touches (deleted_at, valid_from, valid_to), trailed by
|
|
39
|
+
// to_id — the compiled traversal join reads `n.id = e.to_id` for an
|
|
40
|
+
// outgoing traversal (standard-builders.ts), so without to_id here
|
|
41
|
+
// the join still fetches the edge's heap row for that one column
|
|
42
|
+
// even with the seek/predicate columns covered.
|
|
43
|
+
{
|
|
44
|
+
table: "edges",
|
|
45
|
+
suffix: "from_idx",
|
|
46
|
+
columns: [
|
|
47
|
+
"graph_id",
|
|
48
|
+
"from_kind",
|
|
49
|
+
"from_id",
|
|
50
|
+
"kind",
|
|
51
|
+
"to_kind",
|
|
52
|
+
"deleted_at",
|
|
53
|
+
"valid_from",
|
|
54
|
+
"valid_to",
|
|
55
|
+
"to_id"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
// Directional traversal index (incoming): mirrors from_idx for
|
|
59
|
+
// reverse traversals, trailed by from_id for the same reason
|
|
60
|
+
// (`n.id = e.from_id` for an incoming traversal).
|
|
61
|
+
{
|
|
62
|
+
table: "edges",
|
|
63
|
+
suffix: "to_idx",
|
|
64
|
+
columns: [
|
|
65
|
+
"graph_id",
|
|
66
|
+
"to_kind",
|
|
67
|
+
"to_id",
|
|
68
|
+
"kind",
|
|
69
|
+
"from_kind",
|
|
70
|
+
"deleted_at",
|
|
71
|
+
"valid_from",
|
|
72
|
+
"valid_to",
|
|
73
|
+
"from_id"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
table: "edges",
|
|
78
|
+
suffix: "kind_created_idx",
|
|
79
|
+
columns: ["graph_id", "kind", "deleted_at", "created_at"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
table: "edges",
|
|
83
|
+
suffix: "deleted_idx",
|
|
84
|
+
columns: ["graph_id", "deleted_at"]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
table: "edges",
|
|
88
|
+
suffix: "valid_idx",
|
|
89
|
+
columns: ["graph_id", "valid_from", "valid_to"]
|
|
90
|
+
},
|
|
91
|
+
// Cardinality enforcement: the one-per-endpoint check probes for a
|
|
92
|
+
// currently-valid edge of a kind from a specific endpoint.
|
|
93
|
+
{
|
|
94
|
+
table: "edges",
|
|
95
|
+
suffix: "cardinality_idx",
|
|
96
|
+
columns: ["graph_id", "kind", "from_kind", "from_id", "valid_to"]
|
|
97
|
+
},
|
|
98
|
+
// ---------------------------------------------------------- recordedNodes
|
|
99
|
+
{
|
|
100
|
+
table: "recordedNodes",
|
|
101
|
+
suffix: "entity_idx",
|
|
102
|
+
columns: ["graph_id", "kind", "id", "recorded_from", "recorded_to"]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
table: "recordedNodes",
|
|
106
|
+
suffix: "open_idx",
|
|
107
|
+
columns: ["graph_id", "recorded_to"]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
table: "recordedNodes",
|
|
111
|
+
suffix: "valid_idx",
|
|
112
|
+
columns: ["graph_id", "valid_from", "valid_to"]
|
|
113
|
+
},
|
|
114
|
+
// Bare-id lookup parity with the live nodes table: recorded-pinned
|
|
115
|
+
// reads swap this relation in as the node source, and `entity_idx`
|
|
116
|
+
// leads with `kind`, so the same kind-by-bare-id probe (e.g.
|
|
117
|
+
// `degree()` at a recorded coordinate) would otherwise scan every
|
|
118
|
+
// historical version in the graph. See typegraph#280.
|
|
119
|
+
{ table: "recordedNodes", suffix: "id_idx", columns: ["graph_id", "id"] },
|
|
120
|
+
// ---------------------------------------------------------- recordedEdges
|
|
121
|
+
{
|
|
122
|
+
table: "recordedEdges",
|
|
123
|
+
suffix: "entity_idx",
|
|
124
|
+
columns: ["graph_id", "kind", "id", "recorded_from", "recorded_to"]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
table: "recordedEdges",
|
|
128
|
+
suffix: "open_idx",
|
|
129
|
+
columns: ["graph_id", "recorded_to"]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
table: "recordedEdges",
|
|
133
|
+
suffix: "from_idx",
|
|
134
|
+
columns: [
|
|
135
|
+
"graph_id",
|
|
136
|
+
"from_kind",
|
|
137
|
+
"from_id",
|
|
138
|
+
"kind",
|
|
139
|
+
"to_kind",
|
|
140
|
+
"recorded_from",
|
|
141
|
+
"recorded_to"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
table: "recordedEdges",
|
|
146
|
+
suffix: "to_idx",
|
|
147
|
+
columns: [
|
|
148
|
+
"graph_id",
|
|
149
|
+
"to_kind",
|
|
150
|
+
"to_id",
|
|
151
|
+
"kind",
|
|
152
|
+
"from_kind",
|
|
153
|
+
"recorded_from",
|
|
154
|
+
"recorded_to"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
table: "recordedEdges",
|
|
159
|
+
suffix: "valid_idx",
|
|
160
|
+
columns: ["graph_id", "valid_from", "valid_to"]
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
var DEFAULT_SYSTEM_INDEX_TABLE_NAMES = {
|
|
164
|
+
nodes: "typegraph_nodes",
|
|
165
|
+
edges: "typegraph_edges",
|
|
166
|
+
recordedNodes: "typegraph_recorded_nodes",
|
|
167
|
+
recordedEdges: "typegraph_recorded_edges"
|
|
168
|
+
};
|
|
169
|
+
function resolveSystemIndexTableName(table, overrides) {
|
|
170
|
+
return overrides?.[table] ?? DEFAULT_SYSTEM_INDEX_TABLE_NAMES[table];
|
|
171
|
+
}
|
|
172
|
+
var MAX_SQL_IDENTIFIER_LENGTH = 63;
|
|
173
|
+
function systemIndexName(physicalTableName, suffix) {
|
|
174
|
+
const full = `${physicalTableName}_${suffix}`;
|
|
175
|
+
if (full.length <= MAX_SQL_IDENTIFIER_LENGTH) return full;
|
|
176
|
+
const hash = shortHash(JSON.stringify([physicalTableName, suffix]));
|
|
177
|
+
return `${full.slice(0, MAX_SQL_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;
|
|
178
|
+
}
|
|
179
|
+
function resolveSystemIndexNames(overrides) {
|
|
180
|
+
return new Set(
|
|
181
|
+
SYSTEM_INDEX_DECLARATIONS.map(
|
|
182
|
+
(declaration) => systemIndexName(
|
|
183
|
+
resolveSystemIndexTableName(declaration.table, overrides),
|
|
184
|
+
declaration.suffix
|
|
185
|
+
)
|
|
186
|
+
)
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function assertNoSystemIndexNameCollision(indexes, overrides) {
|
|
190
|
+
if (indexes.length === 0) return;
|
|
191
|
+
const reserved = resolveSystemIndexNames(overrides);
|
|
192
|
+
for (const index of indexes) {
|
|
193
|
+
if (reserved.has(index.name)) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
`Index name "${index.name}" collides with a TypeGraph system index. Choose a different name \u2014 system index names are reserved, and a same-named CREATE INDEX IF NOT EXISTS would silently no-op against the system index instead of creating the declared one.`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function generateSystemIndexDDL(declaration, physicalTableName, options) {
|
|
201
|
+
const name = quoteIdentifier(
|
|
202
|
+
systemIndexName(physicalTableName, declaration.suffix)
|
|
203
|
+
);
|
|
204
|
+
const table = quoteIdentifier(physicalTableName);
|
|
205
|
+
const columns = declaration.columns.map((column) => quoteIdentifier(column)).join(", ");
|
|
206
|
+
const concurrently = options.concurrent ? "CONCURRENTLY " : "";
|
|
207
|
+
return `CREATE INDEX ${concurrently}IF NOT EXISTS ${name} ON ${table} (${columns});`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export { SYSTEM_INDEX_DECLARATIONS, assertNoSystemIndexNameCollision, generateSystemIndexDDL, resolveSystemIndexNames, resolveSystemIndexTableName, systemIndexName };
|
|
211
|
+
//# sourceMappingURL=chunk-YTSN73ND.js.map
|
|
212
|
+
//# sourceMappingURL=chunk-YTSN73ND.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/indexes/system.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AO,eAAA;AAAA,IACX,eAAA,CAAgB,iBAAA,EAAmB,WAAA,CAAY,MAAM;AAAA,GACvD;AACA,EAAA,MAAM,KAAA,GAAQ,gBAAgB,iBAAiB,CAAA;AAC/C,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,OAAA,CACzB,GAAA,CAAI,CAAC,MAAA,KAAW,eAAA,CAAgB,MAAM,CAAC,CAAA,CACvC,IAAA,CAAK,IAAI,CAAA;AACZ,EAAA,MAAM,YAAA,GAAe,OAAA,CAAQ,UAAA,GAAa,eAAA,GAAkB,EAAA;AAC5D,EAAA,OAAO,gBAAgB,YAAY,CAAA,cAAA,EAAiB,IAAI,CAAA,IAAA,EAAO,KAAK,KAAK,OAAO,CAAA,EAAA,CAAA;AAClF","file":"chunk-YTSN73ND.js","sourcesContent":["/**\n * System-index declarations — the single source of truth for the plain\n * btree indexes TypeGraph ships on its own relations.\n *\n * Both dialect schema factories (`createSqliteTables` /\n * `createPostgresTables`) derive their Drizzle index builders from this\n * list, so the two dialects cannot drift, and\n * `materializeSystemIndexes()` derives the same indexes as runtime DDL so\n * an index added in a new library version reaches already-initialized\n * databases (bootstrap DDL only runs on first boot — see\n * `loadActiveSchemaWithBootstrap`).\n *\n * Scope: non-unique btree column indexes on the four graph relations,\n * where performance iteration actually happens. Primary keys, unique /\n * partial-unique constraints, and status-table indexes are structural —\n * they are created with their table and never retrofitted — and stay in\n * the schema files.\n *\n * Changing a declaration's shape under the same suffix is a signature\n * drift: `materializeSystemIndexes` reports `failed` for it until the\n * operator drops the old physical index. Rename (new suffix) instead,\n * exactly like graph-declared indexes. Two acknowledged limits of that\n * contract: on databases whose indexes were bootstrap-created (no status\n * rows) an in-place reshape is undetectable at runtime — the rename rule\n * is enforced by review and the parity tests; and a renamed suffix\n * strands the old physical index (the runner only adds). When the first\n * rename actually happens, add a retired-suffixes list + drop path here.\n */\nimport { quoteIdentifier, shortHash } from \"../query/dialect/vector-strategy\";\n\n/** The TypeGraph relations that carry system indexes. */\nexport type SystemIndexTable =\n \"nodes\" | \"edges\" | \"recordedNodes\" | \"recordedEdges\";\n\ntype LiveColumn =\n | \"graph_id\"\n | \"kind\"\n | \"id\"\n | \"deleted_at\"\n | \"valid_from\"\n | \"valid_to\"\n | \"created_at\";\n\ntype LiveEdgeColumn =\n LiveColumn | \"from_kind\" | \"from_id\" | \"to_kind\" | \"to_id\";\n\ntype RecordedColumn =\n | \"graph_id\"\n | \"kind\"\n | \"id\"\n | \"valid_from\"\n | \"valid_to\"\n | \"recorded_from\"\n | \"recorded_to\";\n\ntype RecordedEdgeColumn =\n RecordedColumn | \"from_kind\" | \"from_id\" | \"to_kind\" | \"to_id\";\n\ntype SystemIndexColumnsFor<T extends SystemIndexTable> =\n T extends \"nodes\" ? LiveColumn\n : T extends \"edges\" ? LiveEdgeColumn\n : T extends \"recordedNodes\" ? RecordedColumn\n : RecordedEdgeColumn;\n\ntype SystemIndexDeclarationFor<T extends SystemIndexTable> = Readonly<{\n table: T;\n /** Physical index name is `${physicalTableName}_${suffix}`. */\n suffix: string;\n columns: readonly [SystemIndexColumnsFor<T>, ...SystemIndexColumnsFor<T>[]];\n}>;\n\nexport type SystemIndexDeclaration =\n | SystemIndexDeclarationFor<\"nodes\">\n | SystemIndexDeclarationFor<\"edges\">\n | SystemIndexDeclarationFor<\"recordedNodes\">\n | SystemIndexDeclarationFor<\"recordedEdges\">;\n\nexport const SYSTEM_INDEX_DECLARATIONS: readonly SystemIndexDeclaration[] = [\n // ---------------------------------------------------------- nodes\n { table: \"nodes\", suffix: \"kind_idx\", columns: [\"graph_id\", \"kind\"] },\n // Listing shape: kind partition ordered by creation with the\n // soft-delete column ahead of it so `deleted_at IS NULL` list queries\n // stay index-served.\n {\n table: \"nodes\",\n suffix: \"kind_created_idx\",\n columns: [\"graph_id\", \"kind\", \"deleted_at\", \"created_at\"],\n },\n {\n table: \"nodes\",\n suffix: \"deleted_idx\",\n columns: [\"graph_id\", \"deleted_at\"],\n },\n {\n table: \"nodes\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Bare-id lookup: the primary key leads with `kind` (graph_id, kind,\n // id), so a `WHERE graph_id = ? AND id = ?` probe that doesn't know the\n // kind can't seek it — SQLite falls back to a graph_id-only scan of\n // every node in the graph (~3M at LDBC SF1).\n // `store.algorithms.degree`'s node-kind subquery does exactly that\n // lookup (it resolves the seed's kind by id), so without this index\n // degree is a full nodes scan (~95ms at SF1). See typegraph#280.\n { table: \"nodes\", suffix: \"id_idx\", columns: [\"graph_id\", \"id\"] },\n\n // ---------------------------------------------------------- edges\n { table: \"edges\", suffix: \"kind_idx\", columns: [\"graph_id\", \"kind\"] },\n // Directional traversal index (outgoing): supports endpoint lookups\n // and extra filtering by edge kind / target kind. Includes every\n // system column the compiled query's soft-delete/temporal-validity\n // predicate touches (deleted_at, valid_from, valid_to), trailed by\n // to_id — the compiled traversal join reads `n.id = e.to_id` for an\n // outgoing traversal (standard-builders.ts), so without to_id here\n // the join still fetches the edge's heap row for that one column\n // even with the seek/predicate columns covered.\n {\n table: \"edges\",\n suffix: \"from_idx\",\n columns: [\n \"graph_id\",\n \"from_kind\",\n \"from_id\",\n \"kind\",\n \"to_kind\",\n \"deleted_at\",\n \"valid_from\",\n \"valid_to\",\n \"to_id\",\n ],\n },\n // Directional traversal index (incoming): mirrors from_idx for\n // reverse traversals, trailed by from_id for the same reason\n // (`n.id = e.from_id` for an incoming traversal).\n {\n table: \"edges\",\n suffix: \"to_idx\",\n columns: [\n \"graph_id\",\n \"to_kind\",\n \"to_id\",\n \"kind\",\n \"from_kind\",\n \"deleted_at\",\n \"valid_from\",\n \"valid_to\",\n \"from_id\",\n ],\n },\n {\n table: \"edges\",\n suffix: \"kind_created_idx\",\n columns: [\"graph_id\", \"kind\", \"deleted_at\", \"created_at\"],\n },\n {\n table: \"edges\",\n suffix: \"deleted_idx\",\n columns: [\"graph_id\", \"deleted_at\"],\n },\n {\n table: \"edges\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Cardinality enforcement: the one-per-endpoint check probes for a\n // currently-valid edge of a kind from a specific endpoint.\n {\n table: \"edges\",\n suffix: \"cardinality_idx\",\n columns: [\"graph_id\", \"kind\", \"from_kind\", \"from_id\", \"valid_to\"],\n },\n\n // ---------------------------------------------------------- recordedNodes\n {\n table: \"recordedNodes\",\n suffix: \"entity_idx\",\n columns: [\"graph_id\", \"kind\", \"id\", \"recorded_from\", \"recorded_to\"],\n },\n {\n table: \"recordedNodes\",\n suffix: \"open_idx\",\n columns: [\"graph_id\", \"recorded_to\"],\n },\n {\n table: \"recordedNodes\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n // Bare-id lookup parity with the live nodes table: recorded-pinned\n // reads swap this relation in as the node source, and `entity_idx`\n // leads with `kind`, so the same kind-by-bare-id probe (e.g.\n // `degree()` at a recorded coordinate) would otherwise scan every\n // historical version in the graph. See typegraph#280.\n { table: \"recordedNodes\", suffix: \"id_idx\", columns: [\"graph_id\", \"id\"] },\n\n // ---------------------------------------------------------- recordedEdges\n {\n table: \"recordedEdges\",\n suffix: \"entity_idx\",\n columns: [\"graph_id\", \"kind\", \"id\", \"recorded_from\", \"recorded_to\"],\n },\n {\n table: \"recordedEdges\",\n suffix: \"open_idx\",\n columns: [\"graph_id\", \"recorded_to\"],\n },\n {\n table: \"recordedEdges\",\n suffix: \"from_idx\",\n columns: [\n \"graph_id\",\n \"from_kind\",\n \"from_id\",\n \"kind\",\n \"to_kind\",\n \"recorded_from\",\n \"recorded_to\",\n ],\n },\n {\n table: \"recordedEdges\",\n suffix: \"to_idx\",\n columns: [\n \"graph_id\",\n \"to_kind\",\n \"to_id\",\n \"kind\",\n \"from_kind\",\n \"recorded_from\",\n \"recorded_to\",\n ],\n },\n {\n table: \"recordedEdges\",\n suffix: \"valid_idx\",\n columns: [\"graph_id\", \"valid_from\", \"valid_to\"],\n },\n];\n\n/** Default physical table names for the system-index relations. */\nconst DEFAULT_SYSTEM_INDEX_TABLE_NAMES: Readonly<\n Record<SystemIndexTable, string>\n> = {\n nodes: \"typegraph_nodes\",\n edges: \"typegraph_edges\",\n recordedNodes: \"typegraph_recorded_nodes\",\n recordedEdges: \"typegraph_recorded_edges\",\n};\n\n/**\n * Resolves the physical table name for a system-index relation, honoring\n * a backend's table-name overrides.\n */\nexport function resolveSystemIndexTableName(\n table: SystemIndexTable,\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): string {\n return overrides?.[table] ?? DEFAULT_SYSTEM_INDEX_TABLE_NAMES[table];\n}\n\n/**\n * PostgreSQL truncates identifiers to NAMEDATALEN-1 = 63 bytes SILENTLY —\n * two suffixes of one long custom table name would collide after\n * truncation, and the catalog probes (which compare by exact name) would\n * never match the stored name, re-attempting the build on every boot.\n * SQLite has no such limit but uses the same bound so the two dialects'\n * index sets stay in byte-for-byte parity. (Char-based like the vector\n * identifier bound — multibyte table names are out of scope.)\n */\nconst MAX_SQL_IDENTIFIER_LENGTH = 63;\n\n/**\n * Physical index name: `${physicalTableName}_${suffix}`, deterministically\n * truncated + hash-suffixed past the 63-char identifier bound so distinct\n * indexes stay distinct. Single choke point — the Drizzle builders, the\n * runtime DDL, the catalog probes, and the status keys all derive the\n * name here, so they can never disagree.\n */\nexport function systemIndexName(\n physicalTableName: string,\n suffix: string,\n): string {\n const full = `${physicalTableName}_${suffix}`;\n if (full.length <= MAX_SQL_IDENTIFIER_LENGTH) return full;\n const hash = shortHash(JSON.stringify([physicalTableName, suffix]));\n return `${full.slice(0, MAX_SQL_IDENTIFIER_LENGTH - 1 - hash.length)}_${hash}`;\n}\n\n/**\n * Every system index name for a deployment's (possibly overridden) table\n * names. Graph-declared index names must not collide with these: a\n * colliding `CREATE INDEX IF NOT EXISTS` would silently no-op against the\n * system index (wrong shape) while recording a false success — see the\n * guards in the schema factories and `materializeIndexes`.\n */\nexport function resolveSystemIndexNames(\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): ReadonlySet<string> {\n return new Set(\n SYSTEM_INDEX_DECLARATIONS.map((declaration) =>\n systemIndexName(\n resolveSystemIndexTableName(declaration.table, overrides),\n declaration.suffix,\n ),\n ),\n );\n}\n\n/**\n * Rejects graph-declared indexes whose names collide with this\n * deployment's system index names. Called by both dialect schema\n * factories so a colliding declaration fails at table-definition time\n * instead of silently no-opping against the (differently shaped) system\n * index at CREATE INDEX IF NOT EXISTS time. `materializeIndexes` applies\n * the same check per-declaration on its runtime path.\n */\nexport function assertNoSystemIndexNameCollision(\n indexes: readonly Readonly<{ name: string }>[],\n overrides:\n Readonly<Partial<Record<SystemIndexTable, string | undefined>>> | undefined,\n): void {\n if (indexes.length === 0) return;\n const reserved = resolveSystemIndexNames(overrides);\n for (const index of indexes) {\n if (reserved.has(index.name)) {\n throw new Error(\n `Index name \"${index.name}\" collides with a TypeGraph system ` +\n `index. Choose a different name — system index names are ` +\n `reserved, and a same-named CREATE INDEX IF NOT EXISTS would ` +\n `silently no-op against the system index instead of creating ` +\n `the declared one.`,\n );\n }\n }\n}\n\n/**\n * Runtime DDL for one system index — byte-compatible with the index the\n * bootstrap path creates from the Drizzle schema (same name, same\n * columns), plus `CONCURRENTLY` where the dialect supports building\n * without blocking writes.\n */\nexport function generateSystemIndexDDL(\n declaration: SystemIndexDeclaration,\n physicalTableName: string,\n options: Readonly<{ concurrent: boolean }>,\n): string {\n const name = quoteIdentifier(\n systemIndexName(physicalTableName, declaration.suffix),\n );\n const table = quoteIdentifier(physicalTableName);\n const columns = declaration.columns\n .map((column) => quoteIdentifier(column))\n .join(\", \");\n const concurrently = options.concurrent ? \"CONCURRENTLY \" : \"\";\n return `CREATE INDEX ${concurrently}IF NOT EXISTS ${name} ON ${table} (${columns});`;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as FulltextStrategy } from './fulltext-strategy-
|
|
2
|
-
import { P as PostgresTables } from './postgres-
|
|
3
|
-
import { S as SqliteTables } from './sqlite-
|
|
1
|
+
import { F as FulltextStrategy } from './fulltext-strategy-C27vXaeB.cjs';
|
|
2
|
+
import { P as PostgresTables } from './postgres-YrYmPlaU.cjs';
|
|
3
|
+
import { S as SqliteTables } from './sqlite-Pp8O19WE.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generates all DDL statements for the given SQLite tables.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as FulltextStrategy } from './fulltext-strategy-
|
|
2
|
-
import { P as PostgresTables } from './postgres-
|
|
3
|
-
import { S as SqliteTables } from './sqlite-
|
|
1
|
+
import { F as FulltextStrategy } from './fulltext-strategy-DebsMrqg.js';
|
|
2
|
+
import { P as PostgresTables } from './postgres-IaBA4RgE.js';
|
|
3
|
+
import { S as SqliteTables } from './sqlite-BUOHPx7p.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generates all DDL statements for the given SQLite tables.
|
|
@@ -11,8 +11,13 @@ type KindEntity = "node" | "edge";
|
|
|
11
11
|
* kind directly (they back a per-`(kind, field)` typed embedding table
|
|
12
12
|
* owned by the active `VectorStrategy`), but they participate in the same
|
|
13
13
|
* materialization and diff pipelines, so they share this discriminator.
|
|
14
|
+
*
|
|
15
|
+
* `"system"` marks TypeGraph's own base-relation indexes
|
|
16
|
+
* (`SYSTEM_INDEX_DECLARATIONS`) — graph-independent, but materialized and
|
|
17
|
+
* status-tracked through the same pipeline; their status rows carry the
|
|
18
|
+
* relation key (e.g. `"recordedNodes"`) in the `kind` column.
|
|
14
19
|
*/
|
|
15
|
-
type IndexEntity = "node" | "edge" | "vector";
|
|
20
|
+
type IndexEntity = "node" | "edge" | "vector" | "system";
|
|
16
21
|
/**
|
|
17
22
|
* Field-level null-check operations that round-trip through persisted
|
|
18
23
|
* documents (unique-constraint where clauses, index where clauses,
|
|
@@ -11,8 +11,13 @@ type KindEntity = "node" | "edge";
|
|
|
11
11
|
* kind directly (they back a per-`(kind, field)` typed embedding table
|
|
12
12
|
* owned by the active `VectorStrategy`), but they participate in the same
|
|
13
13
|
* materialization and diff pipelines, so they share this discriminator.
|
|
14
|
+
*
|
|
15
|
+
* `"system"` marks TypeGraph's own base-relation indexes
|
|
16
|
+
* (`SYSTEM_INDEX_DECLARATIONS`) — graph-independent, but materialized and
|
|
17
|
+
* status-tracked through the same pipeline; their status rows carry the
|
|
18
|
+
* relation key (e.g. `"recordedNodes"`) in the `kind` column.
|
|
14
19
|
*/
|
|
15
|
-
type IndexEntity = "node" | "edge" | "vector";
|
|
20
|
+
type IndexEntity = "node" | "edge" | "vector" | "system";
|
|
16
21
|
/**
|
|
17
22
|
* Field-level null-check operations that round-trip through persisted
|
|
18
23
|
* documents (unique-constraint where clauses, index where clauses,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SQL } from 'drizzle-orm';
|
|
2
|
-
import { a as NullCheckOp, K as KindEntity, T as TemporalMode, A as AnyEdgeType, N as NodeType, g as EdgeType, s as UniquenessScope, n as Collation, D as DeleteBehavior, f as KindAnnotations, m as Cardinality, q as EndpointExistence, G as GraphExtension, I as IndexEntity } from './extension-types-
|
|
2
|
+
import { a as NullCheckOp, K as KindEntity, T as TemporalMode, A as AnyEdgeType, N as NodeType, g as EdgeType, s as UniquenessScope, n as Collation, D as DeleteBehavior, f as KindAnnotations, m as Cardinality, q as EndpointExistence, G as GraphExtension, I as IndexEntity } from './extension-types-BM2ACfYO.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
5
5
|
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
@@ -424,13 +424,14 @@ interface VectorStrategy {
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
declare const SqlIntentBrand: unique symbol;
|
|
427
|
-
type SqlIntent = "rows" | "statement";
|
|
427
|
+
type SqlIntent = "rows" | "statement" | "temporary-statement";
|
|
428
428
|
type IntentSql<I extends SqlIntent> = SQL & Readonly<{
|
|
429
429
|
[SqlIntentBrand]: I;
|
|
430
430
|
}>;
|
|
431
431
|
type CompiledRowsSql = IntentSql<"rows">;
|
|
432
432
|
type CompiledSelectSql = CompiledRowsSql;
|
|
433
433
|
type CompiledStatementSql = IntentSql<"statement">;
|
|
434
|
+
type CompiledTemporaryStatementSql = IntentSql<"temporary-statement">;
|
|
434
435
|
declare function asCompiledRowsSql(query: SQL): CompiledRowsSql;
|
|
435
436
|
declare function asCompiledSelectSql(query: SQL): CompiledSelectSql;
|
|
436
437
|
declare function asCompiledStatementSql(query: SQL): CompiledStatementSql;
|
|
@@ -1652,6 +1653,19 @@ type FulltextCapabilities = Readonly<{
|
|
|
1652
1653
|
/** Whether highlighting / snippets are supported. */
|
|
1653
1654
|
highlighting: boolean;
|
|
1654
1655
|
}>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Whole-graph analytics capabilities declared by a backend.
|
|
1658
|
+
*
|
|
1659
|
+
* `supported` means the backend can pin one transactional connection while
|
|
1660
|
+
* an algorithm creates, updates, and drops session-local temporary state.
|
|
1661
|
+
* `mathFunctions` records whether transcendental SQL functions needed by
|
|
1662
|
+
* deferred algorithms such as MCL/spectral are available; exact WCC does not
|
|
1663
|
+
* require them.
|
|
1664
|
+
*/
|
|
1665
|
+
type GraphAnalyticsCapabilities = Readonly<{
|
|
1666
|
+
supported: boolean;
|
|
1667
|
+
mathFunctions: boolean;
|
|
1668
|
+
}>;
|
|
1655
1669
|
|
|
1656
1670
|
/**
|
|
1657
1671
|
* Backend capabilities that vary by dialect.
|
|
@@ -1673,18 +1687,22 @@ type BackendCapabilities = Readonly<{
|
|
|
1673
1687
|
/**
|
|
1674
1688
|
* Maximum number of bound parameters the engine accepts in one statement.
|
|
1675
1689
|
* SQLite defaults to 999 (raisable at compile time via
|
|
1676
|
-
* `SQLITE_MAX_VARIABLE_NUMBER`)
|
|
1690
|
+
* `SQLITE_MAX_VARIABLE_NUMBER`), while hosted SQLite runtimes may impose a
|
|
1691
|
+
* lower platform ceiling; PostgreSQL's wire protocol caps it at 65535.
|
|
1677
1692
|
* Recorded-time capture and recorded point reads size their multi-row
|
|
1678
1693
|
* statements to this ceiling — the same budget the backend's own batched
|
|
1679
|
-
* inserts use — instead of a conservative dialect-blind constant.
|
|
1680
|
-
*
|
|
1681
|
-
* recorded-time fallback
|
|
1694
|
+
* inserts use — instead of a conservative dialect-blind constant. Custom
|
|
1695
|
+
* runtimes can override a detected or probed limit here, but hosted platform
|
|
1696
|
+
* hard ceilings may only be lowered. Absent means the recorded-time fallback
|
|
1697
|
+
* budget applies.
|
|
1682
1698
|
*/
|
|
1683
1699
|
maxBindParameters?: number;
|
|
1684
1700
|
/** Vector search capabilities (undefined if not configured) */
|
|
1685
1701
|
vector?: VectorCapabilities | undefined;
|
|
1686
1702
|
/** Fulltext search capabilities (undefined if not configured) */
|
|
1687
1703
|
fulltext?: FulltextCapabilities | undefined;
|
|
1704
|
+
/** Whole-graph analytics capabilities (undefined when unavailable). */
|
|
1705
|
+
graphAnalytics?: GraphAnalyticsCapabilities | undefined;
|
|
1688
1706
|
}>;
|
|
1689
1707
|
/**
|
|
1690
1708
|
* A node/edge row's `props` column as the driver returned it: SQLite always
|
|
@@ -1814,6 +1832,18 @@ type InsertEdgeParams = Readonly<{
|
|
|
1814
1832
|
validFrom?: string | null;
|
|
1815
1833
|
validTo?: string;
|
|
1816
1834
|
}>;
|
|
1835
|
+
/**
|
|
1836
|
+
* Write-only session exposed inside {@link GraphBackend.trustedImport}.
|
|
1837
|
+
*
|
|
1838
|
+
* The caller has accepted the trusted-import contract: properties, endpoint
|
|
1839
|
+
* references, uniqueness, and cardinality are not validated. Backends may
|
|
1840
|
+
* therefore use engine-native ingestion primitives that bypass the normal
|
|
1841
|
+
* store write pipeline.
|
|
1842
|
+
*/
|
|
1843
|
+
type TrustedImportSession = Readonly<{
|
|
1844
|
+
insertNodes: (params: readonly InsertNodeParams[]) => Promise<void>;
|
|
1845
|
+
insertEdges: (params: readonly InsertEdgeParams[]) => Promise<void>;
|
|
1846
|
+
}>;
|
|
1817
1847
|
/**
|
|
1818
1848
|
* Parameters for updating an edge.
|
|
1819
1849
|
*/
|
|
@@ -2354,12 +2384,25 @@ type RecordKindRemovalParams = Readonly<{
|
|
|
2354
2384
|
/** Error message on failure; undefined on success or while pending. */
|
|
2355
2385
|
error: string | undefined;
|
|
2356
2386
|
}>;
|
|
2387
|
+
/** @internal Capability token for connection-local temporary writes. */
|
|
2388
|
+
declare const INTERNAL_TEMPORARY_WRITES: unique symbol;
|
|
2357
2389
|
/**
|
|
2358
2390
|
* Transaction options.
|
|
2359
2391
|
*/
|
|
2360
2392
|
type TransactionOptions = Readonly<{
|
|
2361
2393
|
/** Transaction isolation level (if supported) */
|
|
2362
2394
|
isolationLevel?: "read_uncommitted" | "read_committed" | "repeatable_read" | "serializable";
|
|
2395
|
+
/**
|
|
2396
|
+
* Transaction access mode (if supported). `read_only` is intended for
|
|
2397
|
+
* multi-statement reads that need one snapshot and must not perform writes.
|
|
2398
|
+
*/
|
|
2399
|
+
accessMode?: "read_only" | "read_write";
|
|
2400
|
+
/**
|
|
2401
|
+
* @internal Permit writes only to connection-local temporary state. The
|
|
2402
|
+
* iterative-operation primitive uses this when an engine rejects temporary
|
|
2403
|
+
* DDL in a read-only transaction.
|
|
2404
|
+
*/
|
|
2405
|
+
temporaryWrites?: typeof INTERNAL_TEMPORARY_WRITES;
|
|
2363
2406
|
}>;
|
|
2364
2407
|
/**
|
|
2365
2408
|
* A caller-owned, already-open Drizzle transaction handle that a
|
|
@@ -2684,6 +2727,61 @@ type GraphBackend = Readonly<{
|
|
|
2684
2727
|
* records the marker (success or failure) keyed by `graphId`.
|
|
2685
2728
|
*/
|
|
2686
2729
|
ensureRuntimeContributions?: (graphId: string) => Promise<void>;
|
|
2730
|
+
/**
|
|
2731
|
+
* Privileged materializer for one embedding `(kind, field)` slot's
|
|
2732
|
+
* `ownedTables` contribution(s): creates the per-field vector table and
|
|
2733
|
+
* records its durable marker, idempotently. The vector counterpart of
|
|
2734
|
+
* `ensureRuntimeContributions` — vectors are per-`(kind, field)` and
|
|
2735
|
+
* graph-derived, so the store enumerates slots (via
|
|
2736
|
+
* `resolveEmbeddingFields`) and uses the batch counterpart at boot under
|
|
2737
|
+
* the privileged role. Pass `{ force: true }` to overwrite the marker
|
|
2738
|
+
* at the current signature, bypassing the drift-guard — the sanctioned
|
|
2739
|
+
* path `store.reembedVectorField()` uses after recreating storage at a
|
|
2740
|
+
* new dimension. Pass `{ onDrift: "skip" }` to leave an
|
|
2741
|
+
* already-provisioned slot whose shape has since changed untouched
|
|
2742
|
+
* (warn + no-op) instead of refusing — the boot/evolve path, so a
|
|
2743
|
+
* declared dimension change never blocks startup before the operator
|
|
2744
|
+
* can run `reembedVectorField`. Present only on backends wired with a
|
|
2745
|
+
* vector strategy.
|
|
2746
|
+
*/
|
|
2747
|
+
ensureVectorSlotContribution?: (slot: VectorSlot, options?: Readonly<{
|
|
2748
|
+
force?: boolean;
|
|
2749
|
+
onDrift?: "throw" | "skip";
|
|
2750
|
+
}>) => Promise<void>;
|
|
2751
|
+
/**
|
|
2752
|
+
* Batch form of `ensureVectorSlotContribution`, used by privileged boot to
|
|
2753
|
+
* resolve every slot's durable markers with one graph-scoped query. The
|
|
2754
|
+
* singular method remains available for re-embedding and compatibility.
|
|
2755
|
+
*/
|
|
2756
|
+
ensureVectorSlotContributions?: (slots: readonly VectorSlot[], options?: Readonly<{
|
|
2757
|
+
force?: boolean;
|
|
2758
|
+
onDrift?: "throw" | "skip";
|
|
2759
|
+
}>) => Promise<void>;
|
|
2760
|
+
/**
|
|
2761
|
+
* SELECT-only gate for one embedding `(kind, field)` slot: asserts the
|
|
2762
|
+
* durable marker(s) for the slot's `ownedTables` contribution(s),
|
|
2763
|
+
* cached per backend instance. Throws `StoreNotInitializedError` when
|
|
2764
|
+
* the slot is missing, stale (signature drift), or recorded a failed
|
|
2765
|
+
* last attempt. The vector counterpart of
|
|
2766
|
+
* `assertRuntimeContributionsInitialized`, consulted by the verified
|
|
2767
|
+
* runtime attach. Performs ZERO DDL and ZERO writes. Present only on
|
|
2768
|
+
* backends wired with a vector strategy.
|
|
2769
|
+
*/
|
|
2770
|
+
assertVectorSlotInitialized?: (slot: VectorSlot) => Promise<void>;
|
|
2771
|
+
/**
|
|
2772
|
+
* Batch form of `assertVectorSlotInitialized`, used by verified attach to
|
|
2773
|
+
* resolve every slot's durable markers with one graph-scoped query.
|
|
2774
|
+
*/
|
|
2775
|
+
assertVectorSlotsInitialized?: (slots: readonly VectorSlot[]) => Promise<void>;
|
|
2776
|
+
/**
|
|
2777
|
+
* Forget one embedding `(kind, field)` slot's durable contribution
|
|
2778
|
+
* marker(s). Called after the slot's per-field table is dropped
|
|
2779
|
+
* (vector-field reclaim) so a later `ensureVectorSlotContribution`
|
|
2780
|
+
* re-creates the table instead of trusting an orphaned "initialized"
|
|
2781
|
+
* marker. Does NOT drop the table itself (the caller already did).
|
|
2782
|
+
* Present only on backends wired with a vector strategy.
|
|
2783
|
+
*/
|
|
2784
|
+
deleteVectorSlotContribution?: (slot: VectorSlot) => Promise<void>;
|
|
2687
2785
|
/**
|
|
2688
2786
|
* Bootstraps the fulltext storage table the active `FulltextStrategy`
|
|
2689
2787
|
* owns. Same focused-bootstrap rationale as the other `ensure*Table`
|
|
@@ -2743,6 +2841,20 @@ type GraphBackend = Readonly<{
|
|
|
2743
2841
|
* sizes this library is designed for.
|
|
2744
2842
|
*/
|
|
2745
2843
|
refreshStatistics: () => Promise<void>;
|
|
2844
|
+
/**
|
|
2845
|
+
* Runs an intentionally trusted, all-or-nothing initial import.
|
|
2846
|
+
*
|
|
2847
|
+
* Optional because only backends that can pin one transaction and use a
|
|
2848
|
+
* native high-throughput write path expose it. Implementations must reject
|
|
2849
|
+
* a database whose TypeGraph node or edge tables already contain rows. They
|
|
2850
|
+
* may temporarily remove rebuildable secondary indexes, but must restore
|
|
2851
|
+
* them before committing. Any callback, insert, or rebuild failure rolls the
|
|
2852
|
+
* entire operation back.
|
|
2853
|
+
*
|
|
2854
|
+
* This is a top-level-only lifecycle operation and is deliberately absent
|
|
2855
|
+
* from {@link TransactionBackend}.
|
|
2856
|
+
*/
|
|
2857
|
+
trustedImport?: <T>(fn: (session: TrustedImportSession) => Promise<T>) => Promise<T>;
|
|
2746
2858
|
execute: <T>(query: CompiledRowsSql) => Promise<readonly T[]>;
|
|
2747
2859
|
/**
|
|
2748
2860
|
* Execute a non-row-returning SQL statement bound to this backend or
|
|
@@ -2751,6 +2863,13 @@ type GraphBackend = Readonly<{
|
|
|
2751
2863
|
* capability-check and fail loudly.
|
|
2752
2864
|
*/
|
|
2753
2865
|
executeStatement?: (query: CompiledStatementSql) => Promise<void>;
|
|
2866
|
+
/**
|
|
2867
|
+
* Execute an internally compiled statement against connection-local
|
|
2868
|
+
* temporary state. History wrappers preserve this path because it cannot
|
|
2869
|
+
* mutate graph or history tables; callers cannot construct its branded
|
|
2870
|
+
* input through the public API.
|
|
2871
|
+
*/
|
|
2872
|
+
executeTemporaryStatement?: (query: CompiledTemporaryStatementSql) => Promise<void>;
|
|
2754
2873
|
/** Execute pre-compiled SQL text with bound parameters. Available on sync SQLite and pg backends. */
|
|
2755
2874
|
executeRaw?: <T>(sqlText: string, params: readonly unknown[]) => Promise<readonly T[]>;
|
|
2756
2875
|
/** Compile a Drizzle SQL object to { sql, params } without executing. */
|
|
@@ -2837,7 +2956,7 @@ type RemovalMaterializationBackend = Pick<GraphBackend, "ensureKindRemovalsTable
|
|
|
2837
2956
|
type GraphLifecycleBackend = Pick<GraphBackend, "clearGraph" | "bootstrapTables">;
|
|
2838
2957
|
type QueryExecutionBackend = Pick<GraphBackend, "execute">;
|
|
2839
2958
|
type RawQueryExecutionBackend = Pick<GraphBackend, "executeRaw" | "compileSql">;
|
|
2840
|
-
type RawStatementExecutionBackend = Pick<GraphBackend, "executeStatement" | "executeDdl">;
|
|
2959
|
+
type RawStatementExecutionBackend = Pick<GraphBackend, "executeStatement" | "executeTemporaryStatement" | "executeDdl">;
|
|
2841
2960
|
type BackendMaintenance = Pick<GraphBackend, "refreshStatistics">;
|
|
2842
2961
|
type BackendTransactions = Pick<GraphBackend, "transaction" | "adoptTransaction">;
|
|
2843
2962
|
type BackendLifecycle = Pick<GraphBackend, "close">;
|
|
@@ -3182,4 +3301,4 @@ interface FulltextStrategy {
|
|
|
3182
3301
|
declare const tsvectorStrategy: FulltextStrategy;
|
|
3183
3302
|
declare const fts5Strategy: FulltextStrategy;
|
|
3184
3303
|
|
|
3185
|
-
export { type BackendTransactions as $, type AnyPgDatabase as A, type BackendCapabilities as B, type SerializedOntology as C, type SerializedUniqueConstraint as D, type
|
|
3304
|
+
export { type BackendTransactions as $, type AnyPgDatabase as A, type BackendCapabilities as B, type SerializedOntology as C, type SerializedUniqueConstraint as D, type EdgeIndexDeclaration as E, type FulltextStrategy as F, type GraphBackend as G, type SchemaVersionRow as H, type IndexDeclaration as I, type JsonPointer as J, type InferenceType as K, type AggregateExpr as L, type MetaEdge as M, type NodeIndexDeclaration as N, type OntologyRelation as O, type FieldRef as P, type QueryAst as Q, type RelationalIndexDeclaration as R, type SqliteExecutionProfileHints as S, type ComparisonOp as T, type AggregateComparisonPredicate as U, type VectorStrategy as V, type TraversalDirection as W, type AdoptedTransaction as X, type BackendIdentity as Y, type BackendLifecycle as Z, type BackendMaintenance as _, type AnySqliteDatabase as a, asCompiledRowsSql as a$, type CommitSchemaVersionExpected as a0, type CommitSchemaVersionParams as a1, type CompiledRowsSql as a2, type CompiledSelectSql as a3, type CompiledStatementSql as a4, type ContributionMaterializationBackend as a5, DEFAULT_SQL_SCHEMA as a6, type DeleteFulltextBatchParams as a7, type EdgeEntityReadBackend as a8, type EdgeEntityWriteBackend as a9, type ParameterRef as aA, type QueryExecutionBackend as aB, type RawQueryExecutionBackend as aC, type RawStatementExecutionBackend as aD, type RecordedRelationOptions as aE, type RemovalMaterializationBackend as aF, type ResolveJsonPointer as aG, type ResolveJsonPointerSegments as aH, type ResolvedSqlTableNames as aI, type RowProps as aJ, type SchemaCommitBackend as aK, type SchemaReadBackend as aL, type SetActiveVersionParams as aM, type SortDirection as aN, type SqlIntent as aO, type SqlSchema as aP, type SqlTableNames as aQ, type StrategyTableContribution as aR, type TableContribution as aS, type TransactionBackend as aT, type TraversalExpansion as aU, type TrustedImportSession as aV, type UniqueConstraintBackend as aW, type UpsertFulltextBatchParams as aX, type VectorCapabilities as aY, type VectorOperationBackend as aZ, type VectorSlot as a_, type ExternalRecordedReadSource as aa, type FilteredApproximateSearch as ab, type FilteredApproximateSearchMode as ac, type FulltextBatchRow as ad, type FulltextCapabilities as ae, type FulltextOperationBackend as af, type FulltextQueryMode as ag, type FulltextSearchParams as ah, type FulltextSearchResult as ai, type GraphAnalyticsCapabilities as aj, type GraphEntityReadBackend as ak, type GraphEntityWriteBackend as al, type GraphLifecycleBackend as am, type HybridFusionOptions as an, type IndexMaterializationBackend as ao, type IntentSql as ap, type JsonPointerFor as aq, type JsonPointerInput as ar, type JsonPointerSegment as as, type JsonPointerSegments as at, type JsonPointerSegmentsFor as au, MAX_JSON_POINTER_DEPTH as av, type MetaEdgeProperties as aw, type NodeEntityReadBackend as ax, type NodeEntityWriteBackend as ay, type OrderSpec as az, type SqliteTransactionMode as b, asCompiledSelectSql as b0, asCompiledStatementSql as b1, buildVectorCapabilities as b2, createSqlSchema as b3, fts5Strategy as b4, isMetaEdge as b5, joinJsonPointers as b6, jsonPointer as b7, normalizeJsonPointer as b8, parseJsonPointer as b9, recordedRelation as ba, rowPropsToJsonText as bb, rowPropsToObject as bc, tsvectorStrategy as bd, type ValueType as be, type PredicateExpression as bf, type VectorMetricType as bg, type Traversal as bh, type NodePredicate as bi, type ProjectedField as bj, type AggregateOrderSpec as bk, type GroupBySpec as bl, type RecursiveCyclePolicy as bm, type NodeRow as bn, type EdgeRow as bo, type VectorSlotMap as bp, type RecordedReadBinding as bq, type SelectiveField as br, type ComposableQuery as bs, type SetOperationType as bt, type SetOperation as bu, type VectorMetric as bv, type TransactionOptions as bw, type SqlDialect as c, type EdgeIndexConfig as d, type EdgeIndexDirection as e, type EdgeIndexWhereBuilder as f, type IndexOrigin as g, type IndexScope as h, type IndexWhereExpression as i, type IndexWhereFieldBuilder as j, type IndexWhereInput as k, type NodeIndexConfig as l, type NodeIndexWhereBuilder as m, type SystemColumnName as n, type VectorIndexDeclaration as o, type VectorIndexImplementation as p, type VectorIndexMetric as q, type VectorIndexParams as r, type SerializedSchema as s, type SchemaHash as t, type SerializedNodeDef as u, type SerializedEdgeDef as v, type SerializedMetaEdge as w, type SerializedOntologyRelation as x, type SerializedClosures as y, type JsonSchema as z };
|