@bridgerust/embex 0.1.20 → 0.1.21

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/Cargo.toml CHANGED
@@ -8,7 +8,18 @@ crate-type = ["cdylib"]
8
8
 
9
9
  [features]
10
10
  default = ["all"]
11
- all = ["qdrant", "pinecone", "chroma", "lancedb", "pgvector", "weaviate", "milvus"]
11
+ all = [
12
+ "qdrant",
13
+ "pinecone",
14
+ "chroma",
15
+ "lancedb",
16
+ "pgvector",
17
+ "weaviate",
18
+ "milvus",
19
+ "elasticsearch",
20
+ "opensearch",
21
+ "redis",
22
+ ]
12
23
  qdrant = ["bridge-embex/qdrant"]
13
24
  pinecone = ["bridge-embex/pinecone"]
14
25
  chroma = ["bridge-embex/chroma"]
@@ -16,9 +27,12 @@ lancedb = ["bridge-embex/lancedb"]
16
27
  pgvector = ["bridge-embex/pgvector"]
17
28
  weaviate = ["bridge-embex/weaviate"]
18
29
  milvus = ["bridge-embex/milvus"]
30
+ elasticsearch = ["bridge-embex/elasticsearch"]
31
+ opensearch = ["bridge-embex/opensearch"]
32
+ redis = ["bridge-embex/redis"]
19
33
 
20
34
  [dependencies]
21
- napi = { version = "3.7.1", features = ["async", "serde-json"] }
35
+ napi = { version = "3.7.1", features = ["napi8", "async", "serde-json"] }
22
36
  napi-derive = "3.4.1"
23
37
  serde = { version = "1.0.228", features = ["derive"] }
24
38
  serde_json = "1.0.147"
package/dist/native.d.ts CHANGED
@@ -35,6 +35,7 @@ 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
+ insertStream(points: Array<Point>, batchSize?: number | undefined | null, parallel?: number | undefined | null): Promise<void>
38
39
  /** Scroll through points in the collection (paginated export). */
39
40
  scroll(offset?: string | undefined | null, limit?: number | undefined | null): Promise<ScrollResponse>
40
41
  }
package/dist/native.js CHANGED
@@ -78,7 +78,7 @@ function requireNative() {
78
78
  const binding = require('@bridgerust/embex-android-arm64')
79
79
  const bindingPackageVersion = require('@bridgerust/embex-android-arm64/package.json').version
80
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.`)
81
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -94,7 +94,7 @@ function requireNative() {
94
94
  const binding = require('@bridgerust/embex-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@bridgerust/embex-android-arm-eabi/package.json').version
96
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.`)
97
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -115,7 +115,7 @@ function requireNative() {
115
115
  const binding = require('@bridgerust/embex-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@bridgerust/embex-win32-x64-gnu/package.json').version
117
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.`)
118
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -131,7 +131,7 @@ function requireNative() {
131
131
  const binding = require('@bridgerust/embex-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@bridgerust/embex-win32-x64-msvc/package.json').version
133
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.`)
134
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -148,7 +148,7 @@ function requireNative() {
148
148
  const binding = require('@bridgerust/embex-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@bridgerust/embex-win32-ia32-msvc/package.json').version
150
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.`)
151
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -164,7 +164,7 @@ function requireNative() {
164
164
  const binding = require('@bridgerust/embex-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@bridgerust/embex-win32-arm64-msvc/package.json').version
166
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.`)
167
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -183,7 +183,7 @@ function requireNative() {
183
183
  const binding = require('@bridgerust/embex-darwin-universal')
184
184
  const bindingPackageVersion = require('@bridgerust/embex-darwin-universal/package.json').version
185
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.`)
186
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -199,7 +199,7 @@ function requireNative() {
199
199
  const binding = require('@bridgerust/embex-darwin-x64')
200
200
  const bindingPackageVersion = require('@bridgerust/embex-darwin-x64/package.json').version
201
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.`)
202
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -215,7 +215,7 @@ function requireNative() {
215
215
  const binding = require('@bridgerust/embex-darwin-arm64')
216
216
  const bindingPackageVersion = require('@bridgerust/embex-darwin-arm64/package.json').version
217
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.`)
218
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -235,7 +235,7 @@ function requireNative() {
235
235
  const binding = require('@bridgerust/embex-freebsd-x64')
236
236
  const bindingPackageVersion = require('@bridgerust/embex-freebsd-x64/package.json').version
237
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.`)
238
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -251,7 +251,7 @@ function requireNative() {
251
251
  const binding = require('@bridgerust/embex-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@bridgerust/embex-freebsd-arm64/package.json').version
253
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.`)
254
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -272,7 +272,7 @@ function requireNative() {
272
272
  const binding = require('@bridgerust/embex-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@bridgerust/embex-linux-x64-musl/package.json').version
274
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.`)
275
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -288,7 +288,7 @@ function requireNative() {
288
288
  const binding = require('@bridgerust/embex-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@bridgerust/embex-linux-x64-gnu/package.json').version
290
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.`)
291
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -306,7 +306,7 @@ function requireNative() {
306
306
  const binding = require('@bridgerust/embex-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-musl/package.json').version
308
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.`)
309
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -322,7 +322,7 @@ function requireNative() {
322
322
  const binding = require('@bridgerust/embex-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-gnu/package.json').version
324
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.`)
325
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -340,7 +340,7 @@ function requireNative() {
340
340
  const binding = require('@bridgerust/embex-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm-musleabihf/package.json').version
342
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.`)
343
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -356,7 +356,7 @@ function requireNative() {
356
356
  const binding = require('@bridgerust/embex-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm-gnueabihf/package.json').version
358
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.`)
359
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -374,7 +374,7 @@ function requireNative() {
374
374
  const binding = require('@bridgerust/embex-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-musl/package.json').version
376
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.`)
377
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -390,7 +390,7 @@ function requireNative() {
390
390
  const binding = require('@bridgerust/embex-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-gnu/package.json').version
392
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.`)
393
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -408,7 +408,7 @@ function requireNative() {
408
408
  const binding = require('@bridgerust/embex-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-musl/package.json').version
410
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.`)
411
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -424,7 +424,7 @@ function requireNative() {
424
424
  const binding = require('@bridgerust/embex-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-gnu/package.json').version
426
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.`)
427
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -441,7 +441,7 @@ function requireNative() {
441
441
  const binding = require('@bridgerust/embex-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@bridgerust/embex-linux-ppc64-gnu/package.json').version
443
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.`)
444
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -457,7 +457,7 @@ function requireNative() {
457
457
  const binding = require('@bridgerust/embex-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@bridgerust/embex-linux-s390x-gnu/package.json').version
459
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.`)
460
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -477,7 +477,7 @@ function requireNative() {
477
477
  const binding = require('@bridgerust/embex-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm64/package.json').version
479
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.`)
480
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -493,7 +493,7 @@ function requireNative() {
493
493
  const binding = require('@bridgerust/embex-openharmony-x64')
494
494
  const bindingPackageVersion = require('@bridgerust/embex-openharmony-x64/package.json').version
495
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.`)
496
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -509,7 +509,7 @@ function requireNative() {
509
509
  const binding = require('@bridgerust/embex-openharmony-arm')
510
510
  const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm/package.json').version
511
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.`)
512
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -1,7 +1,7 @@
1
1
  import { Collection, EmbexClient, QueryBuilder, SearchBuilder, DataMigrator, ScrollResponse, MigrationResult, cli, Point } from "../native";
2
2
  declare module "../native" {
3
3
  interface Collection {
4
- insertStream(points: AsyncIterable<Point>, parallel?: number): Promise<void>;
4
+ insertStream(points: AsyncIterable<Point>, batchSize?: number, parallel?: number): Promise<void>;
5
5
  }
6
6
  }
7
7
  export { Collection, EmbexClient, QueryBuilder, SearchBuilder, DataMigrator, ScrollResponse, MigrationResult, cli, Point, };
@@ -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,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"}
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,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAAC;KAClB;CACF;AAqCD,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
@@ -10,18 +10,31 @@ Object.defineProperty(exports, "DataMigrator", { enumerable: true, get: function
10
10
  Object.defineProperty(exports, "cli", { enumerable: true, get: function () { return
11
11
  // @ts-ignore
12
12
  native_1.cli; } });
13
- // Monkey patch
14
- native_1.Collection.prototype.insertStream = async function (points, parallel = 5) {
15
- const BATCH_SIZE = 100;
13
+ const nativeInsertStream = native_1.Collection.prototype.insertStream;
14
+ // API-level adapter: accepts AsyncIterable while delegating to native ReadableStream path.
15
+ native_1.Collection.prototype.insertStream = async function (points, batchSize = 1000, parallel = 5) {
16
+ if (batchSize <= 0) {
17
+ throw new Error("batchSize must be greater than 0");
18
+ }
16
19
  let batch = [];
17
20
  for await (const point of points) {
18
21
  batch.push(point);
19
- if (batch.length >= BATCH_SIZE) {
20
- await this.insertBatch(batch, BATCH_SIZE, parallel);
22
+ if (batch.length >= batchSize) {
23
+ if (typeof nativeInsertStream === "function") {
24
+ await nativeInsertStream.call(this, batch, batchSize, parallel);
25
+ }
26
+ else {
27
+ await this.insertBatch(batch, batchSize, parallel);
28
+ }
21
29
  batch = [];
22
30
  }
23
31
  }
24
32
  if (batch.length > 0) {
25
- await this.insertBatch(batch, BATCH_SIZE, parallel);
33
+ if (typeof nativeInsertStream === "function") {
34
+ await nativeInsertStream.call(this, batch, batchSize, parallel);
35
+ }
36
+ else {
37
+ await this.insertBatch(batch, batchSize, parallel);
38
+ }
26
39
  }
27
40
  };
package/native.d.ts CHANGED
@@ -35,6 +35,7 @@ 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
+ insertStream(points: Array<Point>, batchSize?: number | undefined | null, parallel?: number | undefined | null): Promise<void>
38
39
  /** Scroll through points in the collection (paginated export). */
39
40
  scroll(offset?: string | undefined | null, limit?: number | undefined | null): Promise<ScrollResponse>
40
41
  }
package/native.js CHANGED
@@ -78,7 +78,7 @@ function requireNative() {
78
78
  const binding = require('@bridgerust/embex-android-arm64')
79
79
  const bindingPackageVersion = require('@bridgerust/embex-android-arm64/package.json').version
80
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.`)
81
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -94,7 +94,7 @@ function requireNative() {
94
94
  const binding = require('@bridgerust/embex-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@bridgerust/embex-android-arm-eabi/package.json').version
96
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.`)
97
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -115,7 +115,7 @@ function requireNative() {
115
115
  const binding = require('@bridgerust/embex-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@bridgerust/embex-win32-x64-gnu/package.json').version
117
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.`)
118
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -131,7 +131,7 @@ function requireNative() {
131
131
  const binding = require('@bridgerust/embex-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@bridgerust/embex-win32-x64-msvc/package.json').version
133
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.`)
134
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -148,7 +148,7 @@ function requireNative() {
148
148
  const binding = require('@bridgerust/embex-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@bridgerust/embex-win32-ia32-msvc/package.json').version
150
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.`)
151
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -164,7 +164,7 @@ function requireNative() {
164
164
  const binding = require('@bridgerust/embex-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@bridgerust/embex-win32-arm64-msvc/package.json').version
166
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.`)
167
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -183,7 +183,7 @@ function requireNative() {
183
183
  const binding = require('@bridgerust/embex-darwin-universal')
184
184
  const bindingPackageVersion = require('@bridgerust/embex-darwin-universal/package.json').version
185
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.`)
186
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -199,7 +199,7 @@ function requireNative() {
199
199
  const binding = require('@bridgerust/embex-darwin-x64')
200
200
  const bindingPackageVersion = require('@bridgerust/embex-darwin-x64/package.json').version
201
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.`)
202
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -215,7 +215,7 @@ function requireNative() {
215
215
  const binding = require('@bridgerust/embex-darwin-arm64')
216
216
  const bindingPackageVersion = require('@bridgerust/embex-darwin-arm64/package.json').version
217
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.`)
218
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -235,7 +235,7 @@ function requireNative() {
235
235
  const binding = require('@bridgerust/embex-freebsd-x64')
236
236
  const bindingPackageVersion = require('@bridgerust/embex-freebsd-x64/package.json').version
237
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.`)
238
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -251,7 +251,7 @@ function requireNative() {
251
251
  const binding = require('@bridgerust/embex-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@bridgerust/embex-freebsd-arm64/package.json').version
253
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.`)
254
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -272,7 +272,7 @@ function requireNative() {
272
272
  const binding = require('@bridgerust/embex-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@bridgerust/embex-linux-x64-musl/package.json').version
274
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.`)
275
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -288,7 +288,7 @@ function requireNative() {
288
288
  const binding = require('@bridgerust/embex-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@bridgerust/embex-linux-x64-gnu/package.json').version
290
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.`)
291
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -306,7 +306,7 @@ function requireNative() {
306
306
  const binding = require('@bridgerust/embex-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-musl/package.json').version
308
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.`)
309
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -322,7 +322,7 @@ function requireNative() {
322
322
  const binding = require('@bridgerust/embex-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm64-gnu/package.json').version
324
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.`)
325
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -340,7 +340,7 @@ function requireNative() {
340
340
  const binding = require('@bridgerust/embex-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm-musleabihf/package.json').version
342
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.`)
343
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -356,7 +356,7 @@ function requireNative() {
356
356
  const binding = require('@bridgerust/embex-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@bridgerust/embex-linux-arm-gnueabihf/package.json').version
358
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.`)
359
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -374,7 +374,7 @@ function requireNative() {
374
374
  const binding = require('@bridgerust/embex-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-musl/package.json').version
376
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.`)
377
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -390,7 +390,7 @@ function requireNative() {
390
390
  const binding = require('@bridgerust/embex-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@bridgerust/embex-linux-loong64-gnu/package.json').version
392
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.`)
393
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -408,7 +408,7 @@ function requireNative() {
408
408
  const binding = require('@bridgerust/embex-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-musl/package.json').version
410
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.`)
411
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -424,7 +424,7 @@ function requireNative() {
424
424
  const binding = require('@bridgerust/embex-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@bridgerust/embex-linux-riscv64-gnu/package.json').version
426
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.`)
427
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -441,7 +441,7 @@ function requireNative() {
441
441
  const binding = require('@bridgerust/embex-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@bridgerust/embex-linux-ppc64-gnu/package.json').version
443
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.`)
444
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -457,7 +457,7 @@ function requireNative() {
457
457
  const binding = require('@bridgerust/embex-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@bridgerust/embex-linux-s390x-gnu/package.json').version
459
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.`)
460
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -477,7 +477,7 @@ function requireNative() {
477
477
  const binding = require('@bridgerust/embex-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm64/package.json').version
479
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.`)
480
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -493,7 +493,7 @@ function requireNative() {
493
493
  const binding = require('@bridgerust/embex-openharmony-x64')
494
494
  const bindingPackageVersion = require('@bridgerust/embex-openharmony-x64/package.json').version
495
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.`)
496
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -509,7 +509,7 @@ function requireNative() {
509
509
  const binding = require('@bridgerust/embex-openharmony-arm')
510
510
  const bindingPackageVersion = require('@bridgerust/embex-openharmony-arm/package.json').version
511
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.`)
512
+ throw new Error(`Native binding package version mismatch, expected 0.1.21 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridgerust/embex",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Embex Vector Database ORM Node.js Bindings",
5
5
  "homepage": "https://github.com/bridgerust/bridgerust/tree/main/crates/embex",
6
6
  "authors": [
@@ -69,10 +69,10 @@
69
69
  "vitest": "^4.0.16"
70
70
  },
71
71
  "optionalDependencies": {
72
- "@bridgerust/embex-darwin-arm64": "0.1.20",
73
- "@bridgerust/embex-darwin-x64": "0.1.20",
74
- "@bridgerust/embex-linux-x64-gnu": "0.1.20",
75
- "@bridgerust/embex-linux-x64-musl": "0.1.20",
76
- "@bridgerust/embex-win32-x64-msvc": "0.1.20"
72
+ "@bridgerust/embex-darwin-arm64": "0.1.21",
73
+ "@bridgerust/embex-darwin-x64": "0.1.21",
74
+ "@bridgerust/embex-linux-x64-gnu": "0.1.21",
75
+ "@bridgerust/embex-linux-x64-musl": "0.1.21",
76
+ "@bridgerust/embex-win32-x64-msvc": "0.1.21"
77
77
  }
78
78
  }
package/src/index.ts CHANGED
@@ -15,30 +15,44 @@ declare module "../native" {
15
15
  interface Collection {
16
16
  insertStream(
17
17
  points: AsyncIterable<Point>,
18
+ batchSize?: number,
18
19
  parallel?: number
19
20
  ): Promise<void>;
20
21
  }
21
22
  }
22
23
 
23
- // Monkey patch
24
+ const nativeInsertStream = (Collection.prototype as any).insertStream;
25
+
26
+ // API-level adapter: accepts AsyncIterable while delegating to native ReadableStream path.
24
27
  (Collection.prototype as any).insertStream = async function (
25
28
  this: Collection,
26
29
  points: AsyncIterable<Point>,
30
+ batchSize: number = 1000,
27
31
  parallel: number = 5
28
32
  ) {
29
- const BATCH_SIZE = 100;
30
- let batch: Point[] = [];
33
+ if (batchSize <= 0) {
34
+ throw new Error("batchSize must be greater than 0");
35
+ }
31
36
 
37
+ let batch: Point[] = [];
32
38
  for await (const point of points) {
33
39
  batch.push(point);
34
- if (batch.length >= BATCH_SIZE) {
35
- await this.insertBatch(batch, BATCH_SIZE, parallel);
40
+ if (batch.length >= batchSize) {
41
+ if (typeof nativeInsertStream === "function") {
42
+ await nativeInsertStream.call(this, batch, batchSize, parallel);
43
+ } else {
44
+ await this.insertBatch(batch, batchSize, parallel);
45
+ }
36
46
  batch = [];
37
47
  }
38
48
  }
39
49
 
40
50
  if (batch.length > 0) {
41
- await this.insertBatch(batch, BATCH_SIZE, parallel);
51
+ if (typeof nativeInsertStream === "function") {
52
+ await nativeInsertStream.call(this, batch, batchSize, parallel);
53
+ } else {
54
+ await this.insertBatch(batch, batchSize, parallel);
55
+ }
42
56
  }
43
57
  };
44
58
 
package/src/lib.rs CHANGED
@@ -328,24 +328,10 @@ impl Collection {
328
328
  pub async fn insert(&self, points: Vec<Point>) -> Result<()> {
329
329
  let inner = self.inner.clone();
330
330
 
331
- // Validate points
332
- for p in &points {
333
- if p.vector.is_empty() {
334
- return Err(Error::new(
335
- Status::InvalidArg,
336
- "Vector cannot be empty".to_string(),
337
- ));
338
- }
339
- }
340
-
341
- let rust_points: Vec<RustPoint> = points
331
+ let rust_points = points
342
332
  .into_iter()
343
- .map(|p| RustPoint {
344
- id: p.id,
345
- vector: p.vector.into_iter().map(|v| v as f32).collect(),
346
- metadata: p.metadata,
347
- })
348
- .collect();
333
+ .map(point_to_rust)
334
+ .collect::<Result<Vec<_>>>()?;
349
335
 
350
336
  inner.insert(rust_points).await.map_err(to_napi_err)
351
337
  }
@@ -567,24 +553,10 @@ impl Collection {
567
553
  let size = batch_size.unwrap_or(1000) as usize;
568
554
  let concurrency = parallel.map(|p| p as usize);
569
555
 
570
- // Validate points
571
- for p in &points {
572
- if p.vector.is_empty() {
573
- return Err(Error::new(
574
- Status::InvalidArg,
575
- "Vector cannot be empty".to_string(),
576
- ));
577
- }
578
- }
579
-
580
- let rust_points: Vec<RustPoint> = points
556
+ let rust_points = points
581
557
  .into_iter()
582
- .map(|p| RustPoint {
583
- id: p.id,
584
- vector: p.vector.into_iter().map(|v| v as f32).collect(),
585
- metadata: p.metadata,
586
- })
587
- .collect();
558
+ .map(point_to_rust)
559
+ .collect::<Result<Vec<_>>>()?;
588
560
 
589
561
  inner
590
562
  .insert_batch(rust_points, size, concurrency)
@@ -592,9 +564,35 @@ impl Collection {
592
564
  .map_err(to_napi_err)
593
565
  }
594
566
 
595
- // Note: insert_stream is not yet implemented for Node.js.
596
- // The Python version uses async iterables which require complex napi-rs interop.
597
- // For now, use insert_batch for bulk operations.
567
+ /// Insert points in streaming batches from the JS wrapper.
568
+ ///
569
+ /// The TypeScript layer accepts `AsyncIterable<Point>` and forwards each batch here.
570
+ #[napi]
571
+ pub async fn insert_stream(
572
+ &self,
573
+ points: Vec<Point>,
574
+ batch_size: Option<u32>,
575
+ parallel: Option<u32>,
576
+ ) -> Result<()> {
577
+ let inner = self.inner.clone();
578
+ let size = batch_size.unwrap_or(1000) as usize;
579
+ let concurrency = parallel.map(|p| p as usize);
580
+
581
+ if size == 0 {
582
+ return Err(Error::new(
583
+ Status::InvalidArg,
584
+ "batch_size must be greater than 0".to_string(),
585
+ ));
586
+ }
587
+ let rust_points = points
588
+ .into_iter()
589
+ .map(point_to_rust)
590
+ .collect::<Result<Vec<_>>>()?;
591
+ inner
592
+ .insert_batch(rust_points, size, concurrency)
593
+ .await
594
+ .map_err(to_napi_err)
595
+ }
598
596
 
599
597
  /// Scroll through points in the collection (paginated export).
600
598
  #[napi]
@@ -870,3 +868,18 @@ pub async fn cli(args: Vec<String>) -> Result<()> {
870
868
  .await
871
869
  .map_err(|e| Error::from_reason(e.to_string()))
872
870
  }
871
+
872
+ fn point_to_rust(point: Point) -> Result<RustPoint> {
873
+ if point.vector.is_empty() {
874
+ return Err(Error::new(
875
+ Status::InvalidArg,
876
+ "Vector cannot be empty".to_string(),
877
+ ));
878
+ }
879
+
880
+ Ok(RustPoint {
881
+ id: point.id,
882
+ vector: point.vector.into_iter().map(|v| v as f32).collect(),
883
+ metadata: point.metadata,
884
+ })
885
+ }