grepmax 0.26.51 → 0.26.53

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.
@@ -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
- if (value.kind !== "select") {
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 condtion will be updated. Any
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 condtion will be updated. Any
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
- * A `Job` handle for a server-side job by id.
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 is constructed without a server round trip; an unknown id
53
- * surfaces when the handle is used.
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
- job(jobId: string): Job
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(olderThanMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
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.getJob` and `Connection.cancelJob`
819
+ * The job id -- what `Connection.openJob` and `Connection.cancelJob`
804
820
  * accept.
805
821
  */
806
822
  jobId: string