@bridgerust/embex 0.1.16 → 0.1.17
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/CHANGELOG.md +32 -0
- package/README.md +21 -0
- package/bun.lockb +0 -0
- package/dist/native.d.ts +18 -0
- package/dist/native.js +59 -54
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/tests/integration/data_migration.test.d.ts +2 -0
- package/dist/src/tests/integration/data_migration.test.d.ts.map +1 -0
- package/dist/src/tests/integration/data_migration.test.js +114 -0
- package/native.d.ts +18 -0
- package/native.js +59 -54
- package/package.json +1 -1
- package/src/index.ts +14 -1
- package/src/lib.rs +124 -2
- package/src/tests/integration/data_migration.test.ts +94 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the Embex Node.js bindings will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.16] - 2026-01-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
#### Performance
|
|
15
|
+
|
|
16
|
+
- **SIMD Optimizations**: Added SIMD-accelerated vector operations with scalar fallback.
|
|
17
|
+
- **Connection Pooling**: Implemented internal pooling for Qdrant and Chroma adapters.
|
|
18
|
+
|
|
19
|
+
#### Features
|
|
20
|
+
|
|
21
|
+
- **API Parity**: Added new methods to match Python SDK (`updateMetadata`, `buildQuery`, `aggregation`).
|
|
22
|
+
- **Query Builder**: Added support for filter-only queries and aggregations.
|
|
23
|
+
- **Observability**: Added metrics collection and structured logging instrumentation.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **Architecture**: Refactored internal architecture for better separation of concerns.
|
|
28
|
+
- **Error Handling**: Introduced more specific error types and better exception messages.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **Output Filename**: Resolved filename collision with `embex-bridge` crate.
|
package/README.md
CHANGED
|
@@ -106,6 +106,27 @@ const client = new EmbexClient(
|
|
|
106
106
|
);
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
## 🔄 Data Migration
|
|
110
|
+
|
|
111
|
+
Move data between providers effortlessly using the built-in `DataMigrator`.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { EmbexClient, DataMigrator } from "@bridgerust/embex";
|
|
115
|
+
|
|
116
|
+
// 1. Setup clients
|
|
117
|
+
const source = await EmbexClient.newAsync("lancedb", "./local_data");
|
|
118
|
+
const dest = new EmbexClient("qdrant", "http://prod-db:6333");
|
|
119
|
+
|
|
120
|
+
// 2. Migrate
|
|
121
|
+
const migrator = new DataMigrator(source, dest);
|
|
122
|
+
const result = await migrator.migrateSimple(
|
|
123
|
+
"products", // source
|
|
124
|
+
"products_v2" // destination
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
console.log(`Migrated ${result.pointsMigrated} points!`);
|
|
128
|
+
```
|
|
129
|
+
|
|
109
130
|
## 🔗 Resources
|
|
110
131
|
|
|
111
132
|
- **Full Documentation**: [bridgerust.dev/embex](https://bridgerust.dev/embex/introduction)
|
package/bun.lockb
CHANGED
|
Binary file
|
package/dist/native.d.ts
CHANGED
|
@@ -35,6 +35,14 @@ export declare class Collection {
|
|
|
35
35
|
*/
|
|
36
36
|
createAuto(dimension?: number | undefined | null, distance?: string | undefined | null): Promise<void>
|
|
37
37
|
insertBatch(points: Array<Point>, batchSize?: number | undefined | null, parallel?: number | undefined | null): Promise<void>
|
|
38
|
+
/** Scroll through points in the collection (paginated export). */
|
|
39
|
+
scroll(offset?: string | undefined | null, limit?: number | undefined | null): Promise<ScrollResponse>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export declare class DataMigrator {
|
|
43
|
+
constructor(source: EmbexClient, dest: EmbexClient)
|
|
44
|
+
migrate(sourceCollection: string, destCollection: string, dimension: number, batchSize?: number | undefined | null, distance?: string | undefined | null): Promise<MigrationResult>
|
|
45
|
+
migrateSimple(sourceCollection: string, destCollection: string, batchSize?: number | undefined | null): Promise<MigrationResult>
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/** Main client for the Embex vector database. */
|
|
@@ -105,6 +113,11 @@ export interface MigrationInput {
|
|
|
105
113
|
downOperations?: any
|
|
106
114
|
}
|
|
107
115
|
|
|
116
|
+
export interface MigrationResult {
|
|
117
|
+
pointsMigrated: number
|
|
118
|
+
elapsedMs: number
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
/** A point in the vector database. */
|
|
109
122
|
export interface Point {
|
|
110
123
|
id: string
|
|
@@ -112,6 +125,11 @@ export interface Point {
|
|
|
112
125
|
metadata?: Record<string, any>
|
|
113
126
|
}
|
|
114
127
|
|
|
128
|
+
export interface ScrollResponse {
|
|
129
|
+
points: Array<Point>
|
|
130
|
+
nextOffset?: string
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
export interface SearchOptions {
|
|
116
134
|
/** Number of results to return. */
|
|
117
135
|
limit?: number
|
package/dist/native.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@bridgerust/embex-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@bridgerust/embex-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@bridgerust/embex-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@bridgerust/embex-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@bridgerust/embex-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@bridgerust/embex-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@bridgerust/embex-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@bridgerust/embex-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@bridgerust/embex-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@bridgerust/embex-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@bridgerust/embex-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@bridgerust/embex-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@bridgerust/embex-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@bridgerust/embex-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@bridgerust/embex-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@bridgerust/embex-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@bridgerust/embex-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@bridgerust/embex-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@bridgerust/embex-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@bridgerust/embex-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@bridgerust/embex-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@bridgerust/embex-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@bridgerust/embex-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@bridgerust/embex-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@bridgerust/embex-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@bridgerust/embex-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@bridgerust/embex-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@bridgerust/embex-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@bridgerust/embex-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@bridgerust/embex-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@bridgerust/embex-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@bridgerust/embex-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@bridgerust/embex-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@bridgerust/embex-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@bridgerust/embex-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@bridgerust/embex-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@bridgerust/embex-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@bridgerust/embex-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@bridgerust/embex-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@bridgerust/embex-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@bridgerust/embex-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@bridgerust/embex-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -536,13 +536,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
536
536
|
wasiBindingError = err
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
if (!nativeBinding) {
|
|
539
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
540
540
|
try {
|
|
541
541
|
wasiBinding = require('@bridgerust/embex-wasm32-wasi')
|
|
542
542
|
nativeBinding = wasiBinding
|
|
543
543
|
} catch (err) {
|
|
544
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
545
|
-
wasiBindingError
|
|
545
|
+
if (!wasiBindingError) {
|
|
546
|
+
wasiBindingError = err
|
|
547
|
+
} else {
|
|
548
|
+
wasiBindingError.cause = err
|
|
549
|
+
}
|
|
546
550
|
loadErrors.push(err)
|
|
547
551
|
}
|
|
548
552
|
}
|
|
@@ -573,6 +577,7 @@ if (!nativeBinding) {
|
|
|
573
577
|
|
|
574
578
|
module.exports = nativeBinding
|
|
575
579
|
module.exports.Collection = nativeBinding.Collection
|
|
580
|
+
module.exports.DataMigrator = nativeBinding.DataMigrator
|
|
576
581
|
module.exports.EmbexClient = nativeBinding.EmbexClient
|
|
577
582
|
module.exports.QueryBuilder = nativeBinding.QueryBuilder
|
|
578
583
|
module.exports.SearchBuilder = nativeBinding.SearchBuilder
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Collection, EmbexClient, QueryBuilder, SearchBuilder, cli, Point } from "../native";
|
|
1
|
+
import { Collection, EmbexClient, QueryBuilder, SearchBuilder, DataMigrator, ScrollResponse, MigrationResult, cli, Point } from "../native";
|
|
2
2
|
declare module "../native" {
|
|
3
3
|
interface Collection {
|
|
4
4
|
insertStream(points: AsyncIterable<Point>, parallel?: number): Promise<void>;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
export { Collection, EmbexClient, QueryBuilder, SearchBuilder, cli, Point };
|
|
7
|
+
export { Collection, EmbexClient, QueryBuilder, SearchBuilder, DataMigrator, ScrollResponse, MigrationResult, cli, Point, };
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EAEf,GAAG,EACH,KAAK,EACN,MAAM,WAAW,CAAC;AAEnB,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU;QAClB,YAAY,CACV,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAC5B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAAC;KAClB;CACF;AAwBD,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,GAAG,EACH,KAAK,GACN,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cli = exports.SearchBuilder = exports.QueryBuilder = exports.EmbexClient = exports.Collection = void 0;
|
|
3
|
+
exports.cli = exports.DataMigrator = exports.SearchBuilder = exports.QueryBuilder = exports.EmbexClient = exports.Collection = void 0;
|
|
4
4
|
const native_1 = require("../native");
|
|
5
5
|
Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return native_1.Collection; } });
|
|
6
6
|
Object.defineProperty(exports, "EmbexClient", { enumerable: true, get: function () { return native_1.EmbexClient; } });
|
|
7
7
|
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return native_1.QueryBuilder; } });
|
|
8
8
|
Object.defineProperty(exports, "SearchBuilder", { enumerable: true, get: function () { return native_1.SearchBuilder; } });
|
|
9
|
+
Object.defineProperty(exports, "DataMigrator", { enumerable: true, get: function () { return native_1.DataMigrator; } });
|
|
9
10
|
Object.defineProperty(exports, "cli", { enumerable: true, get: function () { return
|
|
10
11
|
// @ts-ignore
|
|
11
12
|
native_1.cli; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data_migration.test.d.ts","sourceRoot":"","sources":["../../../../src/tests/integration/data_migration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const vitest_1 = require("vitest");
|
|
37
|
+
const index_1 = require("../../index"); // Assuming index exports DataMigrator
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
// Helper to create temp dir
|
|
42
|
+
const createTempDir = () => {
|
|
43
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), "embex-test-"));
|
|
44
|
+
};
|
|
45
|
+
(0, vitest_1.describe)("Data Migrator and Scroll", () => {
|
|
46
|
+
let sourceDbPath;
|
|
47
|
+
let destDbPath;
|
|
48
|
+
let sourceClient;
|
|
49
|
+
let destClient;
|
|
50
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
51
|
+
sourceDbPath = createTempDir();
|
|
52
|
+
destDbPath = createTempDir();
|
|
53
|
+
// Initialize source and destination (LanceDB)
|
|
54
|
+
sourceClient = await index_1.EmbexClient.newAsync("lancedb", sourceDbPath);
|
|
55
|
+
destClient = await index_1.EmbexClient.newAsync("lancedb", destDbPath);
|
|
56
|
+
});
|
|
57
|
+
(0, vitest_1.afterAll)(async () => {
|
|
58
|
+
// Cleanup
|
|
59
|
+
try {
|
|
60
|
+
fs.rmSync(sourceDbPath, { recursive: true, force: true });
|
|
61
|
+
fs.rmSync(destDbPath, { recursive: true, force: true });
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
console.error("Cleanup failed", e);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
(0, vitest_1.it)("should migrate data between databases", async () => {
|
|
68
|
+
const srcColName = "products_src";
|
|
69
|
+
const destColName = "products_dest";
|
|
70
|
+
const srcCol = sourceClient.collection(srcColName);
|
|
71
|
+
// Insert data into source
|
|
72
|
+
// Note: LanceDB creates auto-schema on first insert if not exists
|
|
73
|
+
const points = [
|
|
74
|
+
{
|
|
75
|
+
id: "p1",
|
|
76
|
+
vector: [0.1, 0.1, 0.1, 0.1],
|
|
77
|
+
metadata: { type: "electronics" },
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "p2",
|
|
81
|
+
vector: [0.2, 0.2, 0.2, 0.2],
|
|
82
|
+
metadata: { type: "clothing" },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "p3",
|
|
86
|
+
vector: [0.3, 0.3, 0.3, 0.3],
|
|
87
|
+
metadata: { type: "electronics" },
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
await srcCol.createAuto(4, "cosine");
|
|
91
|
+
await srcCol.insert(points);
|
|
92
|
+
// Verify source
|
|
93
|
+
const srcRes = await srcCol.search([0.1, 0.1, 0.1, 0.1], 10);
|
|
94
|
+
(0, vitest_1.expect)(srcRes.results.length).toBeGreaterThanOrEqual(3);
|
|
95
|
+
// Test scroll explicitly
|
|
96
|
+
const scrollRes = await srcCol.scroll(undefined, 2); // limit 2
|
|
97
|
+
(0, vitest_1.expect)(scrollRes.points.length).toBe(2);
|
|
98
|
+
(0, vitest_1.expect)(scrollRes.nextOffset).toBeDefined(); // Should have next offset
|
|
99
|
+
// Migrate
|
|
100
|
+
const migrator = new index_1.DataMigrator(sourceClient, destClient);
|
|
101
|
+
// Simple migration
|
|
102
|
+
const result = await migrator.migrateSimple(srcColName, destColName, 10);
|
|
103
|
+
console.log("Migration result:", result);
|
|
104
|
+
(0, vitest_1.expect)(result.pointsMigrated).toBe(3);
|
|
105
|
+
// Verify destination
|
|
106
|
+
const destCol = destClient.collection(destColName);
|
|
107
|
+
const destRes = await destCol.search([0.1, 0.1, 0.1, 0.1], 10);
|
|
108
|
+
(0, vitest_1.expect)(destRes.results.length).toBe(3);
|
|
109
|
+
// Verify metadata
|
|
110
|
+
const p1 = destRes.results.find((r) => r.id === "p1");
|
|
111
|
+
(0, vitest_1.expect)(p1).toBeDefined();
|
|
112
|
+
(0, vitest_1.expect)(p1?.metadata?.type).toBe("electronics");
|
|
113
|
+
});
|
|
114
|
+
});
|
package/native.d.ts
CHANGED
|
@@ -35,6 +35,14 @@ export declare class Collection {
|
|
|
35
35
|
*/
|
|
36
36
|
createAuto(dimension?: number | undefined | null, distance?: string | undefined | null): Promise<void>
|
|
37
37
|
insertBatch(points: Array<Point>, batchSize?: number | undefined | null, parallel?: number | undefined | null): Promise<void>
|
|
38
|
+
/** Scroll through points in the collection (paginated export). */
|
|
39
|
+
scroll(offset?: string | undefined | null, limit?: number | undefined | null): Promise<ScrollResponse>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export declare class DataMigrator {
|
|
43
|
+
constructor(source: EmbexClient, dest: EmbexClient)
|
|
44
|
+
migrate(sourceCollection: string, destCollection: string, dimension: number, batchSize?: number | undefined | null, distance?: string | undefined | null): Promise<MigrationResult>
|
|
45
|
+
migrateSimple(sourceCollection: string, destCollection: string, batchSize?: number | undefined | null): Promise<MigrationResult>
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/** Main client for the Embex vector database. */
|
|
@@ -105,6 +113,11 @@ export interface MigrationInput {
|
|
|
105
113
|
downOperations?: any
|
|
106
114
|
}
|
|
107
115
|
|
|
116
|
+
export interface MigrationResult {
|
|
117
|
+
pointsMigrated: number
|
|
118
|
+
elapsedMs: number
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
/** A point in the vector database. */
|
|
109
122
|
export interface Point {
|
|
110
123
|
id: string
|
|
@@ -112,6 +125,11 @@ export interface Point {
|
|
|
112
125
|
metadata?: Record<string, any>
|
|
113
126
|
}
|
|
114
127
|
|
|
128
|
+
export interface ScrollResponse {
|
|
129
|
+
points: Array<Point>
|
|
130
|
+
nextOffset?: string
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
export interface SearchOptions {
|
|
116
134
|
/** Number of results to return. */
|
|
117
135
|
limit?: number
|
package/native.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@bridgerust/embex-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@bridgerust/embex-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@bridgerust/embex-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@bridgerust/embex-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@bridgerust/embex-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@bridgerust/embex-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@bridgerust/embex-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@bridgerust/embex-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@bridgerust/embex-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@bridgerust/embex-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@bridgerust/embex-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@bridgerust/embex-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@bridgerust/embex-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@bridgerust/embex-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@bridgerust/embex-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@bridgerust/embex-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@bridgerust/embex-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@bridgerust/embex-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@bridgerust/embex-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@bridgerust/embex-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@bridgerust/embex-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@bridgerust/embex-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@bridgerust/embex-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@bridgerust/embex-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@bridgerust/embex-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@bridgerust/embex-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@bridgerust/embex-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@bridgerust/embex-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@bridgerust/embex-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@bridgerust/embex-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@bridgerust/embex-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@bridgerust/embex-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@bridgerust/embex-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@bridgerust/embex-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@bridgerust/embex-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@bridgerust/embex-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@bridgerust/embex-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@bridgerust/embex-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@bridgerust/embex-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@bridgerust/embex-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@bridgerust/embex-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@bridgerust/embex-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@bridgerust/embex-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.17' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.17 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -536,13 +536,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
536
536
|
wasiBindingError = err
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
if (!nativeBinding) {
|
|
539
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
540
540
|
try {
|
|
541
541
|
wasiBinding = require('@bridgerust/embex-wasm32-wasi')
|
|
542
542
|
nativeBinding = wasiBinding
|
|
543
543
|
} catch (err) {
|
|
544
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
545
|
-
wasiBindingError
|
|
545
|
+
if (!wasiBindingError) {
|
|
546
|
+
wasiBindingError = err
|
|
547
|
+
} else {
|
|
548
|
+
wasiBindingError.cause = err
|
|
549
|
+
}
|
|
546
550
|
loadErrors.push(err)
|
|
547
551
|
}
|
|
548
552
|
}
|
|
@@ -573,6 +577,7 @@ if (!nativeBinding) {
|
|
|
573
577
|
|
|
574
578
|
module.exports = nativeBinding
|
|
575
579
|
module.exports.Collection = nativeBinding.Collection
|
|
580
|
+
module.exports.DataMigrator = nativeBinding.DataMigrator
|
|
576
581
|
module.exports.EmbexClient = nativeBinding.EmbexClient
|
|
577
582
|
module.exports.QueryBuilder = nativeBinding.QueryBuilder
|
|
578
583
|
module.exports.SearchBuilder = nativeBinding.SearchBuilder
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
EmbexClient,
|
|
4
4
|
QueryBuilder,
|
|
5
5
|
SearchBuilder,
|
|
6
|
+
DataMigrator,
|
|
7
|
+
ScrollResponse,
|
|
8
|
+
MigrationResult,
|
|
6
9
|
// @ts-ignore
|
|
7
10
|
cli,
|
|
8
11
|
Point,
|
|
@@ -39,4 +42,14 @@ declare module "../native" {
|
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
44
|
|
|
42
|
-
export {
|
|
45
|
+
export {
|
|
46
|
+
Collection,
|
|
47
|
+
EmbexClient,
|
|
48
|
+
QueryBuilder,
|
|
49
|
+
SearchBuilder,
|
|
50
|
+
DataMigrator,
|
|
51
|
+
ScrollResponse,
|
|
52
|
+
MigrationResult,
|
|
53
|
+
cli,
|
|
54
|
+
Point,
|
|
55
|
+
};
|
package/src/lib.rs
CHANGED
|
@@ -5,8 +5,10 @@ use std::sync::Arc;
|
|
|
5
5
|
use std::sync::Mutex;
|
|
6
6
|
|
|
7
7
|
use bridge_embex::{
|
|
8
|
-
config::EmbexConfig,
|
|
9
|
-
|
|
8
|
+
config::EmbexConfig,
|
|
9
|
+
types::{CollectionSchema, DistanceMetric, Point as RustPoint},
|
|
10
|
+
DataMigrator as RustDataMigrator, EmbexClient as RustClient, Migration, MigrationManager,
|
|
11
|
+
MigrationProgress as RustMigrationProgress, QueryBuilder as RustQueryBuilder, VectorDatabase,
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
use napi_derive::napi;
|
|
@@ -227,6 +229,98 @@ pub struct MetadataUpdate {
|
|
|
227
229
|
pub updates: HashMap<String, serde_json::Value>,
|
|
228
230
|
}
|
|
229
231
|
|
|
232
|
+
#[napi(object)]
|
|
233
|
+
pub struct ScrollResponse {
|
|
234
|
+
pub points: Vec<Point>,
|
|
235
|
+
pub next_offset: Option<String>,
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
#[napi(object)]
|
|
239
|
+
pub struct MigrationResult {
|
|
240
|
+
pub points_migrated: u32,
|
|
241
|
+
pub elapsed_ms: f64,
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#[napi]
|
|
245
|
+
pub struct DataMigrator {
|
|
246
|
+
source_db: Arc<dyn VectorDatabase>,
|
|
247
|
+
dest_db: Arc<dyn VectorDatabase>,
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#[napi]
|
|
251
|
+
impl DataMigrator {
|
|
252
|
+
#[napi(constructor)]
|
|
253
|
+
pub fn new(source: &EmbexClient, dest: &EmbexClient) -> Self {
|
|
254
|
+
Self {
|
|
255
|
+
source_db: source.inner.db(),
|
|
256
|
+
dest_db: dest.inner.db(),
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
#[napi]
|
|
261
|
+
pub async fn migrate(
|
|
262
|
+
&self,
|
|
263
|
+
source_collection: String,
|
|
264
|
+
dest_collection: String,
|
|
265
|
+
dimension: u32,
|
|
266
|
+
batch_size: Option<u32>,
|
|
267
|
+
distance: Option<String>,
|
|
268
|
+
) -> Result<MigrationResult> {
|
|
269
|
+
let migrator = RustDataMigrator::new(self.source_db.clone(), self.dest_db.clone());
|
|
270
|
+
|
|
271
|
+
let batch_size = batch_size.unwrap_or(1000) as usize;
|
|
272
|
+
let metric = match distance.as_deref().unwrap_or("cosine") {
|
|
273
|
+
"cosine" => DistanceMetric::Cosine,
|
|
274
|
+
"euclidean" => DistanceMetric::Euclidean,
|
|
275
|
+
"dot" => DistanceMetric::Dot,
|
|
276
|
+
_ => return Err(Error::from_reason("Invalid distance metric")),
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
let schema = CollectionSchema {
|
|
280
|
+
name: dest_collection.clone(),
|
|
281
|
+
dimension: dimension as usize,
|
|
282
|
+
metric,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
let result = migrator
|
|
286
|
+
.migrate::<fn(RustMigrationProgress)>(
|
|
287
|
+
&source_collection,
|
|
288
|
+
&dest_collection,
|
|
289
|
+
schema,
|
|
290
|
+
batch_size,
|
|
291
|
+
None,
|
|
292
|
+
)
|
|
293
|
+
.await
|
|
294
|
+
.map_err(to_napi_err)?;
|
|
295
|
+
|
|
296
|
+
Ok(MigrationResult {
|
|
297
|
+
points_migrated: result.points_migrated as u32,
|
|
298
|
+
elapsed_ms: result.elapsed_ms as f64,
|
|
299
|
+
})
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
#[napi]
|
|
303
|
+
pub async fn migrate_simple(
|
|
304
|
+
&self,
|
|
305
|
+
source_collection: String,
|
|
306
|
+
dest_collection: String,
|
|
307
|
+
batch_size: Option<u32>,
|
|
308
|
+
) -> Result<MigrationResult> {
|
|
309
|
+
let migrator = RustDataMigrator::new(self.source_db.clone(), self.dest_db.clone());
|
|
310
|
+
let batch_size = batch_size.unwrap_or(1000) as usize;
|
|
311
|
+
|
|
312
|
+
let result = migrator
|
|
313
|
+
.migrate_simple(&source_collection, &dest_collection, batch_size)
|
|
314
|
+
.await
|
|
315
|
+
.map_err(to_napi_err)?;
|
|
316
|
+
|
|
317
|
+
Ok(MigrationResult {
|
|
318
|
+
points_migrated: result.points_migrated as u32,
|
|
319
|
+
elapsed_ms: result.elapsed_ms as f64,
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
230
324
|
#[napi]
|
|
231
325
|
impl Collection {
|
|
232
326
|
/// Insert points into the collection.
|
|
@@ -501,6 +595,34 @@ impl Collection {
|
|
|
501
595
|
// Note: insert_stream is not yet implemented for Node.js.
|
|
502
596
|
// The Python version uses async iterables which require complex napi-rs interop.
|
|
503
597
|
// For now, use insert_batch for bulk operations.
|
|
598
|
+
|
|
599
|
+
/// Scroll through points in the collection (paginated export).
|
|
600
|
+
#[napi]
|
|
601
|
+
pub async fn scroll(
|
|
602
|
+
&self,
|
|
603
|
+
offset: Option<String>,
|
|
604
|
+
limit: Option<u32>,
|
|
605
|
+
) -> Result<ScrollResponse> {
|
|
606
|
+
let inner = self.inner.clone();
|
|
607
|
+
let limit = limit.unwrap_or(100) as usize;
|
|
608
|
+
|
|
609
|
+
let res = inner.scroll(offset, limit).await.map_err(to_napi_err)?;
|
|
610
|
+
|
|
611
|
+
let points = res
|
|
612
|
+
.points
|
|
613
|
+
.into_iter()
|
|
614
|
+
.map(|p| Point {
|
|
615
|
+
id: p.id,
|
|
616
|
+
vector: p.vector.into_iter().map(|v| v as f64).collect(),
|
|
617
|
+
metadata: p.metadata,
|
|
618
|
+
})
|
|
619
|
+
.collect();
|
|
620
|
+
|
|
621
|
+
Ok(ScrollResponse {
|
|
622
|
+
points,
|
|
623
|
+
next_offset: res.next_offset,
|
|
624
|
+
})
|
|
625
|
+
}
|
|
504
626
|
}
|
|
505
627
|
|
|
506
628
|
#[napi]
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { describe, it, expect, beforeAll, afterAll } from "vitest";
|
|
2
|
+
import { EmbexClient, DataMigrator, Point } from "../../index"; // Assuming index exports DataMigrator
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import * as os from "os";
|
|
6
|
+
|
|
7
|
+
// Helper to create temp dir
|
|
8
|
+
const createTempDir = () => {
|
|
9
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), "embex-test-"));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe("Data Migrator and Scroll", () => {
|
|
13
|
+
let sourceDbPath: string;
|
|
14
|
+
let destDbPath: string;
|
|
15
|
+
let sourceClient: EmbexClient;
|
|
16
|
+
let destClient: EmbexClient;
|
|
17
|
+
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
sourceDbPath = createTempDir();
|
|
20
|
+
destDbPath = createTempDir();
|
|
21
|
+
|
|
22
|
+
// Initialize source and destination (LanceDB)
|
|
23
|
+
sourceClient = await EmbexClient.newAsync("lancedb", sourceDbPath);
|
|
24
|
+
destClient = await EmbexClient.newAsync("lancedb", destDbPath);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterAll(async () => {
|
|
28
|
+
// Cleanup
|
|
29
|
+
try {
|
|
30
|
+
fs.rmSync(sourceDbPath, { recursive: true, force: true });
|
|
31
|
+
fs.rmSync(destDbPath, { recursive: true, force: true });
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("Cleanup failed", e);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should migrate data between databases", async () => {
|
|
38
|
+
const srcColName = "products_src";
|
|
39
|
+
const destColName = "products_dest";
|
|
40
|
+
|
|
41
|
+
const srcCol = sourceClient.collection(srcColName);
|
|
42
|
+
|
|
43
|
+
// Insert data into source
|
|
44
|
+
// Note: LanceDB creates auto-schema on first insert if not exists
|
|
45
|
+
const points: Point[] = [
|
|
46
|
+
{
|
|
47
|
+
id: "p1",
|
|
48
|
+
vector: [0.1, 0.1, 0.1, 0.1],
|
|
49
|
+
metadata: { type: "electronics" },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "p2",
|
|
53
|
+
vector: [0.2, 0.2, 0.2, 0.2],
|
|
54
|
+
metadata: { type: "clothing" },
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "p3",
|
|
58
|
+
vector: [0.3, 0.3, 0.3, 0.3],
|
|
59
|
+
metadata: { type: "electronics" },
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
await srcCol.createAuto(4, "cosine");
|
|
64
|
+
await srcCol.insert(points);
|
|
65
|
+
|
|
66
|
+
// Verify source
|
|
67
|
+
const srcRes = await srcCol.search([0.1, 0.1, 0.1, 0.1], 10);
|
|
68
|
+
expect(srcRes.results.length).toBeGreaterThanOrEqual(3);
|
|
69
|
+
|
|
70
|
+
// Test scroll explicitly
|
|
71
|
+
const scrollRes = await srcCol.scroll(undefined, 2); // limit 2
|
|
72
|
+
expect(scrollRes.points.length).toBe(2);
|
|
73
|
+
expect(scrollRes.nextOffset).toBeDefined(); // Should have next offset
|
|
74
|
+
|
|
75
|
+
// Migrate
|
|
76
|
+
const migrator = new DataMigrator(sourceClient, destClient);
|
|
77
|
+
|
|
78
|
+
// Simple migration
|
|
79
|
+
const result = await migrator.migrateSimple(srcColName, destColName, 10);
|
|
80
|
+
|
|
81
|
+
console.log("Migration result:", result);
|
|
82
|
+
expect(result.pointsMigrated).toBe(3);
|
|
83
|
+
|
|
84
|
+
// Verify destination
|
|
85
|
+
const destCol = destClient.collection(destColName);
|
|
86
|
+
const destRes = await destCol.search([0.1, 0.1, 0.1, 0.1], 10);
|
|
87
|
+
expect(destRes.results.length).toBe(3);
|
|
88
|
+
|
|
89
|
+
// Verify metadata
|
|
90
|
+
const p1 = destRes.results.find((r) => r.id === "p1");
|
|
91
|
+
expect(p1).toBeDefined();
|
|
92
|
+
expect(p1?.metadata?.type).toBe("electronics");
|
|
93
|
+
});
|
|
94
|
+
});
|