@mastra/vectorize 0.1.13-alpha.0 → 0.2.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.
@@ -30,6 +30,11 @@ declare class CloudflareVector extends MastraVector {
30
30
  createMetadataIndex(indexName: string, propertyName: string, indexType: 'string' | 'number' | 'boolean'): Promise<void>;
31
31
  deleteMetadataIndex(indexName: string, propertyName: string): Promise<void>;
32
32
  listMetadataIndexes(indexName: string): Promise<Cloudflare.Vectorize.Indexes.MetadataIndex.MetadataIndexListResponse.MetadataIndex[]>;
33
+ updateIndexById(indexName: string, id: string, update: {
34
+ vector?: number[];
35
+ metadata?: Record<string, any>;
36
+ }): Promise<void>;
37
+ deleteIndexById(indexName: string, id: string): Promise<void>;
33
38
  }
34
39
  export { CloudflareVector }
35
40
  export { CloudflareVector as CloudflareVector_alias_1 }
@@ -30,6 +30,11 @@ declare class CloudflareVector extends MastraVector {
30
30
  createMetadataIndex(indexName: string, propertyName: string, indexType: 'string' | 'number' | 'boolean'): Promise<void>;
31
31
  deleteMetadataIndex(indexName: string, propertyName: string): Promise<void>;
32
32
  listMetadataIndexes(indexName: string): Promise<Cloudflare.Vectorize.Indexes.MetadataIndex.MetadataIndexListResponse.MetadataIndex[]>;
33
+ updateIndexById(indexName: string, id: string, update: {
34
+ vector?: number[];
35
+ metadata?: Record<string, any>;
36
+ }): Promise<void>;
37
+ deleteIndexById(indexName: string, id: string): Promise<void>;
33
38
  }
34
39
  export { CloudflareVector }
35
40
  export { CloudflareVector as CloudflareVector_alias_1 }
package/dist/index.cjs CHANGED
@@ -179,6 +179,26 @@ var CloudflareVector = class extends vector.MastraVector {
179
179
  });
180
180
  return res?.metadataIndexes ?? [];
181
181
  }
182
+ async updateIndexById(indexName, id, update) {
183
+ if (!update.vector && !update.metadata) {
184
+ throw new Error("No update data provided");
185
+ }
186
+ const updatePayload = {
187
+ };
188
+ if (update.vector) {
189
+ updatePayload.vectors = [update.vector];
190
+ }
191
+ if (update.metadata) {
192
+ updatePayload.metadata = [update.metadata];
193
+ }
194
+ await this.upsert({ indexName, vectors: updatePayload.vectors, metadata: updatePayload.metadata });
195
+ }
196
+ async deleteIndexById(indexName, id) {
197
+ await this.client.vectorize.indexes.deleteByIds(indexName, {
198
+ ids: [id],
199
+ account_id: this.accountId
200
+ });
201
+ }
182
202
  };
183
203
 
184
204
  exports.CloudflareVector = CloudflareVector;
package/dist/index.js CHANGED
@@ -173,6 +173,26 @@ var CloudflareVector = class extends MastraVector {
173
173
  });
174
174
  return res?.metadataIndexes ?? [];
175
175
  }
176
+ async updateIndexById(indexName, id, update) {
177
+ if (!update.vector && !update.metadata) {
178
+ throw new Error("No update data provided");
179
+ }
180
+ const updatePayload = {
181
+ };
182
+ if (update.vector) {
183
+ updatePayload.vectors = [update.vector];
184
+ }
185
+ if (update.metadata) {
186
+ updatePayload.metadata = [update.metadata];
187
+ }
188
+ await this.upsert({ indexName, vectors: updatePayload.vectors, metadata: updatePayload.metadata });
189
+ }
190
+ async deleteIndexById(indexName, id) {
191
+ await this.client.vectorize.indexes.deleteByIds(indexName, {
192
+ ids: [id],
193
+ account_id: this.accountId
194
+ });
195
+ }
176
196
  };
177
197
 
178
198
  export { CloudflareVector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/vectorize",
3
- "version": "0.1.13-alpha.0",
3
+ "version": "0.2.0",
4
4
  "description": "Cloudflare Vectorize store provider for Mastra",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "cloudflare": "^4.1.0",
26
- "@mastra/core": "^0.6.4-alpha.0"
26
+ "@mastra/core": "^0.6.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@microsoft/api-extractor": "^7.52.1",
@@ -32,6 +32,7 @@
32
32
  "tsup": "^8.4.0",
33
33
  "typescript": "^5.8.2",
34
34
  "vitest": "^3.0.8",
35
+ "dotenv": "^16.4.7",
35
36
  "@internal/lint": "0.0.1"
36
37
  },
37
38
  "scripts": {