ci(node): check docs in CI (#2084)

* Make `npm run docs` fail if there are any warnings. This will catch
items missing from the API reference.
* Add a check in our CI to make sure `npm run dos` runs without warnings
and doesn't generate any new files (indicating it might be out-of-date.
* Hide constructors that aren't user facing.
* Remove unused enum `WriteMode`.

Closes #2068
This commit is contained in:
Will Jones
2025-01-30 16:06:06 -08:00
committed by GitHub
parent 25c17ebf4e
commit e05c0cd87e
59 changed files with 1287 additions and 597 deletions

View File

@@ -93,10 +93,19 @@ export interface FullTextSearchOptions {
columns?: string | string[];
}
/** Common methods supported by all query types */
/** Common methods supported by all query types
*
* @see {@link Query}
* @see {@link VectorQuery}
*
* @hideconstructor
*/
export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
implements AsyncIterable<RecordBatch>
{
/**
* @hidden
*/
protected constructor(
protected inner: NativeQueryType | Promise<NativeQueryType>,
) {
@@ -104,6 +113,9 @@ export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
}
// call a function on the inner (either a promise or the actual object)
/**
* @hidden
*/
protected doCall(fn: (inner: NativeQueryType) => void) {
if (this.inner instanceof Promise) {
this.inner = this.inner.then((inner) => {
@@ -132,7 +144,7 @@ export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
}
/**
* A filter statement to be applied to this query.
* @alias where
* @see where
* @deprecated Use `where` instead
*/
filter(predicate: string): this {
@@ -235,7 +247,7 @@ export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
* Skip searching un-indexed data. This can make search faster, but will miss
* any data that is not yet indexed.
*
* Use {@link lancedb.Table#optimize} to index all un-indexed data.
* Use {@link Table#optimize} to index all un-indexed data.
*/
fastSearch(): this {
this.doCall((inner: NativeQueryType) => inner.fastSearch());
@@ -254,6 +266,9 @@ export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
return this;
}
/**
* @hidden
*/
protected nativeExecute(
options?: Partial<QueryExecutionOptions>,
): Promise<NativeBatchIterator> {
@@ -281,6 +296,9 @@ export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
return new RecordBatchIterator(this.nativeExecute(options));
}
/**
* @hidden
*/
// biome-ignore lint/suspicious/noExplicitAny: skip
[Symbol.asyncIterator](): AsyncIterator<RecordBatch<any>> {
const promise = this.nativeExecute();
@@ -343,8 +361,15 @@ export interface ExecutableQuery {}
* A builder used to construct a vector search
*
* This builder can be reused to execute the query many times.
*
* @see {@link Query#nearestTo}
*
* @hideconstructor
*/
export class VectorQuery extends QueryBase<NativeVectorQuery> {
/**
* @hidden
*/
constructor(inner: NativeVectorQuery | Promise<NativeVectorQuery>) {
super(inner);
}
@@ -570,8 +595,16 @@ export class VectorQuery extends QueryBase<NativeVectorQuery> {
}
}
/** A builder for LanceDB queries. */
/** A builder for LanceDB queries.
*
* @see {@link Table#query}, {@link Table#search}
*
* @hideconstructor
*/
export class Query extends QueryBase<NativeQuery> {
/**
* @hidden
*/
constructor(tbl: NativeTable) {
super(tbl.query());
}