@lancedb/lancedb 0.28.0-beta.9 → 0.29.1-beta.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/native.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  export declare class Connection {
4
4
  /** Create a new Connection instance from the given URI. */
5
5
  static new(uri: string, options: ConnectionOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise<Connection>
6
+ /** Create a new Connection instance backed by a namespace implementation. */
7
+ static newWithNamespace(implName: string, properties: Record<string, string>, options: ConnectNamespaceOptions): Promise<Connection>
6
8
  display(): string
7
9
  isOpen(): boolean
8
10
  close(): void
@@ -21,7 +23,16 @@ export declare class Connection {
21
23
  cloneTable(targetTableName: string, sourceUri: string, targetNamespacePath: Array<string> | undefined | null, sourceVersion: number | undefined | null, sourceTag: string | undefined | null, isShallow: boolean): Promise<Table>
22
24
  /** Drop table with the name. Or raise an error if the table does not exist. */
23
25
  dropTable(name: string, namespacePath?: Array<string> | undefined | null): Promise<void>
26
+ renameTable(oldName: string, newName: string, namespacePath?: Array<string> | undefined | null): Promise<void>
24
27
  dropAllTables(namespacePath?: Array<string> | undefined | null): Promise<void>
28
+ /** Describe a namespace and return its properties. */
29
+ describeNamespace(namespacePath: Array<string>): Promise<DescribeNamespaceResponse>
30
+ /** List child namespaces under the given namespace path */
31
+ listNamespaces(namespacePath?: Array<string> | undefined | null, pageToken?: string | undefined | null, limit?: number | undefined | null): Promise<ListNamespacesResponse>
32
+ /** Create a new namespace with optional properties. */
33
+ createNamespace(namespacePath: Array<string>, mode?: string | undefined | null, properties?: Record<string, string> | undefined | null): Promise<CreateNamespaceResponse>
34
+ /** Drop a namespace. */
35
+ dropNamespace(namespacePath: Array<string>, mode?: string | undefined | null, behavior?: string | undefined | null): Promise<DropNamespaceResponse>
25
36
  }
26
37
 
27
38
  export declare class Index {
@@ -55,6 +66,30 @@ export declare class JsHeaderProvider {
55
66
  constructor(getHeadersCallback: () => Promise<Record<string, string>>)
56
67
  }
57
68
 
69
+ /**
70
+ * A Rust-side view of a JS-constructed `Scannable`.
71
+ *
72
+ * Held in JS as the return value of the `Scannable` class constructor. When
73
+ * passed to a consumer that accepts `impl lancedb::data::scannable::Scannable`,
74
+ * the consumer invokes `scan_as_stream()` to pull batches through the JS
75
+ * callback.
76
+ */
77
+ export declare class NapiScannable {
78
+ /**
79
+ * Construct a new `NapiScannable`.
80
+ *
81
+ * - `schema_buf` — Arrow IPC File buffer carrying only the schema (no batches).
82
+ * - `num_rows` — optional row count hint; not validated against the stream.
83
+ * - `rescannable` — whether `get_next_batch` may be re-driven after the
84
+ * scan completes.
85
+ * - `get_next_batch` -- JS callback that yields the next batch as an Arrow
86
+ * IPC Stream message wrapped in a `Buffer`, or `null` at EOF. The
87
+ * `isStart` argument is `true` on the first call of each new scan;
88
+ * JS uses it to discard any cached iterator before pulling.
89
+ */
90
+ constructor(schemaBuf: Buffer, numRows: number | undefined | null, rescannable: boolean, getNextBatch: (arg: boolean) => Promise<Buffer | undefined | null>)
91
+ }
92
+
58
93
  /** A builder used to create and run a merge insert operation */
59
94
  export declare class NativeMergeInsertBuilder {
60
95
  whenMatchedUpdateAll(condition?: string | undefined | null): NativeMergeInsertBuilder
@@ -94,6 +129,7 @@ export declare class Query {
94
129
  nearestToRaw(data: Uint8Array, dtype: string): VectorQuery
95
130
  fastSearch(): void
96
131
  withRowId(): void
132
+ orderBy(ordering?: Array<ColumnOrdering> | undefined | null): void
97
133
  outputSchema(): Promise<Buffer>
98
134
  execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator>
99
135
  explainPlan(verbose: boolean): Promise<string>
@@ -160,6 +196,7 @@ export declare class Table {
160
196
  createIndex(index: Index | undefined | null, column: string, replace?: boolean | undefined | null, waitTimeoutS?: number | undefined | null, name?: string | undefined | null, train?: boolean | undefined | null): Promise<void>
161
197
  dropIndex(indexName: string): Promise<void>
162
198
  prewarmIndex(indexName: string): Promise<void>
199
+ prewarmData(columns?: Array<string> | undefined | null): Promise<void>
163
200
  waitForIndex(indexNames: Array<string>, timeoutS: number): Promise<void>
164
201
  stats(): Promise<TableStatistics>
165
202
  initialStorageOptions(): Promise<Record<string, string> | null>
@@ -173,6 +210,9 @@ export declare class Table {
173
210
  addColumnsWithSchema(schemaBuf: Buffer): Promise<AddColumnsResult>
174
211
  alterColumns(alterations: Array<ColumnAlteration>): Promise<AlterColumnsResult>
175
212
  dropColumns(columns: Array<string>): Promise<DropColumnsResult>
213
+ setUnenforcedPrimaryKey(columns: Array<string>): Promise<void>
214
+ setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>
215
+ unsetLsmWriteSpec(): Promise<void>
176
216
  version(): Promise<number>
177
217
  checkout(version: number): Promise<void>
178
218
  checkoutTag(tag: string): Promise<void>
@@ -233,6 +273,7 @@ export declare class VectorQuery {
233
273
  fastSearch(): void
234
274
  withRowId(): void
235
275
  rerank(rerankHybrid: (arg: RerankHybridCallbackArgs) => Promise<Buffer>): void
276
+ orderBy(ordering?: Array<ColumnOrdering> | undefined | null): void
236
277
  outputSchema(): Promise<Buffer>
237
278
  execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator>
238
279
  explainPlan(verbose: boolean): Promise<string>
@@ -315,6 +356,12 @@ export interface ColumnAlteration {
315
356
  nullable?: boolean
316
357
  }
317
358
 
359
+ export interface ColumnOrdering {
360
+ ascending: boolean
361
+ nullsFirst: boolean
362
+ columnName: string
363
+ }
364
+
318
365
  /** Statistics about a compaction operation. */
319
366
  export interface CompactionStats {
320
367
  /** The number of fragments removed */
@@ -346,6 +393,17 @@ export interface ConnectionOptions {
346
393
  * The available options are described at https://docs.lancedb.com/storage/
347
394
  */
348
395
  storageOptions?: Record<string, string>
396
+ /**
397
+ * (For LanceDB OSS only): use directory namespace manifests as the source
398
+ * of truth for table metadata. Existing directory-listed root tables are
399
+ * migrated into the manifest on access.
400
+ */
401
+ manifestEnabled?: boolean
402
+ /**
403
+ * (For LanceDB OSS only): extra properties for the backing namespace
404
+ * client used by manifest-enabled native connections.
405
+ */
406
+ namespaceClientProperties?: Record<string, string>
349
407
  /**
350
408
  * (For LanceDB OSS only): the session to use for this connection. Holds
351
409
  * shared caches and other session-specific state.
@@ -371,15 +429,53 @@ export interface ConnectionOptions {
371
429
  hostOverride?: string
372
430
  }
373
431
 
432
+ export interface ConnectNamespaceOptions {
433
+ /**
434
+ * The interval, in seconds, at which to check for updates to the table
435
+ * from other processes. If None, then consistency is not checked. For
436
+ * performance reasons, this is the default. For strong consistency, set
437
+ * this to zero seconds. Then every read will check for updates from other
438
+ * processes. As a compromise, you can set this to a non-zero value for
439
+ * eventual consistency.
440
+ */
441
+ readConsistencyInterval?: number
442
+ /**
443
+ * Configuration for object storage. The available options are described
444
+ * at https://docs.lancedb.com/storage/
445
+ */
446
+ storageOptions?: Record<string, string>
447
+ /** Extra properties for the backing namespace client. */
448
+ namespaceClientProperties?: Record<string, string>
449
+ /**
450
+ * The session to use for this connection. Holds shared caches and other
451
+ * session-specific state.
452
+ */
453
+ session?: Session
454
+ }
455
+
456
+ export interface CreateNamespaceResponse {
457
+ properties?: Record<string, string>
458
+ transactionId?: string
459
+ }
460
+
374
461
  export interface DeleteResult {
375
462
  numDeletedRows: number
376
463
  version: number
377
464
  }
378
465
 
466
+ export interface DescribeNamespaceResponse {
467
+ properties?: Record<string, string>
468
+ }
469
+
379
470
  export interface DropColumnsResult {
380
471
  version: number
381
472
  }
382
473
 
474
+ export interface DropNamespaceResponse {
475
+ properties?: Record<string, string>
476
+ transactionId?: Array<string>
477
+ }
478
+
383
479
  export interface FragmentStatistics {
384
480
  /** The number of fragments in the table */
385
481
  numFragments: number
@@ -443,6 +539,32 @@ export interface IndexStatistics {
443
539
  loss?: number
444
540
  }
445
541
 
542
+ export interface ListNamespacesResponse {
543
+ namespaces: Array<string>
544
+ pageToken?: string
545
+ }
546
+
547
+ /**
548
+ * Specification selecting Lance's MemWAL LSM-style write path for
549
+ * `mergeInsert`.
550
+ *
551
+ * `specType` must be `"bucket"`, `"identity"`, or `"unsharded"`. For
552
+ * `"bucket"`, `column` and `numBuckets` are required; for `"identity"`,
553
+ * `column` is required.
554
+ */
555
+ export interface LsmWriteSpec {
556
+ /** One of `"bucket"`, `"identity"`, or `"unsharded"`. */
557
+ specType: string
558
+ /** Bucket and identity variants: the sharding column. */
559
+ column?: string
560
+ /** Bucket variant: the number of buckets, in `[1, 1024]`. */
561
+ numBuckets?: number
562
+ /** Names of indexes the MemWAL should keep up to date during writes. */
563
+ maintainedIndexes?: Array<string>
564
+ /** Default `ShardWriter` configuration recorded in the MemWAL index. */
565
+ writerConfigDefaults?: Record<string, string>
566
+ }
567
+
446
568
  export interface MergeResult {
447
569
  version: number
448
570
  numInsertedRows: number
package/dist/native.js CHANGED
@@ -76,8 +76,8 @@ function requireNative() {
76
76
  try {
77
77
  const binding = require('@lancedb/lancedb-android-arm64');
78
78
  const bindingPackageVersion = require('@lancedb/lancedb-android-arm64/package.json').version;
79
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
80
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
79
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
80
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
81
81
  }
82
82
  return binding;
83
83
  }
@@ -95,8 +95,8 @@ function requireNative() {
95
95
  try {
96
96
  const binding = require('@lancedb/lancedb-android-arm-eabi');
97
97
  const bindingPackageVersion = require('@lancedb/lancedb-android-arm-eabi/package.json').version;
98
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
99
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
98
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
99
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
100
100
  }
101
101
  return binding;
102
102
  }
@@ -120,8 +120,8 @@ function requireNative() {
120
120
  try {
121
121
  const binding = require('@lancedb/lancedb-win32-x64-gnu');
122
122
  const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-gnu/package.json').version;
123
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
124
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
123
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
124
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
125
125
  }
126
126
  return binding;
127
127
  }
@@ -139,8 +139,8 @@ function requireNative() {
139
139
  try {
140
140
  const binding = require('@lancedb/lancedb-win32-x64-msvc');
141
141
  const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-msvc/package.json').version;
142
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
143
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
142
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
143
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
144
144
  }
145
145
  return binding;
146
146
  }
@@ -159,8 +159,8 @@ function requireNative() {
159
159
  try {
160
160
  const binding = require('@lancedb/lancedb-win32-ia32-msvc');
161
161
  const bindingPackageVersion = require('@lancedb/lancedb-win32-ia32-msvc/package.json').version;
162
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
162
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
164
164
  }
165
165
  return binding;
166
166
  }
@@ -178,8 +178,8 @@ function requireNative() {
178
178
  try {
179
179
  const binding = require('@lancedb/lancedb-win32-arm64-msvc');
180
180
  const bindingPackageVersion = require('@lancedb/lancedb-win32-arm64-msvc/package.json').version;
181
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
181
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
183
183
  }
184
184
  return binding;
185
185
  }
@@ -201,8 +201,8 @@ function requireNative() {
201
201
  try {
202
202
  const binding = require('@lancedb/lancedb-darwin-universal');
203
203
  const bindingPackageVersion = require('@lancedb/lancedb-darwin-universal/package.json').version;
204
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
204
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
206
206
  }
207
207
  return binding;
208
208
  }
@@ -219,8 +219,8 @@ function requireNative() {
219
219
  try {
220
220
  const binding = require('@lancedb/lancedb-darwin-x64');
221
221
  const bindingPackageVersion = require('@lancedb/lancedb-darwin-x64/package.json').version;
222
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
222
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
224
224
  }
225
225
  return binding;
226
226
  }
@@ -238,8 +238,8 @@ function requireNative() {
238
238
  try {
239
239
  const binding = require('@lancedb/lancedb-darwin-arm64');
240
240
  const bindingPackageVersion = require('@lancedb/lancedb-darwin-arm64/package.json').version;
241
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
241
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
243
243
  }
244
244
  return binding;
245
245
  }
@@ -262,8 +262,8 @@ function requireNative() {
262
262
  try {
263
263
  const binding = require('@lancedb/lancedb-freebsd-x64');
264
264
  const bindingPackageVersion = require('@lancedb/lancedb-freebsd-x64/package.json').version;
265
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
265
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
267
267
  }
268
268
  return binding;
269
269
  }
@@ -281,8 +281,8 @@ function requireNative() {
281
281
  try {
282
282
  const binding = require('@lancedb/lancedb-freebsd-arm64');
283
283
  const bindingPackageVersion = require('@lancedb/lancedb-freebsd-arm64/package.json').version;
284
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
285
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
284
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
285
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
286
286
  }
287
287
  return binding;
288
288
  }
@@ -306,8 +306,8 @@ function requireNative() {
306
306
  try {
307
307
  const binding = require('@lancedb/lancedb-linux-x64-musl');
308
308
  const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-musl/package.json').version;
309
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
311
311
  }
312
312
  return binding;
313
313
  }
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@lancedb/lancedb-linux-x64-gnu');
327
327
  const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-gnu/package.json').version;
328
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
328
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
330
330
  }
331
331
  return binding;
332
332
  }
@@ -346,8 +346,8 @@ function requireNative() {
346
346
  try {
347
347
  const binding = require('@lancedb/lancedb-linux-arm64-musl');
348
348
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-musl/package.json').version;
349
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
350
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
350
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
351
351
  }
352
352
  return binding;
353
353
  }
@@ -365,8 +365,8 @@ function requireNative() {
365
365
  try {
366
366
  const binding = require('@lancedb/lancedb-linux-arm64-gnu');
367
367
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-gnu/package.json').version;
368
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
369
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
368
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
369
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
370
370
  }
371
371
  return binding;
372
372
  }
@@ -386,8 +386,8 @@ function requireNative() {
386
386
  try {
387
387
  const binding = require('@lancedb/lancedb-linux-arm-musleabihf');
388
388
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-musleabihf/package.json').version;
389
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
390
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
389
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
390
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
391
391
  }
392
392
  return binding;
393
393
  }
@@ -405,8 +405,8 @@ function requireNative() {
405
405
  try {
406
406
  const binding = require('@lancedb/lancedb-linux-arm-gnueabihf');
407
407
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-gnueabihf/package.json').version;
408
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
409
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
408
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
409
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
410
410
  }
411
411
  return binding;
412
412
  }
@@ -426,8 +426,8 @@ function requireNative() {
426
426
  try {
427
427
  const binding = require('@lancedb/lancedb-linux-loong64-musl');
428
428
  const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-musl/package.json').version;
429
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
429
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
431
431
  }
432
432
  return binding;
433
433
  }
@@ -445,8 +445,8 @@ function requireNative() {
445
445
  try {
446
446
  const binding = require('@lancedb/lancedb-linux-loong64-gnu');
447
447
  const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-gnu/package.json').version;
448
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
449
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
448
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
449
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
450
450
  }
451
451
  return binding;
452
452
  }
@@ -466,8 +466,8 @@ function requireNative() {
466
466
  try {
467
467
  const binding = require('@lancedb/lancedb-linux-riscv64-musl');
468
468
  const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-musl/package.json').version;
469
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
470
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
469
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
470
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
471
471
  }
472
472
  return binding;
473
473
  }
@@ -485,8 +485,8 @@ function requireNative() {
485
485
  try {
486
486
  const binding = require('@lancedb/lancedb-linux-riscv64-gnu');
487
487
  const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-gnu/package.json').version;
488
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
489
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
488
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
489
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
490
490
  }
491
491
  return binding;
492
492
  }
@@ -505,8 +505,8 @@ function requireNative() {
505
505
  try {
506
506
  const binding = require('@lancedb/lancedb-linux-ppc64-gnu');
507
507
  const bindingPackageVersion = require('@lancedb/lancedb-linux-ppc64-gnu/package.json').version;
508
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
509
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
508
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
509
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
510
510
  }
511
511
  return binding;
512
512
  }
@@ -524,8 +524,8 @@ function requireNative() {
524
524
  try {
525
525
  const binding = require('@lancedb/lancedb-linux-s390x-gnu');
526
526
  const bindingPackageVersion = require('@lancedb/lancedb-linux-s390x-gnu/package.json').version;
527
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
528
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
527
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
528
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
529
529
  }
530
530
  return binding;
531
531
  }
@@ -548,8 +548,8 @@ function requireNative() {
548
548
  try {
549
549
  const binding = require('@lancedb/lancedb-openharmony-arm64');
550
550
  const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm64/package.json').version;
551
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
552
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
551
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
552
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
553
553
  }
554
554
  return binding;
555
555
  }
@@ -567,8 +567,8 @@ function requireNative() {
567
567
  try {
568
568
  const binding = require('@lancedb/lancedb-openharmony-x64');
569
569
  const bindingPackageVersion = require('@lancedb/lancedb-openharmony-x64/package.json').version;
570
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
571
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
570
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
571
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
572
572
  }
573
573
  return binding;
574
574
  }
@@ -586,8 +586,8 @@ function requireNative() {
586
586
  try {
587
587
  const binding = require('@lancedb/lancedb-openharmony-arm');
588
588
  const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm/package.json').version;
589
- if (bindingPackageVersion !== '0.28.0-beta.9' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
590
- throw new Error(`Native binding package version mismatch, expected 0.28.0-beta.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
589
+ if (bindingPackageVersion !== '0.29.1-beta.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
590
+ throw new Error(`Native binding package version mismatch, expected 0.29.1-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
591
591
  }
592
592
  return binding;
593
593
  }
@@ -657,6 +657,7 @@ module.exports.Connection = nativeBinding.Connection;
657
657
  module.exports.Index = nativeBinding.Index;
658
658
  module.exports.JsFullTextQuery = nativeBinding.JsFullTextQuery;
659
659
  module.exports.JsHeaderProvider = nativeBinding.JsHeaderProvider;
660
+ module.exports.NapiScannable = nativeBinding.NapiScannable;
660
661
  module.exports.NativeMergeInsertBuilder = nativeBinding.NativeMergeInsertBuilder;
661
662
  module.exports.PermutationBuilder = nativeBinding.PermutationBuilder;
662
663
  module.exports.Query = nativeBinding.Query;
package/dist/query.d.ts CHANGED
@@ -19,6 +19,11 @@ export interface QueryExecutionOptions {
19
19
  */
20
20
  timeoutMs?: number;
21
21
  }
22
+ export interface ColumnOrdering {
23
+ columnName: string;
24
+ ascending?: boolean;
25
+ nullsFirst?: boolean;
26
+ }
22
27
  /**
23
28
  * Options that control the behavior of a full text search
24
29
  */
@@ -201,6 +206,11 @@ export declare class StandardQueryBase<NativeQueryType extends NativeQuery | Nat
201
206
  * This is useful for pagination.
202
207
  */
203
208
  offset(offset: number): this;
209
+ /**
210
+ * Sort the results by the specified column(s).
211
+ * @returns This query builder.
212
+ */
213
+ orderBy(ordering: ColumnOrdering | ColumnOrdering[]): this;
204
214
  /**
205
215
  * Skip searching un-indexed data. This can make search faster, but will miss
206
216
  * any data that is not yet indexed.
package/dist/query.js CHANGED
@@ -332,6 +332,20 @@ class StandardQueryBase extends QueryBase {
332
332
  this.doCall((inner) => inner.offset(offset));
333
333
  return this;
334
334
  }
335
+ /**
336
+ * Sort the results by the specified column(s).
337
+ * @returns This query builder.
338
+ */
339
+ orderBy(ordering) {
340
+ const orderings = Array.isArray(ordering) ? ordering : [ordering];
341
+ const normalized = orderings.map((o) => ({
342
+ columnName: o.columnName,
343
+ ascending: o.ascending ?? true,
344
+ nullsFirst: o.nullsFirst ?? false,
345
+ }));
346
+ this.doCall((inner) => inner.orderBy(normalized));
347
+ return this;
348
+ }
335
349
  /**
336
350
  * Skip searching un-indexed data. This can make search faster, but will miss
337
351
  * any data that is not yet indexed.
@@ -0,0 +1,92 @@
1
+ import { Table as ArrowTable, RecordBatch, RecordBatchReader, Schema } from "apache-arrow";
2
+ import { NapiScannable } from "./native.js";
3
+ export interface ScannableOptions {
4
+ /** Hint about the number of rows. Not validated against the stream. */
5
+ numRows?: number;
6
+ /**
7
+ * Whether the source can be scanned more than once. Defaults to `true` for
8
+ * `fromTable` / `fromFactory` and `false` for `fromIterable` /
9
+ * `fromRecordBatchReader`.
10
+ */
11
+ rescannable?: boolean;
12
+ }
13
+ /**
14
+ * A data source that can be scanned as a stream of Arrow `RecordBatch`es.
15
+ *
16
+ * `Scannable` wraps the schema + optional row count + rescannable flag and
17
+ * a callback that yields batches one at a time. It is passed to consumers
18
+ * (e.g. `Table.add`, `createTable`, `mergeInsert` — follow-up work) that
19
+ * need to pull data without materializing the full dataset in JS memory.
20
+ *
21
+ * Batches cross the JS↔Rust boundary as Arrow IPC Stream messages; a fresh
22
+ * writer serializes each batch, and the Rust side decodes it with
23
+ * `arrow_ipc::reader::StreamReader`. One batch is in flight at a time.
24
+ */
25
+ export declare class Scannable {
26
+ readonly schema: Schema;
27
+ readonly numRows: number | null;
28
+ readonly rescannable: boolean;
29
+ /** @hidden */
30
+ private readonly native;
31
+ private constructor();
32
+ /** @hidden Access the native handle for passing through to Rust consumers. */
33
+ get inner(): NapiScannable;
34
+ /**
35
+ * Build a Scannable from an explicit schema and a factory that returns a
36
+ * fresh batch iterator on each call.
37
+ *
38
+ * The factory is invoked once per scan. Each iterator yields
39
+ * `RecordBatch`es matching the declared schema. Use this when you need
40
+ * direct control over the pull loop — for example, to wrap a streaming
41
+ * source whose batches are produced lazily.
42
+ *
43
+ * @param schema - The Arrow schema of the produced batches.
44
+ * @param factory - Called at the start of each scan to produce a batch
45
+ * iterator. Must be idempotent when `rescannable` is true.
46
+ * @param opts - Optional hints. `rescannable` defaults to `true`; set to
47
+ * `false` if calling `factory()` twice would not reproduce the same data.
48
+ */
49
+ static fromFactory(schema: Schema, factory: () => AsyncIterable<RecordBatch> | Iterable<RecordBatch> | AsyncIterator<RecordBatch> | Iterator<RecordBatch>, opts?: ScannableOptions): Promise<Scannable>;
50
+ /**
51
+ * Build a Scannable from an in-memory Arrow `Table`. Always rescannable;
52
+ * the table's batches are replayed on each scan.
53
+ *
54
+ * The table's row count is authoritative: `opts.numRows` must either be
55
+ * omitted or equal to `table.numRows`. `opts.rescannable` of `false` is
56
+ * rejected because in-memory Tables are always rescannable.
57
+ */
58
+ static fromTable(table: ArrowTable, opts?: ScannableOptions): Promise<Scannable>;
59
+ /**
60
+ * Build a Scannable from an iterable of `RecordBatch`es. `rescannable`
61
+ * defaults to `false`. Pass an explicit schema so the consumer can
62
+ * validate before any batch is pulled.
63
+ *
64
+ * `opts.rescannable: true` is honest for replayable iterables (Arrays,
65
+ * Sets, or custom iterables whose `[Symbol.iterator]()` returns a fresh
66
+ * iterator each call). It is rejected for one-shot iterables (generators,
67
+ * async generators, or already-an-iterator inputs) because their
68
+ * `[Symbol.iterator]()` returns the same exhausted object on the second
69
+ * scan. For replayable sources outside this shape, use
70
+ * `fromFactory(schema, () => createIter(), { rescannable: true })`.
71
+ *
72
+ * Note: when `opts.rescannable` is `true`, the constructor calls
73
+ * `[Symbol.iterator]()` once on the input to perform the structural check.
74
+ */
75
+ static fromIterable(schema: Schema, iter: AsyncIterable<RecordBatch> | Iterable<RecordBatch>, opts?: ScannableOptions): Promise<Scannable>;
76
+ /**
77
+ * Build a Scannable from an Arrow `RecordBatchReader`. A reader can only
78
+ * be consumed once; `rescannable` defaults to `false`.
79
+ *
80
+ * The reader must already be opened (via `.open()`) so its `.schema` is
81
+ * populated. `RecordBatchReader.from(...)` returns an unopened reader.
82
+ *
83
+ * `opts.rescannable: true` is rejected because `RecordBatchReader` is a
84
+ * self-iterator (its `[Symbol.iterator]()` returns itself), and this
85
+ * constructor does not call `reader.reset()` between scans, so a second
86
+ * scan would always see an exhausted reader. For genuinely replayable
87
+ * sources, use
88
+ * `fromFactory(schema, () => openReader(), { rescannable: true })`,
89
+ * which mints a fresh reader on each scan.
90
+ */
91
+ static fromRecordBatchReader(reader: RecordBatchReader, opts?: ScannableOptions): Promise<Scannable>;
92
+ }