feat(nodejs): expose dropViewAsync on the public connection

The napi binding returned the cleanup job, but `Connection` and
`LocalConnection` in `nodejs/lancedb/connection.ts` did not, so a Node caller
had no way to reach it: `dropView` waits and resolves to void.

Declared on the abstract `Connection` and implemented on `LocalConnection`,
wrapping the native handle in the exported `Job` the way
`dropMaterializedViewAsync` does.
This commit is contained in:
Jack Ye
2026-09-23 21:32:27 -07:00
parent 75eefedc4b
commit 1f3a24b594
+19 -2
View File
@@ -404,12 +404,25 @@ export abstract class Connection {
): Promise<ViewDescription>;
/**
* Drop the view named `name`.
* Drop the view named `name` and wait for its definition to be deleted.
*
* The tables it reads are untouched: a view holds no rows of its own.
* The tables it reads are untouched: a view holds no rows of its own. Use
* {@link dropViewAsync} to retain the cleanup job instead of waiting on it.
*/
abstract dropView(name: string, namespacePath?: string[]): Promise<void>;
/**
* Start dropping the view named `name` and return the job deleting its
* definition, without waiting for completion.
*
* The name is free before this resolves. When nothing was bound to it, the
* returned job is already finished and has no id.
*/
abstract dropViewAsync(
name: string,
namespacePath?: string[],
): Promise<Job>;
/**
* The names of the views in one namespace.
*
@@ -759,6 +772,10 @@ export class LocalConnection extends Connection {
return this.inner.dropView(name, namespacePath ?? []);
}
async dropViewAsync(name: string, namespacePath?: string[]): Promise<Job> {
return new Job(await this.inner.dropViewAsync(name, namespacePath ?? []));
}
async listViews(namespacePath?: string[]): Promise<string[]> {
return this.inner.listViews(namespacePath ?? []);
}