@lancedb/lancedb 0.5.1 → 0.7.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.
Files changed (91) hide show
  1. package/Cargo.toml +3 -3
  2. package/biome.json +19 -3
  3. package/dist/arrow.d.ts +42 -7
  4. package/dist/arrow.js +6 -5
  5. package/dist/connection.d.ts +55 -29
  6. package/dist/connection.js +22 -74
  7. package/dist/embedding/embedding_function.d.ts +11 -3
  8. package/dist/embedding/embedding_function.js +36 -12
  9. package/dist/embedding/openai.d.ts +6 -5
  10. package/dist/embedding/openai.js +4 -2
  11. package/dist/embedding/registry.d.ts +10 -11
  12. package/dist/embedding/registry.js +4 -0
  13. package/dist/index.d.ts +51 -3
  14. package/dist/index.js +28 -4
  15. package/dist/merge.d.ts +54 -0
  16. package/dist/merge.js +64 -0
  17. package/dist/native.d.ts +34 -7
  18. package/dist/native.js +26 -9
  19. package/dist/query.d.ts +51 -16
  20. package/dist/query.js +122 -21
  21. package/dist/remote/client.d.ts +28 -0
  22. package/dist/remote/client.js +172 -0
  23. package/dist/remote/connection.d.ts +25 -0
  24. package/dist/remote/connection.js +110 -0
  25. package/dist/remote/index.d.ts +3 -0
  26. package/dist/remote/index.js +9 -0
  27. package/dist/remote/table.d.ts +42 -0
  28. package/dist/remote/table.js +179 -0
  29. package/dist/sanitize.d.ts +3 -2
  30. package/dist/sanitize.js +55 -1
  31. package/dist/table.d.ts +116 -25
  32. package/dist/table.js +117 -233
  33. package/dist/util.d.ts +14 -0
  34. package/dist/util.js +65 -0
  35. package/examples/ann_indexes.ts +49 -0
  36. package/examples/basic.ts +149 -0
  37. package/examples/embedding.ts +83 -0
  38. package/examples/filtering.ts +34 -0
  39. package/examples/jsconfig.json +27 -0
  40. package/examples/package-lock.json +79 -0
  41. package/examples/package.json +18 -0
  42. package/examples/search.ts +37 -0
  43. package/lancedb/arrow.ts +87 -24
  44. package/lancedb/connection.ts +115 -92
  45. package/lancedb/embedding/embedding_function.ts +48 -16
  46. package/lancedb/embedding/openai.ts +11 -6
  47. package/lancedb/embedding/registry.ts +38 -22
  48. package/lancedb/index.ts +101 -2
  49. package/lancedb/merge.ts +70 -0
  50. package/lancedb/query.ts +168 -39
  51. package/lancedb/remote/client.ts +221 -0
  52. package/lancedb/remote/connection.ts +201 -0
  53. package/lancedb/remote/index.ts +3 -0
  54. package/lancedb/remote/table.ts +226 -0
  55. package/lancedb/sanitize.ts +73 -1
  56. package/lancedb/table.ts +344 -101
  57. package/lancedb/util.ts +69 -0
  58. package/native.d.ts +208 -0
  59. package/nodejs-artifacts/arrow.d.ts +42 -7
  60. package/nodejs-artifacts/arrow.js +6 -5
  61. package/nodejs-artifacts/connection.d.ts +55 -29
  62. package/nodejs-artifacts/connection.js +22 -74
  63. package/nodejs-artifacts/embedding/embedding_function.d.ts +11 -3
  64. package/nodejs-artifacts/embedding/embedding_function.js +36 -12
  65. package/nodejs-artifacts/embedding/openai.d.ts +6 -5
  66. package/nodejs-artifacts/embedding/openai.js +4 -2
  67. package/nodejs-artifacts/embedding/registry.d.ts +10 -11
  68. package/nodejs-artifacts/embedding/registry.js +4 -0
  69. package/nodejs-artifacts/index.d.ts +51 -3
  70. package/nodejs-artifacts/index.js +28 -4
  71. package/nodejs-artifacts/merge.d.ts +54 -0
  72. package/nodejs-artifacts/merge.js +64 -0
  73. package/nodejs-artifacts/native.d.ts +34 -7
  74. package/nodejs-artifacts/native.js +26 -9
  75. package/nodejs-artifacts/query.d.ts +51 -16
  76. package/nodejs-artifacts/query.js +122 -21
  77. package/nodejs-artifacts/remote/client.d.ts +28 -0
  78. package/nodejs-artifacts/remote/client.js +172 -0
  79. package/nodejs-artifacts/remote/connection.d.ts +25 -0
  80. package/nodejs-artifacts/remote/connection.js +110 -0
  81. package/nodejs-artifacts/remote/index.d.ts +3 -0
  82. package/nodejs-artifacts/remote/index.js +9 -0
  83. package/nodejs-artifacts/remote/table.d.ts +42 -0
  84. package/nodejs-artifacts/remote/table.js +179 -0
  85. package/nodejs-artifacts/sanitize.d.ts +3 -2
  86. package/nodejs-artifacts/sanitize.js +55 -1
  87. package/nodejs-artifacts/table.d.ts +116 -25
  88. package/nodejs-artifacts/table.js +117 -233
  89. package/nodejs-artifacts/util.d.ts +14 -0
  90. package/nodejs-artifacts/util.js +65 -0
  91. package/package.json +25 -11
@@ -13,10 +13,13 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Table = void 0;
16
+ exports.LocalTable = exports.Table = void 0;
17
17
  const arrow_1 = require("./arrow");
18
18
  const registry_1 = require("./embedding/registry");
19
+ const merge_1 = require("./merge");
19
20
  const query_1 = require("./query");
21
+ const sanitize_1 = require("./sanitize");
22
+ const util_1 = require("./util");
20
23
  /**
21
24
  * A Table is a collection of Records in a LanceDB Database.
22
25
  *
@@ -30,305 +33,173 @@ const query_1 = require("./query");
30
33
  * collected.
31
34
  */
32
35
  class Table {
36
+ [Symbol.for("nodejs.util.inspect.custom")]() {
37
+ return this.display();
38
+ }
39
+ static async parseTableData(data, options, streaming = false) {
40
+ let mode = options?.mode ?? "create";
41
+ const existOk = options?.existOk ?? false;
42
+ if (mode === "create" && existOk) {
43
+ mode = "exist_ok";
44
+ }
45
+ let table;
46
+ if ((0, arrow_1.isArrowTable)(data)) {
47
+ table = (0, sanitize_1.sanitizeTable)(data);
48
+ }
49
+ else {
50
+ table = (0, arrow_1.makeArrowTable)(data, options);
51
+ }
52
+ if (streaming) {
53
+ const buf = await (0, arrow_1.fromTableToStreamBuffer)(table, options?.embeddingFunction, options?.schema);
54
+ return { buf, mode };
55
+ }
56
+ else {
57
+ const buf = await (0, arrow_1.fromTableToBuffer)(table, options?.embeddingFunction, options?.schema);
58
+ return { buf, mode };
59
+ }
60
+ }
61
+ }
62
+ exports.Table = Table;
63
+ class LocalTable extends Table {
33
64
  inner;
34
- /** Construct a Table. Internal use only. */
35
65
  constructor(inner) {
66
+ super();
36
67
  this.inner = inner;
37
68
  }
38
- /** Return true if the table has not been closed */
69
+ get name() {
70
+ return this.inner.name;
71
+ }
39
72
  isOpen() {
40
73
  return this.inner.isOpen();
41
74
  }
42
- /**
43
- * Close the table, releasing any underlying resources.
44
- *
45
- * It is safe to call this method multiple times.
46
- *
47
- * Any attempt to use the table after it is closed will result in an error.
48
- */
49
75
  close() {
50
76
  this.inner.close();
51
77
  }
52
- /** Return a brief description of the table */
53
78
  display() {
54
79
  return this.inner.display();
55
80
  }
81
+ async getEmbeddingFunctions() {
82
+ const schema = await this.schema();
83
+ const registry = (0, registry_1.getRegistry)();
84
+ return registry.parseFunctions(schema.metadata);
85
+ }
56
86
  /** Get the schema of the table. */
57
87
  async schema() {
58
88
  const schemaBuf = await this.inner.schema();
59
89
  const tbl = (0, arrow_1.tableFromIPC)(schemaBuf);
60
90
  return tbl.schema;
61
91
  }
62
- /**
63
- * Insert records into this Table.
64
- * @param {Data} data Records to be inserted into the Table
65
- */
66
92
  async add(data, options) {
67
93
  const mode = options?.mode ?? "append";
68
94
  const schema = await this.schema();
69
95
  const registry = (0, registry_1.getRegistry)();
70
96
  const functions = registry.parseFunctions(schema.metadata);
71
- const buffer = await (0, arrow_1.fromDataToBuffer)(data, functions.values().next().value);
97
+ const buffer = await (0, arrow_1.fromDataToBuffer)(data, functions.values().next().value, schema);
72
98
  await this.inner.add(buffer, mode);
73
99
  }
74
- /**
75
- * Update existing records in the Table
76
- *
77
- * An update operation can be used to adjust existing values. Use the
78
- * returned builder to specify which columns to update. The new value
79
- * can be a literal value (e.g. replacing nulls with some default value)
80
- * or an expression applied to the old value (e.g. incrementing a value)
81
- *
82
- * An optional condition can be specified (e.g. "only update if the old
83
- * value is 0")
84
- *
85
- * Note: if your condition is something like "some_id_column == 7" and
86
- * you are updating many rows (with different ids) then you will get
87
- * better performance with a single [`merge_insert`] call instead of
88
- * repeatedly calilng this method.
89
- * @param {Map<string, string> | Record<string, string>} updates - the
90
- * columns to update
91
- *
92
- * Keys in the map should specify the name of the column to update.
93
- * Values in the map provide the new value of the column. These can
94
- * be SQL literal strings (e.g. "7" or "'foo'") or they can be expressions
95
- * based on the row being updated (e.g. "my_col + 1")
96
- * @param {Partial<UpdateOptions>} options - additional options to control
97
- * the update behavior
98
- */
99
- async update(updates, options) {
100
- const onlyIf = options?.where;
100
+ async update(optsOrUpdates, options) {
101
+ const isValues = "values" in optsOrUpdates && typeof optsOrUpdates.values !== "string";
102
+ const isValuesSql = "valuesSql" in optsOrUpdates &&
103
+ typeof optsOrUpdates.valuesSql !== "string";
104
+ const isMap = (obj) => {
105
+ return obj instanceof Map;
106
+ };
107
+ let predicate;
101
108
  let columns;
102
- if (updates instanceof Map) {
103
- columns = Array.from(updates.entries());
104
- }
105
- else {
106
- columns = Object.entries(updates);
109
+ switch (true) {
110
+ case isMap(optsOrUpdates):
111
+ columns = Array.from(optsOrUpdates.entries());
112
+ predicate = options?.where;
113
+ break;
114
+ case isValues && isMap(optsOrUpdates.values):
115
+ columns = Array.from(optsOrUpdates.values.entries()).map(([k, v]) => [
116
+ k,
117
+ (0, util_1.toSQL)(v),
118
+ ]);
119
+ predicate = optsOrUpdates.where;
120
+ break;
121
+ case isValues && !isMap(optsOrUpdates.values):
122
+ columns = Object.entries(optsOrUpdates.values).map(([k, v]) => [
123
+ k,
124
+ (0, util_1.toSQL)(v),
125
+ ]);
126
+ predicate = optsOrUpdates.where;
127
+ break;
128
+ case isValuesSql && isMap(optsOrUpdates.valuesSql):
129
+ columns = Array.from(optsOrUpdates.valuesSql.entries());
130
+ predicate = optsOrUpdates.where;
131
+ break;
132
+ case isValuesSql && !isMap(optsOrUpdates.valuesSql):
133
+ columns = Object.entries(optsOrUpdates.valuesSql).map(([k, v]) => [
134
+ k,
135
+ v,
136
+ ]);
137
+ predicate = optsOrUpdates.where;
138
+ break;
139
+ default:
140
+ columns = Object.entries(optsOrUpdates);
141
+ predicate = options?.where;
107
142
  }
108
- await this.inner.update(onlyIf, columns);
143
+ await this.inner.update(predicate, columns);
109
144
  }
110
- /** Count the total number of rows in the dataset. */
111
145
  async countRows(filter) {
112
146
  return await this.inner.countRows(filter);
113
147
  }
114
- /** Delete the rows that satisfy the predicate. */
115
148
  async delete(predicate) {
116
149
  await this.inner.delete(predicate);
117
150
  }
118
- /**
119
- * Create an index to speed up queries.
120
- *
121
- * Indices can be created on vector columns or scalar columns.
122
- * Indices on vector columns will speed up vector searches.
123
- * Indices on scalar columns will speed up filtering (in both
124
- * vector and non-vector searches)
125
- * @example
126
- * // If the column has a vector (fixed size list) data type then
127
- * // an IvfPq vector index will be created.
128
- * const table = await conn.openTable("my_table");
129
- * await table.createIndex("vector");
130
- * @example
131
- * // For advanced control over vector index creation you can specify
132
- * // the index type and options.
133
- * const table = await conn.openTable("my_table");
134
- * await table.createIndex("vector", {
135
- * config: lancedb.Index.ivfPq({
136
- * numPartitions: 128,
137
- * numSubVectors: 16,
138
- * }),
139
- * });
140
- * @example
141
- * // Or create a Scalar index
142
- * await table.createIndex("my_float_col");
143
- */
144
151
  async createIndex(column, options) {
145
152
  // Bit of a hack to get around the fact that TS has no package-scope.
146
153
  // biome-ignore lint/suspicious/noExplicitAny: skip
147
154
  const nativeIndex = options?.config?.inner;
148
155
  await this.inner.createIndex(nativeIndex, column, options?.replace);
149
156
  }
150
- /**
151
- * Create a {@link Query} Builder.
152
- *
153
- * Queries allow you to search your existing data. By default the query will
154
- * return all the data in the table in no particular order. The builder
155
- * returned by this method can be used to control the query using filtering,
156
- * vector similarity, sorting, and more.
157
- *
158
- * Note: By default, all columns are returned. For best performance, you should
159
- * only fetch the columns you need.
160
- *
161
- * When appropriate, various indices and statistics based pruning will be used to
162
- * accelerate the query.
163
- * @example
164
- * // SQL-style filtering
165
- * //
166
- * // This query will return up to 1000 rows whose value in the `id` column
167
- * // is greater than 5. LanceDb supports a broad set of filtering functions.
168
- * for await (const batch of table
169
- * .query()
170
- * .where("id > 1")
171
- * .select(["id"])
172
- * .limit(20)) {
173
- * console.log(batch);
174
- * }
175
- * @example
176
- * // Vector Similarity Search
177
- * //
178
- * // This example will find the 10 rows whose value in the "vector" column are
179
- * // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
180
- * // on the "vector" column then this will perform an ANN search.
181
- * //
182
- * // The `refineFactor` and `nprobes` methods are used to control the recall /
183
- * // latency tradeoff of the search.
184
- * for await (const batch of table
185
- * .query()
186
- * .where("id > 1")
187
- * .select(["id"])
188
- * .limit(20)) {
189
- * console.log(batch);
190
- * }
191
- * @example
192
- * // Scan the full dataset
193
- * //
194
- * // This query will return everything in the table in no particular order.
195
- * for await (const batch of table.query()) {
196
- * console.log(batch);
197
- * }
198
- * @returns {Query} A builder that can be used to parameterize the query
199
- */
200
157
  query() {
201
158
  return new query_1.Query(this.inner);
202
159
  }
203
- /**
204
- * Search the table with a given query vector.
205
- *
206
- * This is a convenience method for preparing a vector query and
207
- * is the same thing as calling `nearestTo` on the builder returned
208
- * by `query`. @see {@link Query#nearestTo} for more details.
209
- */
160
+ search(query) {
161
+ if (typeof query !== "string") {
162
+ return this.vectorSearch(query);
163
+ }
164
+ else {
165
+ const queryPromise = this.getEmbeddingFunctions().then(async (functions) => {
166
+ // TODO: Support multiple embedding functions
167
+ const embeddingFunc = functions
168
+ .values()
169
+ .next().value;
170
+ if (!embeddingFunc) {
171
+ return Promise.reject(new Error("No embedding functions are defined in the table"));
172
+ }
173
+ return await embeddingFunc.function.computeQueryEmbeddings(query);
174
+ });
175
+ return this.query().nearestTo(queryPromise);
176
+ }
177
+ }
210
178
  vectorSearch(vector) {
211
179
  return this.query().nearestTo(vector);
212
180
  }
213
181
  // TODO: Support BatchUDF
214
- /**
215
- * Add new columns with defined values.
216
- * @param {AddColumnsSql[]} newColumnTransforms pairs of column names and
217
- * the SQL expression to use to calculate the value of the new column. These
218
- * expressions will be evaluated for each row in the table, and can
219
- * reference existing columns in the table.
220
- */
221
182
  async addColumns(newColumnTransforms) {
222
183
  await this.inner.addColumns(newColumnTransforms);
223
184
  }
224
- /**
225
- * Alter the name or nullability of columns.
226
- * @param {ColumnAlteration[]} columnAlterations One or more alterations to
227
- * apply to columns.
228
- */
229
185
  async alterColumns(columnAlterations) {
230
186
  await this.inner.alterColumns(columnAlterations);
231
187
  }
232
- /**
233
- * Drop one or more columns from the dataset
234
- *
235
- * This is a metadata-only operation and does not remove the data from the
236
- * underlying storage. In order to remove the data, you must subsequently
237
- * call ``compact_files`` to rewrite the data without the removed columns and
238
- * then call ``cleanup_files`` to remove the old files.
239
- * @param {string[]} columnNames The names of the columns to drop. These can
240
- * be nested column references (e.g. "a.b.c") or top-level column names
241
- * (e.g. "a").
242
- */
243
188
  async dropColumns(columnNames) {
244
189
  await this.inner.dropColumns(columnNames);
245
190
  }
246
- /** Retrieve the version of the table */
247
191
  async version() {
248
192
  return await this.inner.version();
249
193
  }
250
- /**
251
- * Checks out a specific version of the table _This is an in-place operation._
252
- *
253
- * This allows viewing previous versions of the table. If you wish to
254
- * keep writing to the dataset starting from an old version, then use
255
- * the `restore` function.
256
- *
257
- * Calling this method will set the table into time-travel mode. If you
258
- * wish to return to standard mode, call `checkoutLatest`.
259
- * @param {number} version The version to checkout
260
- * @example
261
- * ```typescript
262
- * import * as lancedb from "@lancedb/lancedb"
263
- * const db = await lancedb.connect("./.lancedb");
264
- * const table = await db.createTable("my_table", [
265
- * { vector: [1.1, 0.9], type: "vector" },
266
- * ]);
267
- *
268
- * console.log(await table.version()); // 1
269
- * console.log(table.display());
270
- * await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
271
- * await table.checkout(1);
272
- * console.log(await table.version()); // 2
273
- * ```
274
- */
275
194
  async checkout(version) {
276
195
  await this.inner.checkout(version);
277
196
  }
278
- /**
279
- * Checkout the latest version of the table. _This is an in-place operation._
280
- *
281
- * The table will be set back into standard mode, and will track the latest
282
- * version of the table.
283
- */
284
197
  async checkoutLatest() {
285
198
  await this.inner.checkoutLatest();
286
199
  }
287
- /**
288
- * Restore the table to the currently checked out version
289
- *
290
- * This operation will fail if checkout has not been called previously
291
- *
292
- * This operation will overwrite the latest version of the table with a
293
- * previous version. Any changes made since the checked out version will
294
- * no longer be visible.
295
- *
296
- * Once the operation concludes the table will no longer be in a checked
297
- * out state and the read_consistency_interval, if any, will apply.
298
- */
299
200
  async restore() {
300
201
  await this.inner.restore();
301
202
  }
302
- /**
303
- * Optimize the on-disk data and indices for better performance.
304
- *
305
- * Modeled after ``VACUUM`` in PostgreSQL.
306
- *
307
- * Optimization covers three operations:
308
- *
309
- * - Compaction: Merges small files into larger ones
310
- * - Prune: Removes old versions of the dataset
311
- * - Index: Optimizes the indices, adding new data to existing indices
312
- *
313
- *
314
- * Experimental API
315
- * ----------------
316
- *
317
- * The optimization process is undergoing active development and may change.
318
- * Our goal with these changes is to improve the performance of optimization and
319
- * reduce the complexity.
320
- *
321
- * That being said, it is essential today to run optimize if you want the best
322
- * performance. It should be stable and safe to use in production, but it our
323
- * hope that the API may be simplified (or not even need to be called) in the
324
- * future.
325
- *
326
- * The frequency an application shoudl call optimize is based on the frequency of
327
- * data modifications. If data is frequently added, deleted, or updated then
328
- * optimize should be run frequently. A good rule of thumb is to run optimize if
329
- * you have added or modified 100,000 or more records or run more than 20 data
330
- * modification operations.
331
- */
332
203
  async optimize(options) {
333
204
  let cleanupOlderThanMs;
334
205
  if (options?.cleanupOlderThan !== undefined &&
@@ -338,9 +209,22 @@ class Table {
338
209
  }
339
210
  return await this.inner.optimize(cleanupOlderThanMs);
340
211
  }
341
- /** List all indices that have been created with {@link Table.createIndex} */
342
212
  async listIndices() {
343
213
  return await this.inner.listIndices();
344
214
  }
215
+ async toArrow() {
216
+ return await this.query().toArrow();
217
+ }
218
+ async indexStats(name) {
219
+ const stats = await this.inner.indexStats(name);
220
+ if (stats === null) {
221
+ return undefined;
222
+ }
223
+ return stats;
224
+ }
225
+ mergeInsert(on) {
226
+ on = Array.isArray(on) ? on : [on];
227
+ return new merge_1.MergeInsertBuilder(this.inner.mergeInsert(on));
228
+ }
345
229
  }
346
- exports.Table = Table;
230
+ exports.LocalTable = LocalTable;
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ export type IntoSql = string | number | boolean | null | Date | ArrayBufferLike | Buffer | IntoSql[];
3
+ export declare function toSQL(value: IntoSql): string;
4
+ export declare class TTLCache {
5
+ private readonly ttl;
6
+ private readonly cache;
7
+ /**
8
+ * @param ttl Time to live in milliseconds
9
+ */
10
+ constructor(ttl: number);
11
+ get(key: string): any | undefined;
12
+ set(key: string, value: any): void;
13
+ delete(key: string): void;
14
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TTLCache = exports.toSQL = void 0;
4
+ function toSQL(value) {
5
+ if (typeof value === "string") {
6
+ return `'${value.replace(/'/g, "''")}'`;
7
+ }
8
+ else if (typeof value === "number") {
9
+ return value.toString();
10
+ }
11
+ else if (typeof value === "boolean") {
12
+ return value ? "TRUE" : "FALSE";
13
+ }
14
+ else if (value === null) {
15
+ return "NULL";
16
+ }
17
+ else if (value instanceof Date) {
18
+ return `'${value.toISOString()}'`;
19
+ }
20
+ else if (Array.isArray(value)) {
21
+ return `[${value.map(toSQL).join(", ")}]`;
22
+ }
23
+ else if (Buffer.isBuffer(value)) {
24
+ return `X'${value.toString("hex")}'`;
25
+ }
26
+ else if (value instanceof ArrayBuffer) {
27
+ return `X'${Buffer.from(value).toString("hex")}'`;
28
+ }
29
+ else {
30
+ throw new Error(`Unsupported value type: ${typeof value} value: (${value})`);
31
+ }
32
+ }
33
+ exports.toSQL = toSQL;
34
+ class TTLCache {
35
+ ttl;
36
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
37
+ cache;
38
+ /**
39
+ * @param ttl Time to live in milliseconds
40
+ */
41
+ constructor(ttl) {
42
+ this.ttl = ttl;
43
+ this.cache = new Map();
44
+ }
45
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
46
+ get(key) {
47
+ const entry = this.cache.get(key);
48
+ if (entry === undefined) {
49
+ return undefined;
50
+ }
51
+ if (entry.expires < Date.now()) {
52
+ this.cache.delete(key);
53
+ return undefined;
54
+ }
55
+ return entry.value;
56
+ }
57
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
58
+ set(key, value) {
59
+ this.cache.set(key, { value, expires: Date.now() + this.ttl });
60
+ }
61
+ delete(key) {
62
+ this.cache.delete(key);
63
+ }
64
+ }
65
+ exports.TTLCache = TTLCache;
package/package.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "name": "@lancedb/lancedb",
3
- "version": "0.5.1",
3
+ "description": "LanceDB: A serverless, low-latency vector database for AI applications",
4
+ "keywords": [
5
+ "database",
6
+ "lance",
7
+ "lancedb",
8
+ "search",
9
+ "vector",
10
+ "vector database",
11
+ "ann"
12
+ ],
13
+ "version": "0.7.0",
4
14
  "main": "dist/index.js",
5
15
  "exports": {
6
16
  ".": "./dist/index.js",
@@ -24,9 +34,10 @@
24
34
  "devDependencies": {
25
35
  "@aws-sdk/client-kms": "^3.33.0",
26
36
  "@aws-sdk/client-s3": "^3.33.0",
37
+ "@aws-sdk/client-dynamodb": "^3.33.0",
27
38
  "@biomejs/biome": "^1.7.3",
28
39
  "@jest/globals": "^29.7.0",
29
- "@napi-rs/cli": "^2.18.0",
40
+ "@napi-rs/cli": "^2.18.3",
30
41
  "@types/jest": "^29.1.2",
31
42
  "@types/tmp": "^0.2.6",
32
43
  "apache-arrow-old": "npm:apache-arrow@13.0.0",
@@ -38,7 +49,8 @@
38
49
  "typedoc": "^0.25.7",
39
50
  "typedoc-plugin-markdown": "^3.17.1",
40
51
  "typescript": "^5.3.3",
41
- "typescript-eslint": "^7.1.0"
52
+ "typescript-eslint": "^7.1.0",
53
+ "@types/axios": "^0.14.0"
42
54
  },
43
55
  "ava": {
44
56
  "timeout": "3m"
@@ -64,7 +76,7 @@
64
76
  "lint-ci": "biome ci .",
65
77
  "docs": "typedoc --plugin typedoc-plugin-markdown --out ../docs/src/js lancedb/index.ts",
66
78
  "lint": "biome check . && biome format .",
67
- "lint-fix": "biome check --apply-unsafe . && biome format --write .",
79
+ "lint-fix": "biome check --write . && biome format --write .",
68
80
  "prepublishOnly": "napi prepublish -t npm",
69
81
  "test": "jest --verbose",
70
82
  "integration": "S3_TEST=1 npm run test",
@@ -72,15 +84,17 @@
72
84
  "version": "napi version"
73
85
  },
74
86
  "dependencies": {
75
- "apache-arrow": "^15.0.0",
76
- "openai": "^4.29.2",
87
+ "axios": "^1.7.2",
77
88
  "reflect-metadata": "^0.2.2"
78
89
  },
79
90
  "optionalDependencies": {
80
- "@lancedb/lancedb-darwin-arm64": "0.5.1",
81
- "@lancedb/lancedb-linux-arm64-gnu": "0.5.1",
82
- "@lancedb/lancedb-darwin-x64": "0.5.1",
83
- "@lancedb/lancedb-linux-x64-gnu": "0.5.1",
84
- "@lancedb/lancedb-win32-x64-msvc": "0.5.1"
91
+ "@lancedb/lancedb-darwin-arm64": "0.7.0",
92
+ "@lancedb/lancedb-linux-arm64-gnu": "0.7.0",
93
+ "@lancedb/lancedb-darwin-x64": "0.7.0",
94
+ "@lancedb/lancedb-linux-x64-gnu": "0.7.0",
95
+ "@lancedb/lancedb-win32-x64-msvc": "0.7.0"
96
+ },
97
+ "peerDependencies": {
98
+ "apache-arrow": "^15.0.0"
85
99
  }
86
100
  }