@lancedb/lancedb 0.39.0-beta.8 → 0.40.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.
- package/dist/arrow.d.ts +16 -0
- package/dist/arrow.js +19 -0
- package/dist/catalog.d.ts +46 -0
- package/dist/catalog.js +63 -0
- package/dist/connection.d.ts +25 -5
- package/dist/connection.js +7 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -1
- package/dist/materialized_view.d.ts +3 -1
- package/dist/materialized_view.js +10 -4
- package/dist/native.d.ts +158 -3
- package/dist/native.js +54 -52
- package/dist/oauth.d.ts +205 -0
- package/dist/oauth.js +97 -1
- package/dist/table.d.ts +6 -2
- package/dist/table.js +4 -7
- package/package.json +8 -8
package/dist/arrow.d.ts
CHANGED
|
@@ -14,6 +14,22 @@ export type FieldLike = Field | {
|
|
|
14
14
|
nullable: boolean;
|
|
15
15
|
metadata?: Map<string, string>;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Create an Arrow field backed by LanceDB's JSON extension type.
|
|
19
|
+
*
|
|
20
|
+
* @param name - The field name.
|
|
21
|
+
* @param nullable - Whether the field accepts null values.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { connect, makeJsonField } from "@lancedb/lancedb";
|
|
25
|
+
* import { Schema } from "apache-arrow";
|
|
26
|
+
*
|
|
27
|
+
* const schema = new Schema([makeJsonField("metadata")]);
|
|
28
|
+
* const db = await connect("/path/to/database");
|
|
29
|
+
* await db.createTable("items", [{ metadata: '{"source":"api"}' }], { schema });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function makeJsonField(name: string, nullable?: boolean): Field;
|
|
17
33
|
export type DataLike = import("apache-arrow").Data | {
|
|
18
34
|
type: any;
|
|
19
35
|
length: number;
|
package/dist/arrow.js
CHANGED
|
@@ -17,6 +17,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.MakeArrowTableOptions = exports.VectorColumnOptions = void 0;
|
|
20
|
+
exports.makeJsonField = makeJsonField;
|
|
20
21
|
exports.isMultiVector = isMultiVector;
|
|
21
22
|
exports.isIntoVector = isIntoVector;
|
|
22
23
|
exports.extractVectorBuffer = extractVectorBuffer;
|
|
@@ -62,6 +63,24 @@ const registry_1 = require("./embedding/registry");
|
|
|
62
63
|
const sanitize_1 = require("./sanitize");
|
|
63
64
|
const schema_1 = require("./schema");
|
|
64
65
|
__exportStar(require("apache-arrow"), exports);
|
|
66
|
+
/**
|
|
67
|
+
* Create an Arrow field backed by LanceDB's JSON extension type.
|
|
68
|
+
*
|
|
69
|
+
* @param name - The field name.
|
|
70
|
+
* @param nullable - Whether the field accepts null values.
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { connect, makeJsonField } from "@lancedb/lancedb";
|
|
74
|
+
* import { Schema } from "apache-arrow";
|
|
75
|
+
*
|
|
76
|
+
* const schema = new Schema([makeJsonField("metadata")]);
|
|
77
|
+
* const db = await connect("/path/to/database");
|
|
78
|
+
* await db.createTable("items", [{ metadata: '{"source":"api"}' }], { schema });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
function makeJsonField(name, nullable = true) {
|
|
82
|
+
return new apache_arrow_1.Field(name, new apache_arrow_1.Utf8(), nullable, new Map([["ARROW:extension:name", "arrow.json"]]));
|
|
83
|
+
}
|
|
65
84
|
function isMultiVector(value) {
|
|
66
85
|
return Array.isArray(value) && isIntoVector(value[0]);
|
|
67
86
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Connection } from "./connection";
|
|
2
|
+
import { HeaderProvider } from "./header";
|
|
3
|
+
import { ListDatabasesResponse, Catalog as NativeCatalog, CatalogOptions as NativeCatalogOptions } from "./native.js";
|
|
4
|
+
import { OAuthConfig } from "./oauth";
|
|
5
|
+
/** Options shared by a catalog and the database connections it returns. */
|
|
6
|
+
export interface CatalogOptions extends Omit<NativeCatalogOptions, "oauthConfig"> {
|
|
7
|
+
oauthConfig?: OAuthConfig;
|
|
8
|
+
/** Called for each request to supply authentication headers. */
|
|
9
|
+
headerProvider?: HeaderProvider | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
10
|
+
}
|
|
11
|
+
export type { ListDatabasesResponse } from "./native.js";
|
|
12
|
+
/** A remote catalog manages databases through the server's root namespace. */
|
|
13
|
+
export declare class Catalog {
|
|
14
|
+
private readonly inner;
|
|
15
|
+
/** @hidden */
|
|
16
|
+
constructor(inner: NativeCatalog);
|
|
17
|
+
/** The root namespace endpoint. */
|
|
18
|
+
get uri(): string;
|
|
19
|
+
/** Create a database, or open an existing database when existOk is true. */
|
|
20
|
+
createDatabase(name: string, options?: {
|
|
21
|
+
existOk?: boolean;
|
|
22
|
+
}): Promise<Connection>;
|
|
23
|
+
/** Connect to an existing database by its logical name. */
|
|
24
|
+
connectDatabase(name: string): Promise<Connection>;
|
|
25
|
+
/** Drop an empty database. The server rejects nonempty databases. */
|
|
26
|
+
dropDatabase(name: string, options?: {
|
|
27
|
+
ignoreMissing?: boolean;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
/** List one page of databases; pass pageToken from a response for the next page. */
|
|
30
|
+
listDatabases(options?: {
|
|
31
|
+
limit?: number;
|
|
32
|
+
pageToken?: string;
|
|
33
|
+
}): Promise<ListDatabasesResponse>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Connect to an HTTP(S) catalog endpoint. Catalog requests omit database-selection
|
|
37
|
+
* headers; opened database connections inherit authentication and client options.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const catalog = await connectCatalog("https://my-server.example", { apiKey: "secret" });
|
|
42
|
+
* const db = await catalog.createDatabase("analytics", { existOk: true });
|
|
43
|
+
* const page = await catalog.listDatabases({ limit: 20 });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function connectCatalog(endpoint: string, options?: CatalogOptions): Promise<Catalog>;
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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.Catalog = void 0;
|
|
6
|
+
exports.connectCatalog = connectCatalog;
|
|
7
|
+
const connection_1 = require("./connection");
|
|
8
|
+
const native_js_1 = require("./native.js");
|
|
9
|
+
/** A remote catalog manages databases through the server's root namespace. */
|
|
10
|
+
class Catalog {
|
|
11
|
+
inner;
|
|
12
|
+
/** @hidden */
|
|
13
|
+
constructor(inner) {
|
|
14
|
+
this.inner = inner;
|
|
15
|
+
}
|
|
16
|
+
/** The root namespace endpoint. */
|
|
17
|
+
get uri() {
|
|
18
|
+
return this.inner.uri;
|
|
19
|
+
}
|
|
20
|
+
/** Create a database, or open an existing database when existOk is true. */
|
|
21
|
+
async createDatabase(name, options = {}) {
|
|
22
|
+
return new connection_1.LocalConnection(await this.inner.createDatabase(name, options.existOk));
|
|
23
|
+
}
|
|
24
|
+
/** Connect to an existing database by its logical name. */
|
|
25
|
+
async connectDatabase(name) {
|
|
26
|
+
return new connection_1.LocalConnection(await this.inner.connectDatabase(name));
|
|
27
|
+
}
|
|
28
|
+
/** Drop an empty database. The server rejects nonempty databases. */
|
|
29
|
+
async dropDatabase(name, options = {}) {
|
|
30
|
+
await this.inner.dropDatabase(name, options.ignoreMissing);
|
|
31
|
+
}
|
|
32
|
+
/** List one page of databases; pass pageToken from a response for the next page. */
|
|
33
|
+
async listDatabases(options = {}) {
|
|
34
|
+
if (options.limit !== undefined &&
|
|
35
|
+
(!Number.isInteger(options.limit) ||
|
|
36
|
+
options.limit <= 0 ||
|
|
37
|
+
options.limit > 2147483647)) {
|
|
38
|
+
throw new Error("Database list limit must be an integer between 1 and 2147483647");
|
|
39
|
+
}
|
|
40
|
+
return this.inner.listDatabases(options.limit, options.pageToken);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.Catalog = Catalog;
|
|
44
|
+
/**
|
|
45
|
+
* Connect to an HTTP(S) catalog endpoint. Catalog requests omit database-selection
|
|
46
|
+
* headers; opened database connections inherit authentication and client options.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const catalog = await connectCatalog("https://my-server.example", { apiKey: "secret" });
|
|
51
|
+
* const db = await catalog.createDatabase("analytics", { existOk: true });
|
|
52
|
+
* const page = await catalog.listDatabases({ limit: 20 });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async function connectCatalog(endpoint, options = {}) {
|
|
56
|
+
const { headerProvider, ...nativeOptions } = options;
|
|
57
|
+
const provider = headerProvider
|
|
58
|
+
? new native_js_1.JsHeaderProvider(async () => typeof headerProvider === "function"
|
|
59
|
+
? headerProvider()
|
|
60
|
+
: headerProvider.getHeaders())
|
|
61
|
+
: undefined;
|
|
62
|
+
return new Catalog(await native_js_1.Catalog.new(endpoint, nativeOptions, provider));
|
|
63
|
+
}
|
package/dist/connection.d.ts
CHANGED
|
@@ -256,18 +256,19 @@ export declare abstract class Connection {
|
|
|
256
256
|
/**
|
|
257
257
|
* Define a materialized view named `name` over the table `source`.
|
|
258
258
|
*
|
|
259
|
-
* The view is
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
259
|
+
* The view is populated before creation returns. Set `withNoData` to create
|
|
260
|
+
* only its definition and empty backing table. The view is a normal table:
|
|
261
|
+
* it can be queried, indexed and searched, and it appears in `tableNames`.
|
|
262
|
+
* The source table must have stable row ids (create it with
|
|
263
263
|
* the `newTableEnableStableRowIds` storage option); they keep the view's
|
|
264
264
|
* provenance valid across source compactions and cannot be enabled after
|
|
265
|
-
* a table exists.
|
|
265
|
+
* a table exists.
|
|
266
266
|
*/
|
|
267
267
|
abstract createMaterializedView(name: string, source: string, options?: {
|
|
268
268
|
select?: MaterializedViewSelect;
|
|
269
269
|
where?: string;
|
|
270
270
|
limit?: number;
|
|
271
|
+
withNoData?: boolean;
|
|
271
272
|
}): Promise<MaterializedView>;
|
|
272
273
|
/**
|
|
273
274
|
* Open the materialized view named `name`.
|
|
@@ -281,6 +282,22 @@ export declare abstract class Connection {
|
|
|
281
282
|
* Found by reading every table's schema, so this costs an open per table.
|
|
282
283
|
*/
|
|
283
284
|
abstract listMaterializedViews(): Promise<string[]>;
|
|
285
|
+
/**
|
|
286
|
+
* Drop the materialized view named `name`.
|
|
287
|
+
*
|
|
288
|
+
* The view may become unavailable before physical cleanup finishes. Use
|
|
289
|
+
* {@link dropMaterializedViewAsync} to retain and wait for the cleanup job.
|
|
290
|
+
*
|
|
291
|
+
* Rejects a table that exists but is not a materialized view.
|
|
292
|
+
*/
|
|
293
|
+
abstract dropMaterializedView(name: string, namespacePath?: string[]): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Start dropping the materialized view named `name` and return its cleanup
|
|
296
|
+
* job without waiting for completion.
|
|
297
|
+
*
|
|
298
|
+
* Rejects a table that exists but is not a materialized view.
|
|
299
|
+
*/
|
|
300
|
+
abstract dropMaterializedViewAsync(name: string, namespacePath?: string[]): Promise<Job>;
|
|
284
301
|
abstract openTable(name: string, namespacePath?: string[], options?: Partial<OpenTableOptions>): Promise<Table>;
|
|
285
302
|
/**
|
|
286
303
|
* Creates a new Table and initialize it with new data.
|
|
@@ -460,9 +477,12 @@ export declare class LocalConnection extends Connection {
|
|
|
460
477
|
select?: MaterializedViewSelect;
|
|
461
478
|
where?: string;
|
|
462
479
|
limit?: number;
|
|
480
|
+
withNoData?: boolean;
|
|
463
481
|
}): Promise<MaterializedView>;
|
|
464
482
|
openMaterializedView(name: string): Promise<MaterializedView>;
|
|
465
483
|
listMaterializedViews(): Promise<string[]>;
|
|
484
|
+
dropMaterializedView(name: string, namespacePath?: string[]): Promise<void>;
|
|
485
|
+
dropMaterializedViewAsync(name: string, namespacePath?: string[]): Promise<Job>;
|
|
466
486
|
listTables(namespacePathOrOptions?: string[] | Partial<ListTablesOptions>, options?: Partial<ListTablesOptions>): Promise<ListTablesResponse>;
|
|
467
487
|
openTable(name: string, namespacePath?: string[], options?: Partial<OpenTableOptions>): Promise<Table>;
|
|
468
488
|
cloneTable(targetTableName: string, sourceUri: string, options?: {
|
package/dist/connection.js
CHANGED
|
@@ -71,7 +71,7 @@ class LocalConnection extends Connection {
|
|
|
71
71
|
}
|
|
72
72
|
async createMaterializedView(name, source, options) {
|
|
73
73
|
(0, materialized_view_1.validateNonNegativeInteger)(options?.limit, "limit");
|
|
74
|
-
const innerTable = await this.inner.createMaterializedView(name, source, (0, materialized_view_1.normalizeSelect)(options?.select), options?.where, options?.limit);
|
|
74
|
+
const innerTable = await this.inner.createMaterializedView(name, source, (0, materialized_view_1.normalizeSelect)(options?.select), options?.where, options?.limit, options?.withNoData ?? false);
|
|
75
75
|
return new materialized_view_1.MaterializedView(new table_1.LocalTable(innerTable));
|
|
76
76
|
}
|
|
77
77
|
async openMaterializedView(name) {
|
|
@@ -81,6 +81,12 @@ class LocalConnection extends Connection {
|
|
|
81
81
|
async listMaterializedViews() {
|
|
82
82
|
return await this.inner.listMaterializedViews();
|
|
83
83
|
}
|
|
84
|
+
async dropMaterializedView(name, namespacePath) {
|
|
85
|
+
return this.inner.dropMaterializedView(name, namespacePath ?? []);
|
|
86
|
+
}
|
|
87
|
+
async dropMaterializedViewAsync(name, namespacePath) {
|
|
88
|
+
return new job_1.Job(await this.inner.dropMaterializedViewAsync(name, namespacePath ?? []));
|
|
89
|
+
}
|
|
84
90
|
async listTables(namespacePathOrOptions, options) {
|
|
85
91
|
// Detect if first argument is namespacePath array or options object
|
|
86
92
|
const namespacePath = Array.isArray(namespacePathOrOptions)
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { MaterializedView, MaterializedViewDefinition, MaterializedViewSelect, }
|
|
|
7
7
|
export { JsHeaderProvider as NativeJsHeaderProvider } from "./native.js";
|
|
8
8
|
export { instrumentLanceDbMetrics } from "./otel";
|
|
9
9
|
export { AddColumnsSql, ConnectionOptions, ConnectNamespaceOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, TlsConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, BranchContents, MergeResult, AddResult, AddColumnsResult, RefreshColumnResult, RefreshMaterializedViewResult, AlterColumnsResult, UpdateFieldMetadataResult, DeleteResult, DropColumnsResult, UpdateResult, SplitCalculatedOptions, SplitRandomOptions, SplitHashOptions, SplitSequentialOptions, ShuffleOptions, OAuthConfig as NativeOAuthConfig, } from "./native.js";
|
|
10
|
-
export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
|
|
10
|
+
export { makeArrowTable, makeJsonField, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
|
|
11
11
|
export { blob, isBlobField, BlobFile } from "./blob";
|
|
12
12
|
export type { BlobOptions } from "./blob";
|
|
13
13
|
export { Connection, CreateTableOptions, TableNamesOptions, ListTablesOptions, OpenTableOptions, ListNamespacesOptions, CreateNamespaceOptions, DropNamespaceOptions, ListNamespacesResponse, ListTablesResponse, CreateNamespaceResponse, DropNamespaceResponse, DescribeNamespaceResponse, RenameTableOptions, } from "./connection";
|
|
@@ -17,7 +17,7 @@ export { AutoQuery, ExecutableQuery, Query, QueryBase, VectorQuery, TakeQuery, A
|
|
|
17
17
|
export { Index, IndexOptions, IvfPqOptions, IvfRqOptions, IvfFlatOptions, HnswPqOptions, HnswSqOptions, FtsOptions, BaseTokenizer, } from "./indices";
|
|
18
18
|
export { Table, Branches, BranchColumnSummary, BranchColumnChange, BranchIndexSummary, BranchRowCountSummary, CherryPickError, BranchDiff, CherryPickPreview, CherryPickResult, AddDataOptions, UpdateOptions, OptimizeOptions, Version, WriteProgress, FtsToken, TokenizeTableOptions, LsmWriteSpec, LsmStats, BucketStats, GenerationStats, MemtableStats, ColumnAlteration, FieldMetadataUpdate, } from "./table";
|
|
19
19
|
export { HeaderProvider, StaticHeaderProvider, OAuthHeaderProvider, TokenResponse, } from "./header";
|
|
20
|
-
export { OAuthConfig, OAuthFlowType } from "./oauth";
|
|
20
|
+
export { ClientAuthMethod, OAuthConfig, OAuthFlowType, OAuthSession, SessionLogout, SessionStatus, TokenCacheOptions, } from "./oauth";
|
|
21
21
|
export { MergeInsertBuilder, WriteExecutionOptions } from "./merge";
|
|
22
22
|
export * as embedding from "./embedding";
|
|
23
23
|
export { permutationBuilder, PermutationBuilder } from "./permutation";
|
|
@@ -247,3 +247,4 @@ export declare function connectNamespace(implName: "rest", config: RestNamespace
|
|
|
247
247
|
* ```
|
|
248
248
|
*/
|
|
249
249
|
export declare function connectNamespace(implName: string, properties: Record<string, string>, options?: Partial<ConnectNamespaceOptions>): Promise<Connection>;
|
|
250
|
+
export { Catalog, CatalogOptions, ListDatabasesResponse, connectCatalog, } from "./catalog";
|
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.OAuthFlowType = 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.AutoQuery = exports.Job = exports.Session = exports.Connection = exports.BlobFile = exports.isBlobField = exports.blob = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.instrumentLanceDbMetrics = exports.NativeJsHeaderProvider = exports.MaterializedView = void 0;
|
|
5
|
+
exports.connectCatalog = exports.Catalog = exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthSession = exports.OAuthFlowType = exports.ClientAuthMethod = 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.AutoQuery = exports.Job = exports.Session = exports.Connection = exports.BlobFile = exports.isBlobField = exports.blob = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeJsonField = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.instrumentLanceDbMetrics = exports.NativeJsHeaderProvider = exports.MaterializedView = void 0;
|
|
6
6
|
exports.tokenize = tokenize;
|
|
7
7
|
exports.connect = connect;
|
|
8
8
|
exports.connectNamespace = connectNamespace;
|
|
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "TagContents", { enumerable: true, get: function
|
|
|
24
24
|
Object.defineProperty(exports, "BranchContents", { enumerable: true, get: function () { return native_js_3.BranchContents; } });
|
|
25
25
|
var arrow_1 = require("./arrow");
|
|
26
26
|
Object.defineProperty(exports, "makeArrowTable", { enumerable: true, get: function () { return arrow_1.makeArrowTable; } });
|
|
27
|
+
Object.defineProperty(exports, "makeJsonField", { enumerable: true, get: function () { return arrow_1.makeJsonField; } });
|
|
27
28
|
Object.defineProperty(exports, "MakeArrowTableOptions", { enumerable: true, get: function () { return arrow_1.MakeArrowTableOptions; } });
|
|
28
29
|
Object.defineProperty(exports, "VectorColumnOptions", { enumerable: true, get: function () { return arrow_1.VectorColumnOptions; } });
|
|
29
30
|
var blob_1 = require("./blob");
|
|
@@ -61,7 +62,9 @@ Object.defineProperty(exports, "HeaderProvider", { enumerable: true, get: functi
|
|
|
61
62
|
Object.defineProperty(exports, "StaticHeaderProvider", { enumerable: true, get: function () { return header_1.StaticHeaderProvider; } });
|
|
62
63
|
Object.defineProperty(exports, "OAuthHeaderProvider", { enumerable: true, get: function () { return header_1.OAuthHeaderProvider; } });
|
|
63
64
|
var oauth_1 = require("./oauth");
|
|
65
|
+
Object.defineProperty(exports, "ClientAuthMethod", { enumerable: true, get: function () { return oauth_1.ClientAuthMethod; } });
|
|
64
66
|
Object.defineProperty(exports, "OAuthFlowType", { enumerable: true, get: function () { return oauth_1.OAuthFlowType; } });
|
|
67
|
+
Object.defineProperty(exports, "OAuthSession", { enumerable: true, get: function () { return oauth_1.OAuthSession; } });
|
|
65
68
|
var merge_1 = require("./merge");
|
|
66
69
|
Object.defineProperty(exports, "MergeInsertBuilder", { enumerable: true, get: function () { return merge_1.MergeInsertBuilder; } });
|
|
67
70
|
exports.embedding = require("./embedding");
|
|
@@ -179,3 +182,6 @@ async function connectNamespace(implName, configOrProperties, options) {
|
|
|
179
182
|
const nativeConn = await native_js_1.Connection.newWithNamespace(implName, properties, finalOptions);
|
|
180
183
|
return new connection_1.LocalConnection(nativeConn);
|
|
181
184
|
}
|
|
185
|
+
var catalog_1 = require("./catalog");
|
|
186
|
+
Object.defineProperty(exports, "Catalog", { enumerable: true, get: function () { return catalog_1.Catalog; } });
|
|
187
|
+
Object.defineProperty(exports, "connectCatalog", { enumerable: true, get: function () { return catalog_1.connectCatalog; } });
|
|
@@ -36,6 +36,8 @@ export declare function validateNonNegativeInteger(value: number | undefined, na
|
|
|
36
36
|
export declare function normalizeSelect(select?: MaterializedViewSelect): [string, string][] | undefined;
|
|
37
37
|
/** @internal Parse a definition off a table's stored schema metadata. */
|
|
38
38
|
export declare function definitionFromMetadata(metadata: Map<string, string>, name: string): MaterializedViewDefinition;
|
|
39
|
+
/** @internal Parse the backend-independent definition returned by native code. */
|
|
40
|
+
export declare function definitionFromJson(raw: string, name: string): MaterializedViewDefinition;
|
|
39
41
|
/**
|
|
40
42
|
* A handle on a materialized view: its table plus its definition.
|
|
41
43
|
*
|
|
@@ -50,7 +52,7 @@ export declare class MaterializedView {
|
|
|
50
52
|
get name(): string;
|
|
51
53
|
/** The view, as the table it is. */
|
|
52
54
|
table(): Table;
|
|
53
|
-
/** The query that defines the view
|
|
55
|
+
/** The query that defines the view. */
|
|
54
56
|
definition(): Promise<MaterializedViewDefinition>;
|
|
55
57
|
/**
|
|
56
58
|
* Recompute the view from its source.
|
|
@@ -6,6 +6,7 @@ exports.MaterializedView = exports.DEFINITION_META_KEY = void 0;
|
|
|
6
6
|
exports.validateNonNegativeInteger = validateNonNegativeInteger;
|
|
7
7
|
exports.normalizeSelect = normalizeSelect;
|
|
8
8
|
exports.definitionFromMetadata = definitionFromMetadata;
|
|
9
|
+
exports.definitionFromJson = definitionFromJson;
|
|
9
10
|
/** Schema metadata key holding a materialized view's definition. */
|
|
10
11
|
exports.DEFINITION_META_KEY = "mv.definition";
|
|
11
12
|
/**
|
|
@@ -42,10 +43,16 @@ function definitionFromMetadata(metadata, name) {
|
|
|
42
43
|
if (raw === undefined) {
|
|
43
44
|
throw new Error(`Table '${name}' is not a materialized view`);
|
|
44
45
|
}
|
|
46
|
+
return definitionFromJson(raw, name);
|
|
47
|
+
}
|
|
48
|
+
/** @internal Parse the backend-independent definition returned by native code. */
|
|
49
|
+
function definitionFromJson(raw, name) {
|
|
45
50
|
// biome-ignore lint/suspicious/noExplicitAny: raw JSON
|
|
46
51
|
const value = JSON.parse(raw);
|
|
47
52
|
// "namespaced_select" keeps older readers from resolving the source at root.
|
|
48
|
-
if (value.kind !==
|
|
53
|
+
if (value.kind !== undefined &&
|
|
54
|
+
value.kind !== "select" &&
|
|
55
|
+
value.kind !== "namespaced_select") {
|
|
49
56
|
throw new Error(`materialized view '${name}' is defined by '${value.kind}', which this ` +
|
|
50
57
|
"version of lancedb cannot refresh");
|
|
51
58
|
}
|
|
@@ -89,10 +96,9 @@ class MaterializedView {
|
|
|
89
96
|
table() {
|
|
90
97
|
return this.inner;
|
|
91
98
|
}
|
|
92
|
-
/** The query that defines the view
|
|
99
|
+
/** The query that defines the view. */
|
|
93
100
|
async definition() {
|
|
94
|
-
|
|
95
|
-
return definitionFromMetadata(schema.metadata, this.name);
|
|
101
|
+
return definitionFromJson(await this.inner.materializedViewDefinition(), this.name);
|
|
96
102
|
}
|
|
97
103
|
/**
|
|
98
104
|
* Recompute the view from its source.
|
package/dist/native.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ export declare class Branches {
|
|
|
21
21
|
cherryPick(fromBranch: string, dryRun?: boolean | undefined | null): Promise<Record<string, unknown>>
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export declare class Catalog {
|
|
25
|
+
static new(endpoint: string, options: CatalogOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise<Catalog>
|
|
26
|
+
get uri(): string
|
|
27
|
+
createDatabase(name: string, existOk?: boolean | undefined | null): Promise<Connection>
|
|
28
|
+
connectDatabase(name: string): Promise<Connection>
|
|
29
|
+
dropDatabase(name: string, ignoreMissing?: boolean | undefined | null): Promise<void>
|
|
30
|
+
listDatabases(limit?: number | undefined | null, pageToken?: string | undefined | null): Promise<ListDatabasesResponse>
|
|
31
|
+
}
|
|
32
|
+
|
|
24
33
|
export declare class Connection {
|
|
25
34
|
/** Create a new Connection instance from the given URI. */
|
|
26
35
|
static new(uri: string, options: ConnectionOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise<Connection>
|
|
@@ -42,9 +51,13 @@ export declare class Connection {
|
|
|
42
51
|
*/
|
|
43
52
|
createTable(name: string, buf: Buffer, mode: string, namespacePath?: Array<string> | undefined | null, storageOptions?: Record<string, string> | undefined | null): Promise<Table>
|
|
44
53
|
createEmptyTable(name: string, schemaBuf: Buffer, mode: string, namespacePath?: Array<string> | undefined | null, storageOptions?: Record<string, string> | undefined | null): Promise<Table>
|
|
45
|
-
createMaterializedView(name: string, source: string, projections
|
|
54
|
+
createMaterializedView(name: string, source: string, projections: Array<Array<string>> | undefined | null, filter: string | undefined | null, limit: number | undefined | null, withNoData: boolean): Promise<Table>
|
|
46
55
|
openMaterializedView(name: string): Promise<Table>
|
|
47
56
|
listMaterializedViews(): Promise<Array<string>>
|
|
57
|
+
/** Drop a materialized view. */
|
|
58
|
+
dropMaterializedView(name: string, namespacePath?: Array<string> | undefined | null): Promise<void>
|
|
59
|
+
/** Start dropping a materialized view and return its cleanup job. */
|
|
60
|
+
dropMaterializedViewAsync(name: string, namespacePath?: Array<string> | undefined | null): Promise<Job>
|
|
48
61
|
openTable(name: string, namespacePath?: Array<string> | undefined | null, storageOptions?: Record<string, string> | undefined | null, indexCacheSize?: number | undefined | null): Promise<Table>
|
|
49
62
|
cloneTable(targetTableName: string, sourceUri: string, targetNamespacePath: Array<string> | undefined | null, sourceVersion: number | undefined | null, sourceTag: string | undefined | null, isShallow: boolean): Promise<Table>
|
|
50
63
|
/** Drop table with the name. Or raise an error if the table does not exist. */
|
|
@@ -207,6 +220,50 @@ export declare class NativeMergeInsertBuilder {
|
|
|
207
220
|
execute(buf: Buffer): Promise<MergeResult>
|
|
208
221
|
}
|
|
209
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Explicit OAuth session lifecycle for the persistent token cache: eager
|
|
225
|
+
* `login`, non-secret `status`, and local `logout`.
|
|
226
|
+
*
|
|
227
|
+
* A session is built from the same `OAuthConfig` used to connect (including
|
|
228
|
+
* its `tokenCache` options). A connection created with the same
|
|
229
|
+
* configuration shares the cache, so logging in here prepares tokens for
|
|
230
|
+
* later processes without any database request.
|
|
231
|
+
*/
|
|
232
|
+
export declare class OAuthSession {
|
|
233
|
+
/**
|
|
234
|
+
* Create a session manager for the given OAuth configuration.
|
|
235
|
+
*
|
|
236
|
+
* The configuration must enable `tokenCache` options and use a flow that
|
|
237
|
+
* supports persistent sessions (authorization code or device code).
|
|
238
|
+
*/
|
|
239
|
+
constructor(config: OAuthConfig)
|
|
240
|
+
/**
|
|
241
|
+
* Eagerly run the configured authentication flow and store the session.
|
|
242
|
+
*
|
|
243
|
+
* A successful login always replaces any prior cached session for this
|
|
244
|
+
* identity; if the provider does not issue a refresh token (for example
|
|
245
|
+
* without `offline_access`), the previous record is removed and the
|
|
246
|
+
* status reports `refreshable == false`.
|
|
247
|
+
*/
|
|
248
|
+
login(): Promise<SessionStatus>
|
|
249
|
+
/**
|
|
250
|
+
* Report whether a matching cached session exists, with safe metadata.
|
|
251
|
+
*
|
|
252
|
+
* This never contacts the identity provider and never exposes token
|
|
253
|
+
* values.
|
|
254
|
+
*/
|
|
255
|
+
status(): Promise<SessionStatus>
|
|
256
|
+
/**
|
|
257
|
+
* Remove the matching local cached credential.
|
|
258
|
+
*
|
|
259
|
+
* This only deletes the local cache entry. It does not revoke the
|
|
260
|
+
* refresh token with the provider and does not sign out of a browser
|
|
261
|
+
* SSO session. Repeated calls succeed; `removed` reports whether a
|
|
262
|
+
* credential existed.
|
|
263
|
+
*/
|
|
264
|
+
logout(): Promise<SessionLogout>
|
|
265
|
+
}
|
|
266
|
+
|
|
210
267
|
export declare class PermutationBuilder {
|
|
211
268
|
persist(connection: Connection, tableName: string): PermutationBuilder
|
|
212
269
|
/** Configure random splits */
|
|
@@ -325,6 +382,7 @@ export declare class Table {
|
|
|
325
382
|
refreshColumn(column: string): Promise<RefreshColumnResult>
|
|
326
383
|
refreshColumnAsync(column: string): Promise<Job>
|
|
327
384
|
refreshMaterializedView(full?: boolean | undefined | null, sourceVersion?: number | undefined | null): Promise<RefreshMaterializedViewResult>
|
|
385
|
+
materializedViewDefinition(): Promise<string>
|
|
328
386
|
addColumnsWithSchema(schemaBuf: Buffer): Promise<AddColumnsResult>
|
|
329
387
|
alterColumns(alterations: Array<ColumnAlteration>): Promise<AlterColumnsResult>
|
|
330
388
|
updateFieldMetadata(updates: Array<FieldMetadataUpdate>): Promise<UpdateFieldMetadataResult>
|
|
@@ -349,7 +407,7 @@ export declare class Table {
|
|
|
349
407
|
branches(): Promise<Branches>
|
|
350
408
|
/** The branch this handle is scoped to, or `null` for the main branch. */
|
|
351
409
|
currentBranch(): string | null
|
|
352
|
-
optimize(
|
|
410
|
+
optimize(beforeTimestampMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
|
|
353
411
|
listIndices(): Promise<Array<IndexConfig>>
|
|
354
412
|
tokenize(query: string, column?: string | undefined | null, indexName?: string | undefined | null): Promise<Array<FtsToken>>
|
|
355
413
|
indexStats(indexName: string): Promise<IndexStatistics | null>
|
|
@@ -474,6 +532,15 @@ export interface BucketStats {
|
|
|
474
532
|
memtables?: Array<MemtableStats>
|
|
475
533
|
}
|
|
476
534
|
|
|
535
|
+
export interface CatalogOptions {
|
|
536
|
+
apiKey?: string
|
|
537
|
+
clientConfig?: ClientConfig
|
|
538
|
+
/** SQL service endpoint inherited by database connections. */
|
|
539
|
+
sqlHostOverride?: string
|
|
540
|
+
readConsistencyInterval?: number
|
|
541
|
+
oauthConfig?: OAuthConfig
|
|
542
|
+
}
|
|
543
|
+
|
|
477
544
|
export interface ClientConfig {
|
|
478
545
|
userAgent?: string
|
|
479
546
|
retryConfig?: RetryConfig
|
|
@@ -832,6 +899,11 @@ export interface JobInfo {
|
|
|
832
899
|
/** The catalog of described LanceDB metrics. Empty until the recorder is installed. */
|
|
833
900
|
export declare function lancedbMetricsCatalog(): Array<MetricDescription>
|
|
834
901
|
|
|
902
|
+
export interface ListDatabasesResponse {
|
|
903
|
+
databases: Array<string>
|
|
904
|
+
pageToken?: string
|
|
905
|
+
}
|
|
906
|
+
|
|
835
907
|
export interface ListNamespacesResponse {
|
|
836
908
|
namespaces: Array<string>
|
|
837
909
|
pageToken?: string
|
|
@@ -955,10 +1027,30 @@ export interface OAuthConfig {
|
|
|
955
1027
|
* or resource is required. For example: `["api://{app_id}/.default"]`
|
|
956
1028
|
*/
|
|
957
1029
|
scopes: Array<string>
|
|
958
|
-
/**
|
|
1030
|
+
/** Optional resource indicator for authorization and token requests. */
|
|
1031
|
+
resource?: string
|
|
1032
|
+
/** Optional provider-specific audience for authorization and token requests. */
|
|
1033
|
+
audience?: string
|
|
1034
|
+
/**
|
|
1035
|
+
* Authentication flow: "client_credentials", "authorization_code",
|
|
1036
|
+
* "device_code", or "azure_managed_identity"
|
|
1037
|
+
*/
|
|
959
1038
|
flow?: string
|
|
960
1039
|
/** Client secret (required for client_credentials). */
|
|
961
1040
|
clientSecret?: string
|
|
1041
|
+
/**
|
|
1042
|
+
* How the client authenticates to the token endpoint: "none",
|
|
1043
|
+
* "client_secret_basic", or "client_secret_post". Defaults to
|
|
1044
|
+
* "client_secret_basic" when a client secret is set, and "none" for
|
|
1045
|
+
* public clients.
|
|
1046
|
+
*/
|
|
1047
|
+
clientAuthMethod?: string
|
|
1048
|
+
/** Loopback redirect URI for authorization_code. */
|
|
1049
|
+
redirectUri?: string
|
|
1050
|
+
/** Port for the authorization_code loopback callback server. */
|
|
1051
|
+
callbackPort?: number
|
|
1052
|
+
/** Whether authorization_code uses S256 PKCE (default: true). */
|
|
1053
|
+
usePkce?: boolean
|
|
962
1054
|
/** Client ID for user-assigned managed identity (azure_managed_identity). */
|
|
963
1055
|
managedIdentityClientId?: string
|
|
964
1056
|
/**
|
|
@@ -967,6 +1059,11 @@ export interface OAuthConfig {
|
|
|
967
1059
|
* the TTL, each request refreshes the token.
|
|
968
1060
|
*/
|
|
969
1061
|
refreshBufferSecs?: number
|
|
1062
|
+
/**
|
|
1063
|
+
* Opt in to the persistent token cache so short-lived processes reuse
|
|
1064
|
+
* one session. Only refresh tokens are persisted.
|
|
1065
|
+
*/
|
|
1066
|
+
tokenCache?: TokenCacheOptions
|
|
970
1067
|
}
|
|
971
1068
|
|
|
972
1069
|
export interface OpenTableOptions {
|
|
@@ -1069,6 +1166,41 @@ export interface RetryConfig {
|
|
|
1069
1166
|
statuses?: Array<number>
|
|
1070
1167
|
}
|
|
1071
1168
|
|
|
1169
|
+
/** Result of `OAuthSession.logout()`. */
|
|
1170
|
+
export interface SessionLogout {
|
|
1171
|
+
/**
|
|
1172
|
+
* Whether a cached credential was removed. `false` means no matching
|
|
1173
|
+
* session was cached; logout is idempotent.
|
|
1174
|
+
*/
|
|
1175
|
+
removed: boolean
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Safe, non-secret view of a cached OAuth session, returned by
|
|
1180
|
+
* `OAuthSession.status()` and `OAuthSession.login()`.
|
|
1181
|
+
*/
|
|
1182
|
+
export interface SessionStatus {
|
|
1183
|
+
/**
|
|
1184
|
+
* Whether a cached session exists that can obtain tokens without
|
|
1185
|
+
* interactive authentication.
|
|
1186
|
+
*/
|
|
1187
|
+
refreshable: boolean
|
|
1188
|
+
/** Canonical issuer URL of the cached session. */
|
|
1189
|
+
issuerUrl: string
|
|
1190
|
+
/** Client ID of the cached session. */
|
|
1191
|
+
clientId: string
|
|
1192
|
+
/** Canonical (sorted, de-duplicated) scopes of the cached session. */
|
|
1193
|
+
scopes: Array<string>
|
|
1194
|
+
/** Optional resource indicator for authorization and token requests. */
|
|
1195
|
+
resource?: string
|
|
1196
|
+
/** Optional provider-specific audience for authorization and token requests. */
|
|
1197
|
+
audience?: string
|
|
1198
|
+
/** Flow that produced the cached session. */
|
|
1199
|
+
flow: string
|
|
1200
|
+
/** When the cached session was obtained, as Unix seconds. */
|
|
1201
|
+
obtainedAt?: number
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1072
1204
|
export interface ShuffleOptions {
|
|
1073
1205
|
seed?: number
|
|
1074
1206
|
clumpSize?: number
|
|
@@ -1167,6 +1299,29 @@ export interface TlsConfig {
|
|
|
1167
1299
|
assertHostname?: boolean
|
|
1168
1300
|
}
|
|
1169
1301
|
|
|
1302
|
+
/**
|
|
1303
|
+
* Options for the persistent OAuth token cache.
|
|
1304
|
+
*
|
|
1305
|
+
* The cache is opt-in: it is only used when set as `tokenCache` on
|
|
1306
|
+
* `OAuthConfig`. Only refresh tokens are persisted, in a private directory
|
|
1307
|
+
* with owner-only permissions, so short-lived processes can reuse an
|
|
1308
|
+
* authenticated session instead of re-prompting on every start.
|
|
1309
|
+
*/
|
|
1310
|
+
export interface TokenCacheOptions {
|
|
1311
|
+
/**
|
|
1312
|
+
* Directory that holds cached credentials. Defaults to
|
|
1313
|
+
* `$XDG_CACHE_HOME/lancedb/oauth`, `$HOME/.cache/lancedb/oauth` on Unix,
|
|
1314
|
+
* or `%LOCALAPPDATA%\lancedb\oauth` on Windows. The directory is created
|
|
1315
|
+
* with owner-only permissions (`0700`) when missing.
|
|
1316
|
+
*/
|
|
1317
|
+
cacheDir?: string
|
|
1318
|
+
/**
|
|
1319
|
+
* How long to wait for the cross-process refresh lock before failing,
|
|
1320
|
+
* in seconds (default: 30).
|
|
1321
|
+
*/
|
|
1322
|
+
lockTimeoutSecs?: number
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1170
1325
|
export declare function tokenize(query: string, baseTokenizer?: string | undefined | null, language?: string | undefined | null, maxTokenLength?: number | undefined | null, lowerCase?: boolean | undefined | null, stem?: boolean | undefined | null, removeStopWords?: boolean | undefined | null, customStopWords?: Array<string> | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null): Array<FtsToken>
|
|
1171
1326
|
|
|
1172
1327
|
export interface UpdateFieldMetadataResult {
|