grepmax 0.26.52 → 0.26.54
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/.claude-plugin/marketplace.json +1 -1
- package/NOTICE +1 -1
- package/README.md +1 -1
- package/dist/lib/output/mcp-results.js +3 -0
- package/dist/lib/store/vector-db.js +94 -4
- package/dist/lib/utils/doctor-optimize.js +6 -0
- package/dist/vendor/lancedb/arrow.d.ts +1 -1
- package/dist/vendor/lancedb/arrow.js +81 -3
- package/dist/vendor/lancedb/blob.d.ts +92 -0
- package/dist/vendor/lancedb/blob.js +165 -0
- package/dist/vendor/lancedb/connection.d.ts +10 -22
- package/dist/vendor/lancedb/connection.js +4 -14
- package/dist/vendor/lancedb/index.d.ts +4 -1
- package/dist/vendor/lancedb/index.js +7 -2
- package/dist/vendor/lancedb/indices.d.ts +3 -3
- package/dist/vendor/lancedb/job.d.ts +93 -0
- package/dist/vendor/lancedb/job.js +163 -0
- package/dist/vendor/lancedb/materialized_view.d.ts +2 -0
- package/dist/vendor/lancedb/materialized_view.js +3 -1
- package/dist/vendor/lancedb/merge.d.ts +1 -1
- package/dist/vendor/lancedb/merge.js +1 -1
- package/dist/vendor/lancedb/native.d.ts +50 -34
- package/dist/vendor/lancedb/native.js +53 -52
- package/dist/vendor/lancedb/provenance.json +2 -2
- package/dist/vendor/lancedb/sanitize.js +1 -1
- package/dist/vendor/lancedb/table.d.ts +47 -11
- package/dist/vendor/lancedb/table.js +36 -25
- package/package.json +9 -9
- package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Data, SchemaLike, TableLike } from "./arrow";
|
|
2
|
-
import { Table as ArrowTable } from "./arrow";
|
|
3
2
|
import { EmbeddingFunctionConfig } from "./embedding/registry";
|
|
3
|
+
import { Job } from "./job";
|
|
4
4
|
import { MaterializedView, MaterializedViewSelect } from "./materialized_view";
|
|
5
5
|
import { Connection as LanceDbConnection } from "./native";
|
|
6
|
-
import type { CreateNamespaceResponse, DescribeNamespaceResponse, DropNamespaceResponse,
|
|
6
|
+
import type { CreateNamespaceResponse, DescribeNamespaceResponse, DropNamespaceResponse, JobInfo, ListNamespacesResponse, ListTablesResponse } from "./native";
|
|
7
7
|
export type { CreateNamespaceResponse, DescribeNamespaceResponse, DropNamespaceResponse, ListNamespacesResponse, ListTablesResponse, };
|
|
8
8
|
import { Table } from "./table";
|
|
9
9
|
export interface CreateTableOptions {
|
|
@@ -428,21 +428,17 @@ export declare abstract class Connection {
|
|
|
428
428
|
*/
|
|
429
429
|
abstract renameTable(currentName: string, newName: string, options?: RenameTableOptions): Promise<void>;
|
|
430
430
|
/**
|
|
431
|
-
*
|
|
431
|
+
* Open a server-side job by id, returning a handle with its record already
|
|
432
|
+
* populated. Rejects when the server has no such job, the way
|
|
433
|
+
* {@link Connection.openTable} does for a missing table.
|
|
432
434
|
*
|
|
433
|
-
* The
|
|
434
|
-
*
|
|
435
|
-
*
|
|
435
|
+
* The returned {@link Job} answers for its own state, specification,
|
|
436
|
+
* result, failure and event history, so there is no separate
|
|
437
|
+
* connection-level call for any of them.
|
|
436
438
|
*/
|
|
437
|
-
abstract
|
|
439
|
+
abstract openJob(jobId: string): Promise<Job>;
|
|
438
440
|
/** List server-side jobs across the database's tables. */
|
|
439
441
|
abstract listJobs(): Promise<JobInfo[]>;
|
|
440
|
-
/**
|
|
441
|
-
* Describe a single server-side job by id.
|
|
442
|
-
*
|
|
443
|
-
* Resolves to `null` when the server has no such job.
|
|
444
|
-
*/
|
|
445
|
-
abstract getJob(jobId: string): Promise<JobDescription | null>;
|
|
446
442
|
/**
|
|
447
443
|
* Request cancellation of a server-side job by id.
|
|
448
444
|
*
|
|
@@ -450,12 +446,6 @@ export declare abstract class Connection {
|
|
|
450
446
|
* such job exists. Cancelling an already-terminal job is a no-op success.
|
|
451
447
|
*/
|
|
452
448
|
abstract cancelJob(jobId: string): Promise<boolean>;
|
|
453
|
-
/**
|
|
454
|
-
* The lifecycle event history of a server-side job, as an Arrow table.
|
|
455
|
-
*
|
|
456
|
-
* Lists history across all jobs when `jobId` is omitted.
|
|
457
|
-
*/
|
|
458
|
-
abstract jobHistory(jobId?: string): Promise<ArrowTable>;
|
|
459
449
|
}
|
|
460
450
|
/** @hideconstructor */
|
|
461
451
|
export declare class LocalConnection extends Connection {
|
|
@@ -496,11 +486,9 @@ export declare class LocalConnection extends Connection {
|
|
|
496
486
|
createNamespace(namespacePath: string[], options?: Partial<CreateNamespaceOptions>): Promise<CreateNamespaceResponse>;
|
|
497
487
|
dropNamespace(namespacePath: string[], options?: Partial<DropNamespaceOptions>): Promise<DropNamespaceResponse>;
|
|
498
488
|
renameTable(currentName: string, newName: string, options?: RenameTableOptions): Promise<void>;
|
|
499
|
-
|
|
489
|
+
openJob(jobId: string): Promise<Job>;
|
|
500
490
|
listJobs(): Promise<JobInfo[]>;
|
|
501
|
-
getJob(jobId: string): Promise<JobDescription | null>;
|
|
502
491
|
cancelJob(jobId: string): Promise<boolean>;
|
|
503
|
-
jobHistory(jobId?: string): Promise<ArrowTable>;
|
|
504
492
|
}
|
|
505
493
|
/**
|
|
506
494
|
* Takes storage options and makes all the keys snake case.
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.LocalConnection = exports.Connection = void 0;
|
|
6
6
|
exports.cleanseStorageOptions = cleanseStorageOptions;
|
|
7
|
-
const apache_arrow_1 = require("apache-arrow");
|
|
8
7
|
const arrow_1 = require("./arrow");
|
|
9
8
|
const arrow_2 = require("./arrow");
|
|
10
9
|
const registry_1 = require("./embedding/registry");
|
|
10
|
+
const job_1 = require("./job");
|
|
11
11
|
const materialized_view_1 = require("./materialized_view");
|
|
12
12
|
const sanitize_1 = require("./sanitize");
|
|
13
13
|
const table_1 = require("./table");
|
|
@@ -198,7 +198,7 @@ class LocalConnection extends Connection {
|
|
|
198
198
|
return this.inner.dropTable(name, namespacePath ?? []);
|
|
199
199
|
}
|
|
200
200
|
async dropTableAsync(name, namespacePath) {
|
|
201
|
-
return this.inner.dropTableAsync(name, namespacePath ?? []);
|
|
201
|
+
return new job_1.Job(await this.inner.dropTableAsync(name, namespacePath ?? []));
|
|
202
202
|
}
|
|
203
203
|
async dropAllTables(namespacePath) {
|
|
204
204
|
return this.inner.dropAllTables(namespacePath ?? []);
|
|
@@ -218,25 +218,15 @@ class LocalConnection extends Connection {
|
|
|
218
218
|
async renameTable(currentName, newName, options) {
|
|
219
219
|
return this.inner.renameTable(currentName, newName, options?.namespacePath ?? [], options?.newNamespacePath);
|
|
220
220
|
}
|
|
221
|
-
|
|
222
|
-
return this.inner.
|
|
221
|
+
async openJob(jobId) {
|
|
222
|
+
return new job_1.Job(await this.inner.openJob(jobId));
|
|
223
223
|
}
|
|
224
224
|
async listJobs() {
|
|
225
225
|
return this.inner.listJobs();
|
|
226
226
|
}
|
|
227
|
-
async getJob(jobId) {
|
|
228
|
-
return this.inner.getJob(jobId);
|
|
229
|
-
}
|
|
230
227
|
async cancelJob(jobId) {
|
|
231
228
|
return this.inner.cancelJob(jobId);
|
|
232
229
|
}
|
|
233
|
-
async jobHistory(jobId) {
|
|
234
|
-
const buf = await this.inner.jobHistory(jobId);
|
|
235
|
-
if (buf.length === 0) {
|
|
236
|
-
return new arrow_2.Table();
|
|
237
|
-
}
|
|
238
|
-
return (0, apache_arrow_1.tableFromIPC)(buf);
|
|
239
|
-
}
|
|
240
230
|
}
|
|
241
231
|
exports.LocalConnection = LocalConnection;
|
|
242
232
|
/**
|
|
@@ -8,8 +8,11 @@ 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
10
|
export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
|
|
11
|
+
export { blob, isBlobField, BlobFile } from "./blob";
|
|
12
|
+
export type { BlobOptions } from "./blob";
|
|
11
13
|
export { Connection, CreateTableOptions, TableNamesOptions, ListTablesOptions, OpenTableOptions, ListNamespacesOptions, CreateNamespaceOptions, DropNamespaceOptions, ListNamespacesResponse, ListTablesResponse, CreateNamespaceResponse, DropNamespaceResponse, DescribeNamespaceResponse, RenameTableOptions, } from "./connection";
|
|
12
|
-
export {
|
|
14
|
+
export { JobFailureInfo, JobInfo, Session } from "./native.js";
|
|
15
|
+
export { Job, JobEventsOptions } from "./job";
|
|
13
16
|
export { AutoQuery, ExecutableQuery, Query, QueryBase, VectorQuery, TakeQuery, AnalyzePlanDistributedMetrics, QueryExecutionOptions, ColumnOrdering, FullTextSearchOptions, RecordBatchIterator, FullTextQuery, MatchQuery, PhraseQuery, BoostQuery, MultiMatchQuery, BooleanQuery, FullTextQueryType, Operator, Occur, } from "./query";
|
|
14
17
|
export { Index, IndexOptions, IvfPqOptions, IvfRqOptions, IvfFlatOptions, HnswPqOptions, HnswSqOptions, FtsOptions, BaseTokenizer, } from "./indices";
|
|
15
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";
|
|
@@ -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.
|
|
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;
|
|
6
6
|
exports.tokenize = tokenize;
|
|
7
7
|
exports.connect = connect;
|
|
8
8
|
exports.connectNamespace = connectNamespace;
|
|
@@ -26,11 +26,16 @@ var arrow_1 = require("./arrow");
|
|
|
26
26
|
Object.defineProperty(exports, "makeArrowTable", { enumerable: true, get: function () { return arrow_1.makeArrowTable; } });
|
|
27
27
|
Object.defineProperty(exports, "MakeArrowTableOptions", { enumerable: true, get: function () { return arrow_1.MakeArrowTableOptions; } });
|
|
28
28
|
Object.defineProperty(exports, "VectorColumnOptions", { enumerable: true, get: function () { return arrow_1.VectorColumnOptions; } });
|
|
29
|
+
var blob_1 = require("./blob");
|
|
30
|
+
Object.defineProperty(exports, "blob", { enumerable: true, get: function () { return blob_1.blob; } });
|
|
31
|
+
Object.defineProperty(exports, "isBlobField", { enumerable: true, get: function () { return blob_1.isBlobField; } });
|
|
32
|
+
Object.defineProperty(exports, "BlobFile", { enumerable: true, get: function () { return blob_1.BlobFile; } });
|
|
29
33
|
var connection_2 = require("./connection");
|
|
30
34
|
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return connection_2.Connection; } });
|
|
31
35
|
var native_js_4 = require("./native.js");
|
|
32
|
-
Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return native_js_4.Job; } });
|
|
33
36
|
Object.defineProperty(exports, "Session", { enumerable: true, get: function () { return native_js_4.Session; } });
|
|
37
|
+
var job_1 = require("./job");
|
|
38
|
+
Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return job_1.Job; } });
|
|
34
39
|
var query_1 = require("./query");
|
|
35
40
|
Object.defineProperty(exports, "AutoQuery", { enumerable: true, get: function () { return query_1.AutoQuery; } });
|
|
36
41
|
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return query_1.Query; } });
|
|
@@ -20,7 +20,7 @@ export interface IvfPqOptions {
|
|
|
20
20
|
* This value controls how much the vector is compressed during the quantization step.
|
|
21
21
|
* The more sub vectors there are the less the vector is compressed. The default is
|
|
22
22
|
* the dimension of the vector divided by 16. If the dimension is not evenly divisible
|
|
23
|
-
* by 16 we use the dimension
|
|
23
|
+
* by 16 we use the dimension divided by 8.
|
|
24
24
|
*
|
|
25
25
|
* The above two cases are highly preferred. Having 8 or 16 values per subvector allows
|
|
26
26
|
* us to use efficient SIMD instructions.
|
|
@@ -210,7 +210,7 @@ export interface HnswPqOptions {
|
|
|
210
210
|
* This value controls how much the vector is compressed during the quantization step.
|
|
211
211
|
* The more sub vectors there are the less the vector is compressed. The default is
|
|
212
212
|
* the dimension of the vector divided by 16. If the dimension is not evenly divisible
|
|
213
|
-
* by 16 we use the dimension
|
|
213
|
+
* by 16 we use the dimension divided by 8.
|
|
214
214
|
*
|
|
215
215
|
* The above two cases are highly preferred. Having 8 or 16 values per subvector allows
|
|
216
216
|
* us to use efficient SIMD instructions.
|
|
@@ -678,7 +678,7 @@ export interface IndexOptions {
|
|
|
678
678
|
/**
|
|
679
679
|
* Advanced index configuration
|
|
680
680
|
*
|
|
681
|
-
* This option allows you to specify a
|
|
681
|
+
* This option allows you to specify a specific index to create and also
|
|
682
682
|
* allows you to pass in configuration for training the index.
|
|
683
683
|
*
|
|
684
684
|
* See the static methods on Index for details on the various index types.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Table as ArrowTable } from "apache-arrow";
|
|
2
|
+
import { JobFailureInfo, Job as NativeJob } from "./native";
|
|
3
|
+
/** Which of a job's events {@link Job.events} returns. */
|
|
4
|
+
export interface JobEventsOptions {
|
|
5
|
+
/** Maximum event rows to return, up to the server maximum of 10,000. */
|
|
6
|
+
limit?: number;
|
|
7
|
+
/** SQL-like filter over the event columns. */
|
|
8
|
+
filter?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A handle to an operation that may still be running.
|
|
12
|
+
*
|
|
13
|
+
* The operation may already be complete when the handle is created.
|
|
14
|
+
*
|
|
15
|
+
* The detail getters read what the handle last observed. Submitting an
|
|
16
|
+
* operation returns only a job id, so populating them eagerly would cost an
|
|
17
|
+
* extra round trip on every call:
|
|
18
|
+
*
|
|
19
|
+
* - {@link Job.refresh} and {@link Job.status} fetch the whole record.
|
|
20
|
+
* - {@link Job.wait} records the terminal state it establishes, but not the
|
|
21
|
+
* rest of the record.
|
|
22
|
+
* - Everything is null until one of those runs.
|
|
23
|
+
*
|
|
24
|
+
* @hideconstructor
|
|
25
|
+
*/
|
|
26
|
+
export declare class Job {
|
|
27
|
+
private readonly inner;
|
|
28
|
+
constructor(inner: NativeJob);
|
|
29
|
+
/**
|
|
30
|
+
* Identifies the operation on the server that is running it.
|
|
31
|
+
*
|
|
32
|
+
* Operations that run in this process have no server id. The value is
|
|
33
|
+
* opaque: parsing it or storing it to resume the job later is not supported.
|
|
34
|
+
*/
|
|
35
|
+
get id(): string | null;
|
|
36
|
+
/** The last observed lifecycle state, without contacting the backend. */
|
|
37
|
+
get state(): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* The job's type, as the server names it. Null for an in-process job, which
|
|
40
|
+
* has no server-side record.
|
|
41
|
+
*/
|
|
42
|
+
get jobType(): string | null;
|
|
43
|
+
/** When the job was created, in milliseconds since the epoch. */
|
|
44
|
+
get creationMs(): number | null;
|
|
45
|
+
/** The job-type-specific specification it was submitted with. */
|
|
46
|
+
get spec(): any | null;
|
|
47
|
+
/**
|
|
48
|
+
* The job-type-specific terminal result. Null until the job succeeds, so a
|
|
49
|
+
* job that never terminates reports its progress through {@link Job.events}
|
|
50
|
+
* instead.
|
|
51
|
+
*/
|
|
52
|
+
get result(): any | null;
|
|
53
|
+
/** Why the job failed, when it failed and the server reports a reason. */
|
|
54
|
+
get failure(): JobFailureInfo | null;
|
|
55
|
+
/**
|
|
56
|
+
* The operation's current lifecycle state: "running", "finished", "failed",
|
|
57
|
+
* or "cancelled".
|
|
58
|
+
*
|
|
59
|
+
* A point snapshot; unlike {@link Job.wait} it does not block or reject on a
|
|
60
|
+
* terminal failure state. Also refreshes the getters above.
|
|
61
|
+
*/
|
|
62
|
+
status(): Promise<string>;
|
|
63
|
+
/** Wait until the operation reaches a terminal state. */
|
|
64
|
+
wait(): Promise<void>;
|
|
65
|
+
/** Request cancellation. Cancelling a finished operation is a no-op. */
|
|
66
|
+
cancel(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Ask the backend for this job's current state, and for a server-side job
|
|
69
|
+
* its full record, then cache it for the getters above.
|
|
70
|
+
*/
|
|
71
|
+
refresh(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* This job's recorded lifecycle events.
|
|
74
|
+
*
|
|
75
|
+
* Where the getters above report a terminal result only once the job reaches
|
|
76
|
+
* one, events are written as the job runs and outlive the workers that
|
|
77
|
+
* produced them. A distributed job records a `claim`/`claim_complete` pair
|
|
78
|
+
* per unit of work, each carrying `rows_processed`, so a job that never
|
|
79
|
+
* finishes still accounts for what it did.
|
|
80
|
+
*
|
|
81
|
+
* The server caps results at 1000 rows by default and 10,000 at most, and
|
|
82
|
+
* truncates without saying so, so pass `limit` for a job that emits an event
|
|
83
|
+
* per fragment. `filter` is a SQL-like expression over the `state`,
|
|
84
|
+
* `updated_by`, `emitted_from`, `emitted_by`, and `claim_entity` columns.
|
|
85
|
+
*/
|
|
86
|
+
events(options?: JobEventsOptions): Promise<ArrowTable>;
|
|
87
|
+
/**
|
|
88
|
+
* Every field the handle currently knows, one per line, with the JSON
|
|
89
|
+
* payloads indented -- a refresh job's spec and result are the point of
|
|
90
|
+
* printing it.
|
|
91
|
+
*/
|
|
92
|
+
toString(): string;
|
|
93
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
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.Job = void 0;
|
|
6
|
+
const apache_arrow_1 = require("apache-arrow");
|
|
7
|
+
/**
|
|
8
|
+
* A handle to an operation that may still be running.
|
|
9
|
+
*
|
|
10
|
+
* The operation may already be complete when the handle is created.
|
|
11
|
+
*
|
|
12
|
+
* The detail getters read what the handle last observed. Submitting an
|
|
13
|
+
* operation returns only a job id, so populating them eagerly would cost an
|
|
14
|
+
* extra round trip on every call:
|
|
15
|
+
*
|
|
16
|
+
* - {@link Job.refresh} and {@link Job.status} fetch the whole record.
|
|
17
|
+
* - {@link Job.wait} records the terminal state it establishes, but not the
|
|
18
|
+
* rest of the record.
|
|
19
|
+
* - Everything is null until one of those runs.
|
|
20
|
+
*
|
|
21
|
+
* @hideconstructor
|
|
22
|
+
*/
|
|
23
|
+
class Job {
|
|
24
|
+
inner;
|
|
25
|
+
constructor(inner) {
|
|
26
|
+
this.inner = inner;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Identifies the operation on the server that is running it.
|
|
30
|
+
*
|
|
31
|
+
* Operations that run in this process have no server id. The value is
|
|
32
|
+
* opaque: parsing it or storing it to resume the job later is not supported.
|
|
33
|
+
*/
|
|
34
|
+
get id() {
|
|
35
|
+
return this.inner.id ?? null;
|
|
36
|
+
}
|
|
37
|
+
/** The last observed lifecycle state, without contacting the backend. */
|
|
38
|
+
get state() {
|
|
39
|
+
return this.inner.state ?? null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The job's type, as the server names it. Null for an in-process job, which
|
|
43
|
+
* has no server-side record.
|
|
44
|
+
*/
|
|
45
|
+
get jobType() {
|
|
46
|
+
return this.inner.jobType ?? null;
|
|
47
|
+
}
|
|
48
|
+
/** When the job was created, in milliseconds since the epoch. */
|
|
49
|
+
get creationMs() {
|
|
50
|
+
return this.inner.creationMs ?? null;
|
|
51
|
+
}
|
|
52
|
+
/** The job-type-specific specification it was submitted with. */
|
|
53
|
+
// biome-ignore lint/suspicious/noExplicitAny: shape varies by job type
|
|
54
|
+
get spec() {
|
|
55
|
+
return parseJson(this.inner.specJson);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The job-type-specific terminal result. Null until the job succeeds, so a
|
|
59
|
+
* job that never terminates reports its progress through {@link Job.events}
|
|
60
|
+
* instead.
|
|
61
|
+
*/
|
|
62
|
+
// biome-ignore lint/suspicious/noExplicitAny: shape varies by job type
|
|
63
|
+
get result() {
|
|
64
|
+
return parseJson(this.inner.resultJson);
|
|
65
|
+
}
|
|
66
|
+
/** Why the job failed, when it failed and the server reports a reason. */
|
|
67
|
+
get failure() {
|
|
68
|
+
return this.inner.failure ?? null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The operation's current lifecycle state: "running", "finished", "failed",
|
|
72
|
+
* or "cancelled".
|
|
73
|
+
*
|
|
74
|
+
* A point snapshot; unlike {@link Job.wait} it does not block or reject on a
|
|
75
|
+
* terminal failure state. Also refreshes the getters above.
|
|
76
|
+
*/
|
|
77
|
+
async status() {
|
|
78
|
+
return this.inner.status();
|
|
79
|
+
}
|
|
80
|
+
/** Wait until the operation reaches a terminal state. */
|
|
81
|
+
async wait() {
|
|
82
|
+
return this.inner.wait();
|
|
83
|
+
}
|
|
84
|
+
/** Request cancellation. Cancelling a finished operation is a no-op. */
|
|
85
|
+
async cancel() {
|
|
86
|
+
return this.inner.cancel();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Ask the backend for this job's current state, and for a server-side job
|
|
90
|
+
* its full record, then cache it for the getters above.
|
|
91
|
+
*/
|
|
92
|
+
async refresh() {
|
|
93
|
+
return this.inner.refresh();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* This job's recorded lifecycle events.
|
|
97
|
+
*
|
|
98
|
+
* Where the getters above report a terminal result only once the job reaches
|
|
99
|
+
* one, events are written as the job runs and outlive the workers that
|
|
100
|
+
* produced them. A distributed job records a `claim`/`claim_complete` pair
|
|
101
|
+
* per unit of work, each carrying `rows_processed`, so a job that never
|
|
102
|
+
* finishes still accounts for what it did.
|
|
103
|
+
*
|
|
104
|
+
* The server caps results at 1000 rows by default and 10,000 at most, and
|
|
105
|
+
* truncates without saying so, so pass `limit` for a job that emits an event
|
|
106
|
+
* per fragment. `filter` is a SQL-like expression over the `state`,
|
|
107
|
+
* `updated_by`, `emitted_from`, `emitted_by`, and `claim_entity` columns.
|
|
108
|
+
*/
|
|
109
|
+
async events(options) {
|
|
110
|
+
const buf = await this.inner.events(options?.limit, options?.filter);
|
|
111
|
+
if (buf.length === 0) {
|
|
112
|
+
return new apache_arrow_1.Table();
|
|
113
|
+
}
|
|
114
|
+
return (0, apache_arrow_1.tableFromIPC)(buf);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Every field the handle currently knows, one per line, with the JSON
|
|
118
|
+
* payloads indented -- a refresh job's spec and result are the point of
|
|
119
|
+
* printing it.
|
|
120
|
+
*/
|
|
121
|
+
toString() {
|
|
122
|
+
if (this.state === null) {
|
|
123
|
+
const known = this.id === null ? "" : `id=${JSON.stringify(this.id)}, `;
|
|
124
|
+
return `Job(${known}not refreshed)`;
|
|
125
|
+
}
|
|
126
|
+
const fields = [];
|
|
127
|
+
if (this.id !== null) {
|
|
128
|
+
fields.push(`id=${JSON.stringify(this.id)}`);
|
|
129
|
+
}
|
|
130
|
+
fields.push(`state=${JSON.stringify(this.state)}`);
|
|
131
|
+
if (this.jobType !== null) {
|
|
132
|
+
fields.push(`jobType=${JSON.stringify(this.jobType)}`);
|
|
133
|
+
}
|
|
134
|
+
if (this.creationMs !== null) {
|
|
135
|
+
fields.push(`creationMs=${this.creationMs}`);
|
|
136
|
+
}
|
|
137
|
+
for (const [name, value] of [
|
|
138
|
+
["spec", this.spec],
|
|
139
|
+
["result", this.result],
|
|
140
|
+
]) {
|
|
141
|
+
if (value !== null) {
|
|
142
|
+
fields.push(`${name}=${indentJson(value)}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (this.failure !== null) {
|
|
146
|
+
fields.push(`failure=${indentJson(this.failure)}`);
|
|
147
|
+
}
|
|
148
|
+
return `Job(${fields.map((field) => `\n${REPR_INDENT}${field},`).join("")}\n)`;
|
|
149
|
+
}
|
|
150
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
151
|
+
return this.toString();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.Job = Job;
|
|
155
|
+
const REPR_INDENT = " ";
|
|
156
|
+
// biome-ignore lint/suspicious/noExplicitAny: shape varies by job type
|
|
157
|
+
function indentJson(value) {
|
|
158
|
+
return JSON.stringify(value, null, 4).replace(/\n/g, `\n${REPR_INDENT}`);
|
|
159
|
+
}
|
|
160
|
+
// biome-ignore lint/suspicious/noExplicitAny: shape varies by job type
|
|
161
|
+
function parseJson(raw) {
|
|
162
|
+
return raw === null || raw === undefined ? null : JSON.parse(raw);
|
|
163
|
+
}
|
|
@@ -14,6 +14,8 @@ export interface MaterializedViewDefinition {
|
|
|
14
14
|
limit?: number;
|
|
15
15
|
/** Source columns the projections and filter read. */
|
|
16
16
|
inputs: string[];
|
|
17
|
+
/** Namespace holding the source table; empty is the root namespace. */
|
|
18
|
+
sourceNamespace: string[];
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* The view's columns: column names, `[alias, SQL expression]` pairs, or a
|
|
@@ -44,7 +44,8 @@ function definitionFromMetadata(metadata, name) {
|
|
|
44
44
|
}
|
|
45
45
|
// biome-ignore lint/suspicious/noExplicitAny: raw JSON
|
|
46
46
|
const value = JSON.parse(raw);
|
|
47
|
-
|
|
47
|
+
// "namespaced_select" keeps older readers from resolving the source at root.
|
|
48
|
+
if (value.kind !== "select" && value.kind !== "namespaced_select") {
|
|
48
49
|
throw new Error(`materialized view '${name}' is defined by '${value.kind}', which this ` +
|
|
49
50
|
"version of lancedb cannot refresh");
|
|
50
51
|
}
|
|
@@ -65,6 +66,7 @@ function definitionFromMetadata(metadata, name) {
|
|
|
65
66
|
filter: value.filter ?? undefined,
|
|
66
67
|
limit,
|
|
67
68
|
inputs: value.inputs ?? [],
|
|
69
|
+
sourceNamespace: value.source_namespace ?? [],
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
@@ -15,7 +15,7 @@ export declare class MergeInsertBuilder {
|
|
|
15
15
|
* but that behavior is subject to change.
|
|
16
16
|
*
|
|
17
17
|
* An optional condition may be specified. If it is, then only
|
|
18
|
-
* matched rows that satisfy the
|
|
18
|
+
* matched rows that satisfy the condition will be updated. Any
|
|
19
19
|
* rows that do not satisfy the condition will be left as they
|
|
20
20
|
* are. Failing to satisfy the condition does not cause a
|
|
21
21
|
* "matched row" to become a "not matched" row.
|
|
@@ -23,7 +23,7 @@ class MergeInsertBuilder {
|
|
|
23
23
|
* but that behavior is subject to change.
|
|
24
24
|
*
|
|
25
25
|
* An optional condition may be specified. If it is, then only
|
|
26
|
-
* matched rows that satisfy the
|
|
26
|
+
* matched rows that satisfy the condition will be updated. Any
|
|
27
27
|
* rows that do not satisfy the condition will be left as they
|
|
28
28
|
* are. Failing to satisfy the condition does not cause a
|
|
29
29
|
* "matched row" to become a "not matched" row.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export declare class BlobFile {
|
|
4
|
+
size(): bigint
|
|
5
|
+
read(): Promise<Buffer>
|
|
6
|
+
readRange(start: bigint, end: bigint): Promise<Buffer>
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export declare class BranchContents {
|
|
4
10
|
parentBranch?: string
|
|
5
11
|
parentVersion: number
|
|
@@ -47,30 +53,21 @@ export declare class Connection {
|
|
|
47
53
|
dropTableAsync(name: string, namespacePath?: Array<string> | undefined | null): Promise<Job>
|
|
48
54
|
dropAllTables(namespacePath?: Array<string> | undefined | null): Promise<void>
|
|
49
55
|
/**
|
|
50
|
-
*
|
|
56
|
+
* Open a server-side job by id, returning a handle with its record
|
|
57
|
+
* already populated. Rejects when the server has no such job.
|
|
51
58
|
*
|
|
52
|
-
* The handle
|
|
53
|
-
*
|
|
59
|
+
* The returned handle answers for its own state, specification, result,
|
|
60
|
+
* failure and event history, so there is no separate connection-level
|
|
61
|
+
* call for any of them.
|
|
54
62
|
*/
|
|
55
|
-
|
|
63
|
+
openJob(jobId: string): Promise<Job>
|
|
56
64
|
/** List server-side jobs across the database's tables. */
|
|
57
65
|
listJobs(): Promise<Array<JobInfo>>
|
|
58
|
-
/**
|
|
59
|
-
* Describe a single server-side job by id. `null` when the server has
|
|
60
|
-
* no such job.
|
|
61
|
-
*/
|
|
62
|
-
getJob(jobId: string): Promise<JobDescription | null>
|
|
63
66
|
/**
|
|
64
67
|
* Request cancellation of a server-side job by id. Returns true if the
|
|
65
68
|
* server accepted the cancellation, false if no such job exists.
|
|
66
69
|
*/
|
|
67
70
|
cancelJob(jobId: string): Promise<boolean>
|
|
68
|
-
/**
|
|
69
|
-
* The lifecycle event history of a server-side job (all jobs when
|
|
70
|
-
* `job_id` is null), as an Arrow IPC stream buffer. Empty when there is
|
|
71
|
-
* no history.
|
|
72
|
-
*/
|
|
73
|
-
jobHistory(jobId?: string | undefined | null): Promise<Buffer>
|
|
74
71
|
/** Describe a namespace and return its properties. */
|
|
75
72
|
describeNamespace(namespacePath: Array<string>): Promise<DescribeNamespaceResponse>
|
|
76
73
|
/** List child namespaces under the given namespace path */
|
|
@@ -120,6 +117,39 @@ export declare class Job {
|
|
|
120
117
|
wait(): Promise<void>
|
|
121
118
|
/** Request cancellation. Cancelling a finished operation is a no-op. */
|
|
122
119
|
cancel(): Promise<void>
|
|
120
|
+
/**
|
|
121
|
+
* Ask the backend for this job's current state, and for a server-side job
|
|
122
|
+
* its full record, then cache it for the getters below.
|
|
123
|
+
*
|
|
124
|
+
* They are all null until this runs, because submitting an operation
|
|
125
|
+
* returns only a job id. {@link Job.status} fetches the whole record too;
|
|
126
|
+
* {@link Job.wait} records only the terminal state it establishes.
|
|
127
|
+
*/
|
|
128
|
+
refresh(): Promise<void>
|
|
129
|
+
/** The last observed lifecycle state, without contacting the backend. */
|
|
130
|
+
get state(): string | null
|
|
131
|
+
/**
|
|
132
|
+
* The job's type, as the server names it. Null for an in-process job,
|
|
133
|
+
* which has no server-side record.
|
|
134
|
+
*/
|
|
135
|
+
get jobType(): string | null
|
|
136
|
+
/** When the job was created, in milliseconds since the epoch. */
|
|
137
|
+
get creationMs(): number | null
|
|
138
|
+
/** The job-type-specific specification as a JSON string, when present. */
|
|
139
|
+
get specJson(): string | null
|
|
140
|
+
/**
|
|
141
|
+
* The job-type-specific terminal result as a JSON string. Null until the
|
|
142
|
+
* job succeeds, so a job that never terminates reports its progress
|
|
143
|
+
* through {@link Job.events} instead.
|
|
144
|
+
*/
|
|
145
|
+
get resultJson(): string | null
|
|
146
|
+
/** Why the job failed, when it failed and the server reports a reason. */
|
|
147
|
+
get failure(): JobFailureInfo | null
|
|
148
|
+
/**
|
|
149
|
+
* This job's recorded lifecycle events, as an Arrow IPC stream buffer.
|
|
150
|
+
* The TypeScript wrapper turns it into an Arrow table.
|
|
151
|
+
*/
|
|
152
|
+
events(limit?: number | undefined | null, filter?: string | undefined | null): Promise<Buffer>
|
|
123
153
|
}
|
|
124
154
|
|
|
125
155
|
export declare class JsFullTextQuery {
|
|
@@ -286,6 +316,9 @@ export declare class Table {
|
|
|
286
316
|
querySnapshot(): Promise<Table>
|
|
287
317
|
takeOffsets(offsets: Array<number>): TakeQuery
|
|
288
318
|
takeRowIds(rowIds: Array<bigint>): TakeQuery
|
|
319
|
+
blobColumns(): Promise<Array<string>>
|
|
320
|
+
fetchBlobs(column: string, rowIds: Array<bigint>): Promise<Array<Buffer | undefined | null>>
|
|
321
|
+
fetchBlobFiles(column: string, rowIds: Array<bigint>): Promise<Array<BlobFile | undefined | null>>
|
|
289
322
|
vectorSearch(vector: Float32Array): VectorQuery
|
|
290
323
|
addColumns(transforms: Array<AddColumnsSql>): Promise<AddColumnsResult>
|
|
291
324
|
addComputedColumns(columns: Array<AddColumnsSql>): Promise<AddColumnsResult>
|
|
@@ -316,7 +349,7 @@ export declare class Table {
|
|
|
316
349
|
branches(): Promise<Branches>
|
|
317
350
|
/** The branch this handle is scoped to, or `null` for the main branch. */
|
|
318
351
|
currentBranch(): string | null
|
|
319
|
-
optimize(
|
|
352
|
+
optimize(beforeTimestampMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
|
|
320
353
|
listIndices(): Promise<Array<IndexConfig>>
|
|
321
354
|
tokenize(query: string, column?: string | undefined | null, indexName?: string | undefined | null): Promise<Array<FtsToken>>
|
|
322
355
|
indexStats(indexName: string): Promise<IndexStatistics | null>
|
|
@@ -773,23 +806,6 @@ export interface IndexStatistics {
|
|
|
773
806
|
numIndices?: number
|
|
774
807
|
}
|
|
775
808
|
|
|
776
|
-
/** A described job from `Connection.getJob`. */
|
|
777
|
-
export interface JobDescription {
|
|
778
|
-
jobId: string
|
|
779
|
-
jobType: string
|
|
780
|
-
/** Lifecycle state: "running", "finished", "failed", or "cancelled". */
|
|
781
|
-
state: string
|
|
782
|
-
/** When the job was created, in milliseconds since the epoch. */
|
|
783
|
-
creationMs: number
|
|
784
|
-
/** The job-type-specific specification as a JSON string, when present. */
|
|
785
|
-
specJson?: string
|
|
786
|
-
/**
|
|
787
|
-
* Why the job failed, when the job is failed and the server reports a
|
|
788
|
-
* reason.
|
|
789
|
-
*/
|
|
790
|
-
failure?: JobFailureInfo
|
|
791
|
-
}
|
|
792
|
-
|
|
793
809
|
/** The server's account of why a job failed. */
|
|
794
810
|
export interface JobFailureInfo {
|
|
795
811
|
phase?: string
|
|
@@ -800,7 +816,7 @@ export interface JobFailureInfo {
|
|
|
800
816
|
/** A row from `Connection.listJobs`: one server-side job. */
|
|
801
817
|
export interface JobInfo {
|
|
802
818
|
/**
|
|
803
|
-
* The job id -- what `Connection.
|
|
819
|
+
* The job id -- what `Connection.openJob` and `Connection.cancelJob`
|
|
804
820
|
* accept.
|
|
805
821
|
*/
|
|
806
822
|
jobId: string
|