@lancedb/lancedb 0.30.1-beta.1 → 0.31.0-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.
@@ -52,6 +52,20 @@ export interface CreateTableOptions {
52
52
  embeddingFunction?: EmbeddingFunctionConfig;
53
53
  }
54
54
  export interface OpenTableOptions {
55
+ /**
56
+ * Open the table scoped to this branch instead of the default branch.
57
+ *
58
+ * Reads and writes on the returned table operate in the branch's context.
59
+ */
60
+ branch?: string;
61
+ /**
62
+ * Open the table pinned to this version, producing a read-only view.
63
+ *
64
+ * Composes with {@link OpenTableOptions.branch}: when both are set, opens
65
+ * that branch at the version; otherwise opens `main` at the version. Call
66
+ * `checkoutLatest` to return to a writable state.
67
+ */
68
+ version?: number;
55
69
  /**
56
70
  * Configuration for object storage.
57
71
  *
@@ -69,7 +69,20 @@ class LocalConnection extends Connection {
69
69
  }
70
70
  async openTable(name, namespacePath, options) {
71
71
  const innerTable = await this.inner.openTable(name, namespacePath ?? [], cleanseStorageOptions(options?.storageOptions), options?.indexCacheSize);
72
- return new table_1.LocalTable(innerTable);
72
+ let table = new table_1.LocalTable(innerTable);
73
+ // "main" is the default branch, so treat it as no branch. On a real branch,
74
+ // scope and pin in one step (yielding "version V of branch B"); otherwise
75
+ // pin the version, if any, against main.
76
+ const branch = options?.branch != null && options.branch !== "main"
77
+ ? options.branch
78
+ : undefined;
79
+ if (branch != null) {
80
+ table = await (await table.branches()).checkout(branch, options?.version);
81
+ }
82
+ else if (options?.version != null) {
83
+ await table.checkout(options.version);
84
+ }
85
+ return table;
73
86
  }
74
87
  async cloneTable(targetTableName, sourceUri, options) {
75
88
  const innerTable = await this.inner.cloneTable(targetTableName, sourceUri, options?.targetNamespacePath ?? [], options?.sourceVersion ?? null, options?.sourceTag ?? null, options?.isShallow ?? true);
package/dist/index.d.ts CHANGED
@@ -2,13 +2,13 @@ import { Connection } from "./connection";
2
2
  import { ConnectNamespaceOptions, ConnectionOptions, Session } from "./native.js";
3
3
  import { HeaderProvider } from "./header";
4
4
  export { JsHeaderProvider as NativeJsHeaderProvider } from "./native.js";
5
- export { AddColumnsSql, ConnectionOptions, ConnectNamespaceOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, TlsConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, MergeResult, AddResult, AddColumnsResult, AlterColumnsResult, UpdateFieldMetadataResult, DeleteResult, DropColumnsResult, UpdateResult, SplitCalculatedOptions, SplitRandomOptions, SplitHashOptions, SplitSequentialOptions, ShuffleOptions, } from "./native.js";
5
+ export { AddColumnsSql, ConnectionOptions, ConnectNamespaceOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, TlsConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, BranchContents, MergeResult, AddResult, AddColumnsResult, AlterColumnsResult, UpdateFieldMetadataResult, DeleteResult, DropColumnsResult, UpdateResult, SplitCalculatedOptions, SplitRandomOptions, SplitHashOptions, SplitSequentialOptions, ShuffleOptions, } from "./native.js";
6
6
  export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
7
7
  export { Connection, CreateTableOptions, TableNamesOptions, OpenTableOptions, ListNamespacesOptions, CreateNamespaceOptions, DropNamespaceOptions, ListNamespacesResponse, CreateNamespaceResponse, DropNamespaceResponse, DescribeNamespaceResponse, RenameTableOptions, } from "./connection";
8
8
  export { Session } from "./native.js";
9
9
  export { ExecutableQuery, Query, QueryBase, VectorQuery, TakeQuery, QueryExecutionOptions, ColumnOrdering, FullTextSearchOptions, RecordBatchIterator, FullTextQuery, MatchQuery, PhraseQuery, BoostQuery, MultiMatchQuery, BooleanQuery, FullTextQueryType, Operator, Occur, } from "./query";
10
10
  export { Index, IndexOptions, IvfPqOptions, IvfRqOptions, IvfFlatOptions, HnswPqOptions, HnswSqOptions, FtsOptions, } from "./indices";
11
- export { Table, AddDataOptions, UpdateOptions, OptimizeOptions, Version, WriteProgress, LsmWriteSpec, ColumnAlteration, FieldMetadataUpdate, } from "./table";
11
+ export { Table, Branches, AddDataOptions, UpdateOptions, OptimizeOptions, Version, WriteProgress, LsmWriteSpec, ColumnAlteration, FieldMetadataUpdate, } from "./table";
12
12
  export { HeaderProvider, StaticHeaderProvider, OAuthHeaderProvider, TokenResponse, } from "./header";
13
13
  export { MergeInsertBuilder, WriteExecutionOptions } from "./merge";
14
14
  export * as embedding from "./embedding";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthHeaderProvider = exports.StaticHeaderProvider = exports.HeaderProvider = exports.Table = exports.Index = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.TakeQuery = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Session = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.TagContents = exports.Tags = exports.NativeJsHeaderProvider = void 0;
5
+ exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthHeaderProvider = exports.StaticHeaderProvider = exports.HeaderProvider = exports.Branches = exports.Table = exports.Index = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.TakeQuery = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Session = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.NativeJsHeaderProvider = void 0;
6
6
  exports.connect = connect;
7
7
  exports.connectNamespace = connectNamespace;
8
8
  const connection_1 = require("./connection");
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "NativeJsHeaderProvider", { enumerable: true, get
13
13
  var native_js_3 = require("./native.js");
14
14
  Object.defineProperty(exports, "Tags", { enumerable: true, get: function () { return native_js_3.Tags; } });
15
15
  Object.defineProperty(exports, "TagContents", { enumerable: true, get: function () { return native_js_3.TagContents; } });
16
+ Object.defineProperty(exports, "BranchContents", { enumerable: true, get: function () { return native_js_3.BranchContents; } });
16
17
  var arrow_1 = require("./arrow");
17
18
  Object.defineProperty(exports, "makeArrowTable", { enumerable: true, get: function () { return arrow_1.makeArrowTable; } });
18
19
  Object.defineProperty(exports, "MakeArrowTableOptions", { enumerable: true, get: function () { return arrow_1.MakeArrowTableOptions; } });
@@ -39,6 +40,7 @@ var indices_1 = require("./indices");
39
40
  Object.defineProperty(exports, "Index", { enumerable: true, get: function () { return indices_1.Index; } });
40
41
  var table_1 = require("./table");
41
42
  Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return table_1.Table; } });
43
+ Object.defineProperty(exports, "Branches", { enumerable: true, get: function () { return table_1.Branches; } });
42
44
  var header_1 = require("./header");
43
45
  Object.defineProperty(exports, "HeaderProvider", { enumerable: true, get: function () { return header_1.HeaderProvider; } });
44
46
  Object.defineProperty(exports, "StaticHeaderProvider", { enumerable: true, get: function () { return header_1.StaticHeaderProvider; } });
package/dist/indices.d.ts CHANGED
@@ -613,6 +613,14 @@ export declare class Index {
613
613
  * using an underlying bitmap index.
614
614
  */
615
615
  static labelList(): Index;
616
+ /**
617
+ * Create an FM-Index.
618
+ *
619
+ * An FM-Index is a scalar index on string or binary columns that accelerates
620
+ * substring search, i.e. `contains(col, 'needle')`. Unlike the tokenized
621
+ * full-text-search index, it matches arbitrary substrings of the raw bytes.
622
+ */
623
+ static fm(): Index;
616
624
  /**
617
625
  * Create a full text search index
618
626
  *
package/dist/indices.js CHANGED
@@ -115,6 +115,16 @@ class Index {
115
115
  static labelList() {
116
116
  return new Index(native_1.Index.labelList());
117
117
  }
118
+ /**
119
+ * Create an FM-Index.
120
+ *
121
+ * An FM-Index is a scalar index on string or binary columns that accelerates
122
+ * substring search, i.e. `contains(col, 'needle')`. Unlike the tokenized
123
+ * full-text-search index, it matches arbitrary substrings of the raw bytes.
124
+ */
125
+ static fm() {
126
+ return new Index(native_1.Index.fm());
127
+ }
118
128
  /**
119
129
  * Create a full text search index
120
130
  *
package/dist/native.d.ts CHANGED
@@ -1,5 +1,18 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ export declare class BranchContents {
4
+ parentBranch?: string
5
+ parentVersion: number
6
+ manifestSize: number
7
+ }
8
+
9
+ export declare class Branches {
10
+ list(): Promise<Record<string, BranchContents>>
11
+ create(name: string, fromRef?: string | undefined | null, fromVersion?: number | undefined | null): Promise<Table>
12
+ checkout(name: string, version?: number | undefined | null): Promise<Table>
13
+ delete(name: string): Promise<void>
14
+ }
15
+
3
16
  export declare class Connection {
4
17
  /** Create a new Connection instance from the given URI. */
5
18
  static new(uri: string, options: ConnectionOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise<Connection>
@@ -47,6 +60,7 @@ export declare class Index {
47
60
  static btree(): Index
48
61
  static bitmap(): Index
49
62
  static labelList(): Index
63
+ static fm(): Index
50
64
  static fts(withPosition?: boolean | undefined | null, baseTokenizer?: string | undefined | null, language?: string | undefined | null, maxTokenLength?: number | undefined | null, lowerCase?: boolean | undefined | null, stem?: boolean | undefined | null, removeStopWords?: boolean | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null): Index
51
65
  static hnswPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null, m?: number | undefined | null, efConstruction?: number | undefined | null): Index
52
66
  static hnswSq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null, m?: number | undefined | null, efConstruction?: number | undefined | null): Index
@@ -229,6 +243,9 @@ export declare class Table {
229
243
  listVersions(): Promise<Array<Version>>
230
244
  restore(): Promise<void>
231
245
  tags(): Promise<Tags>
246
+ branches(): Promise<Branches>
247
+ /** The branch this handle is scoped to, or `null` for the main branch. */
248
+ currentBranch(): string | null
232
249
  optimize(olderThanMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
233
250
  listIndices(): Promise<Array<IndexConfig>>
234
251
  indexStats(indexName: string): Promise<IndexStatistics | null>
@@ -542,6 +559,61 @@ export interface IndexConfig {
542
559
  * be more columns to represent composite indices.
543
560
  */
544
561
  columns: Array<string>
562
+ /**
563
+ * The UUID of the first segment of the index.
564
+ *
565
+ * `undefined` for remote tables, which do not yet surface this.
566
+ */
567
+ indexUuid?: string
568
+ /**
569
+ * The protobuf type URL, a precise type identifier for the index.
570
+ *
571
+ * `undefined` for remote tables.
572
+ */
573
+ typeUrl?: string
574
+ /**
575
+ * When the index was created.
576
+ *
577
+ * `undefined` for remote tables or indices created before timestamps were tracked.
578
+ */
579
+ createdAt?: Date
580
+ /**
581
+ * The number of rows indexed, across all segments.
582
+ *
583
+ * `undefined` for remote tables.
584
+ */
585
+ numIndexedRows?: number
586
+ /**
587
+ * The number of rows not yet covered by this index.
588
+ *
589
+ * `undefined` for remote tables.
590
+ */
591
+ numUnindexedRows?: number
592
+ /**
593
+ * The total size in bytes of all index files across all segments.
594
+ *
595
+ * `undefined` for remote tables or indices without size tracking.
596
+ */
597
+ sizeBytes?: number
598
+ /**
599
+ * The number of segments that make up the index.
600
+ *
601
+ * `undefined` for remote tables.
602
+ */
603
+ numSegments?: number
604
+ /**
605
+ * The on-disk index format version.
606
+ *
607
+ * `undefined` for remote tables.
608
+ */
609
+ indexVersion?: number
610
+ /**
611
+ * Index-type-specific details parsed as a JavaScript object.
612
+ *
613
+ * Falls back to a raw string if JSON parsing fails. `undefined` for
614
+ * remote tables or when details are unavailable.
615
+ */
616
+ indexDetails?: any
545
617
  }
546
618
 
547
619
  export interface IndexStatistics {
@@ -559,11 +631,6 @@ export interface IndexStatistics {
559
631
  distanceType?: string
560
632
  /** The number of parts this index is split into. */
561
633
  numIndices?: number
562
- /**
563
- * The KMeans loss value of the index,
564
- * it is only present for vector indices.
565
- */
566
- loss?: number
567
634
  }
568
635
 
569
636
  export interface ListNamespacesResponse {
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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
79
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
98
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
123
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
142
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
162
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
181
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
204
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
222
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
241
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
265
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
284
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
328
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
368
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
389
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
408
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
429
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
448
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
469
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
488
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
508
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
527
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
551
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
570
+ if (bindingPackageVersion !== '0.31.0-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.31.0-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.30.1-beta.1' && 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.30.1-beta.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
589
+ if (bindingPackageVersion !== '0.31.0-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.31.0-beta.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
591
591
  }
592
592
  return binding;
593
593
  }
@@ -604,7 +604,15 @@ function requireNative() {
604
604
  }
605
605
  }
606
606
  nativeBinding = requireNative();
607
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
607
+ // NAPI_RS_FORCE_WASI is a tri-state flag:
608
+ // unset / any other value → native binding preferred, WASI is only a fallback
609
+ // 'true' → force WASI fallback even if native loaded
610
+ // 'error' → force WASI and throw if no WASI binding is found
611
+ // Treating any non-empty string as truthy (the historical behavior) meant
612
+ // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
613
+ // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
614
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error';
615
+ if (!nativeBinding || forceWasi) {
608
616
  let wasiBinding = null;
609
617
  let wasiBindingError = null;
610
618
  try {
@@ -612,17 +620,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
612
620
  nativeBinding = wasiBinding;
613
621
  }
614
622
  catch (err) {
615
- if (process.env.NAPI_RS_FORCE_WASI) {
623
+ if (forceWasi) {
616
624
  wasiBindingError = err;
617
625
  }
618
626
  }
619
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
627
+ if (!nativeBinding || forceWasi) {
620
628
  try {
621
629
  wasiBinding = require('@lancedb/lancedb-wasm32-wasi');
622
630
  nativeBinding = wasiBinding;
623
631
  }
624
632
  catch (err) {
625
- if (process.env.NAPI_RS_FORCE_WASI) {
633
+ if (forceWasi) {
626
634
  if (!wasiBindingError) {
627
635
  wasiBindingError = err;
628
636
  }
@@ -653,6 +661,8 @@ if (!nativeBinding) {
653
661
  throw new Error(`Failed to load native binding`);
654
662
  }
655
663
  module.exports = nativeBinding;
664
+ module.exports.BranchContents = nativeBinding.BranchContents;
665
+ module.exports.Branches = nativeBinding.Branches;
656
666
  module.exports.Connection = nativeBinding.Connection;
657
667
  module.exports.Index = nativeBinding.Index;
658
668
  module.exports.JsFullTextQuery = nativeBinding.JsFullTextQuery;
package/dist/table.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Table as ArrowTable, Data, DataType, Field, IntoVector, MultiVector, Schema } from "./arrow";
2
2
  import { IndexOptions } from "./indices";
3
3
  import { MergeInsertBuilder } from "./merge";
4
- import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, DeleteResult, DropColumnsResult, IndexConfig, IndexStatistics, OptimizeStats, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
4
+ import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, IndexConfig, IndexStatistics, Branches as NativeBranches, OptimizeStats, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
5
5
  import { FullTextQuery, Query, TakeQuery, VectorQuery } from "./query";
6
6
  import { IntoSql } from "./util";
7
7
  export { IndexConfig } from "./native";
@@ -557,6 +557,20 @@ export declare abstract class Table {
557
557
  * ```
558
558
  */
559
559
  abstract tags(): Promise<Tags>;
560
+ /**
561
+ * Get the branch manager for this table.
562
+ *
563
+ * Branches are isolated, writable lines of history forked from another
564
+ * branch (or version). Writes on a branch do not affect `main`.
565
+ */
566
+ abstract branches(): Promise<Branches>;
567
+ /**
568
+ * The branch this table handle is scoped to, or `null` for the main branch.
569
+ *
570
+ * A handle returned by {@link Branches.create} or {@link Branches.checkout}
571
+ * reports the branch it targets; a handle opened normally reports `null`.
572
+ */
573
+ abstract currentBranch(): string | null;
560
574
  /**
561
575
  * Restore the table to the currently checked out version
562
576
  *
@@ -674,6 +688,8 @@ export declare class LocalTable extends Table {
674
688
  listVersions(): Promise<Version[]>;
675
689
  restore(): Promise<void>;
676
690
  tags(): Promise<Tags>;
691
+ branches(): Promise<Branches>;
692
+ currentBranch(): string | null;
677
693
  optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
678
694
  listIndices(): Promise<IndexConfig[]>;
679
695
  toArrow(): Promise<ArrowTable>;
@@ -753,3 +769,37 @@ export interface FieldMetadataUpdate {
753
769
  /** If true, replace the field's entire metadata map instead of merging. */
754
770
  replace?: boolean;
755
771
  }
772
+ /**
773
+ * Branch manager for a {@link Table}.
774
+ *
775
+ * Unlike tags, `create` and `checkout` return a new {@link Table} handle scoped
776
+ * to the branch; writes on it do not affect `main`.
777
+ */
778
+ export declare class Branches {
779
+ #private;
780
+ /**
781
+ * Construct a Branches manager. Internal use only.
782
+ * @hidden
783
+ */
784
+ constructor(inner: NativeBranches);
785
+ /** List all branches, mapping name to branch metadata. */
786
+ list(): Promise<Record<string, BranchContents>>;
787
+ /**
788
+ * Create a branch and return a handle scoped to it.
789
+ *
790
+ * @param name Name of the new branch.
791
+ * @param fromRef Source branch to fork from. Defaults to `main`.
792
+ * @param fromVersion A specific version on `fromRef`. Defaults to latest.
793
+ */
794
+ create(name: string, fromRef?: string, fromVersion?: number): Promise<Table>;
795
+ /**
796
+ * Check out an existing branch and return a handle scoped to it.
797
+ *
798
+ * With `version` set, the returned handle is pinned to that version of the
799
+ * branch (a read-only, detached view); otherwise it tracks the branch's
800
+ * latest and stays writable.
801
+ */
802
+ checkout(name: string, version?: number): Promise<Table>;
803
+ /** Delete a branch. */
804
+ delete(name: string): Promise<void>;
805
+ }
package/dist/table.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.LocalTable = exports.Table = void 0;
5
+ exports.Branches = exports.LocalTable = exports.Table = void 0;
6
6
  const arrow_1 = require("./arrow");
7
7
  const registry_1 = require("./embedding/registry");
8
8
  const merge_1 = require("./merge");
@@ -313,6 +313,12 @@ class LocalTable extends Table {
313
313
  async tags() {
314
314
  return await this.inner.tags();
315
315
  }
316
+ async branches() {
317
+ return new Branches(await this.inner.branches());
318
+ }
319
+ currentBranch() {
320
+ return this.inner.currentBranch() ?? null;
321
+ }
316
322
  async optimize(options) {
317
323
  let cleanupOlderThanMs;
318
324
  if (options?.cleanupOlderThan !== undefined &&
@@ -375,3 +381,48 @@ class LocalTable extends Table {
375
381
  }
376
382
  }
377
383
  exports.LocalTable = LocalTable;
384
+ /**
385
+ * Branch manager for a {@link Table}.
386
+ *
387
+ * Unlike tags, `create` and `checkout` return a new {@link Table} handle scoped
388
+ * to the branch; writes on it do not affect `main`.
389
+ */
390
+ class Branches {
391
+ #inner;
392
+ /**
393
+ * Construct a Branches manager. Internal use only.
394
+ * @hidden
395
+ */
396
+ constructor(inner) {
397
+ this.#inner = inner;
398
+ }
399
+ /** List all branches, mapping name to branch metadata. */
400
+ async list() {
401
+ return await this.#inner.list();
402
+ }
403
+ /**
404
+ * Create a branch and return a handle scoped to it.
405
+ *
406
+ * @param name Name of the new branch.
407
+ * @param fromRef Source branch to fork from. Defaults to `main`.
408
+ * @param fromVersion A specific version on `fromRef`. Defaults to latest.
409
+ */
410
+ async create(name, fromRef, fromVersion) {
411
+ return new LocalTable(await this.#inner.create(name, fromRef, fromVersion));
412
+ }
413
+ /**
414
+ * Check out an existing branch and return a handle scoped to it.
415
+ *
416
+ * With `version` set, the returned handle is pinned to that version of the
417
+ * branch (a read-only, detached view); otherwise it tracks the branch's
418
+ * latest and stays writable.
419
+ */
420
+ async checkout(name, version) {
421
+ return new LocalTable(await this.#inner.checkout(name, version));
422
+ }
423
+ /** Delete a branch. */
424
+ async delete(name) {
425
+ return await this.#inner.delete(name);
426
+ }
427
+ }
428
+ exports.Branches = Branches;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.30.1-beta.1",
14
+ "version": "0.31.0-beta.0",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "@aws-sdk/client-s3": "3.1003.0",
44
44
  "@biomejs/biome": "^1.7.3",
45
45
  "@jest/globals": "^29.7.0",
46
- "@napi-rs/cli": "3.5.1",
46
+ "@napi-rs/cli": "3.7.0",
47
47
  "@types/axios": "^0.14.0",
48
48
  "@types/jest": "^29.1.2",
49
49
  "@types/node": "22.7.4",
@@ -102,13 +102,15 @@
102
102
  "reflect-metadata": "^0.2.2"
103
103
  },
104
104
  "optionalDependencies": {
105
- "@lancedb/lancedb-darwin-arm64": "0.30.1-beta.1",
106
- "@lancedb/lancedb-linux-x64-gnu": "0.30.1-beta.1",
107
- "@lancedb/lancedb-linux-arm64-gnu": "0.30.1-beta.1",
108
- "@lancedb/lancedb-linux-x64-musl": "0.30.1-beta.1",
109
- "@lancedb/lancedb-linux-arm64-musl": "0.30.1-beta.1",
110
- "@lancedb/lancedb-win32-x64-msvc": "0.30.1-beta.1",
111
- "@lancedb/lancedb-win32-arm64-msvc": "0.30.1-beta.1"
105
+ "@huggingface/transformers": "3.0.2",
106
+ "openai": "4.29.2",
107
+ "@lancedb/lancedb-darwin-arm64": "0.31.0-beta.0",
108
+ "@lancedb/lancedb-linux-x64-gnu": "0.31.0-beta.0",
109
+ "@lancedb/lancedb-linux-arm64-gnu": "0.31.0-beta.0",
110
+ "@lancedb/lancedb-linux-x64-musl": "0.31.0-beta.0",
111
+ "@lancedb/lancedb-linux-arm64-musl": "0.31.0-beta.0",
112
+ "@lancedb/lancedb-win32-x64-msvc": "0.31.0-beta.0",
113
+ "@lancedb/lancedb-win32-arm64-msvc": "0.31.0-beta.0"
112
114
  },
113
115
  "peerDependencies": {
114
116
  "apache-arrow": ">=15.0.0 <=18.1.0"