@mastra/vectorize 0.2.10-alpha.4 → 0.2.11-alpha.0
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/_tsup-dts-rollup.d.cts +16 -11
- package/dist/_tsup-dts-rollup.d.ts +16 -11
- package/dist/index.cjs +21 -6
- package/dist/index.js +21 -6
- package/package.json +3 -3
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
2
|
import Cloudflare from 'cloudflare';
|
|
3
3
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
4
|
+
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
5
|
+
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
6
|
+
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
7
|
+
import type { IndexStats } from '@mastra/core/vector';
|
|
4
8
|
import { MastraVector } from '@mastra/core/vector';
|
|
5
9
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
6
10
|
import type { ParamsToArgs } from '@mastra/core/vector';
|
|
7
11
|
import type { QueryResult } from '@mastra/core/vector';
|
|
8
12
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
13
|
+
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
9
14
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
10
15
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
11
16
|
|
|
@@ -22,12 +27,15 @@ declare class CloudflareVector extends MastraVector {
|
|
|
22
27
|
createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
23
28
|
query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
|
|
24
29
|
listIndexes(): Promise<string[]>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves statistics about a vector index.
|
|
32
|
+
*
|
|
33
|
+
* @param params - The parameters for describing an index
|
|
34
|
+
* @param params.indexName - The name of the index to describe
|
|
35
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
36
|
+
*/
|
|
37
|
+
describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
|
|
38
|
+
deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
|
|
31
39
|
createMetadataIndex(indexName: string, propertyName: string, indexType: 'string' | 'number' | 'boolean'): Promise<void>;
|
|
32
40
|
deleteMetadataIndex(indexName: string, propertyName: string): Promise<void>;
|
|
33
41
|
listMetadataIndexes(indexName: string): Promise<Cloudflare.Vectorize.Indexes.MetadataIndex.MetadataIndexListResponse.MetadataIndex[]>;
|
|
@@ -57,10 +65,7 @@ declare class CloudflareVector extends MastraVector {
|
|
|
57
65
|
* @returns A promise that resolves when the update is complete.
|
|
58
66
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
59
67
|
*/
|
|
60
|
-
updateVector(
|
|
61
|
-
vector?: number[];
|
|
62
|
-
metadata?: Record<string, any>;
|
|
63
|
-
}): Promise<void>;
|
|
68
|
+
updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
|
|
64
69
|
/**
|
|
65
70
|
* @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
|
|
66
71
|
*
|
|
@@ -78,7 +83,7 @@ declare class CloudflareVector extends MastraVector {
|
|
|
78
83
|
* @returns A promise that resolves when the deletion is complete.
|
|
79
84
|
* @throws Will throw an error if the deletion operation fails.
|
|
80
85
|
*/
|
|
81
|
-
deleteVector(
|
|
86
|
+
deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
|
|
82
87
|
}
|
|
83
88
|
export { CloudflareVector }
|
|
84
89
|
export { CloudflareVector as CloudflareVector_alias_1 }
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
2
|
import Cloudflare from 'cloudflare';
|
|
3
3
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
4
|
+
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
5
|
+
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
6
|
+
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
7
|
+
import type { IndexStats } from '@mastra/core/vector';
|
|
4
8
|
import { MastraVector } from '@mastra/core/vector';
|
|
5
9
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
6
10
|
import type { ParamsToArgs } from '@mastra/core/vector';
|
|
7
11
|
import type { QueryResult } from '@mastra/core/vector';
|
|
8
12
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
13
|
+
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
9
14
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
10
15
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
11
16
|
|
|
@@ -22,12 +27,15 @@ declare class CloudflareVector extends MastraVector {
|
|
|
22
27
|
createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
23
28
|
query(...args: ParamsToArgs<QueryVectorParams>): Promise<QueryResult[]>;
|
|
24
29
|
listIndexes(): Promise<string[]>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves statistics about a vector index.
|
|
32
|
+
*
|
|
33
|
+
* @param params - The parameters for describing an index
|
|
34
|
+
* @param params.indexName - The name of the index to describe
|
|
35
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
36
|
+
*/
|
|
37
|
+
describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
|
|
38
|
+
deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
|
|
31
39
|
createMetadataIndex(indexName: string, propertyName: string, indexType: 'string' | 'number' | 'boolean'): Promise<void>;
|
|
32
40
|
deleteMetadataIndex(indexName: string, propertyName: string): Promise<void>;
|
|
33
41
|
listMetadataIndexes(indexName: string): Promise<Cloudflare.Vectorize.Indexes.MetadataIndex.MetadataIndexListResponse.MetadataIndex[]>;
|
|
@@ -57,10 +65,7 @@ declare class CloudflareVector extends MastraVector {
|
|
|
57
65
|
* @returns A promise that resolves when the update is complete.
|
|
58
66
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
59
67
|
*/
|
|
60
|
-
updateVector(
|
|
61
|
-
vector?: number[];
|
|
62
|
-
metadata?: Record<string, any>;
|
|
63
|
-
}): Promise<void>;
|
|
68
|
+
updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
|
|
64
69
|
/**
|
|
65
70
|
* @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
|
|
66
71
|
*
|
|
@@ -78,7 +83,7 @@ declare class CloudflareVector extends MastraVector {
|
|
|
78
83
|
* @returns A promise that resolves when the deletion is complete.
|
|
79
84
|
* @throws Will throw an error if the deletion operation fails.
|
|
80
85
|
*/
|
|
81
|
-
deleteVector(
|
|
86
|
+
deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
|
|
82
87
|
}
|
|
83
88
|
export { CloudflareVector }
|
|
84
89
|
export { CloudflareVector as CloudflareVector_alias_1 }
|
package/dist/index.cjs
CHANGED
|
@@ -152,7 +152,16 @@ var CloudflareVector = class extends vector.MastraVector {
|
|
|
152
152
|
});
|
|
153
153
|
return res?.result?.map((index) => index.name) || [];
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Retrieves statistics about a vector index.
|
|
157
|
+
*
|
|
158
|
+
* @param params - The parameters for describing an index
|
|
159
|
+
* @param params.indexName - The name of the index to describe
|
|
160
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
161
|
+
*/
|
|
162
|
+
async describeIndex(...args) {
|
|
163
|
+
const params = this.normalizeArgs("describeIndex", args);
|
|
164
|
+
const { indexName } = params;
|
|
156
165
|
const index = await this.client.vectorize.indexes.get(indexName, {
|
|
157
166
|
account_id: this.accountId
|
|
158
167
|
});
|
|
@@ -167,7 +176,9 @@ var CloudflareVector = class extends vector.MastraVector {
|
|
|
167
176
|
metric: index?.config?.metric
|
|
168
177
|
};
|
|
169
178
|
}
|
|
170
|
-
async deleteIndex(
|
|
179
|
+
async deleteIndex(...args) {
|
|
180
|
+
const params = this.normalizeArgs("deleteIndex", args);
|
|
181
|
+
const { indexName } = params;
|
|
171
182
|
await this.client.vectorize.indexes.delete(indexName, {
|
|
172
183
|
account_id: this.accountId
|
|
173
184
|
});
|
|
@@ -209,7 +220,7 @@ var CloudflareVector = class extends vector.MastraVector {
|
|
|
209
220
|
Please use updateVector() instead.
|
|
210
221
|
updateIndexById() will be removed on May 20th, 2025.`
|
|
211
222
|
);
|
|
212
|
-
await this.updateVector(indexName, id, update);
|
|
223
|
+
await this.updateVector({ indexName, id, update });
|
|
213
224
|
}
|
|
214
225
|
/**
|
|
215
226
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
@@ -221,7 +232,9 @@ var CloudflareVector = class extends vector.MastraVector {
|
|
|
221
232
|
* @returns A promise that resolves when the update is complete.
|
|
222
233
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
223
234
|
*/
|
|
224
|
-
async updateVector(
|
|
235
|
+
async updateVector(...args) {
|
|
236
|
+
const params = this.normalizeArgs("updateVector", args);
|
|
237
|
+
const { indexName, id, update } = params;
|
|
225
238
|
try {
|
|
226
239
|
if (!update.vector && !update.metadata) {
|
|
227
240
|
throw new Error("No update data provided");
|
|
@@ -254,7 +267,7 @@ var CloudflareVector = class extends vector.MastraVector {
|
|
|
254
267
|
Please use deleteVector() instead.
|
|
255
268
|
deleteIndexById() will be removed on May 20th, 2025.`
|
|
256
269
|
);
|
|
257
|
-
await this.deleteVector(indexName, id);
|
|
270
|
+
await this.deleteVector({ indexName, id });
|
|
258
271
|
}
|
|
259
272
|
/**
|
|
260
273
|
* Deletes a vector by its ID.
|
|
@@ -263,7 +276,9 @@ var CloudflareVector = class extends vector.MastraVector {
|
|
|
263
276
|
* @returns A promise that resolves when the deletion is complete.
|
|
264
277
|
* @throws Will throw an error if the deletion operation fails.
|
|
265
278
|
*/
|
|
266
|
-
async deleteVector(
|
|
279
|
+
async deleteVector(...args) {
|
|
280
|
+
const params = this.normalizeArgs("deleteVector", args);
|
|
281
|
+
const { indexName, id } = params;
|
|
267
282
|
try {
|
|
268
283
|
await this.client.vectorize.indexes.deleteByIds(indexName, {
|
|
269
284
|
ids: [id],
|
package/dist/index.js
CHANGED
|
@@ -146,7 +146,16 @@ var CloudflareVector = class extends MastraVector {
|
|
|
146
146
|
});
|
|
147
147
|
return res?.result?.map((index) => index.name) || [];
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Retrieves statistics about a vector index.
|
|
151
|
+
*
|
|
152
|
+
* @param params - The parameters for describing an index
|
|
153
|
+
* @param params.indexName - The name of the index to describe
|
|
154
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
155
|
+
*/
|
|
156
|
+
async describeIndex(...args) {
|
|
157
|
+
const params = this.normalizeArgs("describeIndex", args);
|
|
158
|
+
const { indexName } = params;
|
|
150
159
|
const index = await this.client.vectorize.indexes.get(indexName, {
|
|
151
160
|
account_id: this.accountId
|
|
152
161
|
});
|
|
@@ -161,7 +170,9 @@ var CloudflareVector = class extends MastraVector {
|
|
|
161
170
|
metric: index?.config?.metric
|
|
162
171
|
};
|
|
163
172
|
}
|
|
164
|
-
async deleteIndex(
|
|
173
|
+
async deleteIndex(...args) {
|
|
174
|
+
const params = this.normalizeArgs("deleteIndex", args);
|
|
175
|
+
const { indexName } = params;
|
|
165
176
|
await this.client.vectorize.indexes.delete(indexName, {
|
|
166
177
|
account_id: this.accountId
|
|
167
178
|
});
|
|
@@ -203,7 +214,7 @@ var CloudflareVector = class extends MastraVector {
|
|
|
203
214
|
Please use updateVector() instead.
|
|
204
215
|
updateIndexById() will be removed on May 20th, 2025.`
|
|
205
216
|
);
|
|
206
|
-
await this.updateVector(indexName, id, update);
|
|
217
|
+
await this.updateVector({ indexName, id, update });
|
|
207
218
|
}
|
|
208
219
|
/**
|
|
209
220
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
@@ -215,7 +226,9 @@ var CloudflareVector = class extends MastraVector {
|
|
|
215
226
|
* @returns A promise that resolves when the update is complete.
|
|
216
227
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
217
228
|
*/
|
|
218
|
-
async updateVector(
|
|
229
|
+
async updateVector(...args) {
|
|
230
|
+
const params = this.normalizeArgs("updateVector", args);
|
|
231
|
+
const { indexName, id, update } = params;
|
|
219
232
|
try {
|
|
220
233
|
if (!update.vector && !update.metadata) {
|
|
221
234
|
throw new Error("No update data provided");
|
|
@@ -248,7 +261,7 @@ var CloudflareVector = class extends MastraVector {
|
|
|
248
261
|
Please use deleteVector() instead.
|
|
249
262
|
deleteIndexById() will be removed on May 20th, 2025.`
|
|
250
263
|
);
|
|
251
|
-
await this.deleteVector(indexName, id);
|
|
264
|
+
await this.deleteVector({ indexName, id });
|
|
252
265
|
}
|
|
253
266
|
/**
|
|
254
267
|
* Deletes a vector by its ID.
|
|
@@ -257,7 +270,9 @@ var CloudflareVector = class extends MastraVector {
|
|
|
257
270
|
* @returns A promise that resolves when the deletion is complete.
|
|
258
271
|
* @throws Will throw an error if the deletion operation fails.
|
|
259
272
|
*/
|
|
260
|
-
async deleteVector(
|
|
273
|
+
async deleteVector(...args) {
|
|
274
|
+
const params = this.normalizeArgs("deleteVector", args);
|
|
275
|
+
const { indexName, id } = params;
|
|
261
276
|
try {
|
|
262
277
|
await this.client.vectorize.indexes.deleteByIds(indexName, {
|
|
263
278
|
ids: [id],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/vectorize",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11-alpha.0",
|
|
4
4
|
"description": "Cloudflare Vectorize store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"cloudflare": "^4.1.0",
|
|
27
|
-
"@mastra/core": "^0.9.
|
|
27
|
+
"@mastra/core": "^0.9.5-alpha.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@microsoft/api-extractor": "^7.52.5",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"tsup": "^8.4.0",
|
|
35
35
|
"typescript": "^5.8.2",
|
|
36
36
|
"vitest": "^3.1.2",
|
|
37
|
-
"@internal/lint": "0.0.
|
|
37
|
+
"@internal/lint": "0.0.5"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|