@mastra/couchbase 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-update-stores-peerDeps-20250723031338
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 +346 -2
- package/LICENSE.md +11 -42
- package/README.md +11 -1
- package/dist/_tsup-dts-rollup.d.cts +47 -6
- package/dist/_tsup-dts-rollup.d.ts +47 -6
- package/dist/index.cjs +391 -180
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +392 -181
- package/docker-compose.yaml +12 -12
- package/package.json +16 -13
- package/src/vector/index.integration.test.ts +191 -16
- package/src/vector/index.ts +417 -189
- package/src/vector/index.unit.test.ts +55 -55
|
@@ -165,14 +165,14 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
it('should connect to couchbase', async () => {
|
|
168
|
-
couchbase_client = new CouchbaseVector(
|
|
169
|
-
'COUCHBASE_CONNECTION_STRING',
|
|
170
|
-
'COUCHBASE_USERNAME',
|
|
171
|
-
'COUCHBASE_PASSWORD',
|
|
172
|
-
test_bucketName,
|
|
173
|
-
test_scopeName,
|
|
174
|
-
test_collectionName,
|
|
175
|
-
);
|
|
168
|
+
couchbase_client = new CouchbaseVector({
|
|
169
|
+
connectionString: 'COUCHBASE_CONNECTION_STRING',
|
|
170
|
+
username: 'COUCHBASE_USERNAME',
|
|
171
|
+
password: 'COUCHBASE_PASSWORD',
|
|
172
|
+
bucketName: test_bucketName,
|
|
173
|
+
scopeName: test_scopeName,
|
|
174
|
+
collectionName: test_collectionName,
|
|
175
|
+
});
|
|
176
176
|
expect(mockCouchbaseConnectFn).toHaveBeenCalledTimes(1);
|
|
177
177
|
expect(mockCouchbaseConnectFn).toHaveBeenCalledWith('COUCHBASE_CONNECTION_STRING', {
|
|
178
178
|
username: 'COUCHBASE_USERNAME',
|
|
@@ -200,14 +200,14 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
200
200
|
describe('Index Operations', () => {
|
|
201
201
|
beforeAll(async () => {
|
|
202
202
|
clearAllMocks();
|
|
203
|
-
couchbase_client = new CouchbaseVector(
|
|
204
|
-
'COUCHBASE_CONNECTION_STRING',
|
|
205
|
-
'COUCHBASE_USERNAME',
|
|
206
|
-
'COUCHBASE_PASSWORD',
|
|
207
|
-
test_bucketName,
|
|
208
|
-
test_scopeName,
|
|
209
|
-
test_collectionName,
|
|
210
|
-
);
|
|
203
|
+
couchbase_client = new CouchbaseVector({
|
|
204
|
+
connectionString: 'COUCHBASE_CONNECTION_STRING',
|
|
205
|
+
username: 'COUCHBASE_USERNAME',
|
|
206
|
+
password: 'COUCHBASE_PASSWORD',
|
|
207
|
+
bucketName: test_bucketName,
|
|
208
|
+
scopeName: test_scopeName,
|
|
209
|
+
collectionName: test_collectionName,
|
|
210
|
+
});
|
|
211
211
|
await couchbase_client.getCollection();
|
|
212
212
|
});
|
|
213
213
|
|
|
@@ -311,7 +311,7 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
311
311
|
}, 50000);
|
|
312
312
|
|
|
313
313
|
it('should describe index', async () => {
|
|
314
|
-
const stats = await couchbase_client.describeIndex(test_indexName);
|
|
314
|
+
const stats = await couchbase_client.describeIndex({ indexName: test_indexName });
|
|
315
315
|
|
|
316
316
|
expect(mockScopeSearchIndexesFn).toHaveBeenCalledTimes(2);
|
|
317
317
|
|
|
@@ -323,12 +323,12 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
323
323
|
expect(mockGetIndexFn).toHaveResolved();
|
|
324
324
|
|
|
325
325
|
expect(stats.dimension).toBe(dimension);
|
|
326
|
-
expect(stats.metric).toBe('euclidean'); //
|
|
326
|
+
expect(stats.metric).toBe('euclidean'); // similarity(=="l2_norm") is mapped to euclidean in couchbase
|
|
327
327
|
expect(typeof stats.count).toBe('number');
|
|
328
328
|
}, 50000);
|
|
329
329
|
|
|
330
330
|
it('should delete index', async () => {
|
|
331
|
-
await couchbase_client.deleteIndex(test_indexName);
|
|
331
|
+
await couchbase_client.deleteIndex({ indexName: test_indexName });
|
|
332
332
|
|
|
333
333
|
expect(mockScopeSearchIndexesFn).toHaveBeenCalledTimes(2);
|
|
334
334
|
|
|
@@ -343,14 +343,14 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
343
343
|
|
|
344
344
|
describe('Vector Operations', () => {
|
|
345
345
|
beforeAll(async () => {
|
|
346
|
-
couchbase_client = new CouchbaseVector(
|
|
347
|
-
'COUCHBASE_CONNECTION_STRING',
|
|
348
|
-
'COUCHBASE_USERNAME',
|
|
349
|
-
'COUCHBASE_PASSWORD',
|
|
350
|
-
test_bucketName,
|
|
351
|
-
test_scopeName,
|
|
352
|
-
test_collectionName,
|
|
353
|
-
);
|
|
346
|
+
couchbase_client = new CouchbaseVector({
|
|
347
|
+
connectionString: 'COUCHBASE_CONNECTION_STRING',
|
|
348
|
+
username: 'COUCHBASE_USERNAME',
|
|
349
|
+
password: 'COUCHBASE_PASSWORD',
|
|
350
|
+
bucketName: test_bucketName,
|
|
351
|
+
scopeName: test_scopeName,
|
|
352
|
+
collectionName: test_collectionName,
|
|
353
|
+
});
|
|
354
354
|
|
|
355
355
|
await couchbase_client.getCollection();
|
|
356
356
|
});
|
|
@@ -510,14 +510,14 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
510
510
|
describe('Error Cases and Edge Cases', () => {
|
|
511
511
|
beforeAll(async () => {
|
|
512
512
|
clearAllMocks();
|
|
513
|
-
couchbase_client = new CouchbaseVector(
|
|
514
|
-
'COUCHBASE_CONNECTION_STRING',
|
|
515
|
-
'COUCHBASE_USERNAME',
|
|
516
|
-
'COUCHBASE_PASSWORD',
|
|
517
|
-
test_bucketName,
|
|
518
|
-
test_scopeName,
|
|
519
|
-
test_collectionName,
|
|
520
|
-
);
|
|
513
|
+
couchbase_client = new CouchbaseVector({
|
|
514
|
+
connectionString: 'COUCHBASE_CONNECTION_STRING',
|
|
515
|
+
username: 'COUCHBASE_USERNAME',
|
|
516
|
+
password: 'COUCHBASE_PASSWORD',
|
|
517
|
+
bucketName: test_bucketName,
|
|
518
|
+
scopeName: test_scopeName,
|
|
519
|
+
collectionName: test_collectionName,
|
|
520
|
+
});
|
|
521
521
|
await couchbase_client.getCollection();
|
|
522
522
|
});
|
|
523
523
|
|
|
@@ -542,13 +542,13 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
542
542
|
});
|
|
543
543
|
|
|
544
544
|
it('should throw error when describing a non-existent index', async () => {
|
|
545
|
-
await expect(couchbase_client.describeIndex('non_existent_index')).rejects.toThrow(
|
|
545
|
+
await expect(couchbase_client.describeIndex({ indexName: 'non_existent_index' })).rejects.toThrow(
|
|
546
546
|
`Index non_existent_index does not exist`,
|
|
547
547
|
);
|
|
548
548
|
});
|
|
549
549
|
|
|
550
550
|
it('should throw error when deleting a non-existent index', async () => {
|
|
551
|
-
await expect(couchbase_client.deleteIndex('non_existent_index')).rejects.toThrow(
|
|
551
|
+
await expect(couchbase_client.deleteIndex({ indexName: 'non_existent_index' })).rejects.toThrow(
|
|
552
552
|
`Index non_existent_index does not exist`,
|
|
553
553
|
);
|
|
554
554
|
});
|
|
@@ -577,14 +577,14 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
577
577
|
describe('Vector Dimension Tracking', () => {
|
|
578
578
|
beforeEach(async () => {
|
|
579
579
|
clearAllMocks();
|
|
580
|
-
couchbase_client = new CouchbaseVector(
|
|
581
|
-
'COUCHBASE_CONNECTION_STRING',
|
|
582
|
-
'COUCHBASE_USERNAME',
|
|
583
|
-
'COUCHBASE_PASSWORD',
|
|
584
|
-
test_bucketName,
|
|
585
|
-
test_scopeName,
|
|
586
|
-
test_collectionName,
|
|
587
|
-
);
|
|
580
|
+
couchbase_client = new CouchbaseVector({
|
|
581
|
+
connectionString: 'COUCHBASE_CONNECTION_STRING',
|
|
582
|
+
username: 'COUCHBASE_USERNAME',
|
|
583
|
+
password: 'COUCHBASE_PASSWORD',
|
|
584
|
+
bucketName: test_bucketName,
|
|
585
|
+
scopeName: test_scopeName,
|
|
586
|
+
collectionName: test_collectionName,
|
|
587
|
+
});
|
|
588
588
|
await couchbase_client.getCollection();
|
|
589
589
|
});
|
|
590
590
|
|
|
@@ -637,7 +637,7 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
637
637
|
clearAllMocks();
|
|
638
638
|
|
|
639
639
|
// Delete the index
|
|
640
|
-
await couchbase_client.deleteIndex(test_indexName);
|
|
640
|
+
await couchbase_client.deleteIndex({ indexName: test_indexName });
|
|
641
641
|
|
|
642
642
|
// Verify dimension is reset
|
|
643
643
|
expect((couchbase_client as any).vector_dimension).toBeNull();
|
|
@@ -647,14 +647,14 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
647
647
|
describe('Implementation Details', () => {
|
|
648
648
|
beforeEach(async () => {
|
|
649
649
|
clearAllMocks();
|
|
650
|
-
couchbase_client = new CouchbaseVector(
|
|
651
|
-
'COUCHBASE_CONNECTION_STRING',
|
|
652
|
-
'COUCHBASE_USERNAME',
|
|
653
|
-
'COUCHBASE_PASSWORD',
|
|
654
|
-
test_bucketName,
|
|
655
|
-
test_scopeName,
|
|
656
|
-
test_collectionName,
|
|
657
|
-
);
|
|
650
|
+
couchbase_client = new CouchbaseVector({
|
|
651
|
+
connectionString: 'COUCHBASE_CONNECTION_STRING',
|
|
652
|
+
username: 'COUCHBASE_USERNAME',
|
|
653
|
+
password: 'COUCHBASE_PASSWORD',
|
|
654
|
+
bucketName: test_bucketName,
|
|
655
|
+
scopeName: test_scopeName,
|
|
656
|
+
collectionName: test_collectionName,
|
|
657
|
+
});
|
|
658
658
|
await couchbase_client.getCollection();
|
|
659
659
|
});
|
|
660
660
|
|
|
@@ -713,7 +713,7 @@ describe('Unit Testing CouchbaseVector', () => {
|
|
|
713
713
|
},
|
|
714
714
|
});
|
|
715
715
|
|
|
716
|
-
const stats = await couchbase_client.describeIndex(test_indexName);
|
|
716
|
+
const stats = await couchbase_client.describeIndex({ indexName: test_indexName });
|
|
717
717
|
expect(stats.metric).toBe(mastraMetric);
|
|
718
718
|
}
|
|
719
719
|
});
|