lance-csr 0.0.0 → 0.13.1

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/native.d.ts ADDED
@@ -0,0 +1,163 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
12
+ export declare class CypherEngine {
13
+ execute(query: string, paramsJson?: string | undefined | null, timeoutMs?: number | undefined | null): Promise<Buffer>
14
+ executeBatches(query: string, paramsJson?: string | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchStream>
15
+ explain(query: string, paramsJson: string | undefined | null, analyze: boolean): Promise<string>
16
+ checkoutLatest(): Promise<void>
17
+ optimizeCsr(): Promise<void>
18
+ deleteStoredCsr(): Promise<number>
19
+ nodeIndexStats(): Record<string, NodeIndexStats>
20
+ csrStats(): Record<string, CsrStats>
21
+ datasetVersions(): Record<string, number>
22
+ executeWithVectorRerank(query: string, search: VectorSearchSpec): Promise<Buffer>
23
+ }
24
+
25
+ /** A query result read one batch at a time, each batch as Arrow IPC bytes. */
26
+ export declare class RecordBatchStream {
27
+ /** The result schema, as an IPC stream with no batches. */
28
+ schema(): Buffer
29
+ /** The next batch, or `null` at the end. */
30
+ next(): Promise<Buffer | null>
31
+ /** Stop the query and release what it holds. Reading afterwards returns `null`. */
32
+ close(): Promise<void>
33
+ }
34
+
35
+ export declare class SqlEngine {
36
+ /** SQL over a `CypherEngine`'s snapshot, sharing its tables and indexes. */
37
+ static fromEngine(engine: CypherEngine): SqlEngine
38
+ execute(sql: string, paramsJson?: string | undefined | null, timeoutMs?: number | undefined | null): Promise<Buffer>
39
+ explain(sql: string, paramsJson: string | undefined | null, analyze: boolean): Promise<string>
40
+ checkoutLatest(): Promise<void>
41
+ }
42
+
43
+ /** Validate a config, as `GraphConfigBuilder.build()` does in Python. */
44
+ export declare function buildGraphConfig(spec: GraphConfigSpec): GraphConfigInfo
45
+
46
+ export interface CsrStats {
47
+ edges: number
48
+ deltaEdges: number
49
+ tombstones: number
50
+ unindexedEdges: number
51
+ update: string
52
+ version?: number
53
+ baseVersion?: number
54
+ buildMs: number
55
+ }
56
+
57
+ export declare function cypherQueryExecute(spec: CypherQuerySpec, datasetsIn: Record<string, DatasetInput>, executionStrategy?: ExecutionStrategy | undefined | null, timeoutMs?: number | undefined | null): Promise<Buffer>
58
+
59
+ export declare function cypherQueryExecuteWithNamespace(spec: CypherQuerySpec, baseUri: string, executionStrategy?: ExecutionStrategy | undefined | null): Promise<Buffer>
60
+
61
+ export declare function cypherQueryExecuteWithVectorRerank(spec: CypherQuerySpec, datasetsIn: Record<string, DatasetInput>, search: VectorSearchSpec): Promise<Buffer>
62
+
63
+ export declare function cypherQueryExplain(spec: CypherQuerySpec, datasetsIn: Record<string, DatasetInput>): Promise<string>
64
+
65
+ /** Everything a `CypherQuery` holds, sent with each call. */
66
+ export interface CypherQuerySpec {
67
+ query: string
68
+ config?: GraphConfigSpec
69
+ /** JSON text of the bound parameters. */
70
+ parameters?: string
71
+ }
72
+
73
+ export declare function cypherQueryToSql(spec: CypherQuerySpec, datasetsIn: Record<string, DatasetInput>, dialect?: SqlDialect | undefined | null): Promise<string>
74
+
75
+ /** One input table: Arrow IPC stream bytes, or a Lance dataset to open by URI. */
76
+ export interface DatasetInput {
77
+ ipc?: Buffer
78
+ uri?: string
79
+ version?: number
80
+ storageOptions?: Record<string, string>
81
+ }
82
+
83
+ export declare enum DistanceMetric {
84
+ L2 = 0,
85
+ Cosine = 1,
86
+ Dot = 2,
87
+ }
88
+
89
+ export declare enum ExecutionStrategy {
90
+ DataFusion = 0,
91
+ LanceNative = 1,
92
+ }
93
+
94
+ export interface GraphConfigInfo {
95
+ nodeLabels: Array<string>
96
+ relationshipTypes: Array<string>
97
+ }
98
+
99
+ /** What `GraphConfigBuilder` recorded, replayed into the Rust builder. */
100
+ export interface GraphConfigSpec {
101
+ nodes: Array<NodeTableSpec>
102
+ relationships: Array<RelTableSpec>
103
+ }
104
+
105
+ export interface NodeIndexStats {
106
+ rows: number
107
+ version?: number
108
+ buildMs: number
109
+ }
110
+
111
+ export interface NodeTableSpec {
112
+ label: string
113
+ primaryKey: string
114
+ }
115
+
116
+ export declare function openCypherEngine(config: GraphConfigSpec, datasetsIn: Record<string, DatasetInput>, useCsr: boolean, targetPartitions: number | undefined | null, persistCsr: boolean): Promise<CypherEngine>
117
+
118
+ export declare function openSqlEngine(datasetsIn: Record<string, DatasetInput>, config: GraphConfigSpec | undefined | null, useCsr: boolean): Promise<SqlEngine>
119
+
120
+ /** Parse a query, raising on a syntax error, as the Python `CypherQuery` constructor does. */
121
+ export declare function parseCypher(query: string): ParsedCypher
122
+
123
+ export interface ParsedCypher {
124
+ variables: Array<string>
125
+ nodeLabels: Array<string>
126
+ relationshipTypes: Array<string>
127
+ }
128
+
129
+ export interface RelTableSpec {
130
+ relType: string
131
+ fromTable: string
132
+ toTable: string
133
+ src: string
134
+ dst: string
135
+ }
136
+
137
+ export declare enum SqlDialect {
138
+ Default = 0,
139
+ Spark = 1,
140
+ PostgreSql = 2,
141
+ MySql = 3,
142
+ Sqlite = 4,
143
+ }
144
+
145
+ export declare function sqlQueryExecute(sql: string, datasetsIn: Record<string, DatasetInput>): Promise<Buffer>
146
+
147
+ export declare function sqlQueryExplain(sql: string, datasetsIn: Record<string, DatasetInput>): Promise<string>
148
+
149
+ /** `VectorSearch.search`: rank the rows of one table. */
150
+ export declare function vectorSearchSearch(search: VectorSearchSpec, ipc: Buffer): Promise<Buffer>
151
+
152
+ /** What `VectorSearch` recorded, replayed into the Rust builder. */
153
+ export interface VectorSearchSpec {
154
+ column: string
155
+ queryVector?: Array<number>
156
+ metric?: DistanceMetric
157
+ topK?: number
158
+ includeDistance?: boolean
159
+ distanceColumnName?: string
160
+ useLanceIndex?: boolean
161
+ }
162
+
163
+ export declare const VERSION: string