@lancedb/lancedb 0.14.0-beta.2 → 0.14.1-beta.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/util.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export type IntoSql = string | number | boolean | null | Date | ArrayBufferLike | Buffer | IntoSql[];
2
+ export declare function toSQL(value: IntoSql): string;
3
+ export declare class TTLCache {
4
+ private readonly ttl;
5
+ private readonly cache;
6
+ /**
7
+ * @param ttl Time to live in milliseconds
8
+ */
9
+ constructor(ttl: number);
10
+ get(key: string): any | undefined;
11
+ set(key: string, value: any): void;
12
+ delete(key: string): void;
13
+ }
package/dist/util.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TTLCache = void 0;
4
+ exports.toSQL = toSQL;
5
+ function toSQL(value) {
6
+ if (typeof value === "string") {
7
+ return `'${value.replace(/'/g, "''")}'`;
8
+ }
9
+ else if (typeof value === "number") {
10
+ return value.toString();
11
+ }
12
+ else if (typeof value === "boolean") {
13
+ return value ? "TRUE" : "FALSE";
14
+ }
15
+ else if (value === null) {
16
+ return "NULL";
17
+ }
18
+ else if (value instanceof Date) {
19
+ return `'${value.toISOString()}'`;
20
+ }
21
+ else if (Array.isArray(value)) {
22
+ return `[${value.map(toSQL).join(", ")}]`;
23
+ }
24
+ else if (Buffer.isBuffer(value)) {
25
+ return `X'${value.toString("hex")}'`;
26
+ }
27
+ else if (value instanceof ArrayBuffer) {
28
+ return `X'${Buffer.from(value).toString("hex")}'`;
29
+ }
30
+ else {
31
+ throw new Error(`Unsupported value type: ${typeof value} value: (${value})`);
32
+ }
33
+ }
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
@@ -10,8 +10,8 @@
10
10
  "vector database",
11
11
  "ann"
12
12
  ],
13
- "version": "0.14.0-beta.2",
14
13
  "private": false,
14
+ "version": "0.14.1-beta.0",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -98,14 +98,14 @@
98
98
  "reflect-metadata": "^0.2.2"
99
99
  },
100
100
  "optionalDependencies": {
101
- "@lancedb/lancedb-darwin-x64": "0.14.0-beta.2",
102
- "@lancedb/lancedb-darwin-arm64": "0.14.0-beta.2",
103
- "@lancedb/lancedb-linux-x64-gnu": "0.14.0-beta.2",
104
- "@lancedb/lancedb-linux-arm64-gnu": "0.14.0-beta.2",
105
- "@lancedb/lancedb-linux-x64-musl": "0.14.0-beta.2",
106
- "@lancedb/lancedb-linux-arm64-musl": "0.14.0-beta.2",
107
- "@lancedb/lancedb-win32-x64-msvc": "0.14.0-beta.2",
108
- "@lancedb/lancedb-win32-arm64-msvc": "0.14.0-beta.2"
101
+ "@lancedb/lancedb-darwin-x64": "0.14.1-beta.0",
102
+ "@lancedb/lancedb-darwin-arm64": "0.14.1-beta.0",
103
+ "@lancedb/lancedb-linux-x64-gnu": "0.14.1-beta.0",
104
+ "@lancedb/lancedb-linux-arm64-gnu": "0.14.1-beta.0",
105
+ "@lancedb/lancedb-linux-x64-musl": "0.14.1-beta.0",
106
+ "@lancedb/lancedb-linux-arm64-musl": "0.14.1-beta.0",
107
+ "@lancedb/lancedb-win32-x64-msvc": "0.14.1-beta.0",
108
+ "@lancedb/lancedb-win32-arm64-msvc": "0.14.1-beta.0"
109
109
  },
110
110
  "peerDependencies": {
111
111
  "apache-arrow": ">=13.0.0 <=17.0.0"
package/DEVELOPMENT.md DELETED
@@ -1,42 +0,0 @@
1
- # Development
2
-
3
- ```sh
4
- npm run build
5
- npm run test
6
- ```
7
-
8
- ## Running lint / format
9
-
10
- LanceDb uses [biome](https://biomejs.dev/) for linting and formatting. if you are using VSCode you will need to install the official [Biome](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) extension.
11
- To manually lint your code you can run:
12
-
13
- ```sh
14
- npm run lint
15
- ```
16
-
17
- to automatically fix all fixable issues:
18
-
19
- ```sh
20
- npm run lint-fix
21
- ```
22
-
23
- If you do not have your workspace root set to the `nodejs` directory, unfortunately the extension will not work. You can still run the linting and formatting commands manually.
24
-
25
- ## Generating docs
26
-
27
- ```sh
28
- npm run docs
29
-
30
- cd ../docs
31
- # Asssume the virtual environment was created
32
- # python3 -m venv venv
33
- # pip install -r requirements.txt
34
- . ./venv/bin/activate
35
- mkdocs build
36
- ```
37
-
38
- ## Developing examples
39
-
40
- The `examples` directory contains examples that are shown in the docs. They
41
- are their own typescript package with their own scripts.
42
-