@infino-ai/infino 0.1.9 → 0.2.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/infino/index.d.ts +58 -6
- package/infino/index.js +39 -6
- package/infino/native.d.ts +1 -1
- package/package.json +7 -7
package/infino/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export declare const BUILDER_ID: string;
|
|
|
7
7
|
export type Metric = "cosine" | "l2sq" | "negdot";
|
|
8
8
|
/** Boolean mode for multi-term FTS queries. */
|
|
9
9
|
export type BoolMode = "or" | "and";
|
|
10
|
+
/** BM25 statistics scope: per-superfile IDF (default) or corpus-wide
|
|
11
|
+
* `"global"` IDF across superfiles. */
|
|
12
|
+
export type Bm25Stats = "per_superfile" | "global";
|
|
10
13
|
/** A row from a query/search when not materializing to Arrow. */
|
|
11
14
|
export type RowRecord = Record<string, unknown>;
|
|
12
15
|
/** A plain `{ column: type }` schema descriptor for `createTable`. */
|
|
@@ -15,7 +18,15 @@ export type SchemaDescriptor = Record<string, string | {
|
|
|
15
18
|
}>;
|
|
16
19
|
/** Accepted shapes for `Table.append`. */
|
|
17
20
|
export type AppendData = RowRecord[] | arrow.Table | arrow.RecordBatch | Buffer | Uint8Array;
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Storage and cache config the `connect` URI can't carry. All optional.
|
|
23
|
+
*
|
|
24
|
+
* Which options apply depends on the backend: `apiKey` is for a hosted
|
|
25
|
+
* (Infino Cloud) connection, while the storage/cache options — `storageOptions`,
|
|
26
|
+
* `cacheDir`, `cacheBudgetBytes`, `coldFetchMode`, `validate` — apply to **local
|
|
27
|
+
* connections only**; Infino Cloud manages storage, so it ignores them.
|
|
28
|
+
* `connectionMemoryBudgetBytes` applies to both.
|
|
29
|
+
*/
|
|
19
30
|
export interface ConnectOptions {
|
|
20
31
|
/**
|
|
21
32
|
* Credentials/tuning for the URI-selected backend, keyed by `object_store`
|
|
@@ -43,6 +54,12 @@ export interface ConnectOptions {
|
|
|
43
54
|
* on bad credentials instead of on the first table operation.
|
|
44
55
|
*/
|
|
45
56
|
validate?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* API key for a hosted (`https://<host>/<database>`) connection, sent as a
|
|
59
|
+
* bearer credential. Ignored by local backends. Falls back to the
|
|
60
|
+
* `INFINO_API_KEY` environment variable when omitted.
|
|
61
|
+
*/
|
|
62
|
+
apiKey?: string;
|
|
46
63
|
}
|
|
47
64
|
/** Row counts returned by `update` / `delete`. */
|
|
48
65
|
export interface MutationStats {
|
|
@@ -80,6 +97,8 @@ export interface OptimizeOptions {
|
|
|
80
97
|
}
|
|
81
98
|
export interface Bm25SearchOptions {
|
|
82
99
|
mode?: BoolMode;
|
|
100
|
+
/** BM25 statistics scope: `"per_superfile"` (default) or `"global"`. */
|
|
101
|
+
stats?: Bm25Stats;
|
|
83
102
|
/** Columns to return, e.g. `["_id", "score"]`; omit for full rows. */
|
|
84
103
|
projection?: string[];
|
|
85
104
|
arrow?: boolean;
|
|
@@ -130,8 +149,10 @@ export interface CountOptions {
|
|
|
130
149
|
export interface QueryOptions {
|
|
131
150
|
arrow?: boolean;
|
|
132
151
|
}
|
|
152
|
+
/** A table handle. Obtain one from {@link Connection.createTable} or {@link Connection.openTable}. */
|
|
133
153
|
export declare class Table {
|
|
134
154
|
private inner;
|
|
155
|
+
/** @hidden */
|
|
135
156
|
constructor(inner: any);
|
|
136
157
|
/** The table's Arrow schema. */
|
|
137
158
|
schema(): arrow.Schema;
|
|
@@ -182,16 +203,28 @@ export declare class Table {
|
|
|
182
203
|
/** Delete rows matching a SQL predicate (e.g. `"status = 'spam'"`).
|
|
183
204
|
* Requires durable storage (not `memory://`). */
|
|
184
205
|
delete(predicate: string): MutationStats;
|
|
185
|
-
/**
|
|
186
|
-
*
|
|
206
|
+
/**
|
|
207
|
+
* Merge small / underfilled superfiles into larger ones (omit `settings`
|
|
208
|
+
* for engine defaults).
|
|
209
|
+
*
|
|
210
|
+
* **Local connections only.** On Infino Cloud, compaction is managed for you,
|
|
211
|
+
* so calling this on a hosted (`https://…`) connection throws.
|
|
212
|
+
*/
|
|
187
213
|
optimize(settings?: OptimizeOptions): void;
|
|
188
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* Delete orphaned storage objects left by compaction or interrupted writes.
|
|
189
216
|
* Only objects older than `graceSecs` (a safety window against racing
|
|
190
|
-
* readers/writers) are removed. Requires durable storage (not `memory://`).
|
|
217
|
+
* readers/writers) are removed. Requires durable storage (not `memory://`).
|
|
218
|
+
*
|
|
219
|
+
* **Local connections only.** On Infino Cloud, cleanup is managed for you, so
|
|
220
|
+
* calling this on a hosted connection throws.
|
|
221
|
+
*/
|
|
191
222
|
gc(graceSecs: number): GcReport;
|
|
192
223
|
}
|
|
224
|
+
/** A catalog connection. Create one with {@link connect}. */
|
|
193
225
|
export declare class Connection {
|
|
194
226
|
private inner;
|
|
227
|
+
/** @hidden */
|
|
195
228
|
constructor(inner: any);
|
|
196
229
|
/**
|
|
197
230
|
* Provision the database this connection targets. On the hosted service this
|
|
@@ -210,5 +243,24 @@ export declare class Connection {
|
|
|
210
243
|
}): arrow.Table;
|
|
211
244
|
querySql(sql: string, opts?: QueryOptions): RowRecord[];
|
|
212
245
|
}
|
|
213
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* Open a connection to Infino. The `uri` selects the backend:
|
|
248
|
+
*
|
|
249
|
+
* - a local path (`"./data"`) or `"memory://"` — embedded, in-process;
|
|
250
|
+
* - an object-store URI (`"s3://…"`, `"gs://…"`, `"az://…"`) — embedded over
|
|
251
|
+
* your own bucket;
|
|
252
|
+
* - `"https://<host>/<database>"` — Infino Cloud, the hosted service.
|
|
253
|
+
*
|
|
254
|
+
* For a hosted (`https://`) target, authenticate with an API key: pass
|
|
255
|
+
* {@link ConnectOptions.apiKey}, or set the `INFINO_API_KEY` environment
|
|
256
|
+
* variable. Storage and cache tuning the URI can't carry also goes in
|
|
257
|
+
* `options` (see {@link ConnectOptions}).
|
|
258
|
+
*
|
|
259
|
+
* ```ts
|
|
260
|
+
* // local
|
|
261
|
+
* const db = connect("./data");
|
|
262
|
+
* // Infino Cloud
|
|
263
|
+
* const cloud = connect("https://api.platform.infino.ai/my-app", { apiKey: "inf_…" });
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
214
266
|
export declare function connect(uri: string, options?: ConnectOptions): Connection;
|
package/infino/index.js
CHANGED
|
@@ -190,8 +190,10 @@ function decode(buf, asArrow) {
|
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
// --- friendly handles ---
|
|
193
|
+
/** A table handle. Obtain one from {@link Connection.createTable} or {@link Connection.openTable}. */
|
|
193
194
|
class Table {
|
|
194
195
|
inner;
|
|
196
|
+
/** @hidden */
|
|
195
197
|
constructor(inner) {
|
|
196
198
|
this.inner = inner;
|
|
197
199
|
}
|
|
@@ -208,7 +210,7 @@ class Table {
|
|
|
208
210
|
this.inner.append(dataToIpc(data, () => this.schema()));
|
|
209
211
|
}
|
|
210
212
|
bm25Search(column, query, k, opts = {}) {
|
|
211
|
-
const buf = this.inner.bm25Search(column, query, k, opts.mode, opts.projection);
|
|
213
|
+
const buf = this.inner.bm25Search(column, query, k, opts.mode, opts.stats, opts.projection);
|
|
212
214
|
return decode(buf, opts.arrow);
|
|
213
215
|
}
|
|
214
216
|
vectorSearch(column, query, k, opts = {}) {
|
|
@@ -245,21 +247,33 @@ class Table {
|
|
|
245
247
|
delete(predicate) {
|
|
246
248
|
return this.inner.delete(predicate);
|
|
247
249
|
}
|
|
248
|
-
/**
|
|
249
|
-
*
|
|
250
|
+
/**
|
|
251
|
+
* Merge small / underfilled superfiles into larger ones (omit `settings`
|
|
252
|
+
* for engine defaults).
|
|
253
|
+
*
|
|
254
|
+
* **Local connections only.** On Infino Cloud, compaction is managed for you,
|
|
255
|
+
* so calling this on a hosted (`https://…`) connection throws.
|
|
256
|
+
*/
|
|
250
257
|
optimize(settings) {
|
|
251
258
|
this.inner.optimize(settings);
|
|
252
259
|
}
|
|
253
|
-
/**
|
|
260
|
+
/**
|
|
261
|
+
* Delete orphaned storage objects left by compaction or interrupted writes.
|
|
254
262
|
* Only objects older than `graceSecs` (a safety window against racing
|
|
255
|
-
* readers/writers) are removed. Requires durable storage (not `memory://`).
|
|
263
|
+
* readers/writers) are removed. Requires durable storage (not `memory://`).
|
|
264
|
+
*
|
|
265
|
+
* **Local connections only.** On Infino Cloud, cleanup is managed for you, so
|
|
266
|
+
* calling this on a hosted connection throws.
|
|
267
|
+
*/
|
|
256
268
|
gc(graceSecs) {
|
|
257
269
|
return this.inner.gc(graceSecs);
|
|
258
270
|
}
|
|
259
271
|
}
|
|
260
272
|
exports.Table = Table;
|
|
273
|
+
/** A catalog connection. Create one with {@link connect}. */
|
|
261
274
|
class Connection {
|
|
262
275
|
inner;
|
|
276
|
+
/** @hidden */
|
|
263
277
|
constructor(inner) {
|
|
264
278
|
this.inner = inner;
|
|
265
279
|
}
|
|
@@ -289,7 +303,26 @@ class Connection {
|
|
|
289
303
|
}
|
|
290
304
|
}
|
|
291
305
|
exports.Connection = Connection;
|
|
292
|
-
/**
|
|
306
|
+
/**
|
|
307
|
+
* Open a connection to Infino. The `uri` selects the backend:
|
|
308
|
+
*
|
|
309
|
+
* - a local path (`"./data"`) or `"memory://"` — embedded, in-process;
|
|
310
|
+
* - an object-store URI (`"s3://…"`, `"gs://…"`, `"az://…"`) — embedded over
|
|
311
|
+
* your own bucket;
|
|
312
|
+
* - `"https://<host>/<database>"` — Infino Cloud, the hosted service.
|
|
313
|
+
*
|
|
314
|
+
* For a hosted (`https://`) target, authenticate with an API key: pass
|
|
315
|
+
* {@link ConnectOptions.apiKey}, or set the `INFINO_API_KEY` environment
|
|
316
|
+
* variable. Storage and cache tuning the URI can't carry also goes in
|
|
317
|
+
* `options` (see {@link ConnectOptions}).
|
|
318
|
+
*
|
|
319
|
+
* ```ts
|
|
320
|
+
* // local
|
|
321
|
+
* const db = connect("./data");
|
|
322
|
+
* // Infino Cloud
|
|
323
|
+
* const cloud = connect("https://api.platform.infino.ai/my-app", { apiKey: "inf_…" });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
293
326
|
function connect(uri, options) {
|
|
294
327
|
return new Connection((0, native_js_1.connect)(uri, options));
|
|
295
328
|
}
|
package/infino/native.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ export declare class Table {
|
|
|
165
165
|
* `score` is a similarity (higher is better) — opposite direction
|
|
166
166
|
* from `vectorSearch`'s distance. Fuse with `hybridSearch`.
|
|
167
167
|
*/
|
|
168
|
-
bm25Search(column: string, query: string, k: number, mode?: string | undefined | null, projection?: Array<string> | undefined | null): Buffer
|
|
168
|
+
bm25Search(column: string, query: string, k: number, mode?: string | undefined | null, stats?: string | undefined | null, projection?: Array<string> | undefined | null): Buffer
|
|
169
169
|
/**
|
|
170
170
|
* Vector kNN over one vector column. `query` is a `Float32Array`
|
|
171
171
|
* (crosses by reference — no copy). Returns matching rows as an Arrow
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infino-ai/infino",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Fast search on object storage — SQL, full-text, and vector search.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
"apache-arrow": "^17"
|
|
83
83
|
},
|
|
84
84
|
"optionalDependencies": {
|
|
85
|
-
"infx-darwin-x64": "0.1
|
|
86
|
-
"infx-darwin-arm64": "0.1
|
|
87
|
-
"infx-linux-x64-gnu": "0.1
|
|
88
|
-
"infx-linux-arm64-gnu": "0.1
|
|
89
|
-
"infx-linux-x64-musl": "0.1
|
|
90
|
-
"infx-linux-arm64-musl": "0.1
|
|
85
|
+
"infx-darwin-x64": "0.2.1",
|
|
86
|
+
"infx-darwin-arm64": "0.2.1",
|
|
87
|
+
"infx-linux-x64-gnu": "0.2.1",
|
|
88
|
+
"infx-linux-arm64-gnu": "0.2.1",
|
|
89
|
+
"infx-linux-x64-musl": "0.2.1",
|
|
90
|
+
"infx-linux-arm64-musl": "0.2.1"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@napi-rs/cli": "^2.18.0",
|