@mastra/astra 0.2.6 → 0.2.7-alpha.2
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +34 -0
- package/package.json +2 -2
- package/src/vector/index.test.ts +59 -20
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/astra@0.2.
|
|
2
|
+
> @mastra/astra@0.2.7-alpha.2 build /home/runner/work/mastra/mastra/stores/astra
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 5799ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/astra/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/astra/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 9416ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[32m7.06 KB[39m
|
|
21
|
-
[32mESM[39m ⚡️ Build success in 571ms
|
|
22
20
|
[32mCJS[39m [1mdist/index.cjs [22m[32m7.09 KB[39m
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 461ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m7.06 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 462ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @mastra/astra
|
|
2
2
|
|
|
3
|
+
## 0.2.7-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [56c31b7]
|
|
8
|
+
- Updated dependencies [dbbbf80]
|
|
9
|
+
- Updated dependencies [99d43b9]
|
|
10
|
+
- @mastra/core@0.8.0-alpha.2
|
|
11
|
+
|
|
12
|
+
## 0.2.7-alpha.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 866da3c: Update astra tests to check collection is empty
|
|
17
|
+
- Updated dependencies [619c39d]
|
|
18
|
+
- Updated dependencies [fe56be0]
|
|
19
|
+
- Updated dependencies [a0967a0]
|
|
20
|
+
- Updated dependencies [fca3b21]
|
|
21
|
+
- Updated dependencies [0118361]
|
|
22
|
+
- Updated dependencies [619c39d]
|
|
23
|
+
- @mastra/core@0.8.0-alpha.1
|
|
24
|
+
|
|
25
|
+
## 0.2.7-alpha.0
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [107bcfe]
|
|
30
|
+
- Updated dependencies [5b4e19f]
|
|
31
|
+
- Updated dependencies [7599d77]
|
|
32
|
+
- Updated dependencies [cafae83]
|
|
33
|
+
- Updated dependencies [8076ecf]
|
|
34
|
+
- Updated dependencies [304397c]
|
|
35
|
+
- @mastra/core@0.7.1-alpha.0
|
|
36
|
+
|
|
3
37
|
## 0.2.6
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/astra",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7-alpha.2",
|
|
4
4
|
"description": "Astra DB provider for Mastra - includes vector store capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@datastax/astra-db-ts": "^1.5.0",
|
|
23
|
-
"@mastra/core": "^0.
|
|
23
|
+
"@mastra/core": "^0.8.0-alpha.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@microsoft/api-extractor": "^7.52.1",
|
package/src/vector/index.test.ts
CHANGED
|
@@ -23,6 +23,41 @@ async function waitForCondition(
|
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
async function createIndexAndWait(
|
|
27
|
+
vectorDB: AstraVector,
|
|
28
|
+
indexName: string,
|
|
29
|
+
dimension: number,
|
|
30
|
+
metric: 'cosine' | 'euclidean' | 'dotproduct',
|
|
31
|
+
) {
|
|
32
|
+
await vectorDB.createIndex({ indexName, dimension, metric });
|
|
33
|
+
const created = await waitForCondition(
|
|
34
|
+
async () => {
|
|
35
|
+
const newCollections = await vectorDB.listIndexes();
|
|
36
|
+
return newCollections.includes(indexName);
|
|
37
|
+
},
|
|
38
|
+
30000,
|
|
39
|
+
2000,
|
|
40
|
+
);
|
|
41
|
+
if (!created) {
|
|
42
|
+
throw new Error('Timed out waiting for collection to be created');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function deleteIndexAndWait(vectorDB: AstraVector, indexName: string) {
|
|
47
|
+
await vectorDB.deleteIndex(indexName);
|
|
48
|
+
const deleted = await waitForCondition(
|
|
49
|
+
async () => {
|
|
50
|
+
const newCollections = await vectorDB.listIndexes();
|
|
51
|
+
return !newCollections.includes(indexName);
|
|
52
|
+
},
|
|
53
|
+
30000,
|
|
54
|
+
2000,
|
|
55
|
+
);
|
|
56
|
+
if (!deleted) {
|
|
57
|
+
throw new Error('Timed out waiting for collection to be deleted');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
26
61
|
describe('AstraVector Integration Tests', () => {
|
|
27
62
|
let vectorDB: AstraVector;
|
|
28
63
|
const testIndexName = 'testvectors1733728136118'; // Unique collection name
|
|
@@ -46,12 +81,24 @@ describe('AstraVector Integration Tests', () => {
|
|
|
46
81
|
try {
|
|
47
82
|
const collections = await vectorDB.listIndexes();
|
|
48
83
|
await Promise.all(collections.map(c => vectorDB.deleteIndex(c)));
|
|
84
|
+
const deleted = await waitForCondition(
|
|
85
|
+
async () => {
|
|
86
|
+
const remainingCollections = await vectorDB.listIndexes();
|
|
87
|
+
return remainingCollections.length === 0;
|
|
88
|
+
},
|
|
89
|
+
30000,
|
|
90
|
+
2000,
|
|
91
|
+
);
|
|
92
|
+
if (!deleted) {
|
|
93
|
+
throw new Error('Timed out waiting for collections to be deleted');
|
|
94
|
+
}
|
|
49
95
|
} catch (error) {
|
|
50
96
|
console.error('Failed to delete test collections:', error);
|
|
97
|
+
throw error;
|
|
51
98
|
}
|
|
52
99
|
|
|
53
|
-
await vectorDB
|
|
54
|
-
await vectorDB
|
|
100
|
+
await createIndexAndWait(vectorDB, testIndexName, 4, 'cosine');
|
|
101
|
+
await createIndexAndWait(vectorDB, testIndexName2, 4, 'cosine');
|
|
55
102
|
}, 500000);
|
|
56
103
|
|
|
57
104
|
afterAll(async () => {
|
|
@@ -159,11 +206,7 @@ describe('AstraVector Integration Tests', () => {
|
|
|
159
206
|
|
|
160
207
|
try {
|
|
161
208
|
// Create index with higher dimensions
|
|
162
|
-
await vectorDB
|
|
163
|
-
indexName: highDimIndexName,
|
|
164
|
-
dimension: 1536,
|
|
165
|
-
metric: 'cosine',
|
|
166
|
-
});
|
|
209
|
+
await createIndexAndWait(vectorDB, highDimIndexName, 1536, 'cosine');
|
|
167
210
|
|
|
168
211
|
// Insert high-dimensional vectors
|
|
169
212
|
const vectors = [
|
|
@@ -202,7 +245,7 @@ describe('AstraVector Integration Tests', () => {
|
|
|
202
245
|
expect(results?.[0]?.score).toBeCloseTo(1, 4);
|
|
203
246
|
} finally {
|
|
204
247
|
// Cleanup
|
|
205
|
-
await vectorDB
|
|
248
|
+
await deleteIndexAndWait(vectorDB, highDimIndexName);
|
|
206
249
|
}
|
|
207
250
|
});
|
|
208
251
|
|
|
@@ -214,11 +257,7 @@ describe('AstraVector Integration Tests', () => {
|
|
|
214
257
|
|
|
215
258
|
try {
|
|
216
259
|
// Create index with different metric
|
|
217
|
-
await vectorDB
|
|
218
|
-
indexName: metricIndexName,
|
|
219
|
-
dimension: 4,
|
|
220
|
-
metric,
|
|
221
|
-
});
|
|
260
|
+
await createIndexAndWait(vectorDB, metricIndexName, 4, metric);
|
|
222
261
|
|
|
223
262
|
// Insert same vectors
|
|
224
263
|
const vectors = [
|
|
@@ -247,7 +286,7 @@ describe('AstraVector Integration Tests', () => {
|
|
|
247
286
|
expect(results?.[0]?.score).toBeGreaterThan(results?.[1]?.score!);
|
|
248
287
|
} finally {
|
|
249
288
|
// Cleanup
|
|
250
|
-
await vectorDB
|
|
289
|
+
await deleteIndexAndWait(vectorDB, metricIndexName);
|
|
251
290
|
}
|
|
252
291
|
}
|
|
253
292
|
}, 500000);
|
|
@@ -1062,12 +1101,12 @@ describe('AstraVector Integration Tests', () => {
|
|
|
1062
1101
|
let warnSpy;
|
|
1063
1102
|
|
|
1064
1103
|
beforeAll(async () => {
|
|
1065
|
-
await vectorDB
|
|
1104
|
+
await createIndexAndWait(vectorDB, indexName, 3, 'cosine');
|
|
1066
1105
|
});
|
|
1067
1106
|
|
|
1068
1107
|
afterAll(async () => {
|
|
1069
|
-
await vectorDB
|
|
1070
|
-
await vectorDB
|
|
1108
|
+
await deleteIndexAndWait(vectorDB, indexName);
|
|
1109
|
+
await deleteIndexAndWait(vectorDB, indexName2);
|
|
1071
1110
|
});
|
|
1072
1111
|
|
|
1073
1112
|
beforeEach(async () => {
|
|
@@ -1076,7 +1115,7 @@ describe('AstraVector Integration Tests', () => {
|
|
|
1076
1115
|
|
|
1077
1116
|
afterEach(async () => {
|
|
1078
1117
|
warnSpy.mockRestore();
|
|
1079
|
-
await vectorDB
|
|
1118
|
+
await deleteIndexAndWait(vectorDB, indexName2);
|
|
1080
1119
|
});
|
|
1081
1120
|
|
|
1082
1121
|
it('should show deprecation warning when using individual args for createIndex', async () => {
|
|
@@ -1156,11 +1195,11 @@ describe('AstraVector Integration Tests', () => {
|
|
|
1156
1195
|
const indexName = 'testbasicvectoroperations';
|
|
1157
1196
|
|
|
1158
1197
|
beforeAll(async () => {
|
|
1159
|
-
await vectorDB
|
|
1198
|
+
await createIndexAndWait(vectorDB, indexName, 4, 'cosine');
|
|
1160
1199
|
});
|
|
1161
1200
|
|
|
1162
1201
|
afterAll(async () => {
|
|
1163
|
-
await vectorDB
|
|
1202
|
+
await deleteIndexAndWait(vectorDB, indexName);
|
|
1164
1203
|
});
|
|
1165
1204
|
|
|
1166
1205
|
const testVectors = [
|