@lancedb/lancedb 0.42.0-beta.20 → 0.42.0-beta.22

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/prewarm.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.decodePrewarmDataResult = decodePrewarmDataResult;
6
+ exports.decodePrewarmDataPlan = decodePrewarmDataPlan;
6
7
  /** @internal */
7
8
  function decodePrewarmDataResult(value) {
8
9
  // Rust validates the typed wire result before handing it to JavaScript.
@@ -17,3 +18,20 @@ function decodePrewarmDataResult(value) {
17
18
  bytesRead: result.bytes_read ?? null,
18
19
  };
19
20
  }
21
+ /** @internal */
22
+ function decodePrewarmDataPlan(value) {
23
+ // Rust validates the versioned response before handing it to JavaScript.
24
+ const result = value;
25
+ return {
26
+ tableVersion: result.table_version,
27
+ plan: result.plan,
28
+ pruning: {
29
+ mode: result.pruning.mode,
30
+ inputFragments: result.pruning.input_fragments,
31
+ selectedFragments: result.pruning.selected_fragments,
32
+ prunedFragments: result.pruning.pruned_fragments,
33
+ selectedRowRanges: result.pruning.selected_row_ranges ?? null,
34
+ fallbackReason: result.pruning.fallback_reason ?? null,
35
+ },
36
+ };
37
+ }
@@ -0,0 +1,44 @@
1
+ /** Evidence collected from one Function worker's Python execution session. */
2
+ export type FunctionProfileKind = "cpu" | "gpu" | "memory";
3
+ /** A capture's lifecycle, independent of its parent refresh job. */
4
+ export type FunctionProfileStatus = "pending" | "capturing" | "complete" | "failed";
5
+ /** Options for requesting a Function worker capture. */
6
+ export interface FunctionProfileOptions {
7
+ /** CPU samples, retained Python allocations, or PyTorch CUDA activities. */
8
+ kind?: FunctionProfileKind;
9
+ /** 1–30 seconds for CPU/memory, default 10; 1–5 for GPU, default 5. */
10
+ durationSeconds?: number;
11
+ /** Python execution session within the worker; default zero. */
12
+ sessionSlot?: number;
13
+ }
14
+ /** Client-side controls while waiting for a Function worker capture. */
15
+ export interface FunctionProfileWaitOptions {
16
+ /** Maximum wait including HTTP requests and sleeps; defaults to 60,000 ms. */
17
+ timeoutMs?: number;
18
+ /** Delay between status requests; defaults to 2,000 ms and must be positive. */
19
+ pollIntervalMs?: number;
20
+ }
21
+ /**
22
+ * A capture identity and status snapshot. Keep profileId for retained lookup
23
+ * after the Function refresh completes. Timestamp fields are epoch milliseconds.
24
+ */
25
+ export interface FunctionProfile {
26
+ readonly profileId: string;
27
+ readonly jobId: string;
28
+ readonly workerId: string;
29
+ readonly executionEpoch: number;
30
+ readonly sessionSlot: number;
31
+ readonly kind: FunctionProfileKind;
32
+ readonly durationSeconds: number;
33
+ readonly status: FunctionProfileStatus;
34
+ readonly requestedAtMillis: number;
35
+ readonly deadlineAtMillis: number;
36
+ /** Upper retention bound; job scratch reclamation can remove artifacts sooner. */
37
+ readonly expiresAtMillis: number;
38
+ readonly completedAtMillis: number | null;
39
+ /** The server's capture failure reason; this is not a refresh job failure. */
40
+ readonly error: string | null;
41
+ readonly artifactId: string | null;
42
+ }
43
+ export declare function decodeFunctionProfile(value: string): FunctionProfile;
44
+ export declare function validateProfileOptions(options: object, names: string[]): void;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.decodeFunctionProfile = decodeFunctionProfile;
6
+ exports.validateProfileOptions = validateProfileOptions;
7
+ function decodeFunctionProfile(value) {
8
+ const data = JSON.parse(value);
9
+ return {
10
+ profileId: data.profile_id,
11
+ jobId: data.job_id,
12
+ workerId: data.worker_id,
13
+ executionEpoch: data.execution_epoch,
14
+ sessionSlot: data.session_slot,
15
+ kind: data.kind,
16
+ durationSeconds: data.duration_seconds,
17
+ status: data.status,
18
+ requestedAtMillis: data.requested_at_millis,
19
+ deadlineAtMillis: data.deadline_at_millis,
20
+ expiresAtMillis: data.expires_at_millis,
21
+ completedAtMillis: data.completed_at_millis,
22
+ error: data.error,
23
+ artifactId: data.artifact_id,
24
+ };
25
+ }
26
+ function validateProfileOptions(options, names) {
27
+ if (typeof options !== "object" ||
28
+ options === null ||
29
+ Array.isArray(options)) {
30
+ throw new TypeError("profiling expects an options object");
31
+ }
32
+ for (const key of Object.keys(options)) {
33
+ if (!names.includes(key)) {
34
+ throw new TypeError(`Unknown profiling option: ${key}`);
35
+ }
36
+ }
37
+ }
package/dist/sql.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { type RecordBatchLike, type TableLike } from "./arrow";
2
+ /** Scalar SQL values. Use a one-row Arrow table for explicit Arrow types. */
3
+ export type QueryParameterValue = string | number | bigint | boolean | Date | Uint8Array | null;
4
+ /** Values for `$1`/`$name` placeholders, sent separately from SQL text.
5
+ * Arrays bind by position; objects bind by name. Arrow columns bind both ways.
6
+ * Safe integers and bigint use Int64; fractional numbers use Float64.
7
+ * Arrow input preserves explicit types.
8
+ */
9
+ export type QueryParameters = readonly QueryParameterValue[] | Readonly<Record<string, QueryParameterValue>> | TableLike | RecordBatchLike;
10
+ /** @internal */
11
+ export declare function toParameterBuffer(parameters: QueryParameters): Promise<Buffer>;
package/dist/sql.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.toParameterBuffer = toParameterBuffer;
6
+ const arrow_1 = require("./arrow");
7
+ const sanitize_1 = require("./sanitize");
8
+ /** @internal */
9
+ async function toParameterBuffer(parameters) {
10
+ let table;
11
+ if ("schema" in parameters &&
12
+ parameters.schema !== null &&
13
+ typeof parameters.schema === "object" &&
14
+ "fields" in parameters.schema) {
15
+ const arrow = parameters;
16
+ table = (0, sanitize_1.sanitizeTable)("batches" in arrow ? arrow : { schema: arrow.schema, batches: [arrow] });
17
+ }
18
+ else {
19
+ const entries = Array.isArray(parameters)
20
+ ? parameters.map((value, index) => [String(index + 1), value])
21
+ : Object.entries(parameters);
22
+ const columns = Object.fromEntries(entries.map(([name, input]) => {
23
+ let value = input;
24
+ let type;
25
+ if (value === null)
26
+ type = new arrow_1.Null();
27
+ else if (typeof value === "string")
28
+ type = new arrow_1.Utf8();
29
+ else if (typeof value === "boolean")
30
+ type = new arrow_1.Bool();
31
+ else if (typeof value === "number") {
32
+ if (!Number.isFinite(value) ||
33
+ (Number.isInteger(value) && !Number.isSafeInteger(value))) {
34
+ throw new Error("Numeric parameters must be finite and integers must be safe; use bigint for Int64");
35
+ }
36
+ type = Number.isInteger(value) ? new arrow_1.Int64() : new arrow_1.Float64();
37
+ if (Number.isInteger(value))
38
+ value = BigInt(value);
39
+ }
40
+ else if (typeof value === "bigint") {
41
+ if (value < -(1n << 63n) || value >= 1n << 63n) {
42
+ throw new Error("bigint parameters must fit Int64");
43
+ }
44
+ type = new arrow_1.Int64();
45
+ }
46
+ else if (value instanceof Date && Number.isFinite(value.getTime())) {
47
+ type = new arrow_1.TimestampMillisecond();
48
+ }
49
+ else if (value instanceof Uint8Array)
50
+ type = new arrow_1.Binary();
51
+ else
52
+ throw new Error("Query parameters must be scalar values or a one-row Arrow table");
53
+ return [name, (0, arrow_1.vectorFromArray)([value], type)];
54
+ }));
55
+ table = new arrow_1.Table(columns);
56
+ }
57
+ if (table.numRows !== 1) {
58
+ throw new Error(`Query parameters must contain exactly one row, got ${table.numRows}`);
59
+ }
60
+ return Buffer.from(await arrow_1.RecordBatchFileWriter.writeAll(table).toUint8Array());
61
+ }
package/dist/table.d.ts CHANGED
@@ -1,12 +1,14 @@
1
+ import { CleanupOptions, CleanupPlan, CleanupResult } from "./cleanup";
1
2
  import { CompactionResult } from "./compaction";
2
- import { PrewarmDataResult } from "./prewarm";
3
- import { Table as ArrowTable, Data, DataType, Field, IntoVector, MultiVector, Schema } from "./arrow";
3
+ import { PrewarmDataPlan, PrewarmDataResult } from "./prewarm";
4
+ import { Table as ArrowTable, Data, DataType, Field, IntoVector, MultiVector, RecordBatch, Schema } from "./arrow";
4
5
  import { BlobFile, BlobRangeRequest, BlobReadOptions } from "./blob";
5
6
  import { IndexOptions } from "./indices";
6
7
  import { Job } from "./job";
7
8
  import { MergeInsertBuilder } from "./merge";
8
- import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, FunctionErrors, FunctionErrorsOptions, IndexConfig, IndexStatistics, JobFailureInfo, Branches as NativeBranches, OptimizeStats, RTEStats, RefreshColumnOptions, RefreshColumnResult, RefreshMaterializedViewResult, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
9
+ import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, FunctionErrors, FunctionErrorsOptions, IndexConfig, IndexStatistics, JobFailureInfo, Branches as NativeBranches, TableDelta as NativeTableDelta, OptimizeStats, RTEStats, RefreshColumnOptions, RefreshColumnResult, RefreshMaterializedViewResult, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
9
10
  import { AutoQuery, FullTextQuery, Query, TakeQuery, VectorQuery } from "./query";
11
+ import { QueryParameters } from "./sql";
10
12
  import { IntoSql } from "./util";
11
13
  export { IndexConfig } from "./native";
12
14
  export { TableShardStats, SsTableStats, RTEStats, MemtableStats, } from "./native";
@@ -97,12 +99,14 @@ export interface UpdateOptions {
97
99
  */
98
100
  where: string;
99
101
  }
100
- /** Settings for submitting a durable remote data-cache prewarm job. */
102
+ /** Settings for data-cache prewarm submissions and metadata previews. */
101
103
  export interface PrewarmDataOptions {
102
104
  /** Lance field paths to warm; omitted or empty means every column. */
103
105
  columns?: string[];
104
106
  /** A single SQL predicate for conservative metadata pruning. */
105
107
  filter?: string;
108
+ /** Typed positional or named filter values, sent separately from SQL. */
109
+ parameters?: QueryParameters;
106
110
  /** Positive per-executor concurrency, at most 4294967295. */
107
111
  concurrency?: number;
108
112
  }
@@ -162,6 +166,37 @@ export interface Version {
162
166
  timestamp: Date;
163
167
  metadata: Record<string, string>;
164
168
  }
169
+ /**
170
+ * One endpoint of a table delta: a positive version number/bigint or a tag on
171
+ * the table handle's current branch.
172
+ *
173
+ * Use a `bigint` when the version may exceed `Number.MAX_SAFE_INTEGER`.
174
+ * Strings are always tags.
175
+ */
176
+ export type DeltaVersion = number | bigint | string;
177
+ /** A committed transaction in a table delta range. */
178
+ export interface TableDeltaTransaction {
179
+ /** The version the transaction was based on. Exact u64 value. */
180
+ readVersion: bigint;
181
+ uuid: string;
182
+ operation: string;
183
+ tag?: string;
184
+ transactionProperties?: Record<string, string>;
185
+ }
186
+ /**
187
+ * A streaming table-delta reader.
188
+ *
189
+ * `schema()` is available before consuming the stream, including when the
190
+ * range is empty. The stream yields Arrow record batches without
191
+ * materializing the full result.
192
+ *
193
+ * A reader owns one native cursor. It is single-use:
194
+ * `[Symbol.asyncIterator]()` returns the same iterator, concurrent pulls are
195
+ * serialized, and `return()` releases the native stream on early drop.
196
+ */
197
+ export interface TableDeltaReader extends AsyncIterable<RecordBatch>, AsyncIterator<RecordBatch> {
198
+ schema(): Promise<Schema>;
199
+ }
165
200
  /** Token produced by the tokenizer configured on a full-text search index. */
166
201
  export interface FtsToken {
167
202
  /** Token text after tokenizer filters have been applied. */
@@ -491,11 +526,29 @@ export declare abstract class Table {
491
526
  *
492
527
  * @example
493
528
  * const job = await table.prewarmDataAsync({
494
- * columns: ["video"], filter: "quality > 0.7", concurrency: 4,
529
+ * columns: ["video"], filter: "quality > $minimum",
530
+ * parameters: { minimum: 0.7 }, concurrency: 4,
495
531
  * });
496
532
  * await job.wait();
497
533
  */
498
534
  abstract prewarmDataAsync(options?: PrewarmDataOptions): Promise<Job<PrewarmDataResult>>;
535
+ /**
536
+ * Preview prewarm with the same options as {@link prewarmDataAsync}, without
537
+ * submitting a warming job. Requires LanceDB Enterprise with structured SQL
538
+ * previews, table Select and database/namespace Usage. Reads metadata and
539
+ * returns the source version, readable plan, and conservative pruning summary.
540
+ * A later submission plans its own snapshot. Historical and Embedded handles
541
+ * are unsupported. Unknown measurements remain null.
542
+ * Custom table implementations can override this method; its default rejects
543
+ * with an unsupported-operation error.
544
+ *
545
+ * @example
546
+ * const plan = await table.explainPrewarmData({
547
+ * columns: ["video"], filter: "quality > $minimum", parameters: {minimum: 0.7},
548
+ * });
549
+ * console.log(plan.pruning.selectedFragments);
550
+ */
551
+ explainPrewarmData(_options?: PrewarmDataOptions): Promise<PrewarmDataPlan>;
499
552
  /**
500
553
  * Waits for asynchronous indexing to complete on the table.
501
554
  *
@@ -712,26 +765,18 @@ export declare abstract class Table {
712
765
  * `REFRESH COLUMN ... WHERE ... WITH (...)` form: `where` narrows the rows,
713
766
  * `errorPolicy`, `maxFailedFraction`, `maxFailedRows`, `rowTimeoutSeconds`
714
767
  * and `initTimeoutSeconds` govern failing rows. `batchSize`, `gpuClass`,
715
- * `maxConcurrency`, `resourceBudget`, `supervisorResources`,
768
+ * `maxConcurrency`, `totalCpuMillis`, `totalMemoryBytes`, `supervisorResources`,
716
769
  * `planningWorkers` and `maxExecutorProcessesPerWorker` size registered
717
770
  * Function refreshes. `retryPolicy` overrides user-code retries only when
718
771
  * repeating partial work is safe; set `maxAttempts: 1` to disable retries.
719
772
  * `maxConcurrency` overrides the registered default for this logical
720
773
  * execution only and is a positive integer; it is not an account-wide
721
- * quota. A `resourceBudget` requires `cpuMillis` and
722
- * `memoryBytes`; its `gpuCount` defaults to zero for a CPU-only Function.
723
- * `supervisorResources` and each `planningWorkers.resources` entry require
724
- * positive `cpuMillis`, `memoryBytes` and `ephemeralStorageBytes`.
725
- * `planningWorkers` also requires positive `maxWorkers`,
726
- * `rowsPerWorker` and `fragmentsPerWorker`.
727
- * The budget applies only to this explicit refresh and does not configure
728
- * a later automatic refresh.
729
- * `gpuCount` at the top level is the shorthand that preserves the
730
- * deployment defaults for CPU and memory, and cannot be combined with
731
- * `resourceBudget`. `numWorkers` applies only to expression columns; use
732
- * `resourceBudget` for registered Functions. All are LanceDB Enterprise
733
- * only; a LanceDB Embedded refresh rejects every option other than
734
- * `batchSize`, `gpuClass` and `gpuCount`.
774
+ * quota. `totalCpuMillis`, `totalMemoryBytes`, and `totalGpuCount` override
775
+ * their corresponding execution-wide resource limits independently. Unset
776
+ * values inherit column defaults, then Function defaults, then deployment
777
+ * defaults. A zero GPU limit is valid for CPU-only Functions.
778
+ * `supervisorResources` and `planningWorkers.resources` are per-pod sizes.
779
+ * `numWorkers` applies only to expression columns.
735
780
  * `publicationIntervalRows` opts into publishing completed Function split
736
781
  * ranges once their accumulated unpublished rows reach the threshold.
737
782
  * It must be a positive safe integer and requires non-Blob Function outputs.
@@ -741,10 +786,8 @@ export declare abstract class Table {
741
786
  * ```ts
742
787
  * const job = await table.refreshColumnAsync("embedding", {
743
788
  * where: "published_at > '2026-01-01'",
744
- * resourceBudget: {
745
- * cpuMillis: 8000,
746
- * memoryBytes: 16 * 1024 ** 3,
747
- * },
789
+ * totalCpuMillis: 8000,
790
+ * totalMemoryBytes: 16 * 1024 ** 3,
748
791
  * maxConcurrency: 4,
749
792
  * publicationIntervalRows: 10000,
750
793
  * errorPolicy: "skip",
@@ -799,7 +842,7 @@ export declare abstract class Table {
799
842
  * it: rejects tables that carry no view definition.
800
843
  * @ignore
801
844
  */
802
- abstract refreshMaterializedView(sourceVersion?: number, full?: boolean): Promise<RefreshMaterializedViewResult>;
845
+ abstract refreshMaterializedView(sourceVersion?: number, full?: boolean, totalCpuMillis?: number, totalMemoryBytes?: number, totalGpuCount?: number, gpuClass?: string, gpuCount?: number): Promise<RefreshMaterializedViewResult>;
803
846
  /** @ignore */
804
847
  abstract materializedViewDefinition(): Promise<string>;
805
848
  /**
@@ -912,6 +955,45 @@ export declare abstract class Table {
912
955
  * @returns {Promise<RTEWriteSpec | undefined>}
913
956
  */
914
957
  abstract getRTESpec(): Promise<RTEWriteSpec | undefined>;
958
+ /**
959
+ * Read the stored overrides for a remote Enterprise table.
960
+ *
961
+ * Overrides configure background behavior such as automatic compaction,
962
+ * cleanup, and reindex execution. Keys use the server's snake_case names.
963
+ * Returns an empty object when no overrides are set. Local tables are unsupported.
964
+ * Custom table implementations inherit a default rejection unless they override
965
+ * this method.
966
+ */
967
+ getTableOverrides(): Promise<Record<string, unknown>>;
968
+ /**
969
+ * Recursively merge overrides into a remote Enterprise table's stored overrides.
970
+ *
971
+ * Fetches the current overrides, merges nested objects locally, then sends the
972
+ * complete replacement using REST PUT. Other values replace existing values;
973
+ * unrelated fields from the read snapshot are preserved. This read-modify-write
974
+ * is not atomic: concurrent edits can be overwritten, even to unrelated fields.
975
+ * Coordinate writers when concurrent edits must be preserved. An empty update
976
+ * only reads and returns the current overrides.
977
+ *
978
+ * Unlike this SDK method, CLI `set` and REST PUT replace the overrides object
979
+ * without merging. Use {@link Table.resetTableOverrides} to clear all overrides.
980
+ * Local tables and custom table implementations without override support reject
981
+ * this operation.
982
+ *
983
+ * @example
984
+ * ```ts
985
+ * await table.updateTableOverrides({
986
+ * job_types: { compaction: { enabled: false } },
987
+ * });
988
+ * ```
989
+ */
990
+ updateTableOverrides(overrides: Record<string, unknown>): Promise<Record<string, unknown>>;
991
+ /**
992
+ * Clear a remote Enterprise table's overrides and return an empty object.
993
+ * Local tables and custom table implementations without override support reject
994
+ * this operation.
995
+ */
996
+ resetTableOverrides(): Promise<Record<string, unknown>>;
915
997
  /**
916
998
  * Drain and close any cached RTE shard writers held for this table.
917
999
  *
@@ -1055,6 +1137,50 @@ export declare abstract class Table {
1055
1137
  * out state and the read_consistency_interval, if any, will apply.
1056
1138
  */
1057
1139
  abstract restore(): Promise<void>;
1140
+ /**
1141
+ * Compare two persisted versions or same-branch tags on an Embedded table.
1142
+ *
1143
+ * `fromVersion` is exclusive and `toVersion` is inclusive. Omitting
1144
+ * `toVersion` uses the version currently visible through this handle,
1145
+ * including a checked-out version. The endpoints are fixed when the delta is
1146
+ * created.
1147
+ *
1148
+ * Row readers require stable row IDs at both endpoints. Create the table with
1149
+ * `storageOptions: { new_table_enable_stable_row_ids: "true" }` to enable
1150
+ * them. `listTransactions()` works without stable row IDs.
1151
+ *
1152
+ * Row readers reject ranges containing a Restore, or ranges whose transaction
1153
+ * history cannot prove they are restore-free. Recompute the checkpoint with a
1154
+ * full rescan and reinitialize it at the range end version.
1155
+ *
1156
+ * LanceDB Enterprise tables reject this operation.
1157
+ *
1158
+ * @example
1159
+ * const delta = await table.delta("baseline");
1160
+ * const reader = delta.insertedRows();
1161
+ * console.log((await reader.schema()).fields.map((field) => field.name));
1162
+ * for await (const batch of reader) {
1163
+ * console.log(batch.getChild("id")?.toJSON());
1164
+ * }
1165
+ * console.log(await delta.listTransactions());
1166
+ */
1167
+ delta(fromVersion: DeltaVersion, toVersion?: DeltaVersion): Promise<TableDelta>;
1168
+ /**
1169
+ * Submit durable remote cleanup through SQL VACUUM and return after acceptance.
1170
+ * Requires table Ownership and parent Usage. Retention inherits from the table
1171
+ * then deployment when omitted. Local/historical handles are unsupported.
1172
+ * Before submission, disable/drain automatic cleanup and prevent other cleanup,
1173
+ * tag/branch publication and restore until completion, including direct clients.
1174
+ * Coordination is not enforced by the server. Cancellation cannot undo deletion
1175
+ * or prove storage I/O stopped. Preview is available without deletion.
1176
+ * Wait timeout leaves work running; save the ID and reopen with db.openJob().
1177
+ * @example
1178
+ * const job = await table.cleanupAsync({ minAgeSeconds: 604800 });
1179
+ * const result = await job.wait({ timeoutMs: 600000 });
1180
+ */
1181
+ cleanupAsync(_options?: CleanupOptions): Promise<Job<CleanupResult>>;
1182
+ /** Preview version deletion without creating a job. Execution re-evaluates current state. */
1183
+ explainCleanup(_options?: CleanupOptions): Promise<CleanupPlan>;
1058
1184
  /**
1059
1185
  * Submit remote compaction and return its durable job after acceptance.
1060
1186
  *
@@ -1199,6 +1325,7 @@ export declare class LocalTable extends Table {
1199
1325
  prewarmData(options?: PrewarmDataOptions): Promise<void>;
1200
1326
  prewarmData(columns?: string[]): Promise<void>;
1201
1327
  prewarmDataAsync(options?: PrewarmDataOptions): Promise<Job<PrewarmDataResult>>;
1328
+ explainPrewarmData(options?: PrewarmDataOptions): Promise<PrewarmDataPlan>;
1202
1329
  waitForIndex(indexNames: string[], timeoutSeconds: number): Promise<void>;
1203
1330
  takeOffsets(offsets: number[]): TakeQuery;
1204
1331
  takeRowIds(rowIds: readonly (bigint | number)[]): TakeQuery;
@@ -1218,7 +1345,7 @@ export declare class LocalTable extends Table {
1218
1345
  functionColumnStatuses(column?: string): Promise<FunctionColumnStatus[]>;
1219
1346
  functionColumnStatus(column: string): Promise<FunctionColumnStatus>;
1220
1347
  waitFresh(column: string, timeoutSeconds?: number): Promise<FunctionColumnStatus>;
1221
- refreshMaterializedView(sourceVersion?: number, full?: boolean): Promise<RefreshMaterializedViewResult>;
1348
+ refreshMaterializedView(sourceVersion?: number, full?: boolean, totalCpuMillis?: number, totalMemoryBytes?: number, totalGpuCount?: number, gpuClass?: string, gpuCount?: number): Promise<RefreshMaterializedViewResult>;
1222
1349
  materializedViewDefinition(): Promise<string>;
1223
1350
  alterColumns(columnAlterations: ColumnAlteration[]): Promise<AlterColumnsResult>;
1224
1351
  updateFieldMetadata(updates: FieldMetadataUpdate[]): Promise<UpdateFieldMetadataResult>;
@@ -1227,6 +1354,9 @@ export declare class LocalTable extends Table {
1227
1354
  enableRTE(spec: RTEWriteSpec): Promise<void>;
1228
1355
  disableRTE(): Promise<void>;
1229
1356
  getRTESpec(): Promise<RTEWriteSpec | undefined>;
1357
+ getTableOverrides(): Promise<Record<string, unknown>>;
1358
+ updateTableOverrides(overrides: Record<string, unknown>): Promise<Record<string, unknown>>;
1359
+ resetTableOverrides(): Promise<Record<string, unknown>>;
1230
1360
  closeRTEWriters(): Promise<void>;
1231
1361
  flushRTE(): Promise<void>;
1232
1362
  compactRTE(): Promise<void>;
@@ -1235,12 +1365,15 @@ export declare class LocalTable extends Table {
1235
1365
  version(): Promise<number>;
1236
1366
  checkout(version: number | string): Promise<void>;
1237
1367
  checkoutLatest(): Promise<void>;
1368
+ delta(fromVersion: DeltaVersion, toVersion?: DeltaVersion): Promise<TableDelta>;
1238
1369
  listVersions(): Promise<Version[]>;
1239
1370
  restore(): Promise<void>;
1240
1371
  tags(): Promise<Tags>;
1241
1372
  branches(): Promise<Branches>;
1242
1373
  currentBranch(): string | null;
1243
1374
  compactAsync(options?: CompactionOptions): Promise<Job<CompactionResult>>;
1375
+ cleanupAsync(options?: CleanupOptions): Promise<Job<CleanupResult>>;
1376
+ explainCleanup(options?: CleanupOptions): Promise<CleanupPlan>;
1244
1377
  optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
1245
1378
  listIndices(): Promise<IndexConfig[]>;
1246
1379
  tokenize(query: string, options: TokenizeTableOptions): Promise<FtsToken[]>;
@@ -1383,6 +1516,44 @@ export interface CherryPickResult {
1383
1516
  preview: CherryPickPreview;
1384
1517
  mainVersionAfter?: number;
1385
1518
  }
1519
+ /**
1520
+ * Options for creating a branch from a named source.
1521
+ */
1522
+ export interface CreateBranchOptions {
1523
+ /**
1524
+ * Tag to fork from. The tag keeps the branch and version it points to.
1525
+ * Cannot be combined with `fromRef` or `fromVersion`.
1526
+ */
1527
+ fromTag: string;
1528
+ }
1529
+ /**
1530
+ * A handle for reading changes between two pinned table versions.
1531
+ *
1532
+ * Created by {@link Table.delta}. Endpoints are fixed at creation; later writes
1533
+ * or tag moves do not change this delta.
1534
+ */
1535
+ export declare class TableDelta {
1536
+ #private;
1537
+ /**
1538
+ * Construct a table-delta handle. Internal use only.
1539
+ * @hidden
1540
+ */
1541
+ constructor(inner: NativeTableDelta);
1542
+ /** The exclusive start version, as an exact u64 bigint. */
1543
+ get beginVersion(): bigint;
1544
+ /** The inclusive end version, as an exact u64 bigint. */
1545
+ get endVersion(): bigint;
1546
+ /** Stream rows inserted in `(beginVersion, endVersion]`. */
1547
+ insertedRows(): TableDeltaReader;
1548
+ /** Stream rows updated in `(beginVersion, endVersion]`. */
1549
+ updatedRows(): TableDeltaReader;
1550
+ /** Stream inserted and updated rows in `(beginVersion, endVersion]`. */
1551
+ upsertedRows(): TableDeltaReader;
1552
+ /** Stream deleted row IDs. Each batch has one `_rowid: uint64` column. */
1553
+ deletedRowIds(): TableDeltaReader;
1554
+ /** List readable transactions committed in `(beginVersion, endVersion]`. */
1555
+ listTransactions(): Promise<TableDeltaTransaction[]>;
1556
+ }
1386
1557
  /**
1387
1558
  * Branch manager for a {@link Table}.
1388
1559
  *
@@ -1398,6 +1569,18 @@ export declare class Branches {
1398
1569
  constructor(inner: NativeBranches);
1399
1570
  /** List all branches, mapping name to branch metadata. */
1400
1571
  list(): Promise<Record<string, BranchContents>>;
1572
+ /**
1573
+ * Create a branch from a tag and return a handle scoped to it.
1574
+ *
1575
+ * @param name Name of the new branch.
1576
+ * @param options Named source. `fromTag` keeps the tag's branch and version.
1577
+ * @example
1578
+ * ```typescript
1579
+ * const branches = await table.branches();
1580
+ * const branch = await branches.create("exp", { fromTag: "baseline" });
1581
+ * ```
1582
+ */
1583
+ create(name: string, options: CreateBranchOptions): Promise<Table>;
1401
1584
  /**
1402
1585
  * Create a branch and return a handle scoped to it.
1403
1586
  *