taladb 0.7.9 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.mjs +29 -20
- package/dist/index.js +29 -20
- package/dist/index.mjs +29 -20
- package/dist/index.react-native.mjs +31 -22
- package/dist/node-A4LKRSW5.mjs +5 -0
- package/package.json +1 -1
package/dist/index.browser.mjs
CHANGED
|
@@ -69,6 +69,9 @@ function applySchema(col, options) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function detectPlatform() {
|
|
72
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
73
|
+
return "react-native";
|
|
74
|
+
}
|
|
72
75
|
if (globalThis.nativeCallSyncHook !== void 0) {
|
|
73
76
|
return "react-native";
|
|
74
77
|
}
|
|
@@ -309,30 +312,36 @@ async function createNativeDB(_dbName) {
|
|
|
309
312
|
}
|
|
310
313
|
const native = maybeNative;
|
|
311
314
|
function wrapCollection(name, opts) {
|
|
312
|
-
const col = native.collection(name);
|
|
313
315
|
const wrapped = {
|
|
314
|
-
insert: async (doc) =>
|
|
315
|
-
insertMany: async (docs) =>
|
|
316
|
-
find: async (filter) =>
|
|
317
|
-
findOne: async (filter) =>
|
|
318
|
-
updateOne: async (filter, update) =>
|
|
319
|
-
updateMany: async (filter, update) =>
|
|
320
|
-
deleteOne: async (filter) =>
|
|
321
|
-
deleteMany: async (filter) =>
|
|
322
|
-
count: async (filter) =>
|
|
323
|
-
createIndex: async (field) =>
|
|
324
|
-
dropIndex: async (field) =>
|
|
325
|
-
createFtsIndex: async (field) =>
|
|
326
|
-
dropFtsIndex: async (field) =>
|
|
327
|
-
createVectorIndex: async (field, options) =>
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
316
|
+
insert: async (doc) => native.insert(name, doc),
|
|
317
|
+
insertMany: async (docs) => native.insertMany(name, docs),
|
|
318
|
+
find: async (filter) => native.find(name, filter ?? {}),
|
|
319
|
+
findOne: async (filter) => native.findOne(name, filter ?? {}),
|
|
320
|
+
updateOne: async (filter, update) => native.updateOne(name, filter, update),
|
|
321
|
+
updateMany: async (filter, update) => native.updateMany(name, filter, update),
|
|
322
|
+
deleteOne: async (filter) => native.deleteOne(name, filter),
|
|
323
|
+
deleteMany: async (filter) => native.deleteMany(name, filter),
|
|
324
|
+
count: async (filter) => native.count(name, filter ?? {}),
|
|
325
|
+
createIndex: async (field) => native.createIndex(name, field),
|
|
326
|
+
dropIndex: async (field) => native.dropIndex(name, field),
|
|
327
|
+
createFtsIndex: async (field) => native.createFtsIndex(name, field),
|
|
328
|
+
dropFtsIndex: async (field) => native.dropFtsIndex(name, field),
|
|
329
|
+
createVectorIndex: async (field, options) => {
|
|
330
|
+
const opts2 = {};
|
|
331
|
+
if (options.metric) opts2.metric = options.metric;
|
|
332
|
+
if (options.hnswM || options.hnswEfConstruction) {
|
|
333
|
+
opts2.hnsw = { m: options.hnswM, efConstruction: options.hnswEfConstruction };
|
|
334
|
+
}
|
|
335
|
+
return native.createVectorIndex(name, field, options.dimensions, opts2);
|
|
336
|
+
},
|
|
337
|
+
dropVectorIndex: async (field) => native.dropVectorIndex(name, field),
|
|
338
|
+
upgradeVectorIndex: async (field) => native.upgradeVectorIndex(name, field),
|
|
339
|
+
listIndexes: async () => ({}),
|
|
331
340
|
findNearest: async (field, vector, topK, filter) => {
|
|
332
|
-
const raw =
|
|
341
|
+
const raw = native.findNearest(name, field, vector, topK, filter ?? null);
|
|
333
342
|
return raw;
|
|
334
343
|
},
|
|
335
|
-
subscribe: (filter, callback) => makePoller(async () =>
|
|
344
|
+
subscribe: (filter, callback) => makePoller(async () => native.find(name, filter ?? {}), callback)
|
|
336
345
|
};
|
|
337
346
|
return opts ? applySchema(wrapped, opts) : wrapped;
|
|
338
347
|
}
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,9 @@ function applySchema(col, options) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function detectPlatform() {
|
|
154
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
155
|
+
return "react-native";
|
|
156
|
+
}
|
|
154
157
|
if (globalThis.nativeCallSyncHook !== void 0) {
|
|
155
158
|
return "react-native";
|
|
156
159
|
}
|
|
@@ -391,30 +394,36 @@ async function createNativeDB(_dbName) {
|
|
|
391
394
|
}
|
|
392
395
|
const native = maybeNative;
|
|
393
396
|
function wrapCollection(name, opts) {
|
|
394
|
-
const col = native.collection(name);
|
|
395
397
|
const wrapped = {
|
|
396
|
-
insert: async (doc) =>
|
|
397
|
-
insertMany: async (docs) =>
|
|
398
|
-
find: async (filter) =>
|
|
399
|
-
findOne: async (filter) =>
|
|
400
|
-
updateOne: async (filter, update) =>
|
|
401
|
-
updateMany: async (filter, update) =>
|
|
402
|
-
deleteOne: async (filter) =>
|
|
403
|
-
deleteMany: async (filter) =>
|
|
404
|
-
count: async (filter) =>
|
|
405
|
-
createIndex: async (field) =>
|
|
406
|
-
dropIndex: async (field) =>
|
|
407
|
-
createFtsIndex: async (field) =>
|
|
408
|
-
dropFtsIndex: async (field) =>
|
|
409
|
-
createVectorIndex: async (field, options) =>
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
398
|
+
insert: async (doc) => native.insert(name, doc),
|
|
399
|
+
insertMany: async (docs) => native.insertMany(name, docs),
|
|
400
|
+
find: async (filter) => native.find(name, filter ?? {}),
|
|
401
|
+
findOne: async (filter) => native.findOne(name, filter ?? {}),
|
|
402
|
+
updateOne: async (filter, update) => native.updateOne(name, filter, update),
|
|
403
|
+
updateMany: async (filter, update) => native.updateMany(name, filter, update),
|
|
404
|
+
deleteOne: async (filter) => native.deleteOne(name, filter),
|
|
405
|
+
deleteMany: async (filter) => native.deleteMany(name, filter),
|
|
406
|
+
count: async (filter) => native.count(name, filter ?? {}),
|
|
407
|
+
createIndex: async (field) => native.createIndex(name, field),
|
|
408
|
+
dropIndex: async (field) => native.dropIndex(name, field),
|
|
409
|
+
createFtsIndex: async (field) => native.createFtsIndex(name, field),
|
|
410
|
+
dropFtsIndex: async (field) => native.dropFtsIndex(name, field),
|
|
411
|
+
createVectorIndex: async (field, options) => {
|
|
412
|
+
const opts2 = {};
|
|
413
|
+
if (options.metric) opts2.metric = options.metric;
|
|
414
|
+
if (options.hnswM || options.hnswEfConstruction) {
|
|
415
|
+
opts2.hnsw = { m: options.hnswM, efConstruction: options.hnswEfConstruction };
|
|
416
|
+
}
|
|
417
|
+
return native.createVectorIndex(name, field, options.dimensions, opts2);
|
|
418
|
+
},
|
|
419
|
+
dropVectorIndex: async (field) => native.dropVectorIndex(name, field),
|
|
420
|
+
upgradeVectorIndex: async (field) => native.upgradeVectorIndex(name, field),
|
|
421
|
+
listIndexes: async () => ({}),
|
|
413
422
|
findNearest: async (field, vector, topK, filter) => {
|
|
414
|
-
const raw =
|
|
423
|
+
const raw = native.findNearest(name, field, vector, topK, filter ?? null);
|
|
415
424
|
return raw;
|
|
416
425
|
},
|
|
417
|
-
subscribe: (filter, callback) => makePoller(async () =>
|
|
426
|
+
subscribe: (filter, callback) => makePoller(async () => native.find(name, filter ?? {}), callback)
|
|
418
427
|
};
|
|
419
428
|
return opts ? applySchema(wrapped, opts) : wrapped;
|
|
420
429
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -113,6 +113,9 @@ function applySchema(col, options) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
function detectPlatform() {
|
|
116
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
117
|
+
return "react-native";
|
|
118
|
+
}
|
|
116
119
|
if (globalThis.nativeCallSyncHook !== void 0) {
|
|
117
120
|
return "react-native";
|
|
118
121
|
}
|
|
@@ -353,30 +356,36 @@ async function createNativeDB(_dbName) {
|
|
|
353
356
|
}
|
|
354
357
|
const native = maybeNative;
|
|
355
358
|
function wrapCollection(name, opts) {
|
|
356
|
-
const col = native.collection(name);
|
|
357
359
|
const wrapped = {
|
|
358
|
-
insert: async (doc) =>
|
|
359
|
-
insertMany: async (docs) =>
|
|
360
|
-
find: async (filter) =>
|
|
361
|
-
findOne: async (filter) =>
|
|
362
|
-
updateOne: async (filter, update) =>
|
|
363
|
-
updateMany: async (filter, update) =>
|
|
364
|
-
deleteOne: async (filter) =>
|
|
365
|
-
deleteMany: async (filter) =>
|
|
366
|
-
count: async (filter) =>
|
|
367
|
-
createIndex: async (field) =>
|
|
368
|
-
dropIndex: async (field) =>
|
|
369
|
-
createFtsIndex: async (field) =>
|
|
370
|
-
dropFtsIndex: async (field) =>
|
|
371
|
-
createVectorIndex: async (field, options) =>
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
360
|
+
insert: async (doc) => native.insert(name, doc),
|
|
361
|
+
insertMany: async (docs) => native.insertMany(name, docs),
|
|
362
|
+
find: async (filter) => native.find(name, filter ?? {}),
|
|
363
|
+
findOne: async (filter) => native.findOne(name, filter ?? {}),
|
|
364
|
+
updateOne: async (filter, update) => native.updateOne(name, filter, update),
|
|
365
|
+
updateMany: async (filter, update) => native.updateMany(name, filter, update),
|
|
366
|
+
deleteOne: async (filter) => native.deleteOne(name, filter),
|
|
367
|
+
deleteMany: async (filter) => native.deleteMany(name, filter),
|
|
368
|
+
count: async (filter) => native.count(name, filter ?? {}),
|
|
369
|
+
createIndex: async (field) => native.createIndex(name, field),
|
|
370
|
+
dropIndex: async (field) => native.dropIndex(name, field),
|
|
371
|
+
createFtsIndex: async (field) => native.createFtsIndex(name, field),
|
|
372
|
+
dropFtsIndex: async (field) => native.dropFtsIndex(name, field),
|
|
373
|
+
createVectorIndex: async (field, options) => {
|
|
374
|
+
const opts2 = {};
|
|
375
|
+
if (options.metric) opts2.metric = options.metric;
|
|
376
|
+
if (options.hnswM || options.hnswEfConstruction) {
|
|
377
|
+
opts2.hnsw = { m: options.hnswM, efConstruction: options.hnswEfConstruction };
|
|
378
|
+
}
|
|
379
|
+
return native.createVectorIndex(name, field, options.dimensions, opts2);
|
|
380
|
+
},
|
|
381
|
+
dropVectorIndex: async (field) => native.dropVectorIndex(name, field),
|
|
382
|
+
upgradeVectorIndex: async (field) => native.upgradeVectorIndex(name, field),
|
|
383
|
+
listIndexes: async () => ({}),
|
|
375
384
|
findNearest: async (field, vector, topK, filter) => {
|
|
376
|
-
const raw =
|
|
385
|
+
const raw = native.findNearest(name, field, vector, topK, filter ?? null);
|
|
377
386
|
return raw;
|
|
378
387
|
},
|
|
379
|
-
subscribe: (filter, callback) => makePoller(async () =>
|
|
388
|
+
subscribe: (filter, callback) => makePoller(async () => native.find(name, filter ?? {}), callback)
|
|
380
389
|
};
|
|
381
390
|
return opts ? applySchema(wrapped, opts) : wrapped;
|
|
382
391
|
}
|
|
@@ -69,6 +69,9 @@ function applySchema(col, options) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function detectPlatform() {
|
|
72
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
73
|
+
return "react-native";
|
|
74
|
+
}
|
|
72
75
|
if (globalThis.nativeCallSyncHook !== void 0) {
|
|
73
76
|
return "react-native";
|
|
74
77
|
}
|
|
@@ -123,7 +126,7 @@ function makePoller(findFn, callback) {
|
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
128
|
async function createBrowserDB(dbName, config) {
|
|
126
|
-
const workerUrl = new URL("@taladb/web/worker/taladb.worker.js",
|
|
129
|
+
const workerUrl = new URL("@taladb/web/worker/taladb.worker.js", "react-native://unreachable");
|
|
127
130
|
const worker = new Worker(workerUrl, { type: "module", name: "taladb" });
|
|
128
131
|
const proxy = new WorkerProxy(worker);
|
|
129
132
|
const configJson = config !== void 0 ? JSON.stringify(config) : void 0;
|
|
@@ -259,7 +262,7 @@ async function createBrowserDB(dbName, config) {
|
|
|
259
262
|
};
|
|
260
263
|
}
|
|
261
264
|
async function createNodeDB(dbName, config) {
|
|
262
|
-
const { TalaDBNode } = await import("
|
|
265
|
+
const { TalaDBNode } = await import("./node-A4LKRSW5.mjs");
|
|
263
266
|
const configJson = config !== void 0 ? JSON.stringify(config) : null;
|
|
264
267
|
const db = TalaDBNode.open(dbName, configJson);
|
|
265
268
|
function wrapCollection(name, opts) {
|
|
@@ -309,30 +312,36 @@ async function createNativeDB(_dbName) {
|
|
|
309
312
|
}
|
|
310
313
|
const native = maybeNative;
|
|
311
314
|
function wrapCollection(name, opts) {
|
|
312
|
-
const col = native.collection(name);
|
|
313
315
|
const wrapped = {
|
|
314
|
-
insert: async (doc) =>
|
|
315
|
-
insertMany: async (docs) =>
|
|
316
|
-
find: async (filter) =>
|
|
317
|
-
findOne: async (filter) =>
|
|
318
|
-
updateOne: async (filter, update) =>
|
|
319
|
-
updateMany: async (filter, update) =>
|
|
320
|
-
deleteOne: async (filter) =>
|
|
321
|
-
deleteMany: async (filter) =>
|
|
322
|
-
count: async (filter) =>
|
|
323
|
-
createIndex: async (field) =>
|
|
324
|
-
dropIndex: async (field) =>
|
|
325
|
-
createFtsIndex: async (field) =>
|
|
326
|
-
dropFtsIndex: async (field) =>
|
|
327
|
-
createVectorIndex: async (field, options) =>
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
316
|
+
insert: async (doc) => native.insert(name, doc),
|
|
317
|
+
insertMany: async (docs) => native.insertMany(name, docs),
|
|
318
|
+
find: async (filter) => native.find(name, filter ?? {}),
|
|
319
|
+
findOne: async (filter) => native.findOne(name, filter ?? {}),
|
|
320
|
+
updateOne: async (filter, update) => native.updateOne(name, filter, update),
|
|
321
|
+
updateMany: async (filter, update) => native.updateMany(name, filter, update),
|
|
322
|
+
deleteOne: async (filter) => native.deleteOne(name, filter),
|
|
323
|
+
deleteMany: async (filter) => native.deleteMany(name, filter),
|
|
324
|
+
count: async (filter) => native.count(name, filter ?? {}),
|
|
325
|
+
createIndex: async (field) => native.createIndex(name, field),
|
|
326
|
+
dropIndex: async (field) => native.dropIndex(name, field),
|
|
327
|
+
createFtsIndex: async (field) => native.createFtsIndex(name, field),
|
|
328
|
+
dropFtsIndex: async (field) => native.dropFtsIndex(name, field),
|
|
329
|
+
createVectorIndex: async (field, options) => {
|
|
330
|
+
const opts2 = {};
|
|
331
|
+
if (options.metric) opts2.metric = options.metric;
|
|
332
|
+
if (options.hnswM || options.hnswEfConstruction) {
|
|
333
|
+
opts2.hnsw = { m: options.hnswM, efConstruction: options.hnswEfConstruction };
|
|
334
|
+
}
|
|
335
|
+
return native.createVectorIndex(name, field, options.dimensions, opts2);
|
|
336
|
+
},
|
|
337
|
+
dropVectorIndex: async (field) => native.dropVectorIndex(name, field),
|
|
338
|
+
upgradeVectorIndex: async (field) => native.upgradeVectorIndex(name, field),
|
|
339
|
+
listIndexes: async () => ({}),
|
|
331
340
|
findNearest: async (field, vector, topK, filter) => {
|
|
332
|
-
const raw =
|
|
341
|
+
const raw = native.findNearest(name, field, vector, topK, filter ?? null);
|
|
333
342
|
return raw;
|
|
334
343
|
},
|
|
335
|
-
subscribe: (filter, callback) => makePoller(async () =>
|
|
344
|
+
subscribe: (filter, callback) => makePoller(async () => native.find(name, filter ?? {}), callback)
|
|
336
345
|
};
|
|
337
346
|
return opts ? applySchema(wrapped, opts) : wrapped;
|
|
338
347
|
}
|