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

@@ -78,7 +78,7 @@ export abstract class EmbeddingFunction<
*
* @param optionsOrDatatype - The options for the field or the datatype
*
* @see {@link lancedb.LanceSchema}
* @see {@link LanceSchema}
*/
sourceField(
optionsOrDatatype: Partial<FieldOptions> | DataType,
@@ -100,9 +100,9 @@ export abstract class EmbeddingFunction<
/**
* vectorField is used in combination with `LanceSchema` to provide a declarative data model
*
* @param options - The options for the field
* @param optionsOrDatatype - The options for the field
*
* @see {@link lancedb.LanceSchema}
* @see {@link LanceSchema}
*/
vectorField(
optionsOrDatatype?: Partial<FieldOptions> | DataType,

View File

@@ -6,7 +6,13 @@ import { sanitizeType } from "../sanitize";
import { EmbeddingFunction } from "./embedding_function";
import { EmbeddingFunctionConfig, getRegistry } from "./registry";
export { EmbeddingFunction, TextEmbeddingFunction } from "./embedding_function";
export {
FieldOptions,
EmbeddingFunction,
TextEmbeddingFunction,
FunctionOptions,
EmbeddingFunctionConstructor,
} from "./embedding_function";
export * from "./registry";

View File

@@ -7,11 +7,11 @@ import {
} from "./embedding_function";
import "reflect-metadata";
type CreateReturnType<T> = T extends { init: () => Promise<void> }
export type CreateReturnType<T> = T extends { init: () => Promise<void> }
? Promise<T>
: T;
interface EmbeddingFunctionCreate<T extends EmbeddingFunction> {
export interface EmbeddingFunctionCreate<T extends EmbeddingFunction> {
create(options?: T["TOptions"]): CreateReturnType<T>;
}
@@ -33,8 +33,6 @@ export class EmbeddingFunctionRegistry {
/**
* Register an embedding function
* @param name The name of the function
* @param func The function to register
* @throws Error if the function is already registered
*/
register<