@lancedb/lancedb 0.15.1-beta.2 → 0.16.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/table.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { Table as ArrowTable, Data, IntoVector, Schema, TableLike } from "./arrow";
2
- import { CreateTableOptions } from "./connection";
1
+ import { Table as ArrowTable, Data, IntoVector, Schema } from "./arrow";
3
2
  import { IndexOptions } from "./indices";
4
3
  import { MergeInsertBuilder } from "./merge";
5
4
  import { AddColumnsSql, ColumnAlteration, IndexConfig, IndexStatistics, OptimizeStats, Table as _NativeTable } from "./native";
@@ -61,8 +60,14 @@ export interface Version {
61
60
  * can call the `close` method. Once the Table is closed, it cannot be used for any
62
61
  * further operations.
63
62
  *
63
+ * Tables are created using the methods {@link Connection#createTable}
64
+ * and {@link Connection#createEmptyTable}. Existing tables are opened
65
+ * using {@link Connection#openTable}.
66
+ *
64
67
  * Closing a table is optional. It not closed, it will be closed when it is garbage
65
68
  * collected.
69
+ *
70
+ * @hideconstructor
66
71
  */
67
72
  export declare abstract class Table {
68
73
  /** Returns the name of the table */
@@ -148,8 +153,9 @@ export declare abstract class Table {
148
153
  * Indices on scalar columns will speed up filtering (in both
149
154
  * vector and non-vector searches)
150
155
  *
151
- * @note We currently don't support custom named indexes,
152
- * The index name will always be `${column}_idx`
156
+ * We currently don't support custom named indexes.
157
+ * The index name will always be `${column}_idx`.
158
+ *
153
159
  * @example
154
160
  * // If the column has a vector (fixed size list) data type then
155
161
  * // an IvfPq vector index will be created.
@@ -175,7 +181,7 @@ export declare abstract class Table {
175
181
  *
176
182
  * @param name The name of the index.
177
183
  *
178
- * @note This does not delete the index from disk, it just removes it from the table.
184
+ * This does not delete the index from disk, it just removes it from the table.
179
185
  * To delete the index, run {@link Table#optimize} after dropping the index.
180
186
  *
181
187
  * Use {@link Table.listIndices} to find the names of the indices.
@@ -374,10 +380,6 @@ export declare abstract class Table {
374
380
  * Use {@link Table.listIndices} to find the names of the indices.
375
381
  */
376
382
  abstract indexStats(name: string): Promise<IndexStatistics | undefined>;
377
- static parseTableData(data: Record<string, unknown>[] | TableLike, options?: Partial<CreateTableOptions>, streaming?: boolean): Promise<{
378
- buf: Buffer;
379
- mode: string;
380
- }>;
381
383
  }
382
384
  export declare class LocalTable extends Table {
383
385
  private readonly inner;
package/dist/table.js CHANGED
@@ -7,7 +7,6 @@ const arrow_1 = require("./arrow");
7
7
  const registry_1 = require("./embedding/registry");
8
8
  const merge_1 = require("./merge");
9
9
  const query_1 = require("./query");
10
- const sanitize_1 = require("./sanitize");
11
10
  const util_1 = require("./util");
12
11
  /**
13
12
  * A Table is a collection of Records in a LanceDB Database.
@@ -18,35 +17,19 @@ const util_1 = require("./util");
18
17
  * can call the `close` method. Once the Table is closed, it cannot be used for any
19
18
  * further operations.
20
19
  *
20
+ * Tables are created using the methods {@link Connection#createTable}
21
+ * and {@link Connection#createEmptyTable}. Existing tables are opened
22
+ * using {@link Connection#openTable}.
23
+ *
21
24
  * Closing a table is optional. It not closed, it will be closed when it is garbage
22
25
  * collected.
26
+ *
27
+ * @hideconstructor
23
28
  */
24
29
  class Table {
25
30
  [Symbol.for("nodejs.util.inspect.custom")]() {
26
31
  return this.display();
27
32
  }
28
- static async parseTableData(data, options, streaming = false) {
29
- let mode = options?.mode ?? "create";
30
- const existOk = options?.existOk ?? false;
31
- if (mode === "create" && existOk) {
32
- mode = "exist_ok";
33
- }
34
- let table;
35
- if ((0, arrow_1.isArrowTable)(data)) {
36
- table = (0, sanitize_1.sanitizeTable)(data);
37
- }
38
- else {
39
- table = (0, arrow_1.makeArrowTable)(data, options);
40
- }
41
- if (streaming) {
42
- const buf = await (0, arrow_1.fromTableToStreamBuffer)(table, options?.embeddingFunction, options?.schema);
43
- return { buf, mode };
44
- }
45
- else {
46
- const buf = await (0, arrow_1.fromTableToBuffer)(table, options?.embeddingFunction, options?.schema);
47
- return { buf, mode };
48
- }
49
- }
50
33
  }
51
34
  exports.Table = Table;
52
35
  class LocalTable extends Table {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.15.1-beta.2",
14
+ "version": "0.16.0",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -84,7 +84,7 @@
84
84
  "build": "npm run build:debug && tsc -b && shx cp lancedb/native.d.ts dist/native.d.ts && shx cp lancedb/*.node dist/",
85
85
  "build-release": "npm run build:release && tsc -b && shx cp lancedb/native.d.ts dist/native.d.ts",
86
86
  "lint-ci": "biome ci .",
87
- "docs": "typedoc --plugin typedoc-plugin-markdown --out ../docs/src/js lancedb/index.ts",
87
+ "docs": "typedoc --plugin typedoc-plugin-markdown --treatWarningsAsErrors --out ../docs/src/js lancedb/index.ts",
88
88
  "postdocs": "node typedoc_post_process.js",
89
89
  "lint": "biome check . && biome format .",
90
90
  "lint-fix": "biome check --write . && biome format --write .",
@@ -98,14 +98,14 @@
98
98
  "reflect-metadata": "^0.2.2"
99
99
  },
100
100
  "optionalDependencies": {
101
- "@lancedb/lancedb-darwin-x64": "0.15.1-beta.2",
102
- "@lancedb/lancedb-darwin-arm64": "0.15.1-beta.2",
103
- "@lancedb/lancedb-linux-x64-gnu": "0.15.1-beta.2",
104
- "@lancedb/lancedb-linux-arm64-gnu": "0.15.1-beta.2",
105
- "@lancedb/lancedb-linux-x64-musl": "0.15.1-beta.2",
106
- "@lancedb/lancedb-linux-arm64-musl": "0.15.1-beta.2",
107
- "@lancedb/lancedb-win32-x64-msvc": "0.15.1-beta.2",
108
- "@lancedb/lancedb-win32-arm64-msvc": "0.15.1-beta.2"
101
+ "@lancedb/lancedb-darwin-x64": "0.16.0",
102
+ "@lancedb/lancedb-darwin-arm64": "0.16.0",
103
+ "@lancedb/lancedb-linux-x64-gnu": "0.16.0",
104
+ "@lancedb/lancedb-linux-arm64-gnu": "0.16.0",
105
+ "@lancedb/lancedb-linux-x64-musl": "0.16.0",
106
+ "@lancedb/lancedb-linux-arm64-musl": "0.16.0",
107
+ "@lancedb/lancedb-win32-x64-msvc": "0.16.0",
108
+ "@lancedb/lancedb-win32-arm64-msvc": "0.16.0"
109
109
  },
110
110
  "peerDependencies": {
111
111
  "apache-arrow": ">=15.0.0 <=18.1.0"
@@ -40,23 +40,28 @@ function processDirectory(directoryPath) {
40
40
  function processContents(contents) {
41
41
  // This changes the parameters section to put the parameter description on
42
42
  // the same line as the bullet with the parameter name and type.
43
- return contents.replace(/(## Parameters[\s\S]*?)(?=##|$)/g, (match) => {
44
- let lines = match
45
- .split("\n")
46
- .map((line) => line.trim())
47
-
48
- .filter((line) => line !== "")
49
- .map((line) => {
50
- if (line.startsWith("##")) {
51
- return line;
52
- } else if (line.startsWith("")) {
53
- return "\n*" + line.substring(1);
54
- } else {
55
- return " " + line;
56
- }
57
- });
58
- return lines.join("\n") + "\n\n";
59
- });
43
+ return (
44
+ contents
45
+ .replace(/(## Parameters[\s\S]*?)(?=##|$)/g, (match) => {
46
+ let lines = match
47
+ .split("\n")
48
+ .map((line) => line.trim())
49
+
50
+ .filter((line) => line !== "")
51
+ .map((line) => {
52
+ if (line.startsWith("##")) {
53
+ return line;
54
+ } else if (line.startsWith("•")) {
55
+ return "\n*" + line.substring(1);
56
+ } else {
57
+ return " " + line;
58
+ }
59
+ });
60
+ return lines.join("\n") + "\n\n";
61
+ })
62
+ // Also trim trailing whitespace
63
+ .replace(/([^ \t])[ \t]+\n/g, "$1\n")
64
+ );
60
65
  }
61
66
 
62
67
  // Start processing from the root directory