@infino-ai/infino 0.8.10 → 0.9.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 CHANGED
@@ -101,6 +101,75 @@ export interface OptimizeOptions {
101
101
  * compaction still runs). Omit for `"auto"`. */
102
102
  recalibrate?: "auto" | "force" | "skip";
103
103
  }
104
+ /** How much a reindex repairs. `"auto"` gives each superfile the cheapest
105
+ * repair that makes it current; `"rewrite"` brings layouts current and leaves
106
+ * superfiles whose terms are stale (reported); `"reanalyze"` re-tokenizes every
107
+ * stale superfile from its stored text. */
108
+ export type ReindexMode = "auto" | "rewrite" | "reanalyze";
109
+ /** Options for `reindex`, `reindexPlan` and `indexStaleness`; all fields
110
+ * optional (omitted ⇒ engine default). Repairs the full-text index. */
111
+ export interface ReindexOptions {
112
+ /** How much to repair; omit for `"auto"`. */
113
+ mode?: ReindexMode;
114
+ /** How old a sealed tombstone sidecar has to be, in milliseconds, before a
115
+ * rewrite takes it over. Omit to use the table's compaction setting. */
116
+ staleSealTimeoutMs?: number;
117
+ /**
118
+ * Credit a superfile that records no analysis revision with the one its
119
+ * writer emitted (default `false`). **Only sound when the table never held
120
+ * superfiles older than that writer**: an older compaction can have folded
121
+ * stale terms into a newer-stamped file, and crediting it reports the table
122
+ * migrated with those terms still in place. Leave unset unless the table's
123
+ * whole history is known.
124
+ */
125
+ trustWriterAnalysis?: boolean;
126
+ }
127
+ /** What a `reindex` did. */
128
+ export interface ReindexReport {
129
+ /** Superfiles rewritten into the current format. */
130
+ rewritten: number;
131
+ /** Superfiles already current when the run planned. */
132
+ alreadyCurrent: number;
133
+ /** Superfiles holding terms from an older analysis that this run's mode
134
+ * cannot repair (non-zero only under `"rewrite"`). */
135
+ awaitingReanalysis: number;
136
+ /** Stale superfiles another run held; run again to finish them. */
137
+ heldByAnotherRun: number;
138
+ /** Columns whose text was never stored, so no repair can fix their terms;
139
+ * only re-ingesting them from source can. */
140
+ unrepairableColumns: string[];
141
+ /** Superfiles left untouched because their footer places a blob where
142
+ * the file or its manifest entry contradicts; they need inspection. */
143
+ inconsistentFooters: string[];
144
+ }
145
+ /** What a `reindex` would do, and what it would cost. */
146
+ export interface StalenessReport {
147
+ /** Superfiles in the table, stale or not. */
148
+ superfiles: number;
149
+ /** Superfiles whose layout is behind — what `"rewrite"` would rewrite. */
150
+ needingRewrite: number;
151
+ /** Superfiles holding terms from an older analysis, which only
152
+ * re-analysis repairs. */
153
+ awaitingReanalysis: number;
154
+ /** Live bytes a `"rewrite"` would read and write again. */
155
+ bytesToRewrite: number;
156
+ /** Columns no repair can fix, because their text was never stored. */
157
+ unrepairableColumns: string[];
158
+ /** Superfiles whose footer places a blob where the file or its manifest
159
+ * entry contradicts. A reindex reports these and never rewrites them. */
160
+ inconsistentFooters: string[];
161
+ /** Whether a reindex would do nothing at all. */
162
+ isCurrent: boolean;
163
+ }
164
+ /** One superfile a `reindex` would repair, and how. */
165
+ export interface PlannedRepair {
166
+ /** The superfile the run reads and replaces. */
167
+ superfileId: string;
168
+ /** The repair it gets — never `"auto"`, which the plan has resolved. */
169
+ mode: Exclude<ReindexMode, "auto">;
170
+ /** Live bytes in the superfile. */
171
+ liveBytes: number;
172
+ }
104
173
  export interface Bm25SearchOptions {
105
174
  mode?: BoolMode;
106
175
  /** BM25 statistics scope: `"global"` (default) or `"per_superfile"`. */
@@ -237,6 +306,24 @@ export declare class Table {
237
306
  * calling this on a hosted connection throws.
238
307
  */
239
308
  gc(graceSecs: number): GcReport;
309
+ /**
310
+ * Repair every superfile whose full-text index is behind what this engine
311
+ * writes. Rows, their order and their `_id`s are unchanged.
312
+ *
313
+ * Throws an Error whose message starts with `AlreadyRunningError:` while an
314
+ * `optimize` or another reindex holds the table — retry later.
315
+ *
316
+ * **Local durable connections only.** A `memory://` table has nothing to
317
+ * repair and a hosted table's storage is the service's, so on either this —
318
+ * and `reindexPlan` / `indexStaleness` — throws with `code` `"InvalidArg"`.
319
+ */
320
+ reindex(options?: ReindexOptions): ReindexReport;
321
+ /** The superfiles {@link Table.reindex} would repair under `options`, and
322
+ * the repair each gets — without repairing anything. Writes nothing. */
323
+ reindexPlan(options?: ReindexOptions): PlannedRepair[];
324
+ /** What is behind and what repairing it would cost. Writes nothing, so it is
325
+ * safe against a live table. */
326
+ indexStaleness(options?: ReindexOptions): StalenessReport;
240
327
  }
241
328
  /** A catalog connection. Create one with {@link connect}. */
242
329
  export declare class Connection {
@@ -253,6 +340,7 @@ export declare class Connection {
253
340
  /** Create a table from an apache-arrow `Schema` or `{ column: type }`. */
254
341
  createTable(name: string, schema: arrow.Schema | SchemaDescriptor | Buffer, indexes: IndexSpec): Table;
255
342
  openTable(name: string): Table;
343
+ /** Drop a table. `purge` defaults to `true`, which also deletes the table's storage; pass `false` to only unregister it and keep the bytes. */
256
344
  dropTable(name: string, purge?: boolean): void;
257
345
  listTables(): string[];
258
346
  /** SQL across the catalog; rows as records (or an Arrow `Table`). */
package/infino/index.js CHANGED
@@ -322,6 +322,30 @@ class Table {
322
322
  gc(graceSecs) {
323
323
  return guard(this.remote, () => this.inner.gc(graceSecs));
324
324
  }
325
+ /**
326
+ * Repair every superfile whose full-text index is behind what this engine
327
+ * writes. Rows, their order and their `_id`s are unchanged.
328
+ *
329
+ * Throws an Error whose message starts with `AlreadyRunningError:` while an
330
+ * `optimize` or another reindex holds the table — retry later.
331
+ *
332
+ * **Local durable connections only.** A `memory://` table has nothing to
333
+ * repair and a hosted table's storage is the service's, so on either this —
334
+ * and `reindexPlan` / `indexStaleness` — throws with `code` `"InvalidArg"`.
335
+ */
336
+ reindex(options) {
337
+ return guard(this.remote, () => this.inner.reindex(options));
338
+ }
339
+ /** The superfiles {@link Table.reindex} would repair under `options`, and
340
+ * the repair each gets — without repairing anything. Writes nothing. */
341
+ reindexPlan(options) {
342
+ return guard(this.remote, () => this.inner.reindexPlan(options));
343
+ }
344
+ /** What is behind and what repairing it would cost. Writes nothing, so it is
345
+ * safe against a live table. */
346
+ indexStaleness(options) {
347
+ return guard(this.remote, () => this.inner.indexStaleness(options));
348
+ }
325
349
  }
326
350
  exports.Table = Table;
327
351
  /** A catalog connection. Create one with {@link connect}. */
@@ -349,6 +373,7 @@ class Connection {
349
373
  openTable(name) {
350
374
  return new Table(guard(this.remote, () => this.inner.openTable(name)), this.remote);
351
375
  }
376
+ /** Drop a table. `purge` defaults to `true`, which also deletes the table's storage; pass `false` to only unregister it and keep the bytes. */
352
377
  dropTable(name, purge) {
353
378
  guard(this.remote, () => this.inner.dropTable(name, purge));
354
379
  }
@@ -84,6 +84,90 @@ export interface GcReport {
84
84
  /** Objects that failed to delete (left for the next sweep). */
85
85
  deleteErrors: number
86
86
  }
87
+ /**
88
+ * Options for `reindex`, `reindexPlan` and `indexStaleness`; all fields
89
+ * optional (omitted ⇒ engine default). Repairs the full-text index, the only
90
+ * index with a repair today.
91
+ */
92
+ export interface ReindexOptions {
93
+ /**
94
+ * How much to repair: `"auto"` (default — the cheapest repair that makes
95
+ * each superfile current), `"rewrite"` (layout only; superfiles whose
96
+ * terms are stale are left and reported), or `"reanalyze"` (re-tokenize
97
+ * every stale superfile from its stored text).
98
+ */
99
+ mode?: string
100
+ /**
101
+ * How old a sealed tombstone sidecar has to be, in milliseconds, before a
102
+ * rewrite takes it over. Omit to use the table's compaction setting.
103
+ */
104
+ staleSealTimeoutMs?: number
105
+ /**
106
+ * Credit a superfile that records no analysis revision with the one its
107
+ * writer emitted (default `false`). **Only sound when the table never held
108
+ * superfiles older than that writer**: an older compaction can have folded
109
+ * stale terms into a newer-stamped file, and crediting it reports the
110
+ * table migrated with those terms still in place. Leave unset unless the
111
+ * table's whole history is known.
112
+ */
113
+ trustWriterAnalysis?: boolean
114
+ }
115
+ /** What a `reindex` did. */
116
+ export interface ReindexReport {
117
+ /** Superfiles rewritten into the current format. */
118
+ rewritten: number
119
+ /** Superfiles already current when the run planned. */
120
+ alreadyCurrent: number
121
+ /**
122
+ * Superfiles holding terms from an older analysis that this run's mode
123
+ * cannot repair (non-zero only under `"rewrite"`).
124
+ */
125
+ awaitingReanalysis: number
126
+ /** Stale superfiles another run held; run again to finish them. */
127
+ heldByAnotherRun: number
128
+ /**
129
+ * Columns whose text was never stored, so no repair can fix their terms;
130
+ * only re-ingesting them from source can.
131
+ */
132
+ unrepairableColumns: Array<string>
133
+ /**
134
+ * Superfiles left untouched because their footer places a blob where
135
+ * the file or its manifest entry contradicts; they need inspection.
136
+ */
137
+ inconsistentFooters: Array<string>
138
+ }
139
+ /** What a `reindex` would do, and what it would cost. */
140
+ export interface StalenessReport {
141
+ /** Superfiles in the table, stale or not. */
142
+ superfiles: number
143
+ /** Superfiles whose layout is behind — what `"rewrite"` would rewrite. */
144
+ needingRewrite: number
145
+ /**
146
+ * Superfiles holding terms from an older analysis, which only
147
+ * re-analysis repairs.
148
+ */
149
+ awaitingReanalysis: number
150
+ /** Live bytes a `"rewrite"` would read and write again. */
151
+ bytesToRewrite: number
152
+ /** Columns no repair can fix, because their text was never stored. */
153
+ unrepairableColumns: Array<string>
154
+ /**
155
+ * Superfiles whose footer places a blob where the file or its manifest
156
+ * entry contradicts. A reindex reports these and never rewrites them.
157
+ */
158
+ inconsistentFooters: Array<string>
159
+ /** Whether a reindex would do nothing at all. */
160
+ isCurrent: boolean
161
+ }
162
+ /** One superfile a `reindex` would repair, and how. */
163
+ export interface PlannedRepair {
164
+ /** The superfile the run reads and replaces. */
165
+ superfileId: string
166
+ /** The repair it gets: `"rewrite"` or `"reanalyze"`, never `"auto"`. */
167
+ mode: string
168
+ /** Live bytes in the superfile. */
169
+ liveBytes: number
170
+ }
87
171
  /**
88
172
  * Text-predicate filter for `vectorSearch` — a pushdown pre-filter, not a
89
173
  * post-filter: kNN ranks only among rows whose FTS-indexed `column` matches
@@ -229,6 +313,7 @@ export declare class Connection {
229
313
  * the JS side reads with `tableFromIPC`. Search is available in SQL
230
314
  * via the TVFs, e.g.
231
315
  * `SELECT _id, score FROM bm25_search('docs', 'body', 'q', 10)`.
316
+ * Read-only, one statement per call: a write throws `InvalidArg`.
232
317
  */
233
318
  querySql(sql: string): Buffer
234
319
  }
@@ -327,6 +412,19 @@ export declare class Table {
327
412
  * racing readers/writers) are removed. Requires durable storage.
328
413
  */
329
414
  gc(graceSecs: number): GcReport
415
+ /**
416
+ * Repair every superfile whose full-text index is behind what this engine
417
+ * writes. Rows, their order and their `_id`s are unchanged. Requires
418
+ * durable storage and takes the table's compaction slot.
419
+ */
420
+ reindex(options?: ReindexOptions | undefined | null): ReindexReport
421
+ /**
422
+ * The superfiles `reindex` would repair under `options`, and the repair
423
+ * each gets — without repairing anything. Writes nothing.
424
+ */
425
+ reindexPlan(options?: ReindexOptions | undefined | null): Array<PlannedRepair>
426
+ /** What is behind and what repairing it would cost. Writes nothing. */
427
+ indexStaleness(options?: ReindexOptions | undefined | null): StalenessReport
330
428
  /**
331
429
  * The user-facing Arrow schema, as an Arrow IPC `Buffer` (an empty
332
430
  * table carrying the schema; read with `tableFromIPC`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infino-ai/infino",
3
- "version": "0.8.10",
3
+ "version": "0.9.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.8.10",
86
- "infx-darwin-arm64": "0.8.10",
87
- "infx-linux-x64-gnu": "0.8.10",
88
- "infx-linux-arm64-gnu": "0.8.10",
89
- "infx-linux-x64-musl": "0.8.10",
90
- "infx-linux-arm64-musl": "0.8.10"
85
+ "infx-darwin-x64": "0.9.1",
86
+ "infx-darwin-arm64": "0.9.1",
87
+ "infx-linux-x64-gnu": "0.9.1",
88
+ "infx-linux-arm64-gnu": "0.9.1",
89
+ "infx-linux-x64-musl": "0.9.1",
90
+ "infx-linux-arm64-musl": "0.9.1"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@napi-rs/cli": "^2.18.0",