@nicia-ai/typegraph 0.1.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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/ast-BVyihVbP.d.cts +564 -0
- package/dist/ast-BVyihVbP.d.ts +564 -0
- package/dist/backend/drizzle/index.cjs +41 -0
- package/dist/backend/drizzle/index.cjs.map +1 -0
- package/dist/backend/drizzle/index.d.cts +12 -0
- package/dist/backend/drizzle/index.d.ts +12 -0
- package/dist/backend/drizzle/index.js +12 -0
- package/dist/backend/drizzle/index.js.map +1 -0
- package/dist/backend/drizzle/postgres.cjs +27 -0
- package/dist/backend/drizzle/postgres.cjs.map +1 -0
- package/dist/backend/drizzle/postgres.d.cts +37 -0
- package/dist/backend/drizzle/postgres.d.ts +37 -0
- package/dist/backend/drizzle/postgres.js +10 -0
- package/dist/backend/drizzle/postgres.js.map +1 -0
- package/dist/backend/drizzle/schema/postgres.cjs +40 -0
- package/dist/backend/drizzle/schema/postgres.cjs.map +1 -0
- package/dist/backend/drizzle/schema/postgres.d.cts +2419 -0
- package/dist/backend/drizzle/schema/postgres.d.ts +2419 -0
- package/dist/backend/drizzle/schema/postgres.js +7 -0
- package/dist/backend/drizzle/schema/postgres.js.map +1 -0
- package/dist/backend/drizzle/schema/sqlite.cjs +40 -0
- package/dist/backend/drizzle/schema/sqlite.cjs.map +1 -0
- package/dist/backend/drizzle/schema/sqlite.d.cts +2647 -0
- package/dist/backend/drizzle/schema/sqlite.d.ts +2647 -0
- package/dist/backend/drizzle/schema/sqlite.js +7 -0
- package/dist/backend/drizzle/schema/sqlite.js.map +1 -0
- package/dist/backend/drizzle/sqlite.cjs +27 -0
- package/dist/backend/drizzle/sqlite.cjs.map +1 -0
- package/dist/backend/drizzle/sqlite.d.cts +36 -0
- package/dist/backend/drizzle/sqlite.d.ts +36 -0
- package/dist/backend/drizzle/sqlite.js +10 -0
- package/dist/backend/drizzle/sqlite.js.map +1 -0
- package/dist/backend/postgres/index.cjs +53 -0
- package/dist/backend/postgres/index.cjs.map +1 -0
- package/dist/backend/postgres/index.d.cts +12 -0
- package/dist/backend/postgres/index.d.ts +12 -0
- package/dist/backend/postgres/index.js +12 -0
- package/dist/backend/postgres/index.js.map +1 -0
- package/dist/backend/sqlite/index.cjs +117 -0
- package/dist/backend/sqlite/index.cjs.map +1 -0
- package/dist/backend/sqlite/index.d.cts +71 -0
- package/dist/backend/sqlite/index.d.ts +71 -0
- package/dist/backend/sqlite/index.js +78 -0
- package/dist/backend/sqlite/index.js.map +1 -0
- package/dist/chunk-2QHQ2C4P.js +146 -0
- package/dist/chunk-2QHQ2C4P.js.map +1 -0
- package/dist/chunk-3A5TKOEJ.js +306 -0
- package/dist/chunk-3A5TKOEJ.js.map +1 -0
- package/dist/chunk-4PIEL2VO.js +162 -0
- package/dist/chunk-4PIEL2VO.js.map +1 -0
- package/dist/chunk-536PH5FT.js +342 -0
- package/dist/chunk-536PH5FT.js.map +1 -0
- package/dist/chunk-DBFCKELK.cjs +156 -0
- package/dist/chunk-DBFCKELK.cjs.map +1 -0
- package/dist/chunk-DDM2FZRJ.cjs +1143 -0
- package/dist/chunk-DDM2FZRJ.cjs.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/chunk-F32HCHYA.cjs +680 -0
- package/dist/chunk-F32HCHYA.cjs.map +1 -0
- package/dist/chunk-IIAT36MI.js +353 -0
- package/dist/chunk-IIAT36MI.js.map +1 -0
- package/dist/chunk-JDAET5LO.js +236 -0
- package/dist/chunk-JDAET5LO.js.map +1 -0
- package/dist/chunk-JEQ2X3Z6.cjs +12 -0
- package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
- package/dist/chunk-JKTO7TW3.js +299 -0
- package/dist/chunk-JKTO7TW3.js.map +1 -0
- package/dist/chunk-K7SQ3SWP.js +497 -0
- package/dist/chunk-K7SQ3SWP.js.map +1 -0
- package/dist/chunk-L642L24T.js +142 -0
- package/dist/chunk-L642L24T.js.map +1 -0
- package/dist/chunk-MFVCSNIY.cjs +308 -0
- package/dist/chunk-MFVCSNIY.cjs.map +1 -0
- package/dist/chunk-MNO33ASC.cjs +240 -0
- package/dist/chunk-MNO33ASC.cjs.map +1 -0
- package/dist/chunk-N4AOJ3VF.cjs +154 -0
- package/dist/chunk-N4AOJ3VF.cjs.map +1 -0
- package/dist/chunk-P5CNM325.cjs +508 -0
- package/dist/chunk-P5CNM325.cjs.map +1 -0
- package/dist/chunk-RYT4H46I.js +646 -0
- package/dist/chunk-RYT4H46I.js.map +1 -0
- package/dist/chunk-SV5H3XM5.cjs +321 -0
- package/dist/chunk-SV5H3XM5.cjs.map +1 -0
- package/dist/chunk-TXHKFLWX.cjs +344 -0
- package/dist/chunk-TXHKFLWX.cjs.map +1 -0
- package/dist/chunk-UJAGXJDG.cjs +170 -0
- package/dist/chunk-UJAGXJDG.cjs.map +1 -0
- package/dist/chunk-VXRVGFCI.js +1128 -0
- package/dist/chunk-VXRVGFCI.js.map +1 -0
- package/dist/chunk-YM5AL65Y.cjs +357 -0
- package/dist/chunk-YM5AL65Y.cjs.map +1 -0
- package/dist/index.cjs +8334 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1365 -0
- package/dist/index.d.ts +1365 -0
- package/dist/index.js +8105 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/index.cjs +67 -0
- package/dist/indexes/index.cjs.map +1 -0
- package/dist/indexes/index.d.cts +62 -0
- package/dist/indexes/index.d.ts +62 -0
- package/dist/indexes/index.js +6 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/interchange/index.cjs +612 -0
- package/dist/interchange/index.cjs.map +1 -0
- package/dist/interchange/index.d.cts +288 -0
- package/dist/interchange/index.d.ts +288 -0
- package/dist/interchange/index.js +598 -0
- package/dist/interchange/index.js.map +1 -0
- package/dist/profiler/index.cjs +793 -0
- package/dist/profiler/index.cjs.map +1 -0
- package/dist/profiler/index.d.cts +283 -0
- package/dist/profiler/index.d.ts +283 -0
- package/dist/profiler/index.js +785 -0
- package/dist/profiler/index.js.map +1 -0
- package/dist/store-60Lcfi0w.d.ts +2263 -0
- package/dist/store-Bifii8MZ.d.cts +2263 -0
- package/dist/test-helpers-BjyRYJZX.d.ts +22 -0
- package/dist/test-helpers-NoQXhleQ.d.cts +22 -0
- package/dist/types-BRzHlhKC.d.cts +14 -0
- package/dist/types-BRzHlhKC.d.ts +14 -0
- package/dist/types-BrSfFSpW.d.cts +158 -0
- package/dist/types-CX4cLd7M.d.ts +152 -0
- package/dist/types-CjZ7g_7v.d.ts +442 -0
- package/dist/types-DDOSfrih.d.cts +442 -0
- package/dist/types-D_3mEv2y.d.ts +158 -0
- package/dist/types-a5rAxC92.d.cts +152 -0
- package/package.json +201 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { S as SqlDialect } from './types-BRzHlhKC.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Backend interface types for TypeGraph storage.
|
|
6
|
+
*
|
|
7
|
+
* The backend abstracts database operations, allowing different
|
|
8
|
+
* SQL implementations (SQLite, PostgreSQL) behind a common interface.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Supported vector similarity metrics.
|
|
13
|
+
*/
|
|
14
|
+
type VectorMetric = "cosine" | "l2" | "inner_product";
|
|
15
|
+
/**
|
|
16
|
+
* Supported vector index types.
|
|
17
|
+
*/
|
|
18
|
+
type VectorIndexType = "hnsw" | "ivfflat" | "none";
|
|
19
|
+
/**
|
|
20
|
+
* Vector search capabilities.
|
|
21
|
+
*/
|
|
22
|
+
type VectorCapabilities = Readonly<{
|
|
23
|
+
/** Whether the backend supports vector operations */
|
|
24
|
+
supported: boolean;
|
|
25
|
+
/** Supported similarity metrics */
|
|
26
|
+
metrics: readonly VectorMetric[];
|
|
27
|
+
/** Supported index types */
|
|
28
|
+
indexTypes: readonly VectorIndexType[];
|
|
29
|
+
/** Maximum dimensions supported */
|
|
30
|
+
maxDimensions: number;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
type Dialect = SqlDialect;
|
|
34
|
+
/**
|
|
35
|
+
* Backend capabilities that vary by dialect.
|
|
36
|
+
*/
|
|
37
|
+
type BackendCapabilities = Readonly<{
|
|
38
|
+
/** Whether the backend supports JSONB type (vs TEXT for JSON) */
|
|
39
|
+
jsonb: boolean;
|
|
40
|
+
/** Whether the backend supports partial indexes */
|
|
41
|
+
partialIndexes: boolean;
|
|
42
|
+
/** Whether the backend supports GIN indexes for JSON */
|
|
43
|
+
ginIndexes: boolean;
|
|
44
|
+
/** Whether the backend supports CTE (WITH) queries */
|
|
45
|
+
cte: boolean;
|
|
46
|
+
/** Whether the backend supports RETURNING clause */
|
|
47
|
+
returning: boolean;
|
|
48
|
+
/** Whether the backend supports atomic transactions (D1 does not) */
|
|
49
|
+
transactions: boolean;
|
|
50
|
+
/** Vector search capabilities (undefined if not configured) */
|
|
51
|
+
vector?: VectorCapabilities | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* A row from the typegraph_nodes table.
|
|
55
|
+
*/
|
|
56
|
+
type NodeRow = Readonly<{
|
|
57
|
+
graph_id: string;
|
|
58
|
+
kind: string;
|
|
59
|
+
id: string;
|
|
60
|
+
props: string;
|
|
61
|
+
version: number;
|
|
62
|
+
valid_from: string | undefined;
|
|
63
|
+
valid_to: string | undefined;
|
|
64
|
+
created_at: string;
|
|
65
|
+
updated_at: string;
|
|
66
|
+
deleted_at: string | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* A row from the typegraph_edges table.
|
|
70
|
+
*/
|
|
71
|
+
type EdgeRow = Readonly<{
|
|
72
|
+
graph_id: string;
|
|
73
|
+
id: string;
|
|
74
|
+
kind: string;
|
|
75
|
+
from_kind: string;
|
|
76
|
+
from_id: string;
|
|
77
|
+
to_kind: string;
|
|
78
|
+
to_id: string;
|
|
79
|
+
props: string;
|
|
80
|
+
valid_from: string | undefined;
|
|
81
|
+
valid_to: string | undefined;
|
|
82
|
+
created_at: string;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
deleted_at: string | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* A row from the typegraph_node_uniques table.
|
|
88
|
+
*/
|
|
89
|
+
type UniqueRow = Readonly<{
|
|
90
|
+
graph_id: string;
|
|
91
|
+
node_kind: string;
|
|
92
|
+
constraint_name: string;
|
|
93
|
+
key: string;
|
|
94
|
+
node_id: string;
|
|
95
|
+
concrete_kind: string;
|
|
96
|
+
deleted_at: string | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* A row from the typegraph_schema_versions table.
|
|
100
|
+
*/
|
|
101
|
+
type SchemaVersionRow = Readonly<{
|
|
102
|
+
graph_id: string;
|
|
103
|
+
version: number;
|
|
104
|
+
schema_hash: string;
|
|
105
|
+
schema_doc: string;
|
|
106
|
+
created_at: string;
|
|
107
|
+
is_active: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* A row from the typegraph_node_embeddings table.
|
|
111
|
+
*/
|
|
112
|
+
type EmbeddingRow = Readonly<{
|
|
113
|
+
graph_id: string;
|
|
114
|
+
node_kind: string;
|
|
115
|
+
node_id: string;
|
|
116
|
+
field_path: string;
|
|
117
|
+
embedding: readonly number[];
|
|
118
|
+
dimensions: number;
|
|
119
|
+
created_at: string;
|
|
120
|
+
updated_at: string;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Parameters for inserting a node.
|
|
124
|
+
*/
|
|
125
|
+
type InsertNodeParams = Readonly<{
|
|
126
|
+
graphId: string;
|
|
127
|
+
kind: string;
|
|
128
|
+
id: string;
|
|
129
|
+
props: Record<string, unknown>;
|
|
130
|
+
validFrom?: string;
|
|
131
|
+
validTo?: string;
|
|
132
|
+
}>;
|
|
133
|
+
/**
|
|
134
|
+
* Parameters for updating a node.
|
|
135
|
+
*/
|
|
136
|
+
type UpdateNodeParams = Readonly<{
|
|
137
|
+
graphId: string;
|
|
138
|
+
kind: string;
|
|
139
|
+
id: string;
|
|
140
|
+
props: Record<string, unknown>;
|
|
141
|
+
validTo?: string;
|
|
142
|
+
incrementVersion?: boolean;
|
|
143
|
+
/** If true, clears deleted_at (un-deletes the node). Used by upsert. */
|
|
144
|
+
clearDeleted?: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
/**
|
|
147
|
+
* Parameters for deleting a node (soft delete).
|
|
148
|
+
*/
|
|
149
|
+
type DeleteNodeParams = Readonly<{
|
|
150
|
+
graphId: string;
|
|
151
|
+
kind: string;
|
|
152
|
+
id: string;
|
|
153
|
+
}>;
|
|
154
|
+
/**
|
|
155
|
+
* Parameters for inserting an edge.
|
|
156
|
+
*/
|
|
157
|
+
type InsertEdgeParams = Readonly<{
|
|
158
|
+
graphId: string;
|
|
159
|
+
id: string;
|
|
160
|
+
kind: string;
|
|
161
|
+
fromKind: string;
|
|
162
|
+
fromId: string;
|
|
163
|
+
toKind: string;
|
|
164
|
+
toId: string;
|
|
165
|
+
props: Record<string, unknown>;
|
|
166
|
+
validFrom?: string;
|
|
167
|
+
validTo?: string;
|
|
168
|
+
}>;
|
|
169
|
+
/**
|
|
170
|
+
* Parameters for updating an edge.
|
|
171
|
+
*/
|
|
172
|
+
type UpdateEdgeParams = Readonly<{
|
|
173
|
+
graphId: string;
|
|
174
|
+
id: string;
|
|
175
|
+
props: Record<string, unknown>;
|
|
176
|
+
validTo?: string;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* Parameters for deleting an edge (soft delete).
|
|
180
|
+
*/
|
|
181
|
+
type DeleteEdgeParams = Readonly<{
|
|
182
|
+
graphId: string;
|
|
183
|
+
id: string;
|
|
184
|
+
}>;
|
|
185
|
+
/**
|
|
186
|
+
* Parameters for hard deleting a node (permanent removal).
|
|
187
|
+
*/
|
|
188
|
+
type HardDeleteNodeParams = Readonly<{
|
|
189
|
+
graphId: string;
|
|
190
|
+
kind: string;
|
|
191
|
+
id: string;
|
|
192
|
+
}>;
|
|
193
|
+
/**
|
|
194
|
+
* Parameters for hard deleting an edge (permanent removal).
|
|
195
|
+
*/
|
|
196
|
+
type HardDeleteEdgeParams = Readonly<{
|
|
197
|
+
graphId: string;
|
|
198
|
+
id: string;
|
|
199
|
+
}>;
|
|
200
|
+
/**
|
|
201
|
+
* Parameters for inserting or updating an embedding.
|
|
202
|
+
*/
|
|
203
|
+
type UpsertEmbeddingParams = Readonly<{
|
|
204
|
+
graphId: string;
|
|
205
|
+
nodeKind: string;
|
|
206
|
+
nodeId: string;
|
|
207
|
+
fieldPath: string;
|
|
208
|
+
embedding: readonly number[];
|
|
209
|
+
dimensions: number;
|
|
210
|
+
}>;
|
|
211
|
+
/**
|
|
212
|
+
* Parameters for deleting an embedding.
|
|
213
|
+
*/
|
|
214
|
+
type DeleteEmbeddingParams = Readonly<{
|
|
215
|
+
graphId: string;
|
|
216
|
+
nodeKind: string;
|
|
217
|
+
nodeId: string;
|
|
218
|
+
fieldPath: string;
|
|
219
|
+
}>;
|
|
220
|
+
/**
|
|
221
|
+
* Parameters for vector similarity search.
|
|
222
|
+
*/
|
|
223
|
+
type VectorSearchParams = Readonly<{
|
|
224
|
+
graphId: string;
|
|
225
|
+
nodeKind: string;
|
|
226
|
+
fieldPath: string;
|
|
227
|
+
queryEmbedding: readonly number[];
|
|
228
|
+
metric: VectorMetric;
|
|
229
|
+
limit: number;
|
|
230
|
+
minScore?: number;
|
|
231
|
+
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Result from a vector similarity search.
|
|
234
|
+
*/
|
|
235
|
+
type VectorSearchResult = Readonly<{
|
|
236
|
+
nodeId: string;
|
|
237
|
+
score: number;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* Parameters for creating a vector index.
|
|
241
|
+
*/
|
|
242
|
+
type CreateVectorIndexParams = Readonly<{
|
|
243
|
+
graphId: string;
|
|
244
|
+
nodeKind: string;
|
|
245
|
+
fieldPath: string;
|
|
246
|
+
dimensions: number;
|
|
247
|
+
metric: VectorMetric;
|
|
248
|
+
indexType: VectorIndexType;
|
|
249
|
+
/** Index-specific parameters */
|
|
250
|
+
indexParams?: Readonly<{
|
|
251
|
+
/** HNSW: max connections per layer */
|
|
252
|
+
m?: number;
|
|
253
|
+
/** HNSW: construction search depth */
|
|
254
|
+
efConstruction?: number;
|
|
255
|
+
/** IVFFlat: number of lists */
|
|
256
|
+
lists?: number;
|
|
257
|
+
}>;
|
|
258
|
+
}>;
|
|
259
|
+
/**
|
|
260
|
+
* Parameters for dropping a vector index.
|
|
261
|
+
*/
|
|
262
|
+
type DropVectorIndexParams = Readonly<{
|
|
263
|
+
graphId: string;
|
|
264
|
+
nodeKind: string;
|
|
265
|
+
fieldPath: string;
|
|
266
|
+
}>;
|
|
267
|
+
/**
|
|
268
|
+
* Transaction options.
|
|
269
|
+
*/
|
|
270
|
+
type TransactionOptions = Readonly<{
|
|
271
|
+
/** Transaction isolation level (if supported) */
|
|
272
|
+
isolationLevel?: "read_uncommitted" | "read_committed" | "repeatable_read" | "serializable";
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* Transaction backend - a backend scoped to a transaction.
|
|
276
|
+
*/
|
|
277
|
+
type TransactionBackend = Omit<GraphBackend, "transaction" | "close">;
|
|
278
|
+
/**
|
|
279
|
+
* The GraphBackend interface abstracts database operations.
|
|
280
|
+
*
|
|
281
|
+
* Implementations should provide:
|
|
282
|
+
* - SQLite backend via better-sqlite3 or libsql
|
|
283
|
+
* - PostgreSQL backend via pg or postgres
|
|
284
|
+
*/
|
|
285
|
+
type GraphBackend = Readonly<{
|
|
286
|
+
/** The SQL dialect */
|
|
287
|
+
dialect: Dialect;
|
|
288
|
+
/** Backend capabilities */
|
|
289
|
+
capabilities: BackendCapabilities;
|
|
290
|
+
insertNode: (params: InsertNodeParams) => Promise<NodeRow>;
|
|
291
|
+
updateNode: (params: UpdateNodeParams) => Promise<NodeRow>;
|
|
292
|
+
deleteNode: (params: DeleteNodeParams) => Promise<void>;
|
|
293
|
+
hardDeleteNode: (params: HardDeleteNodeParams) => Promise<void>;
|
|
294
|
+
getNode: (graphId: string, kind: string, id: string) => Promise<NodeRow | undefined>;
|
|
295
|
+
insertEdge: (params: InsertEdgeParams) => Promise<EdgeRow>;
|
|
296
|
+
updateEdge: (params: UpdateEdgeParams) => Promise<EdgeRow>;
|
|
297
|
+
deleteEdge: (params: DeleteEdgeParams) => Promise<void>;
|
|
298
|
+
hardDeleteEdge: (params: HardDeleteEdgeParams) => Promise<void>;
|
|
299
|
+
getEdge: (graphId: string, id: string) => Promise<EdgeRow | undefined>;
|
|
300
|
+
countEdgesFrom: (params: CountEdgesFromParams) => Promise<number>;
|
|
301
|
+
edgeExistsBetween: (params: EdgeExistsBetweenParams) => Promise<boolean>;
|
|
302
|
+
findEdgesConnectedTo: (params: FindEdgesConnectedToParams) => Promise<readonly EdgeRow[]>;
|
|
303
|
+
findNodesByKind: (params: FindNodesByKindParams) => Promise<readonly NodeRow[]>;
|
|
304
|
+
countNodesByKind: (params: CountNodesByKindParams) => Promise<number>;
|
|
305
|
+
findEdgesByKind: (params: FindEdgesByKindParams) => Promise<readonly EdgeRow[]>;
|
|
306
|
+
countEdgesByKind: (params: CountEdgesByKindParams) => Promise<number>;
|
|
307
|
+
insertUnique: (params: InsertUniqueParams) => Promise<void>;
|
|
308
|
+
deleteUnique: (params: DeleteUniqueParams) => Promise<void>;
|
|
309
|
+
checkUnique: (params: CheckUniqueParams) => Promise<UniqueRow | undefined>;
|
|
310
|
+
getActiveSchema: (graphId: string) => Promise<SchemaVersionRow | undefined>;
|
|
311
|
+
getSchemaVersion: (graphId: string, version: number) => Promise<SchemaVersionRow | undefined>;
|
|
312
|
+
insertSchema: (params: InsertSchemaParams) => Promise<SchemaVersionRow>;
|
|
313
|
+
setActiveSchema: (graphId: string, version: number) => Promise<void>;
|
|
314
|
+
upsertEmbedding?: (params: UpsertEmbeddingParams) => Promise<void>;
|
|
315
|
+
deleteEmbedding?: (params: DeleteEmbeddingParams) => Promise<void>;
|
|
316
|
+
getEmbedding?: (graphId: string, nodeKind: string, nodeId: string, fieldPath: string) => Promise<EmbeddingRow | undefined>;
|
|
317
|
+
vectorSearch?: (params: VectorSearchParams) => Promise<readonly VectorSearchResult[]>;
|
|
318
|
+
createVectorIndex?: (params: CreateVectorIndexParams) => Promise<void>;
|
|
319
|
+
dropVectorIndex?: (params: DropVectorIndexParams) => Promise<void>;
|
|
320
|
+
execute: <T>(query: SQL) => Promise<readonly T[]>;
|
|
321
|
+
transaction: <T>(fn: (tx: TransactionBackend) => Promise<T>, options?: TransactionOptions) => Promise<T>;
|
|
322
|
+
close: () => Promise<void>;
|
|
323
|
+
}>;
|
|
324
|
+
/**
|
|
325
|
+
* Parameters for inserting a unique constraint entry.
|
|
326
|
+
*/
|
|
327
|
+
type InsertUniqueParams = Readonly<{
|
|
328
|
+
graphId: string;
|
|
329
|
+
nodeKind: string;
|
|
330
|
+
constraintName: string;
|
|
331
|
+
key: string;
|
|
332
|
+
nodeId: string;
|
|
333
|
+
concreteKind: string;
|
|
334
|
+
}>;
|
|
335
|
+
/**
|
|
336
|
+
* Parameters for deleting a unique constraint entry.
|
|
337
|
+
*/
|
|
338
|
+
type DeleteUniqueParams = Readonly<{
|
|
339
|
+
graphId: string;
|
|
340
|
+
nodeKind: string;
|
|
341
|
+
constraintName: string;
|
|
342
|
+
key: string;
|
|
343
|
+
}>;
|
|
344
|
+
/**
|
|
345
|
+
* Parameters for checking a unique constraint.
|
|
346
|
+
*/
|
|
347
|
+
type CheckUniqueParams = Readonly<{
|
|
348
|
+
graphId: string;
|
|
349
|
+
nodeKind: string;
|
|
350
|
+
constraintName: string;
|
|
351
|
+
key: string;
|
|
352
|
+
}>;
|
|
353
|
+
/**
|
|
354
|
+
* Parameters for inserting a schema version.
|
|
355
|
+
*/
|
|
356
|
+
type InsertSchemaParams = Readonly<{
|
|
357
|
+
graphId: string;
|
|
358
|
+
version: number;
|
|
359
|
+
schemaHash: string;
|
|
360
|
+
schemaDoc: Record<string, unknown>;
|
|
361
|
+
isActive: boolean;
|
|
362
|
+
}>;
|
|
363
|
+
/**
|
|
364
|
+
* Parameters for counting edges from a source node.
|
|
365
|
+
*/
|
|
366
|
+
type CountEdgesFromParams = Readonly<{
|
|
367
|
+
graphId: string;
|
|
368
|
+
edgeKind: string;
|
|
369
|
+
fromKind: string;
|
|
370
|
+
fromId: string;
|
|
371
|
+
/** If true, only count edges where valid_to IS NULL */
|
|
372
|
+
activeOnly?: boolean;
|
|
373
|
+
}>;
|
|
374
|
+
/**
|
|
375
|
+
* Parameters for checking if an edge exists between two nodes.
|
|
376
|
+
*/
|
|
377
|
+
type EdgeExistsBetweenParams = Readonly<{
|
|
378
|
+
graphId: string;
|
|
379
|
+
edgeKind: string;
|
|
380
|
+
fromKind: string;
|
|
381
|
+
fromId: string;
|
|
382
|
+
toKind: string;
|
|
383
|
+
toId: string;
|
|
384
|
+
}>;
|
|
385
|
+
/**
|
|
386
|
+
* Parameters for finding edges connected to a node.
|
|
387
|
+
*/
|
|
388
|
+
type FindEdgesConnectedToParams = Readonly<{
|
|
389
|
+
graphId: string;
|
|
390
|
+
nodeKind: string;
|
|
391
|
+
nodeId: string;
|
|
392
|
+
}>;
|
|
393
|
+
/**
|
|
394
|
+
* Parameters for finding nodes by kind.
|
|
395
|
+
*/
|
|
396
|
+
type FindNodesByKindParams = Readonly<{
|
|
397
|
+
graphId: string;
|
|
398
|
+
kind: string;
|
|
399
|
+
limit?: number;
|
|
400
|
+
offset?: number;
|
|
401
|
+
/** If true, exclude deleted nodes. Default true. */
|
|
402
|
+
excludeDeleted?: boolean;
|
|
403
|
+
}>;
|
|
404
|
+
/**
|
|
405
|
+
* Parameters for counting nodes by kind.
|
|
406
|
+
*/
|
|
407
|
+
type CountNodesByKindParams = Readonly<{
|
|
408
|
+
graphId: string;
|
|
409
|
+
kind: string;
|
|
410
|
+
/** If true, exclude deleted nodes. Default true. */
|
|
411
|
+
excludeDeleted?: boolean;
|
|
412
|
+
}>;
|
|
413
|
+
/**
|
|
414
|
+
* Parameters for finding edges by kind.
|
|
415
|
+
*/
|
|
416
|
+
type FindEdgesByKindParams = Readonly<{
|
|
417
|
+
graphId: string;
|
|
418
|
+
kind: string;
|
|
419
|
+
fromKind?: string;
|
|
420
|
+
fromId?: string;
|
|
421
|
+
toKind?: string;
|
|
422
|
+
toId?: string;
|
|
423
|
+
limit?: number;
|
|
424
|
+
offset?: number;
|
|
425
|
+
/** If true, exclude deleted edges. Default true. */
|
|
426
|
+
excludeDeleted?: boolean;
|
|
427
|
+
}>;
|
|
428
|
+
/**
|
|
429
|
+
* Parameters for counting edges by kind.
|
|
430
|
+
*/
|
|
431
|
+
type CountEdgesByKindParams = Readonly<{
|
|
432
|
+
graphId: string;
|
|
433
|
+
kind: string;
|
|
434
|
+
fromKind?: string;
|
|
435
|
+
fromId?: string;
|
|
436
|
+
toKind?: string;
|
|
437
|
+
toId?: string;
|
|
438
|
+
/** If true, exclude deleted edges. Default true. */
|
|
439
|
+
excludeDeleted?: boolean;
|
|
440
|
+
}>;
|
|
441
|
+
|
|
442
|
+
export type { GraphBackend as G, SchemaVersionRow as S, TransactionBackend as T };
|