@lancedb/lancedb 0.40.0-beta.11 → 0.40.0-beta.13
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/NODEJS_THIRD_PARTY_LICENSES.md +8 -0
- package/dist/arrow.d.ts +18 -1
- package/dist/arrow.js +182 -13
- package/dist/blob.d.ts +95 -7
- package/dist/blob.js +167 -13
- package/dist/catalog.d.ts +40 -6
- package/dist/catalog.js +58 -9
- package/dist/connection.d.ts +18 -4
- package/dist/connection.js +8 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -1
- package/dist/materialized_view.d.ts +3 -9
- package/dist/materialized_view.js +4 -9
- package/dist/native.d.ts +40 -13
- package/dist/native.js +53 -52
- package/dist/query.d.ts +7 -1
- package/dist/query.js +12 -15
- package/dist/sanitize.d.ts +19 -18
- package/dist/sanitize.js +78 -11
- package/dist/schema.js +31 -3
- package/dist/table.d.ts +21 -7
- package/dist/table.js +7 -7
- package/dist/util.js +9 -0
- package/package.json +13 -9
package/dist/blob.js
CHANGED
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.BlobFile = void 0;
|
|
6
6
|
exports.blob = blob;
|
|
7
7
|
exports.isBlobField = isBlobField;
|
|
8
|
+
exports.runWithSignal = runWithSignal;
|
|
9
|
+
exports.normalizeBlobInput = normalizeBlobInput;
|
|
10
|
+
exports.blobToRead = blobToRead;
|
|
11
|
+
exports.withBlobBytes = withBlobBytes;
|
|
8
12
|
exports.coerceBlobValue = coerceBlobValue;
|
|
9
13
|
const apache_arrow_1 = require("apache-arrow");
|
|
10
14
|
const native_1 = require("./native");
|
|
@@ -87,25 +91,143 @@ class BlobFile {
|
|
|
87
91
|
return this.inner.size();
|
|
88
92
|
}
|
|
89
93
|
/**
|
|
90
|
-
* Reads from the cursor
|
|
94
|
+
* Reads from the cursor and advances the cursor.
|
|
91
95
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
96
|
+
* Reads to the end when `maxBytes` is omitted, or at most `maxBytes` bytes
|
|
97
|
+
* otherwise. Returns an empty buffer at the end of the blob.
|
|
98
|
+
* {@link BlobFile.readRange} does not move the cursor.
|
|
94
99
|
*/
|
|
95
|
-
read() {
|
|
96
|
-
return this.inner.read();
|
|
100
|
+
read(maxBytes, options) {
|
|
101
|
+
return runWithSignal(options?.signal, (signal) => this.inner.read(maxBytes, signal));
|
|
97
102
|
}
|
|
98
103
|
/**
|
|
99
104
|
* Reads the half-open byte range `[start, end)`.
|
|
100
105
|
*
|
|
101
106
|
* Fails when `end` is past the blob size. Does not move the cursor.
|
|
102
107
|
*/
|
|
103
|
-
readRange(start, end) {
|
|
104
|
-
return this.inner.readRange(start, end);
|
|
108
|
+
readRange(start, end, options) {
|
|
109
|
+
return runWithSignal(options?.signal, (signal) => this.inner.readRange(start, end, signal));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Reads several half-open byte ranges. Returns one buffer per range, in
|
|
113
|
+
* the order given.
|
|
114
|
+
*
|
|
115
|
+
* Fails when any `end` is past the blob size. Does not move the cursor.
|
|
116
|
+
*/
|
|
117
|
+
readRanges(ranges, options) {
|
|
118
|
+
return runWithSignal(options?.signal, (signal) => this.inner.readRanges(ranges, signal));
|
|
119
|
+
}
|
|
120
|
+
/** Moves the cursor to `position`, in bytes from the start of the blob. */
|
|
121
|
+
seek(position) {
|
|
122
|
+
return this.inner.seek(position);
|
|
123
|
+
}
|
|
124
|
+
/** Returns the cursor position in bytes. */
|
|
125
|
+
tell() {
|
|
126
|
+
return this.inner.tell();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Releases the handle. Reads after `close()` fail. Calling it again does
|
|
130
|
+
* nothing.
|
|
131
|
+
*/
|
|
132
|
+
close() {
|
|
133
|
+
return this.inner.close();
|
|
134
|
+
}
|
|
135
|
+
/** Returns true after {@link BlobFile.close}. */
|
|
136
|
+
isClosed() {
|
|
137
|
+
return this.inner.isClosed();
|
|
105
138
|
}
|
|
106
139
|
}
|
|
107
140
|
exports.BlobFile = BlobFile;
|
|
108
|
-
|
|
141
|
+
/** @ignore */
|
|
142
|
+
async function runWithSignal(signal, run) {
|
|
143
|
+
if (signal === undefined) {
|
|
144
|
+
return run(undefined);
|
|
145
|
+
}
|
|
146
|
+
signal.throwIfAborted();
|
|
147
|
+
// napi-rs replaces `onabort` on the signal it receives, so pass a private
|
|
148
|
+
// signal and forward the caller's abort to it.
|
|
149
|
+
const controller = new AbortController();
|
|
150
|
+
const onAbort = () => controller.abort();
|
|
151
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
152
|
+
try {
|
|
153
|
+
return await run(controller.signal);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
if (signal.aborted) {
|
|
157
|
+
throw signal.reason;
|
|
158
|
+
}
|
|
159
|
+
throw err;
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
signal.removeEventListener("abort", onAbort);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Rewrites the synchronous-only widenings of {@link BlobInput} (`ArrayBuffer`,
|
|
167
|
+
* `URL`) into `Uint8Array` and URI strings, keeping the value's shape. Other
|
|
168
|
+
* values are returned unchanged and validated later by {@link coerceBlobValue}.
|
|
169
|
+
*
|
|
170
|
+
* Throws on `Blob` / `File`, which must be read into bytes first.
|
|
171
|
+
*/
|
|
172
|
+
function normalizeBlobInput(value) {
|
|
173
|
+
if (blobToRead(value) !== undefined) {
|
|
174
|
+
throw new Error("Blob and File values must be read asynchronously. Pass them to " +
|
|
175
|
+
"createTable, add, or mergeInsert, or convert them with " +
|
|
176
|
+
"`new Uint8Array(await value.arrayBuffer())`");
|
|
177
|
+
}
|
|
178
|
+
if (value instanceof ArrayBuffer) {
|
|
179
|
+
return new Uint8Array(value);
|
|
180
|
+
}
|
|
181
|
+
if (value instanceof URL) {
|
|
182
|
+
return value.href;
|
|
183
|
+
}
|
|
184
|
+
if (isBlobStruct(value)) {
|
|
185
|
+
// Read `data` and `uri` explicitly: spreading a class instance would drop
|
|
186
|
+
// fields defined as getters on its prototype.
|
|
187
|
+
const out = {
|
|
188
|
+
...value,
|
|
189
|
+
data: value.data,
|
|
190
|
+
uri: value.uri,
|
|
191
|
+
};
|
|
192
|
+
let changed = false;
|
|
193
|
+
if (value.data instanceof ArrayBuffer) {
|
|
194
|
+
out.data = new Uint8Array(value.data);
|
|
195
|
+
changed = true;
|
|
196
|
+
}
|
|
197
|
+
if (value.uri instanceof URL) {
|
|
198
|
+
out.uri = value.uri.href;
|
|
199
|
+
changed = true;
|
|
200
|
+
}
|
|
201
|
+
return changed ? out : value;
|
|
202
|
+
}
|
|
203
|
+
return value;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the `Blob` / `File` a blob value needs read, either the value itself
|
|
207
|
+
* or its `data` field, or `undefined` when there is nothing to read.
|
|
208
|
+
*/
|
|
209
|
+
function blobToRead(value) {
|
|
210
|
+
if (isBlobLike(value)) {
|
|
211
|
+
return value;
|
|
212
|
+
}
|
|
213
|
+
if (isBlobStruct(value) && isBlobLike(value.data)) {
|
|
214
|
+
return value.data;
|
|
215
|
+
}
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Replaces the `Blob` that {@link blobToRead} found in `value` with `bytes`,
|
|
220
|
+
* keeping the value's shape.
|
|
221
|
+
*/
|
|
222
|
+
function withBlobBytes(value, bytes) {
|
|
223
|
+
if (isBlobLike(value)) {
|
|
224
|
+
return bytes;
|
|
225
|
+
}
|
|
226
|
+
const record = value;
|
|
227
|
+
return { ...record, uri: record.uri, data: bytes };
|
|
228
|
+
}
|
|
229
|
+
function coerceBlobValue(input) {
|
|
230
|
+
const value = normalizeBlobInput(input);
|
|
109
231
|
if (value == null) {
|
|
110
232
|
return null;
|
|
111
233
|
}
|
|
@@ -113,7 +235,7 @@ function coerceBlobValue(value) {
|
|
|
113
235
|
return { data: value, uri: null };
|
|
114
236
|
}
|
|
115
237
|
if (ArrayBuffer.isView(value)) {
|
|
116
|
-
throw new Error("Blob data must be Buffer or
|
|
238
|
+
throw new Error("Blob data must be Buffer, Uint8Array, ArrayBuffer, or Blob");
|
|
117
239
|
}
|
|
118
240
|
if (typeof value === "string") {
|
|
119
241
|
if (value === "") {
|
|
@@ -121,21 +243,27 @@ function coerceBlobValue(value) {
|
|
|
121
243
|
}
|
|
122
244
|
return { data: null, uri: value };
|
|
123
245
|
}
|
|
124
|
-
if (
|
|
246
|
+
if (isBlobStruct(value)) {
|
|
125
247
|
const record = value;
|
|
126
248
|
if (!("data" in record) && !("uri" in record)) {
|
|
127
249
|
throw new Error("Blob struct values must include a 'data' or 'uri' field");
|
|
128
250
|
}
|
|
251
|
+
const unknownKeys = Object.keys(record).filter((key) => key !== "data" && key !== "uri");
|
|
252
|
+
if (unknownKeys.length > 0) {
|
|
253
|
+
throw new Error(`Blob struct values only support 'data' and 'uri', got ${unknownKeys
|
|
254
|
+
.map((key) => `'${key}'`)
|
|
255
|
+
.join(", ")}`);
|
|
256
|
+
}
|
|
129
257
|
const uri = record.uri;
|
|
130
258
|
if (uri === "") {
|
|
131
259
|
throw new Error("Blob uri cannot be empty");
|
|
132
260
|
}
|
|
133
261
|
if (uri != null && typeof uri !== "string") {
|
|
134
|
-
throw new Error(`Blob uri must be a string or null, got ${typeof uri}`);
|
|
262
|
+
throw new Error(`Blob uri must be a string, URL, or null, got ${typeof uri}`);
|
|
135
263
|
}
|
|
136
264
|
const data = record.data;
|
|
137
265
|
if (data != null && !isBlobBytes(data)) {
|
|
138
|
-
throw new Error("Blob data must be Buffer, Uint8Array, or null");
|
|
266
|
+
throw new Error("Blob data must be Buffer, Uint8Array, ArrayBuffer, Blob, or null");
|
|
139
267
|
}
|
|
140
268
|
const bytes = data ?? null;
|
|
141
269
|
const uriValue = uri ?? null;
|
|
@@ -144,7 +272,33 @@ function coerceBlobValue(value) {
|
|
|
144
272
|
}
|
|
145
273
|
return { data: bytes, uri: uriValue };
|
|
146
274
|
}
|
|
147
|
-
throw new Error("Blob column values must be Buffer, Uint8Array, a URI string, null, or { data?, uri? }");
|
|
275
|
+
throw new Error("Blob column values must be Buffer, Uint8Array, ArrayBuffer, Blob, a URI string or URL, null, or { data?, uri? }");
|
|
276
|
+
}
|
|
277
|
+
function isBlobLike(value) {
|
|
278
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Whether `value` is a `{ data?, uri? }` struct: any plain object, or any
|
|
282
|
+
* other object with a `data` or `uri` field (such as a class instance), apart
|
|
283
|
+
* from the binary, `Blob`, and `URL` values that are blob inputs themselves.
|
|
284
|
+
*/
|
|
285
|
+
function isBlobStruct(value) {
|
|
286
|
+
if (typeof value !== "object" ||
|
|
287
|
+
value === null ||
|
|
288
|
+
Array.isArray(value) ||
|
|
289
|
+
ArrayBuffer.isView(value) ||
|
|
290
|
+
value instanceof ArrayBuffer ||
|
|
291
|
+
(typeof SharedArrayBuffer !== "undefined" &&
|
|
292
|
+
value instanceof SharedArrayBuffer) ||
|
|
293
|
+
isBlobLike(value) ||
|
|
294
|
+
value instanceof URL) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
const prototype = Object.getPrototypeOf(value);
|
|
298
|
+
return (prototype === Object.prototype ||
|
|
299
|
+
prototype === null ||
|
|
300
|
+
"data" in value ||
|
|
301
|
+
"uri" in value);
|
|
148
302
|
}
|
|
149
303
|
function isBlobBytes(value) {
|
|
150
304
|
return Buffer.isBuffer(value) || value instanceof Uint8Array;
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection } from "./connection";
|
|
2
2
|
import { HeaderProvider } from "./header";
|
|
3
|
-
import {
|
|
3
|
+
import { Catalog as NativeCatalog, CatalogOptions as NativeCatalogOptions, DatabaseNames as NativeDatabaseNames } from "./native.js";
|
|
4
4
|
import { OAuthConfig } from "./oauth";
|
|
5
5
|
/** Options shared by a catalog and the database connections it returns. */
|
|
6
6
|
export interface CatalogOptions extends Omit<NativeCatalogOptions, "oauthConfig"> {
|
|
@@ -8,7 +8,27 @@ export interface CatalogOptions extends Omit<NativeCatalogOptions, "oauthConfig"
|
|
|
8
8
|
/** Called for each request to supply authentication headers. */
|
|
9
9
|
headerProvider?: HeaderProvider | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A lazy async iterator of database names with pagination state.
|
|
13
|
+
* Returned by {@link Catalog.listDatabases}.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DatabaseNames implements AsyncIterableIterator<string> {
|
|
16
|
+
private readonly inner;
|
|
17
|
+
/** @hidden */
|
|
18
|
+
constructor(inner: NativeDatabaseNames);
|
|
19
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
|
|
20
|
+
/** Fetch the next name, requesting another page only when needed. */
|
|
21
|
+
next(): Promise<IteratorResult<string>>;
|
|
22
|
+
/** Number of names available without another REST request. */
|
|
23
|
+
numPageResults(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Token for the next REST request. Initially this is the supplied starting token.
|
|
26
|
+
* Returns undefined after the final page is fetched, even if names remain cached.
|
|
27
|
+
* Drain the cache before saving a token to avoid skipping names when resuming.
|
|
28
|
+
* A failed request terminates iteration and retains its token for a new iterator.
|
|
29
|
+
*/
|
|
30
|
+
pageToken(): string | undefined;
|
|
31
|
+
}
|
|
12
32
|
/** A remote catalog manages databases through the server's root namespace. */
|
|
13
33
|
export declare class Catalog {
|
|
14
34
|
private readonly inner;
|
|
@@ -26,11 +46,23 @@ export declare class Catalog {
|
|
|
26
46
|
dropDatabase(name: string, options?: {
|
|
27
47
|
ignoreMissing?: boolean;
|
|
28
48
|
}): Promise<void>;
|
|
29
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Iterate lazily over all database names using `for await...of`.
|
|
51
|
+
* pageToken resumes from a saved token; omitted starts at the beginning.
|
|
52
|
+
* pageLimit limits each REST response, not the total; omitted uses the server default.
|
|
53
|
+
* Request errors are raised during iteration and terminate the iterator.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* for await (const name of catalog.listDatabases({ pageLimit: 20 })) {
|
|
58
|
+
* console.log(name);
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
30
62
|
listDatabases(options?: {
|
|
31
|
-
|
|
63
|
+
pageLimit?: number;
|
|
32
64
|
pageToken?: string;
|
|
33
|
-
}):
|
|
65
|
+
}): DatabaseNames;
|
|
34
66
|
}
|
|
35
67
|
/**
|
|
36
68
|
* Connect to an HTTP(S) catalog endpoint. Catalog requests omit database-selection
|
|
@@ -40,7 +72,9 @@ export declare class Catalog {
|
|
|
40
72
|
* ```ts
|
|
41
73
|
* const catalog = await connectCatalog("https://my-server.example", { apiKey: "secret" });
|
|
42
74
|
* const db = await catalog.createDatabase("analytics", { existOk: true });
|
|
43
|
-
* const
|
|
75
|
+
* for await (const name of catalog.listDatabases({ pageLimit: 20 })) {
|
|
76
|
+
* console.log(name);
|
|
77
|
+
* }
|
|
44
78
|
* ```
|
|
45
79
|
*/
|
|
46
80
|
export declare function connectCatalog(endpoint: string, options?: CatalogOptions): Promise<Catalog>;
|
package/dist/catalog.js
CHANGED
|
@@ -2,10 +2,45 @@
|
|
|
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.Catalog = void 0;
|
|
5
|
+
exports.Catalog = exports.DatabaseNames = void 0;
|
|
6
6
|
exports.connectCatalog = connectCatalog;
|
|
7
7
|
const connection_1 = require("./connection");
|
|
8
8
|
const native_js_1 = require("./native.js");
|
|
9
|
+
/**
|
|
10
|
+
* A lazy async iterator of database names with pagination state.
|
|
11
|
+
* Returned by {@link Catalog.listDatabases}.
|
|
12
|
+
*/
|
|
13
|
+
class DatabaseNames {
|
|
14
|
+
inner;
|
|
15
|
+
/** @hidden */
|
|
16
|
+
constructor(inner) {
|
|
17
|
+
this.inner = inner;
|
|
18
|
+
}
|
|
19
|
+
[Symbol.asyncIterator]() {
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
/** Fetch the next name, requesting another page only when needed. */
|
|
23
|
+
async next() {
|
|
24
|
+
const value = await this.inner.next();
|
|
25
|
+
return value == null
|
|
26
|
+
? { done: true, value: undefined }
|
|
27
|
+
: { done: false, value };
|
|
28
|
+
}
|
|
29
|
+
/** Number of names available without another REST request. */
|
|
30
|
+
numPageResults() {
|
|
31
|
+
return this.inner.numPageResults();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Token for the next REST request. Initially this is the supplied starting token.
|
|
35
|
+
* Returns undefined after the final page is fetched, even if names remain cached.
|
|
36
|
+
* Drain the cache before saving a token to avoid skipping names when resuming.
|
|
37
|
+
* A failed request terminates iteration and retains its token for a new iterator.
|
|
38
|
+
*/
|
|
39
|
+
pageToken() {
|
|
40
|
+
return this.inner.pageToken() ?? undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.DatabaseNames = DatabaseNames;
|
|
9
44
|
/** A remote catalog manages databases through the server's root namespace. */
|
|
10
45
|
class Catalog {
|
|
11
46
|
inner;
|
|
@@ -29,15 +64,27 @@ class Catalog {
|
|
|
29
64
|
async dropDatabase(name, options = {}) {
|
|
30
65
|
await this.inner.dropDatabase(name, options.ignoreMissing);
|
|
31
66
|
}
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Iterate lazily over all database names using `for await...of`.
|
|
69
|
+
* pageToken resumes from a saved token; omitted starts at the beginning.
|
|
70
|
+
* pageLimit limits each REST response, not the total; omitted uses the server default.
|
|
71
|
+
* Request errors are raised during iteration and terminate the iterator.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* for await (const name of catalog.listDatabases({ pageLimit: 20 })) {
|
|
76
|
+
* console.log(name);
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
listDatabases(options = {}) {
|
|
81
|
+
if (options.pageLimit !== undefined &&
|
|
82
|
+
(!Number.isInteger(options.pageLimit) ||
|
|
83
|
+
options.pageLimit <= 0 ||
|
|
84
|
+
options.pageLimit > 2147483647)) {
|
|
38
85
|
throw new Error("Database list limit must be an integer between 1 and 2147483647");
|
|
39
86
|
}
|
|
40
|
-
return this.inner.listDatabases(options.
|
|
87
|
+
return new DatabaseNames(this.inner.listDatabases(options.pageToken, options.pageLimit));
|
|
41
88
|
}
|
|
42
89
|
}
|
|
43
90
|
exports.Catalog = Catalog;
|
|
@@ -49,7 +96,9 @@ exports.Catalog = Catalog;
|
|
|
49
96
|
* ```ts
|
|
50
97
|
* const catalog = await connectCatalog("https://my-server.example", { apiKey: "secret" });
|
|
51
98
|
* const db = await catalog.createDatabase("analytics", { existOk: true });
|
|
52
|
-
* const
|
|
99
|
+
* for await (const name of catalog.listDatabases({ pageLimit: 20 })) {
|
|
100
|
+
* console.log(name);
|
|
101
|
+
* }
|
|
53
102
|
* ```
|
|
54
103
|
*/
|
|
55
104
|
async function connectCatalog(endpoint, options = {}) {
|
package/dist/connection.d.ts
CHANGED
|
@@ -260,10 +260,6 @@ export declare abstract class Connection {
|
|
|
260
260
|
* The view is populated before creation returns. Set `withNoData` to create
|
|
261
261
|
* only its definition and empty backing table. The view is a normal table:
|
|
262
262
|
* it can be queried, indexed and searched, and it appears in `tableNames`.
|
|
263
|
-
* The source table must have stable row ids (create it with
|
|
264
|
-
* the `newTableEnableStableRowIds` storage option); they keep the view's
|
|
265
|
-
* provenance valid across source compactions and cannot be enabled after
|
|
266
|
-
* a table exists.
|
|
267
263
|
*/
|
|
268
264
|
abstract createMaterializedView(name: string, source: string, options?: {
|
|
269
265
|
select?: MaterializedViewSelect;
|
|
@@ -501,6 +497,22 @@ export declare abstract class Connection {
|
|
|
501
497
|
* such job exists. Cancelling an already-terminal job is a no-op success.
|
|
502
498
|
*/
|
|
503
499
|
abstract cancelJob(jobId: string): Promise<boolean>;
|
|
500
|
+
/**
|
|
501
|
+
* Pause a server-side job by id.
|
|
502
|
+
*
|
|
503
|
+
* The job's workers drain and it stays parked until resumed. Resolves to
|
|
504
|
+
* "pausing", "already_paused", or "committing" -- a job finalizing its
|
|
505
|
+
* results cannot be parked; retry shortly.
|
|
506
|
+
*/
|
|
507
|
+
abstract pauseJob(jobId: string): Promise<string>;
|
|
508
|
+
/**
|
|
509
|
+
* Resume a paused server-side job by id.
|
|
510
|
+
*
|
|
511
|
+
* Its workers pick their work back up from checkpoints. Resolves to
|
|
512
|
+
* "resumed", "still_pausing" -- the pause's worker drain is not confirmed
|
|
513
|
+
* yet; retry shortly -- or "not_paused".
|
|
514
|
+
*/
|
|
515
|
+
abstract resumeJob(jobId: string): Promise<string>;
|
|
504
516
|
}
|
|
505
517
|
/** @hideconstructor */
|
|
506
518
|
export declare class LocalConnection extends Connection {
|
|
@@ -552,6 +564,8 @@ export declare class LocalConnection extends Connection {
|
|
|
552
564
|
openJob(jobId: string): Promise<Job>;
|
|
553
565
|
listJobs(): Promise<JobInfo[]>;
|
|
554
566
|
cancelJob(jobId: string): Promise<boolean>;
|
|
567
|
+
pauseJob(jobId: string): Promise<string>;
|
|
568
|
+
resumeJob(jobId: string): Promise<string>;
|
|
555
569
|
}
|
|
556
570
|
/**
|
|
557
571
|
* Takes storage options and makes all the keys snake case.
|
package/dist/connection.js
CHANGED
|
@@ -249,6 +249,12 @@ class LocalConnection extends Connection {
|
|
|
249
249
|
async cancelJob(jobId) {
|
|
250
250
|
return this.inner.cancelJob(jobId);
|
|
251
251
|
}
|
|
252
|
+
async pauseJob(jobId) {
|
|
253
|
+
return this.inner.pauseJob(jobId);
|
|
254
|
+
}
|
|
255
|
+
async resumeJob(jobId) {
|
|
256
|
+
return this.inner.resumeJob(jobId);
|
|
257
|
+
}
|
|
252
258
|
}
|
|
253
259
|
exports.LocalConnection = LocalConnection;
|
|
254
260
|
/**
|
|
@@ -297,7 +303,8 @@ async function parseTableData(data, options, streaming = false) {
|
|
|
297
303
|
table = (0, sanitize_1.sanitizeTable)(data);
|
|
298
304
|
}
|
|
299
305
|
else {
|
|
300
|
-
|
|
306
|
+
const records = await (0, arrow_1.resolveBlobInputs)(data, options?.schema);
|
|
307
|
+
table = (0, arrow_1.makeArrowTable)(records, options);
|
|
301
308
|
}
|
|
302
309
|
if (streaming) {
|
|
303
310
|
const buf = await (0, arrow_1.fromTableToStreamBuffer)(table, options?.embeddingFunction, options?.schema);
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { instrumentLanceDbMetrics } from "./otel";
|
|
|
10
10
|
export { AddColumnsSql, ConnectionOptions, ConnectNamespaceOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, TlsConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, BranchContents, MergeResult, AddResult, AddColumnsResult, RefreshColumnResult, FunctionErrors, FunctionErrorsOptions, FunctionErrorRecord, FunctionErrorFragment, RefreshMaterializedViewResult, AlterColumnsResult, UpdateFieldMetadataResult, DeleteResult, DropColumnsResult, UpdateResult, SplitCalculatedOptions, SplitRandomOptions, SplitHashOptions, SplitSequentialOptions, ShuffleOptions, OAuthConfig as NativeOAuthConfig, } from "./native.js";
|
|
11
11
|
export { makeArrowTable, makeJsonField, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
|
|
12
12
|
export { blob, isBlobField, BlobFile } from "./blob";
|
|
13
|
-
export type { BlobOptions } from "./blob";
|
|
13
|
+
export type { BlobData, BlobInput, BlobOptions, BlobRange, BlobReadOptions, BlobUri, } from "./blob";
|
|
14
14
|
export { Connection, CreateTableOptions, TableNamesOptions, ListTablesOptions, OpenTableOptions, ListNamespacesOptions, CreateNamespaceOptions, DropNamespaceOptions, ListNamespacesResponse, ListTablesResponse, CreateNamespaceResponse, DropNamespaceResponse, DescribeNamespaceResponse, RenameTableOptions, } from "./connection";
|
|
15
15
|
export { JobFailureInfo, JobInfo, Session } from "./native.js";
|
|
16
16
|
export { Job, JobEventsOptions } from "./job";
|
|
@@ -24,7 +24,7 @@ export * as embedding from "./embedding";
|
|
|
24
24
|
export { permutationBuilder, PermutationBuilder } from "./permutation";
|
|
25
25
|
export { Scannable, ScannableOptions } from "./scannable";
|
|
26
26
|
export * as rerankers from "./rerankers";
|
|
27
|
-
export { SchemaLike, TableLike, FieldLike, RecordBatchLike, DataLike, IntoVector, MultiVector, } from "./arrow";
|
|
27
|
+
export { SchemaLike, TableLike, DataTypeLike, FieldLike, RecordBatchLike, DataLike, IntoVector, MultiVector, } from "./arrow";
|
|
28
28
|
export { IntoSql, packBits } from "./util";
|
|
29
29
|
/**
|
|
30
30
|
* Options for tokenizing a full-text search query without a table index.
|
|
@@ -248,4 +248,4 @@ export declare function connectNamespace(implName: "rest", config: RestNamespace
|
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
250
|
export declare function connectNamespace(implName: string, properties: Record<string, string>, options?: Partial<ConnectNamespaceOptions>): Promise<Connection>;
|
|
251
|
-
export { Catalog, CatalogOptions,
|
|
251
|
+
export { Catalog, CatalogOptions, DatabaseNames, 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.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;
|
|
5
|
+
exports.connectCatalog = exports.DatabaseNames = 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;
|
|
@@ -184,4 +184,5 @@ async function connectNamespace(implName, configOrProperties, options) {
|
|
|
184
184
|
}
|
|
185
185
|
var catalog_1 = require("./catalog");
|
|
186
186
|
Object.defineProperty(exports, "Catalog", { enumerable: true, get: function () { return catalog_1.Catalog; } });
|
|
187
|
+
Object.defineProperty(exports, "DatabaseNames", { enumerable: true, get: function () { return catalog_1.DatabaseNames; } });
|
|
187
188
|
Object.defineProperty(exports, "connectCatalog", { enumerable: true, get: function () { return catalog_1.connectCatalog; } });
|
|
@@ -57,17 +57,11 @@ export declare class MaterializedView {
|
|
|
57
57
|
/**
|
|
58
58
|
* Recompute the view from its source.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* refreshes to that source version instead of the latest.
|
|
64
|
-
*
|
|
65
|
-
* Concurrent refreshes of one view do not duplicate its rows. Two that
|
|
66
|
-
* plan the same source rows conflict on commit, and the loser throws
|
|
67
|
-
* rather than writing them a second time.
|
|
60
|
+
* Every refresh rebuilds the complete view. For local views,
|
|
61
|
+
* `sourceVersion` refreshes to that source version instead of the latest;
|
|
62
|
+
* remote SQL refreshes do not support source-version pinning.
|
|
68
63
|
*/
|
|
69
64
|
refresh(options?: {
|
|
70
|
-
full?: boolean;
|
|
71
65
|
sourceVersion?: number;
|
|
72
66
|
}): Promise<RefreshMaterializedViewResult>;
|
|
73
67
|
}
|
|
@@ -132,18 +132,13 @@ class MaterializedView {
|
|
|
132
132
|
/**
|
|
133
133
|
* Recompute the view from its source.
|
|
134
134
|
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* refreshes to that source version instead of the latest.
|
|
139
|
-
*
|
|
140
|
-
* Concurrent refreshes of one view do not duplicate its rows. Two that
|
|
141
|
-
* plan the same source rows conflict on commit, and the loser throws
|
|
142
|
-
* rather than writing them a second time.
|
|
135
|
+
* Every refresh rebuilds the complete view. For local views,
|
|
136
|
+
* `sourceVersion` refreshes to that source version instead of the latest;
|
|
137
|
+
* remote SQL refreshes do not support source-version pinning.
|
|
143
138
|
*/
|
|
144
139
|
async refresh(options) {
|
|
145
140
|
validateNonNegativeInteger(options?.sourceVersion, "sourceVersion");
|
|
146
|
-
return await this.inner.refreshMaterializedView(options?.
|
|
141
|
+
return await this.inner.refreshMaterializedView(options?.sourceVersion);
|
|
147
142
|
}
|
|
148
143
|
}
|
|
149
144
|
exports.MaterializedView = MaterializedView;
|