@mastra/qdrant 0.2.14-alpha.2 → 0.2.14-alpha.3

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/qdrant@0.2.14-alpha.2 build /home/runner/work/mastra/mastra/stores/qdrant
2
+ > @mastra/qdrant@0.2.14-alpha.3 build /home/runner/work/mastra/mastra/stores/qdrant
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 7604ms
9
+ TSC ⚡️ Build success in 8350ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/qdrant/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/qdrant/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 10288ms
16
+ DTS ⚡️ Build success in 9254ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- CJS dist/index.cjs 17.03 KB
21
- CJS ⚡️ Build success in 843ms
22
- ESM dist/index.js 16.97 KB
23
- ESM ⚡️ Build success in 845ms
20
+ CJS dist/index.cjs 19.75 KB
21
+ CJS ⚡️ Build success in 913ms
22
+ ESM dist/index.js 19.69 KB
23
+ ESM ⚡️ Build success in 913ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @mastra/qdrant
2
2
 
3
+ ## 0.2.14-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - c3bd795: [MASTRA-3358] Deprecate updateIndexById and deleteIndexById
8
+ - Updated dependencies [396be50]
9
+ - Updated dependencies [c3bd795]
10
+ - Updated dependencies [da082f8]
11
+ - Updated dependencies [a5810ce]
12
+ - @mastra/core@0.9.4-alpha.3
13
+
3
14
  ## 0.2.14-alpha.2
4
15
 
5
16
  ### Patch Changes
@@ -63,11 +63,54 @@ declare class QdrantVector extends MastraVector {
63
63
  listIndexes(): Promise<string[]>;
64
64
  describeIndex(indexName: string): Promise<IndexStats>;
65
65
  deleteIndex(indexName: string): Promise<void>;
66
+ /**
67
+ * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
68
+ *
69
+ * Updates a vector by its ID with the provided vector and/or metadata.
70
+ * @param indexName - The name of the index containing the vector.
71
+ * @param id - The ID of the vector to update.
72
+ * @param update - An object containing the vector and/or metadata to update.
73
+ * @param update.vector - An optional array of numbers representing the new vector.
74
+ * @param update.metadata - An optional record containing the new metadata.
75
+ * @returns A promise that resolves when the update is complete.
76
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
77
+ */
66
78
  updateIndexById(indexName: string, id: string, update: {
67
79
  vector?: number[];
68
80
  metadata?: Record<string, any>;
69
81
  }): Promise<void>;
82
+ /**
83
+ * Updates a vector by its ID with the provided vector and/or metadata.
84
+ * @param indexName - The name of the index containing the vector.
85
+ * @param id - The ID of the vector to update.
86
+ * @param update - An object containing the vector and/or metadata to update.
87
+ * @param update.vector - An optional array of numbers representing the new vector.
88
+ * @param update.metadata - An optional record containing the new metadata.
89
+ * @returns A promise that resolves when the update is complete.
90
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
91
+ */
92
+ updateVector(indexName: string, id: string, update: {
93
+ vector?: number[];
94
+ metadata?: Record<string, any>;
95
+ }): Promise<void>;
96
+ /**
97
+ * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
98
+ *
99
+ * Deletes a vector by its ID.
100
+ * @param indexName - The name of the index containing the vector.
101
+ * @param id - The ID of the vector to delete.
102
+ * @returns A promise that resolves when the deletion is complete.
103
+ * @throws Will throw an error if the deletion operation fails.
104
+ */
70
105
  deleteIndexById(indexName: string, id: string): Promise<void>;
106
+ /**
107
+ * Deletes a vector by its ID.
108
+ * @param indexName - The name of the index containing the vector.
109
+ * @param id - The ID of the vector to delete.
110
+ * @returns A promise that resolves when the deletion is complete.
111
+ * @throws Will throw an error if the deletion operation fails.
112
+ */
113
+ deleteVector(indexName: string, id: string): Promise<void>;
71
114
  /**
72
115
  * Parses and converts a string ID to the appropriate type (string or number) for Qdrant point operations.
73
116
  *
@@ -63,11 +63,54 @@ declare class QdrantVector extends MastraVector {
63
63
  listIndexes(): Promise<string[]>;
64
64
  describeIndex(indexName: string): Promise<IndexStats>;
65
65
  deleteIndex(indexName: string): Promise<void>;
66
+ /**
67
+ * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
68
+ *
69
+ * Updates a vector by its ID with the provided vector and/or metadata.
70
+ * @param indexName - The name of the index containing the vector.
71
+ * @param id - The ID of the vector to update.
72
+ * @param update - An object containing the vector and/or metadata to update.
73
+ * @param update.vector - An optional array of numbers representing the new vector.
74
+ * @param update.metadata - An optional record containing the new metadata.
75
+ * @returns A promise that resolves when the update is complete.
76
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
77
+ */
66
78
  updateIndexById(indexName: string, id: string, update: {
67
79
  vector?: number[];
68
80
  metadata?: Record<string, any>;
69
81
  }): Promise<void>;
82
+ /**
83
+ * Updates a vector by its ID with the provided vector and/or metadata.
84
+ * @param indexName - The name of the index containing the vector.
85
+ * @param id - The ID of the vector to update.
86
+ * @param update - An object containing the vector and/or metadata to update.
87
+ * @param update.vector - An optional array of numbers representing the new vector.
88
+ * @param update.metadata - An optional record containing the new metadata.
89
+ * @returns A promise that resolves when the update is complete.
90
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
91
+ */
92
+ updateVector(indexName: string, id: string, update: {
93
+ vector?: number[];
94
+ metadata?: Record<string, any>;
95
+ }): Promise<void>;
96
+ /**
97
+ * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
98
+ *
99
+ * Deletes a vector by its ID.
100
+ * @param indexName - The name of the index containing the vector.
101
+ * @param id - The ID of the vector to delete.
102
+ * @returns A promise that resolves when the deletion is complete.
103
+ * @throws Will throw an error if the deletion operation fails.
104
+ */
70
105
  deleteIndexById(indexName: string, id: string): Promise<void>;
106
+ /**
107
+ * Deletes a vector by its ID.
108
+ * @param indexName - The name of the index containing the vector.
109
+ * @param id - The ID of the vector to delete.
110
+ * @returns A promise that resolves when the deletion is complete.
111
+ * @throws Will throw an error if the deletion operation fails.
112
+ */
113
+ deleteVector(indexName: string, id: string): Promise<void>;
71
114
  /**
72
115
  * Parses and converts a string ID to the appropriate type (string or number) for Qdrant point operations.
73
116
  *
package/dist/index.cjs CHANGED
@@ -346,7 +346,37 @@ var QdrantVector = class extends vector.MastraVector {
346
346
  async deleteIndex(indexName) {
347
347
  await this.client.deleteCollection(indexName);
348
348
  }
349
+ /**
350
+ * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
351
+ *
352
+ * Updates a vector by its ID with the provided vector and/or metadata.
353
+ * @param indexName - The name of the index containing the vector.
354
+ * @param id - The ID of the vector to update.
355
+ * @param update - An object containing the vector and/or metadata to update.
356
+ * @param update.vector - An optional array of numbers representing the new vector.
357
+ * @param update.metadata - An optional record containing the new metadata.
358
+ * @returns A promise that resolves when the update is complete.
359
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
360
+ */
349
361
  async updateIndexById(indexName, id, update) {
362
+ this.logger.warn(
363
+ `Deprecation Warning: updateIndexById() is deprecated.
364
+ Please use updateVector() instead.
365
+ updateIndexById() will be removed on May 20th, 2025.`
366
+ );
367
+ await this.updateVector(indexName, id, update);
368
+ }
369
+ /**
370
+ * Updates a vector by its ID with the provided vector and/or metadata.
371
+ * @param indexName - The name of the index containing the vector.
372
+ * @param id - The ID of the vector to update.
373
+ * @param update - An object containing the vector and/or metadata to update.
374
+ * @param update.vector - An optional array of numbers representing the new vector.
375
+ * @param update.metadata - An optional record containing the new metadata.
376
+ * @returns A promise that resolves when the update is complete.
377
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
378
+ */
379
+ async updateVector(indexName, id, update) {
350
380
  if (!update.vector && !update.metadata) {
351
381
  throw new Error("No updates provided");
352
382
  }
@@ -379,15 +409,43 @@ var QdrantVector = class extends vector.MastraVector {
379
409
  return;
380
410
  }
381
411
  } catch (error) {
382
- console.error("Error updating point in Qdrant:", error);
412
+ console.error(`Failed to update vector by id: ${id} for index name: ${indexName}:`, error);
383
413
  throw error;
384
414
  }
385
415
  }
416
+ /**
417
+ * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
418
+ *
419
+ * Deletes a vector by its ID.
420
+ * @param indexName - The name of the index containing the vector.
421
+ * @param id - The ID of the vector to delete.
422
+ * @returns A promise that resolves when the deletion is complete.
423
+ * @throws Will throw an error if the deletion operation fails.
424
+ */
386
425
  async deleteIndexById(indexName, id) {
387
- const pointId = this.parsePointId(id);
388
- await this.client.delete(indexName, {
389
- points: [pointId]
390
- });
426
+ this.logger.warn(
427
+ `Deprecation Warning: deleteIndexById() is deprecated.
428
+ Please use deleteVector() instead.
429
+ deleteIndexById() will be removed on May 20th, 2025.`
430
+ );
431
+ await this.deleteVector(indexName, id);
432
+ }
433
+ /**
434
+ * Deletes a vector by its ID.
435
+ * @param indexName - The name of the index containing the vector.
436
+ * @param id - The ID of the vector to delete.
437
+ * @returns A promise that resolves when the deletion is complete.
438
+ * @throws Will throw an error if the deletion operation fails.
439
+ */
440
+ async deleteVector(indexName, id) {
441
+ try {
442
+ const pointId = this.parsePointId(id);
443
+ await this.client.delete(indexName, {
444
+ points: [pointId]
445
+ });
446
+ } catch (error) {
447
+ throw new Error(`Failed to delete vector by id: ${id} for index name: ${indexName}: ${error.message}`);
448
+ }
391
449
  }
392
450
  /**
393
451
  * Parses and converts a string ID to the appropriate type (string or number) for Qdrant point operations.
package/dist/index.js CHANGED
@@ -344,7 +344,37 @@ var QdrantVector = class extends MastraVector {
344
344
  async deleteIndex(indexName) {
345
345
  await this.client.deleteCollection(indexName);
346
346
  }
347
+ /**
348
+ * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
349
+ *
350
+ * Updates a vector by its ID with the provided vector and/or metadata.
351
+ * @param indexName - The name of the index containing the vector.
352
+ * @param id - The ID of the vector to update.
353
+ * @param update - An object containing the vector and/or metadata to update.
354
+ * @param update.vector - An optional array of numbers representing the new vector.
355
+ * @param update.metadata - An optional record containing the new metadata.
356
+ * @returns A promise that resolves when the update is complete.
357
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
358
+ */
347
359
  async updateIndexById(indexName, id, update) {
360
+ this.logger.warn(
361
+ `Deprecation Warning: updateIndexById() is deprecated.
362
+ Please use updateVector() instead.
363
+ updateIndexById() will be removed on May 20th, 2025.`
364
+ );
365
+ await this.updateVector(indexName, id, update);
366
+ }
367
+ /**
368
+ * Updates a vector by its ID with the provided vector and/or metadata.
369
+ * @param indexName - The name of the index containing the vector.
370
+ * @param id - The ID of the vector to update.
371
+ * @param update - An object containing the vector and/or metadata to update.
372
+ * @param update.vector - An optional array of numbers representing the new vector.
373
+ * @param update.metadata - An optional record containing the new metadata.
374
+ * @returns A promise that resolves when the update is complete.
375
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
376
+ */
377
+ async updateVector(indexName, id, update) {
348
378
  if (!update.vector && !update.metadata) {
349
379
  throw new Error("No updates provided");
350
380
  }
@@ -377,15 +407,43 @@ var QdrantVector = class extends MastraVector {
377
407
  return;
378
408
  }
379
409
  } catch (error) {
380
- console.error("Error updating point in Qdrant:", error);
410
+ console.error(`Failed to update vector by id: ${id} for index name: ${indexName}:`, error);
381
411
  throw error;
382
412
  }
383
413
  }
414
+ /**
415
+ * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
416
+ *
417
+ * Deletes a vector by its ID.
418
+ * @param indexName - The name of the index containing the vector.
419
+ * @param id - The ID of the vector to delete.
420
+ * @returns A promise that resolves when the deletion is complete.
421
+ * @throws Will throw an error if the deletion operation fails.
422
+ */
384
423
  async deleteIndexById(indexName, id) {
385
- const pointId = this.parsePointId(id);
386
- await this.client.delete(indexName, {
387
- points: [pointId]
388
- });
424
+ this.logger.warn(
425
+ `Deprecation Warning: deleteIndexById() is deprecated.
426
+ Please use deleteVector() instead.
427
+ deleteIndexById() will be removed on May 20th, 2025.`
428
+ );
429
+ await this.deleteVector(indexName, id);
430
+ }
431
+ /**
432
+ * Deletes a vector by its ID.
433
+ * @param indexName - The name of the index containing the vector.
434
+ * @param id - The ID of the vector to delete.
435
+ * @returns A promise that resolves when the deletion is complete.
436
+ * @throws Will throw an error if the deletion operation fails.
437
+ */
438
+ async deleteVector(indexName, id) {
439
+ try {
440
+ const pointId = this.parsePointId(id);
441
+ await this.client.delete(indexName, {
442
+ points: [pointId]
443
+ });
444
+ } catch (error) {
445
+ throw new Error(`Failed to delete vector by id: ${id} for index name: ${indexName}: ${error.message}`);
446
+ }
389
447
  }
390
448
  /**
391
449
  * Parses and converts a string ID to the appropriate type (string or number) for Qdrant point operations.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/qdrant",
3
- "version": "0.2.14-alpha.2",
3
+ "version": "0.2.14-alpha.3",
4
4
  "description": "Qdrant vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@qdrant/js-client-rest": "^1.13.0",
24
- "@mastra/core": "^0.9.4-alpha.2"
24
+ "@mastra/core": "^0.9.4-alpha.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@microsoft/api-extractor": "^7.52.5",
@@ -118,7 +118,7 @@ describe('QdrantVector', () => {
118
118
  metadata: newMetaData,
119
119
  };
120
120
 
121
- await qdrant.updateIndexById(testCollectionName, idToBeUpdated, update);
121
+ await qdrant.updateVector(testCollectionName, idToBeUpdated, update);
122
122
 
123
123
  const results: QueryResult[] = await qdrant.query({
124
124
  indexName: testCollectionName,
@@ -146,7 +146,7 @@ describe('QdrantVector', () => {
146
146
  metadata: newMetaData,
147
147
  };
148
148
 
149
- await qdrant.updateIndexById(testCollectionName, idToBeUpdated, update);
149
+ await qdrant.updateVector(testCollectionName, idToBeUpdated, update);
150
150
 
151
151
  const results: QueryResult[] = await qdrant.query({
152
152
  indexName: testCollectionName,
@@ -171,7 +171,7 @@ describe('QdrantVector', () => {
171
171
  vector: newVector,
172
172
  };
173
173
 
174
- await qdrant.updateIndexById(testCollectionName, idToBeUpdated, update);
174
+ await qdrant.updateVector(testCollectionName, idToBeUpdated, update);
175
175
 
176
176
  const results: QueryResult[] = await qdrant.query({
177
177
  indexName: testCollectionName,
@@ -185,12 +185,12 @@ describe('QdrantVector', () => {
185
185
  });
186
186
 
187
187
  it('should throw exception when no updates are given', async () => {
188
- await expect(qdrant.updateIndexById(testCollectionName, 'id', {})).rejects.toThrow('No updates provided');
188
+ await expect(qdrant.updateVector(testCollectionName, 'id', {})).rejects.toThrow('No updates provided');
189
189
  });
190
190
 
191
191
  it('should throw error for non-existent index', async () => {
192
192
  const nonExistentIndex = 'non-existent-index';
193
- await expect(qdrant.updateIndexById(nonExistentIndex, 'test-id', { vector: [1, 2, 3] })).rejects.toThrow();
193
+ await expect(qdrant.updateVector(nonExistentIndex, 'test-id', { vector: [1, 2, 3] })).rejects.toThrow();
194
194
  });
195
195
 
196
196
  it('should throw error for invalid vector dimension', async () => {
@@ -201,7 +201,7 @@ describe('QdrantVector', () => {
201
201
  });
202
202
 
203
203
  await expect(
204
- qdrant.updateIndexById(testCollectionName, id, { vector: [1, 2] }), // Wrong dimension
204
+ qdrant.updateVector(testCollectionName, id, { vector: [1, 2] }), // Wrong dimension
205
205
  ).rejects.toThrow();
206
206
  });
207
207
  });
@@ -226,7 +226,7 @@ describe('QdrantVector', () => {
226
226
  expect(ids).toHaveLength(3);
227
227
  const idToBeDeleted = ids[0];
228
228
 
229
- await qdrant.deleteIndexById(testCollectionName, idToBeDeleted);
229
+ await qdrant.deleteVector(testCollectionName, idToBeDeleted);
230
230
 
231
231
  const results: QueryResult[] = await qdrant.query({
232
232
  indexName: testCollectionName,
@@ -160,7 +160,42 @@ export class QdrantVector extends MastraVector {
160
160
  await this.client.deleteCollection(indexName);
161
161
  }
162
162
 
163
+ /**
164
+ * @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
165
+ *
166
+ * Updates a vector by its ID with the provided vector and/or metadata.
167
+ * @param indexName - The name of the index containing the vector.
168
+ * @param id - The ID of the vector to update.
169
+ * @param update - An object containing the vector and/or metadata to update.
170
+ * @param update.vector - An optional array of numbers representing the new vector.
171
+ * @param update.metadata - An optional record containing the new metadata.
172
+ * @returns A promise that resolves when the update is complete.
173
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
174
+ */
163
175
  async updateIndexById(
176
+ indexName: string,
177
+ id: string,
178
+ update: { vector?: number[]; metadata?: Record<string, any> },
179
+ ): Promise<void> {
180
+ this.logger.warn(
181
+ `Deprecation Warning: updateIndexById() is deprecated.
182
+ Please use updateVector() instead.
183
+ updateIndexById() will be removed on May 20th, 2025.`,
184
+ );
185
+ await this.updateVector(indexName, id, update);
186
+ }
187
+
188
+ /**
189
+ * Updates a vector by its ID with the provided vector and/or metadata.
190
+ * @param indexName - The name of the index containing the vector.
191
+ * @param id - The ID of the vector to update.
192
+ * @param update - An object containing the vector and/or metadata to update.
193
+ * @param update.vector - An optional array of numbers representing the new vector.
194
+ * @param update.metadata - An optional record containing the new metadata.
195
+ * @returns A promise that resolves when the update is complete.
196
+ * @throws Will throw an error if no updates are provided or if the update operation fails.
197
+ */
198
+ async updateVector(
164
199
  indexName: string,
165
200
  id: string,
166
201
  update: {
@@ -209,19 +244,48 @@ export class QdrantVector extends MastraVector {
209
244
  return;
210
245
  }
211
246
  } catch (error) {
212
- console.error('Error updating point in Qdrant:', error);
247
+ console.error(`Failed to update vector by id: ${id} for index name: ${indexName}:`, error);
213
248
  throw error;
214
249
  }
215
250
  }
216
251
 
252
+ /**
253
+ * @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
254
+ *
255
+ * Deletes a vector by its ID.
256
+ * @param indexName - The name of the index containing the vector.
257
+ * @param id - The ID of the vector to delete.
258
+ * @returns A promise that resolves when the deletion is complete.
259
+ * @throws Will throw an error if the deletion operation fails.
260
+ */
217
261
  async deleteIndexById(indexName: string, id: string): Promise<void> {
218
- // Parse the ID - Qdrant supports both string and numeric IDs
219
- const pointId = this.parsePointId(id);
262
+ this.logger.warn(
263
+ `Deprecation Warning: deleteIndexById() is deprecated.
264
+ Please use deleteVector() instead.
265
+ deleteIndexById() will be removed on May 20th, 2025.`,
266
+ );
267
+ await this.deleteVector(indexName, id);
268
+ }
220
269
 
221
- // Use the Qdrant client to delete the point from the collection
222
- await this.client.delete(indexName, {
223
- points: [pointId],
224
- });
270
+ /**
271
+ * Deletes a vector by its ID.
272
+ * @param indexName - The name of the index containing the vector.
273
+ * @param id - The ID of the vector to delete.
274
+ * @returns A promise that resolves when the deletion is complete.
275
+ * @throws Will throw an error if the deletion operation fails.
276
+ */
277
+ async deleteVector(indexName: string, id: string): Promise<void> {
278
+ try {
279
+ // Parse the ID - Qdrant supports both string and numeric IDs
280
+ const pointId = this.parsePointId(id);
281
+
282
+ // Use the Qdrant client to delete the point from the collection
283
+ await this.client.delete(indexName, {
284
+ points: [pointId],
285
+ });
286
+ } catch (error: any) {
287
+ throw new Error(`Failed to delete vector by id: ${id} for index name: ${indexName}: ${error.message}`);
288
+ }
225
289
  }
226
290
 
227
291
  /**