@lancedb/lancedb 0.7.0 → 0.8.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 (86) hide show
  1. package/dist/arrow.d.ts +5 -3
  2. package/dist/arrow.js +1 -1
  3. package/dist/embedding/embedding_function.d.ts +4 -3
  4. package/dist/embedding/index.d.ts +1 -0
  5. package/dist/embedding/index.js +1 -0
  6. package/dist/embedding/registry.d.ts +9 -7
  7. package/dist/embedding/registry.js +24 -6
  8. package/dist/embedding/transformers.d.ts +37 -0
  9. package/dist/embedding/transformers.js +147 -0
  10. package/dist/query.js +15 -9
  11. package/dist/remote/client.d.ts +1 -1
  12. package/dist/remote/client.js +6 -8
  13. package/dist/remote/connection.d.ts +2 -3
  14. package/dist/remote/connection.js +2 -2
  15. package/dist/table.d.ts +3 -0
  16. package/dist/table.js +1 -1
  17. package/package.json +17 -14
  18. package/Cargo.toml +0 -28
  19. package/biome.json +0 -158
  20. package/build.rs +0 -5
  21. package/dist/native.d.ts +0 -208
  22. package/examples/ann_indexes.ts +0 -49
  23. package/examples/basic.ts +0 -149
  24. package/examples/embedding.ts +0 -83
  25. package/examples/filtering.ts +0 -34
  26. package/examples/jsconfig.json +0 -27
  27. package/examples/package-lock.json +0 -79
  28. package/examples/package.json +0 -18
  29. package/examples/search.ts +0 -37
  30. package/jest.config.js +0 -7
  31. package/lancedb/arrow.ts +0 -947
  32. package/lancedb/connection.ts +0 -333
  33. package/lancedb/embedding/embedding_function.ts +0 -194
  34. package/lancedb/embedding/index.ts +0 -113
  35. package/lancedb/embedding/openai.ts +0 -113
  36. package/lancedb/embedding/registry.ts +0 -188
  37. package/lancedb/index.ts +0 -142
  38. package/lancedb/indices.ts +0 -203
  39. package/lancedb/merge.ts +0 -70
  40. package/lancedb/query.ts +0 -507
  41. package/lancedb/remote/client.ts +0 -221
  42. package/lancedb/remote/connection.ts +0 -201
  43. package/lancedb/remote/index.ts +0 -3
  44. package/lancedb/remote/table.ts +0 -226
  45. package/lancedb/sanitize.ts +0 -588
  46. package/lancedb/table.ts +0 -669
  47. package/lancedb/util.ts +0 -69
  48. package/native.d.ts +0 -208
  49. package/nodejs-artifacts/arrow.d.ts +0 -250
  50. package/nodejs-artifacts/arrow.js +0 -768
  51. package/nodejs-artifacts/connection.d.ts +0 -171
  52. package/nodejs-artifacts/connection.js +0 -135
  53. package/nodejs-artifacts/embedding/embedding_function.d.ts +0 -79
  54. package/nodejs-artifacts/embedding/embedding_function.js +0 -112
  55. package/nodejs-artifacts/embedding/index.d.ts +0 -28
  56. package/nodejs-artifacts/embedding/index.js +0 -114
  57. package/nodejs-artifacts/embedding/openai.d.ts +0 -18
  58. package/nodejs-artifacts/embedding/openai.js +0 -105
  59. package/nodejs-artifacts/embedding/registry.d.ts +0 -53
  60. package/nodejs-artifacts/embedding/registry.js +0 -127
  61. package/nodejs-artifacts/index.d.ts +0 -55
  62. package/nodejs-artifacts/index.js +0 -57
  63. package/nodejs-artifacts/indices.d.ts +0 -165
  64. package/nodejs-artifacts/indices.js +0 -71
  65. package/nodejs-artifacts/merge.d.ts +0 -54
  66. package/nodejs-artifacts/merge.js +0 -64
  67. package/nodejs-artifacts/native.d.ts +0 -208
  68. package/nodejs-artifacts/native.js +0 -330
  69. package/nodejs-artifacts/query.d.ts +0 -283
  70. package/nodejs-artifacts/query.js +0 -448
  71. package/nodejs-artifacts/remote/client.d.ts +0 -28
  72. package/nodejs-artifacts/remote/client.js +0 -172
  73. package/nodejs-artifacts/remote/connection.d.ts +0 -25
  74. package/nodejs-artifacts/remote/connection.js +0 -110
  75. package/nodejs-artifacts/remote/index.d.ts +0 -3
  76. package/nodejs-artifacts/remote/index.js +0 -9
  77. package/nodejs-artifacts/remote/table.d.ts +0 -42
  78. package/nodejs-artifacts/remote/table.js +0 -179
  79. package/nodejs-artifacts/sanitize.d.ts +0 -31
  80. package/nodejs-artifacts/sanitize.js +0 -436
  81. package/nodejs-artifacts/table.d.ts +0 -395
  82. package/nodejs-artifacts/table.js +0 -230
  83. package/nodejs-artifacts/util.d.ts +0 -14
  84. package/nodejs-artifacts/util.js +0 -65
  85. package/tsconfig.json +0 -25
  86. package/typedoc.json +0 -10
@@ -1,54 +0,0 @@
1
- import { Data } from "./arrow";
2
- import { NativeMergeInsertBuilder } from "./native";
3
- /** A builder used to create and run a merge insert operation */
4
- export declare class MergeInsertBuilder {
5
- #private;
6
- /** Construct a MergeInsertBuilder. __Internal use only.__ */
7
- constructor(native: NativeMergeInsertBuilder);
8
- /**
9
- * Rows that exist in both the source table (new data) and
10
- * the target table (old data) will be updated, replacing
11
- * the old row with the corresponding matching row.
12
- *
13
- * If there are multiple matches then the behavior is undefined.
14
- * Currently this causes multiple copies of the row to be created
15
- * but that behavior is subject to change.
16
- *
17
- * An optional condition may be specified. If it is, then only
18
- * matched rows that satisfy the condtion will be updated. Any
19
- * rows that do not satisfy the condition will be left as they
20
- * are. Failing to satisfy the condition does not cause a
21
- * "matched row" to become a "not matched" row.
22
- *
23
- * The condition should be an SQL string. Use the prefix
24
- * target. to refer to rows in the target table (old data)
25
- * and the prefix source. to refer to rows in the source
26
- * table (new data).
27
- *
28
- * For example, "target.last_update < source.last_update"
29
- */
30
- whenMatchedUpdateAll(options?: {
31
- where: string;
32
- }): MergeInsertBuilder;
33
- /**
34
- * Rows that exist only in the source table (new data) should
35
- * be inserted into the target table.
36
- */
37
- whenNotMatchedInsertAll(): MergeInsertBuilder;
38
- /**
39
- * Rows that exist only in the target table (old data) will be
40
- * deleted. An optional condition can be provided to limit what
41
- * data is deleted.
42
- *
43
- * @param options.where - An optional condition to limit what data is deleted
44
- */
45
- whenNotMatchedBySourceDelete(options?: {
46
- where: string;
47
- }): MergeInsertBuilder;
48
- /**
49
- * Executes the merge insert operation
50
- *
51
- * Nothing is returned but the `Table` is updated
52
- */
53
- execute(data: Data): Promise<void>;
54
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MergeInsertBuilder = void 0;
4
- const arrow_1 = require("./arrow");
5
- /** A builder used to create and run a merge insert operation */
6
- class MergeInsertBuilder {
7
- #native;
8
- /** Construct a MergeInsertBuilder. __Internal use only.__ */
9
- constructor(native) {
10
- this.#native = native;
11
- }
12
- /**
13
- * Rows that exist in both the source table (new data) and
14
- * the target table (old data) will be updated, replacing
15
- * the old row with the corresponding matching row.
16
- *
17
- * If there are multiple matches then the behavior is undefined.
18
- * Currently this causes multiple copies of the row to be created
19
- * but that behavior is subject to change.
20
- *
21
- * An optional condition may be specified. If it is, then only
22
- * matched rows that satisfy the condtion will be updated. Any
23
- * rows that do not satisfy the condition will be left as they
24
- * are. Failing to satisfy the condition does not cause a
25
- * "matched row" to become a "not matched" row.
26
- *
27
- * The condition should be an SQL string. Use the prefix
28
- * target. to refer to rows in the target table (old data)
29
- * and the prefix source. to refer to rows in the source
30
- * table (new data).
31
- *
32
- * For example, "target.last_update < source.last_update"
33
- */
34
- whenMatchedUpdateAll(options) {
35
- return new MergeInsertBuilder(this.#native.whenMatchedUpdateAll(options?.where));
36
- }
37
- /**
38
- * Rows that exist only in the source table (new data) should
39
- * be inserted into the target table.
40
- */
41
- whenNotMatchedInsertAll() {
42
- return new MergeInsertBuilder(this.#native.whenNotMatchedInsertAll());
43
- }
44
- /**
45
- * Rows that exist only in the target table (old data) will be
46
- * deleted. An optional condition can be provided to limit what
47
- * data is deleted.
48
- *
49
- * @param options.where - An optional condition to limit what data is deleted
50
- */
51
- whenNotMatchedBySourceDelete(options) {
52
- return new MergeInsertBuilder(this.#native.whenNotMatchedBySourceDelete(options?.where));
53
- }
54
- /**
55
- * Executes the merge insert operation
56
- *
57
- * Nothing is returned but the `Table` is updated
58
- */
59
- async execute(data) {
60
- const buffer = await (0, arrow_1.fromDataToBuffer)(data);
61
- await this.#native.execute(buffer);
62
- }
63
- }
64
- exports.MergeInsertBuilder = MergeInsertBuilder;
@@ -1,208 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
- /* auto-generated by NAPI-RS */
5
-
6
- /** A description of an index currently configured on a column */
7
- export interface IndexConfig {
8
- /** The name of the index */
9
- name: string
10
- /** The type of the index */
11
- indexType: string
12
- /**
13
- * The columns in the index
14
- *
15
- * Currently this is always an array of size 1. In the future there may
16
- * be more columns to represent composite indices.
17
- */
18
- columns: Array<string>
19
- }
20
- /** Statistics about a compaction operation. */
21
- export interface CompactionStats {
22
- /** The number of fragments removed */
23
- fragmentsRemoved: number
24
- /** The number of new, compacted fragments added */
25
- fragmentsAdded: number
26
- /** The number of data files removed */
27
- filesRemoved: number
28
- /** The number of new, compacted data files added */
29
- filesAdded: number
30
- }
31
- /** Statistics about a cleanup operation */
32
- export interface RemovalStats {
33
- /** The number of bytes removed */
34
- bytesRemoved: number
35
- /** The number of old versions removed */
36
- oldVersionsRemoved: number
37
- }
38
- /** Statistics about an optimize operation */
39
- export interface OptimizeStats {
40
- /** Statistics about the compaction operation */
41
- compaction: CompactionStats
42
- /** Statistics about the removal operation */
43
- prune: RemovalStats
44
- }
45
- /**
46
- * A definition of a column alteration. The alteration changes the column at
47
- * `path` to have the new name `name`, to be nullable if `nullable` is true,
48
- * and to have the data type `data_type`. At least one of `rename` or `nullable`
49
- * must be provided.
50
- */
51
- export interface ColumnAlteration {
52
- /**
53
- * The path to the column to alter. This is a dot-separated path to the column.
54
- * If it is a top-level column then it is just the name of the column. If it is
55
- * a nested column then it is the path to the column, e.g. "a.b.c" for a column
56
- * `c` nested inside a column `b` nested inside a column `a`.
57
- */
58
- path: string
59
- /**
60
- * The new name of the column. If not provided then the name will not be changed.
61
- * This must be distinct from the names of all other columns in the table.
62
- */
63
- rename?: string
64
- /** Set the new nullability. Note that a nullable column cannot be made non-nullable. */
65
- nullable?: boolean
66
- }
67
- /** A definition of a new column to add to a table. */
68
- export interface AddColumnsSql {
69
- /** The name of the new column. */
70
- name: string
71
- /**
72
- * The values to populate the new column with, as a SQL expression.
73
- * The expression can reference other columns in the table.
74
- */
75
- valueSql: string
76
- }
77
- export interface IndexStatistics {
78
- /** The number of rows indexed by the index */
79
- numIndexedRows: number
80
- /** The number of rows not indexed */
81
- numUnindexedRows: number
82
- /** The type of the index */
83
- indexType?: string
84
- /** The metadata for each index */
85
- indices: Array<IndexMetadata>
86
- }
87
- export interface IndexMetadata {
88
- metricType?: string
89
- indexType?: string
90
- }
91
- export interface ConnectionOptions {
92
- /**
93
- * (For LanceDB OSS only): The interval, in seconds, at which to check for
94
- * updates to the table from other processes. If None, then consistency is not
95
- * checked. For performance reasons, this is the default. For strong
96
- * consistency, set this to zero seconds. Then every read will check for
97
- * updates from other processes. As a compromise, you can set this to a
98
- * non-zero value for eventual consistency. If more than that interval
99
- * has passed since the last check, then the table will be checked for updates.
100
- * Note: this consistency only applies to read operations. Write operations are
101
- * always consistent.
102
- */
103
- readConsistencyInterval?: number
104
- /**
105
- * (For LanceDB OSS only): configuration for object storage.
106
- *
107
- * The available options are described at https://lancedb.github.io/lancedb/guides/storage/
108
- */
109
- storageOptions?: Record<string, string>
110
- }
111
- /** Write mode for writing a table. */
112
- export const enum WriteMode {
113
- Create = 'Create',
114
- Append = 'Append',
115
- Overwrite = 'Overwrite'
116
- }
117
- /** Write options when creating a Table. */
118
- export interface WriteOptions {
119
- /** Write mode for writing to a table. */
120
- mode?: WriteMode
121
- }
122
- export interface OpenTableOptions {
123
- storageOptions?: Record<string, string>
124
- }
125
- export class Connection {
126
- /** Create a new Connection instance from the given URI. */
127
- static new(uri: string, options: ConnectionOptions): Promise<Connection>
128
- display(): string
129
- isOpen(): boolean
130
- close(): void
131
- /** List all tables in the dataset. */
132
- tableNames(startAfter?: string | undefined | null, limit?: number | undefined | null): Promise<Array<string>>
133
- /**
134
- * Create table from a Apache Arrow IPC (file) buffer.
135
- *
136
- * Parameters:
137
- * - name: The name of the table.
138
- * - buf: The buffer containing the IPC file.
139
- *
140
- */
141
- createTable(name: string, buf: Buffer, mode: string, storageOptions?: Record<string, string> | undefined | null, useLegacyFormat?: boolean | undefined | null): Promise<Table>
142
- createEmptyTable(name: string, schemaBuf: Buffer, mode: string, storageOptions?: Record<string, string> | undefined | null, useLegacyFormat?: boolean | undefined | null): Promise<Table>
143
- openTable(name: string, storageOptions?: Record<string, string> | undefined | null, indexCacheSize?: number | undefined | null): Promise<Table>
144
- /** Drop table with the name. Or raise an error if the table does not exist. */
145
- dropTable(name: string): Promise<void>
146
- }
147
- export class Index {
148
- static ivfPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index
149
- static btree(): Index
150
- }
151
- /** Typescript-style Async Iterator over RecordBatches */
152
- export class RecordBatchIterator {
153
- next(): Promise<Buffer | null>
154
- }
155
- /** A builder used to create and run a merge insert operation */
156
- export class NativeMergeInsertBuilder {
157
- whenMatchedUpdateAll(condition?: string | undefined | null): NativeMergeInsertBuilder
158
- whenNotMatchedInsertAll(): NativeMergeInsertBuilder
159
- whenNotMatchedBySourceDelete(filter?: string | undefined | null): NativeMergeInsertBuilder
160
- execute(buf: Buffer): Promise<void>
161
- }
162
- export class Query {
163
- onlyIf(predicate: string): void
164
- select(columns: Array<[string, string]>): void
165
- limit(limit: number): void
166
- nearestTo(vector: Float32Array): VectorQuery
167
- execute(maxBatchLength?: number | undefined | null): Promise<RecordBatchIterator>
168
- explainPlan(verbose: boolean): Promise<string>
169
- }
170
- export class VectorQuery {
171
- column(column: string): void
172
- distanceType(distanceType: string): void
173
- postfilter(): void
174
- refineFactor(refineFactor: number): void
175
- nprobes(nprobe: number): void
176
- bypassVectorIndex(): void
177
- onlyIf(predicate: string): void
178
- select(columns: Array<[string, string]>): void
179
- limit(limit: number): void
180
- execute(maxBatchLength?: number | undefined | null): Promise<RecordBatchIterator>
181
- explainPlan(verbose: boolean): Promise<string>
182
- }
183
- export class Table {
184
- name: string
185
- display(): string
186
- isOpen(): boolean
187
- close(): void
188
- /** Return Schema as empty Arrow IPC file. */
189
- schema(): Promise<Buffer>
190
- add(buf: Buffer, mode: string): Promise<void>
191
- countRows(filter?: string | undefined | null): Promise<number>
192
- delete(predicate: string): Promise<void>
193
- createIndex(index: Index | undefined | null, column: string, replace?: boolean | undefined | null): Promise<void>
194
- update(onlyIf: string | undefined | null, columns: Array<[string, string]>): Promise<void>
195
- query(): Query
196
- vectorSearch(vector: Float32Array): VectorQuery
197
- addColumns(transforms: Array<AddColumnsSql>): Promise<void>
198
- alterColumns(alterations: Array<ColumnAlteration>): Promise<void>
199
- dropColumns(columns: Array<string>): Promise<void>
200
- version(): Promise<number>
201
- checkout(version: number): Promise<void>
202
- checkoutLatest(): Promise<void>
203
- restore(): Promise<void>
204
- optimize(olderThanMs?: number | undefined | null): Promise<OptimizeStats>
205
- listIndices(): Promise<Array<IndexConfig>>
206
- indexStats(indexName: string): Promise<IndexStatistics | null>
207
- mergeInsert(on: Array<string>): NativeMergeInsertBuilder
208
- }
@@ -1,330 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /* prettier-ignore */
5
- /* auto-generated by NAPI-RS */
6
- const { existsSync, readFileSync } = require('fs');
7
- const { join } = require('path');
8
- const { platform, arch } = process;
9
- let nativeBinding = null;
10
- let localFileExisted = false;
11
- let loadError = null;
12
- function isMusl() {
13
- // For Node 10
14
- if (!process.report || typeof process.report.getReport !== 'function') {
15
- try {
16
- const lddPath = require('child_process').execSync('which ldd').toString().trim();
17
- return readFileSync(lddPath, 'utf8').includes('musl');
18
- }
19
- catch (e) {
20
- return true;
21
- }
22
- }
23
- else {
24
- const { glibcVersionRuntime } = process.report.getReport().header;
25
- return !glibcVersionRuntime;
26
- }
27
- }
28
- switch (platform) {
29
- case 'android':
30
- switch (arch) {
31
- case 'arm64':
32
- localFileExisted = existsSync(join(__dirname, 'lancedb.android-arm64.node'));
33
- try {
34
- if (localFileExisted) {
35
- nativeBinding = require('./lancedb.android-arm64.node');
36
- }
37
- else {
38
- nativeBinding = require('@lancedb/lancedb-android-arm64');
39
- }
40
- }
41
- catch (e) {
42
- loadError = e;
43
- }
44
- break;
45
- case 'arm':
46
- localFileExisted = existsSync(join(__dirname, 'lancedb.android-arm-eabi.node'));
47
- try {
48
- if (localFileExisted) {
49
- nativeBinding = require('./lancedb.android-arm-eabi.node');
50
- }
51
- else {
52
- nativeBinding = require('@lancedb/lancedb-android-arm-eabi');
53
- }
54
- }
55
- catch (e) {
56
- loadError = e;
57
- }
58
- break;
59
- default:
60
- throw new Error(`Unsupported architecture on Android ${arch}`);
61
- }
62
- break;
63
- case 'win32':
64
- switch (arch) {
65
- case 'x64':
66
- localFileExisted = existsSync(join(__dirname, 'lancedb.win32-x64-msvc.node'));
67
- try {
68
- if (localFileExisted) {
69
- nativeBinding = require('./lancedb.win32-x64-msvc.node');
70
- }
71
- else {
72
- nativeBinding = require('@lancedb/lancedb-win32-x64-msvc');
73
- }
74
- }
75
- catch (e) {
76
- loadError = e;
77
- }
78
- break;
79
- case 'ia32':
80
- localFileExisted = existsSync(join(__dirname, 'lancedb.win32-ia32-msvc.node'));
81
- try {
82
- if (localFileExisted) {
83
- nativeBinding = require('./lancedb.win32-ia32-msvc.node');
84
- }
85
- else {
86
- nativeBinding = require('@lancedb/lancedb-win32-ia32-msvc');
87
- }
88
- }
89
- catch (e) {
90
- loadError = e;
91
- }
92
- break;
93
- case 'arm64':
94
- localFileExisted = existsSync(join(__dirname, 'lancedb.win32-arm64-msvc.node'));
95
- try {
96
- if (localFileExisted) {
97
- nativeBinding = require('./lancedb.win32-arm64-msvc.node');
98
- }
99
- else {
100
- nativeBinding = require('@lancedb/lancedb-win32-arm64-msvc');
101
- }
102
- }
103
- catch (e) {
104
- loadError = e;
105
- }
106
- break;
107
- default:
108
- throw new Error(`Unsupported architecture on Windows: ${arch}`);
109
- }
110
- break;
111
- case 'darwin':
112
- localFileExisted = existsSync(join(__dirname, 'lancedb.darwin-universal.node'));
113
- try {
114
- if (localFileExisted) {
115
- nativeBinding = require('./lancedb.darwin-universal.node');
116
- }
117
- else {
118
- nativeBinding = require('@lancedb/lancedb-darwin-universal');
119
- }
120
- break;
121
- }
122
- catch { }
123
- switch (arch) {
124
- case 'x64':
125
- localFileExisted = existsSync(join(__dirname, 'lancedb.darwin-x64.node'));
126
- try {
127
- if (localFileExisted) {
128
- nativeBinding = require('./lancedb.darwin-x64.node');
129
- }
130
- else {
131
- nativeBinding = require('@lancedb/lancedb-darwin-x64');
132
- }
133
- }
134
- catch (e) {
135
- loadError = e;
136
- }
137
- break;
138
- case 'arm64':
139
- localFileExisted = existsSync(join(__dirname, 'lancedb.darwin-arm64.node'));
140
- try {
141
- if (localFileExisted) {
142
- nativeBinding = require('./lancedb.darwin-arm64.node');
143
- }
144
- else {
145
- nativeBinding = require('@lancedb/lancedb-darwin-arm64');
146
- }
147
- }
148
- catch (e) {
149
- loadError = e;
150
- }
151
- break;
152
- default:
153
- throw new Error(`Unsupported architecture on macOS: ${arch}`);
154
- }
155
- break;
156
- case 'freebsd':
157
- if (arch !== 'x64') {
158
- throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
159
- }
160
- localFileExisted = existsSync(join(__dirname, 'lancedb.freebsd-x64.node'));
161
- try {
162
- if (localFileExisted) {
163
- nativeBinding = require('./lancedb.freebsd-x64.node');
164
- }
165
- else {
166
- nativeBinding = require('@lancedb/lancedb-freebsd-x64');
167
- }
168
- }
169
- catch (e) {
170
- loadError = e;
171
- }
172
- break;
173
- case 'linux':
174
- switch (arch) {
175
- case 'x64':
176
- if (isMusl()) {
177
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-x64-musl.node'));
178
- try {
179
- if (localFileExisted) {
180
- nativeBinding = require('./lancedb.linux-x64-musl.node');
181
- }
182
- else {
183
- nativeBinding = require('@lancedb/lancedb-linux-x64-musl');
184
- }
185
- }
186
- catch (e) {
187
- loadError = e;
188
- }
189
- }
190
- else {
191
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-x64-gnu.node'));
192
- try {
193
- if (localFileExisted) {
194
- nativeBinding = require('./lancedb.linux-x64-gnu.node');
195
- }
196
- else {
197
- nativeBinding = require('@lancedb/lancedb-linux-x64-gnu');
198
- }
199
- }
200
- catch (e) {
201
- loadError = e;
202
- }
203
- }
204
- break;
205
- case 'arm64':
206
- if (isMusl()) {
207
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm64-musl.node'));
208
- try {
209
- if (localFileExisted) {
210
- nativeBinding = require('./lancedb.linux-arm64-musl.node');
211
- }
212
- else {
213
- nativeBinding = require('@lancedb/lancedb-linux-arm64-musl');
214
- }
215
- }
216
- catch (e) {
217
- loadError = e;
218
- }
219
- }
220
- else {
221
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm64-gnu.node'));
222
- try {
223
- if (localFileExisted) {
224
- nativeBinding = require('./lancedb.linux-arm64-gnu.node');
225
- }
226
- else {
227
- nativeBinding = require('@lancedb/lancedb-linux-arm64-gnu');
228
- }
229
- }
230
- catch (e) {
231
- loadError = e;
232
- }
233
- }
234
- break;
235
- case 'arm':
236
- if (isMusl()) {
237
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm-musleabihf.node'));
238
- try {
239
- if (localFileExisted) {
240
- nativeBinding = require('./lancedb.linux-arm-musleabihf.node');
241
- }
242
- else {
243
- nativeBinding = require('@lancedb/lancedb-linux-arm-musleabihf');
244
- }
245
- }
246
- catch (e) {
247
- loadError = e;
248
- }
249
- }
250
- else {
251
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm-gnueabihf.node'));
252
- try {
253
- if (localFileExisted) {
254
- nativeBinding = require('./lancedb.linux-arm-gnueabihf.node');
255
- }
256
- else {
257
- nativeBinding = require('@lancedb/lancedb-linux-arm-gnueabihf');
258
- }
259
- }
260
- catch (e) {
261
- loadError = e;
262
- }
263
- }
264
- break;
265
- case 'riscv64':
266
- if (isMusl()) {
267
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-riscv64-musl.node'));
268
- try {
269
- if (localFileExisted) {
270
- nativeBinding = require('./lancedb.linux-riscv64-musl.node');
271
- }
272
- else {
273
- nativeBinding = require('@lancedb/lancedb-linux-riscv64-musl');
274
- }
275
- }
276
- catch (e) {
277
- loadError = e;
278
- }
279
- }
280
- else {
281
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-riscv64-gnu.node'));
282
- try {
283
- if (localFileExisted) {
284
- nativeBinding = require('./lancedb.linux-riscv64-gnu.node');
285
- }
286
- else {
287
- nativeBinding = require('@lancedb/lancedb-linux-riscv64-gnu');
288
- }
289
- }
290
- catch (e) {
291
- loadError = e;
292
- }
293
- }
294
- break;
295
- case 's390x':
296
- localFileExisted = existsSync(join(__dirname, 'lancedb.linux-s390x-gnu.node'));
297
- try {
298
- if (localFileExisted) {
299
- nativeBinding = require('./lancedb.linux-s390x-gnu.node');
300
- }
301
- else {
302
- nativeBinding = require('@lancedb/lancedb-linux-s390x-gnu');
303
- }
304
- }
305
- catch (e) {
306
- loadError = e;
307
- }
308
- break;
309
- default:
310
- throw new Error(`Unsupported architecture on Linux: ${arch}`);
311
- }
312
- break;
313
- default:
314
- throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
315
- }
316
- if (!nativeBinding) {
317
- if (loadError) {
318
- throw loadError;
319
- }
320
- throw new Error(`Failed to load native binding`);
321
- }
322
- const { Connection, Index, RecordBatchIterator, NativeMergeInsertBuilder, Query, VectorQuery, Table, WriteMode } = nativeBinding;
323
- module.exports.Connection = Connection;
324
- module.exports.Index = Index;
325
- module.exports.RecordBatchIterator = RecordBatchIterator;
326
- module.exports.NativeMergeInsertBuilder = NativeMergeInsertBuilder;
327
- module.exports.Query = Query;
328
- module.exports.VectorQuery = VectorQuery;
329
- module.exports.Table = Table;
330
- module.exports.WriteMode = WriteMode;