@mastra/qdrant 0.10.3 → 0.11.0-alpha.1

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.10.3-alpha.0 build /home/runner/work/mastra/mastra/stores/qdrant
2
+ > @mastra/qdrant@0.11.0-alpha.1 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.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 7578ms
9
+ TSC ⚡️ Build success in 7990ms
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 10357ms
16
+ DTS ⚡️ Build success in 9199ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 18.24 KB
21
- ESM ⚡️ Build success in 687ms
22
- CJS dist/index.cjs 18.30 KB
23
- CJS ⚡️ Build success in 691ms
20
+ CJS dist/index.cjs 21.23 KB
21
+ CJS ⚡️ Build success in 978ms
22
+ ESM dist/index.js 21.00 KB
23
+ ESM ⚡️ Build success in 980ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @mastra/qdrant
2
2
 
3
+ ## 0.11.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 8a3bfd2: Update peerdeps to latest core
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [792c4c0]
12
+ - Updated dependencies [502fe05]
13
+ - Updated dependencies [4efcfa0]
14
+ - @mastra/core@0.10.7-alpha.3
15
+
16
+ ## 0.10.4-alpha.0
17
+
18
+ ### Patch Changes
19
+
20
+ - 0e17048: Throw mastra errors in storage packages
21
+ - Updated dependencies [d1baedb]
22
+ - Updated dependencies [4d21bf2]
23
+ - Updated dependencies [2097952]
24
+ - Updated dependencies [4fb0cc2]
25
+ - Updated dependencies [d2a7a31]
26
+ - Updated dependencies [0e17048]
27
+ - @mastra/core@0.10.7-alpha.1
28
+
3
29
  ## 0.10.3
4
30
 
5
31
  ### Patch Changes
@@ -1,12 +1,15 @@
1
1
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { BlacklistedRootOperators } from '@mastra/core/vector/filter';
2
3
  import type { CreateIndexParams } from '@mastra/core/vector';
3
4
  import type { DeleteIndexParams } from '@mastra/core/vector';
4
5
  import type { DeleteVectorParams } from '@mastra/core/vector';
5
6
  import type { DescribeIndexParams } from '@mastra/core/vector';
6
7
  import type { IndexStats } from '@mastra/core/vector';
7
8
  import type { LogicalOperator } from '@mastra/core/vector/filter';
9
+ import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
8
10
  import { MastraVector } from '@mastra/core/vector';
9
11
  import type { OperatorSupport } from '@mastra/core/vector/filter';
12
+ import type { OperatorValueMap } from '@mastra/core/vector/filter';
10
13
  import type { QueryResult } from '@mastra/core/vector';
11
14
  import type { QueryVectorParams } from '@mastra/core/vector';
12
15
  import type { UpdateVectorParams } from '@mastra/core/vector';
@@ -21,6 +24,8 @@ declare const QDRANT_PROMPT = "When querying Qdrant, you can ONLY use the operat
21
24
  export { QDRANT_PROMPT }
22
25
  export { QDRANT_PROMPT as QDRANT_PROMPT_alias_1 }
23
26
 
27
+ declare type QdrantBlacklistedRootOperators = BlacklistedRootOperators | '$count' | '$geo' | '$nested' | '$datetime' | '$null' | '$empty';
28
+
24
29
  /**
25
30
  * Translates MongoDB-style filters to Qdrant compatible filters.
26
31
  *
@@ -40,10 +45,10 @@ export { QDRANT_PROMPT as QDRANT_PROMPT_alias_1 }
40
45
  * - $null -> is_null check
41
46
  * - $empty -> is_empty check
42
47
  */
43
- export declare class QdrantFilterTranslator extends BaseFilterTranslator {
48
+ export declare class QdrantFilterTranslator extends BaseFilterTranslator<QdrantVectorFilter> {
44
49
  protected isLogicalOperator(key: string): key is LogicalOperator;
45
50
  protected getSupportedOperators(): OperatorSupport;
46
- translate(filter?: VectorFilter): VectorFilter;
51
+ translate(filter?: QdrantVectorFilter): QdrantVectorFilter;
47
52
  private createCondition;
48
53
  private translateNode;
49
54
  private buildFinalConditions;
@@ -56,6 +61,75 @@ export declare class QdrantFilterTranslator extends BaseFilterTranslator {
56
61
  private normalizeDatetimeRange;
57
62
  }
58
63
 
64
+ declare type QdrantLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$nor'>;
65
+
66
+ declare type QdrantOperatorValueMap = Omit<OperatorValueMap, '$options' | '$elemMatch' | '$all'> & {
67
+ /**
68
+ * $count: Filter by array length or value count.
69
+ * Example: { tags: { $count: { gt: 2 } } }
70
+ */
71
+ $count: {
72
+ $gt?: number;
73
+ $gte?: number;
74
+ $lt?: number;
75
+ $lte?: number;
76
+ $eq?: number;
77
+ };
78
+ /**
79
+ * $geo: Geospatial filter.
80
+ * Example: { location: { $geo: { type: 'geo_radius', center: [lon, lat], radius: 1000 } } }
81
+ */
82
+ $geo: {
83
+ type: string;
84
+ [key: string]: any;
85
+ };
86
+ /**
87
+ * $hasId: Filter by point IDs.
88
+ * Allowed at root level.
89
+ * Example: { $hasId: '123' } or { $hasId: ['123', '456'] }
90
+ */
91
+ $hasId: string | string[];
92
+ /**
93
+ * $nested: Nested object filter.
94
+ * Example: { metadata: { $nested: { key: 'foo', filter: { $eq: 'bar' } } } }
95
+ */
96
+ $nested: {
97
+ [key: string]: any;
98
+ };
99
+ /**
100
+ * $hasVector: Filter by vector existence or field.
101
+ * Allowed at root level.
102
+ * Example: { $hasVector: true } or { $hasVector: 'vector_field' }
103
+ */
104
+ $hasVector: boolean | string;
105
+ /**
106
+ * $datetime: RFC 3339 datetime range.
107
+ * Example: { createdAt: { $datetime: { gte: '2024-01-01T00:00:00Z' } } }
108
+ */
109
+ $datetime: {
110
+ key?: string;
111
+ range?: {
112
+ gt?: Date | string;
113
+ gte?: Date | string;
114
+ lt?: Date | string;
115
+ lte?: Date | string;
116
+ eq?: Date | string;
117
+ };
118
+ };
119
+ /**
120
+ * $null: Check if a field is null.
121
+ * Example: { metadata: { $null: true } }
122
+ */
123
+ $null: boolean;
124
+ /**
125
+ * $empty: Check if an array or object field is empty.
126
+ * Example: { tags: { $empty: true } }
127
+ */
128
+ $empty: boolean;
129
+ };
130
+
131
+ declare type QdrantQueryVectorParams = QueryVectorParams<QdrantVectorFilter>;
132
+
59
133
  declare class QdrantVector extends MastraVector {
60
134
  private client;
61
135
  /**
@@ -71,8 +145,8 @@ declare class QdrantVector extends MastraVector {
71
145
  });
72
146
  upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
73
147
  createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
74
- transformFilter(filter?: VectorFilter): VectorFilter;
75
- query({ indexName, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
148
+ transformFilter(filter?: QdrantVectorFilter): QdrantVectorFilter;
149
+ query({ indexName, queryVector, topK, filter, includeVector, }: QdrantQueryVectorParams): Promise<QueryResult[]>;
76
150
  listIndexes(): Promise<string[]>;
77
151
  /**
78
152
  * Retrieves statistics about a vector index.
@@ -135,4 +209,6 @@ declare class QdrantVector extends MastraVector {
135
209
  export { QdrantVector }
136
210
  export { QdrantVector as QdrantVector_alias_1 }
137
211
 
212
+ export declare type QdrantVectorFilter = VectorFilter<keyof QdrantOperatorValueMap, QdrantOperatorValueMap, QdrantLogicalOperatorValueMap, QdrantBlacklistedRootOperators>;
213
+
138
214
  export { }
@@ -1,12 +1,15 @@
1
1
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { BlacklistedRootOperators } from '@mastra/core/vector/filter';
2
3
  import type { CreateIndexParams } from '@mastra/core/vector';
3
4
  import type { DeleteIndexParams } from '@mastra/core/vector';
4
5
  import type { DeleteVectorParams } from '@mastra/core/vector';
5
6
  import type { DescribeIndexParams } from '@mastra/core/vector';
6
7
  import type { IndexStats } from '@mastra/core/vector';
7
8
  import type { LogicalOperator } from '@mastra/core/vector/filter';
9
+ import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
8
10
  import { MastraVector } from '@mastra/core/vector';
9
11
  import type { OperatorSupport } from '@mastra/core/vector/filter';
12
+ import type { OperatorValueMap } from '@mastra/core/vector/filter';
10
13
  import type { QueryResult } from '@mastra/core/vector';
11
14
  import type { QueryVectorParams } from '@mastra/core/vector';
12
15
  import type { UpdateVectorParams } from '@mastra/core/vector';
@@ -21,6 +24,8 @@ declare const QDRANT_PROMPT = "When querying Qdrant, you can ONLY use the operat
21
24
  export { QDRANT_PROMPT }
22
25
  export { QDRANT_PROMPT as QDRANT_PROMPT_alias_1 }
23
26
 
27
+ declare type QdrantBlacklistedRootOperators = BlacklistedRootOperators | '$count' | '$geo' | '$nested' | '$datetime' | '$null' | '$empty';
28
+
24
29
  /**
25
30
  * Translates MongoDB-style filters to Qdrant compatible filters.
26
31
  *
@@ -40,10 +45,10 @@ export { QDRANT_PROMPT as QDRANT_PROMPT_alias_1 }
40
45
  * - $null -> is_null check
41
46
  * - $empty -> is_empty check
42
47
  */
43
- export declare class QdrantFilterTranslator extends BaseFilterTranslator {
48
+ export declare class QdrantFilterTranslator extends BaseFilterTranslator<QdrantVectorFilter> {
44
49
  protected isLogicalOperator(key: string): key is LogicalOperator;
45
50
  protected getSupportedOperators(): OperatorSupport;
46
- translate(filter?: VectorFilter): VectorFilter;
51
+ translate(filter?: QdrantVectorFilter): QdrantVectorFilter;
47
52
  private createCondition;
48
53
  private translateNode;
49
54
  private buildFinalConditions;
@@ -56,6 +61,75 @@ export declare class QdrantFilterTranslator extends BaseFilterTranslator {
56
61
  private normalizeDatetimeRange;
57
62
  }
58
63
 
64
+ declare type QdrantLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$nor'>;
65
+
66
+ declare type QdrantOperatorValueMap = Omit<OperatorValueMap, '$options' | '$elemMatch' | '$all'> & {
67
+ /**
68
+ * $count: Filter by array length or value count.
69
+ * Example: { tags: { $count: { gt: 2 } } }
70
+ */
71
+ $count: {
72
+ $gt?: number;
73
+ $gte?: number;
74
+ $lt?: number;
75
+ $lte?: number;
76
+ $eq?: number;
77
+ };
78
+ /**
79
+ * $geo: Geospatial filter.
80
+ * Example: { location: { $geo: { type: 'geo_radius', center: [lon, lat], radius: 1000 } } }
81
+ */
82
+ $geo: {
83
+ type: string;
84
+ [key: string]: any;
85
+ };
86
+ /**
87
+ * $hasId: Filter by point IDs.
88
+ * Allowed at root level.
89
+ * Example: { $hasId: '123' } or { $hasId: ['123', '456'] }
90
+ */
91
+ $hasId: string | string[];
92
+ /**
93
+ * $nested: Nested object filter.
94
+ * Example: { metadata: { $nested: { key: 'foo', filter: { $eq: 'bar' } } } }
95
+ */
96
+ $nested: {
97
+ [key: string]: any;
98
+ };
99
+ /**
100
+ * $hasVector: Filter by vector existence or field.
101
+ * Allowed at root level.
102
+ * Example: { $hasVector: true } or { $hasVector: 'vector_field' }
103
+ */
104
+ $hasVector: boolean | string;
105
+ /**
106
+ * $datetime: RFC 3339 datetime range.
107
+ * Example: { createdAt: { $datetime: { gte: '2024-01-01T00:00:00Z' } } }
108
+ */
109
+ $datetime: {
110
+ key?: string;
111
+ range?: {
112
+ gt?: Date | string;
113
+ gte?: Date | string;
114
+ lt?: Date | string;
115
+ lte?: Date | string;
116
+ eq?: Date | string;
117
+ };
118
+ };
119
+ /**
120
+ * $null: Check if a field is null.
121
+ * Example: { metadata: { $null: true } }
122
+ */
123
+ $null: boolean;
124
+ /**
125
+ * $empty: Check if an array or object field is empty.
126
+ * Example: { tags: { $empty: true } }
127
+ */
128
+ $empty: boolean;
129
+ };
130
+
131
+ declare type QdrantQueryVectorParams = QueryVectorParams<QdrantVectorFilter>;
132
+
59
133
  declare class QdrantVector extends MastraVector {
60
134
  private client;
61
135
  /**
@@ -71,8 +145,8 @@ declare class QdrantVector extends MastraVector {
71
145
  });
72
146
  upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
73
147
  createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
74
- transformFilter(filter?: VectorFilter): VectorFilter;
75
- query({ indexName, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
148
+ transformFilter(filter?: QdrantVectorFilter): QdrantVectorFilter;
149
+ query({ indexName, queryVector, topK, filter, includeVector, }: QdrantQueryVectorParams): Promise<QueryResult[]>;
76
150
  listIndexes(): Promise<string[]>;
77
151
  /**
78
152
  * Retrieves statistics about a vector index.
@@ -135,4 +209,6 @@ declare class QdrantVector extends MastraVector {
135
209
  export { QdrantVector }
136
210
  export { QdrantVector as QdrantVector_alias_1 }
137
211
 
212
+ export declare type QdrantVectorFilter = VectorFilter<keyof QdrantOperatorValueMap, QdrantOperatorValueMap, QdrantLogicalOperatorValueMap, QdrantBlacklistedRootOperators>;
213
+
138
214
  export { }
package/dist/index.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var error = require('@mastra/core/error');
3
4
  var vector = require('@mastra/core/vector');
4
5
  var jsClientRest = require('@qdrant/js-client-rest');
5
6
  var filter = require('@mastra/core/vector/filter');
@@ -28,7 +29,7 @@ var QdrantFilterTranslator = class extends filter.BaseFilterTranslator {
28
29
  return fieldKey ? { key: fieldKey, ...condition } : condition;
29
30
  }
30
31
  translateNode(node, isNested = false, fieldKey) {
31
- if (!this.isEmpty(node) && typeof node === "object" && "must" in node) {
32
+ if (!this.isEmpty(node) && !!node && typeof node === "object" && "must" in node) {
32
33
  return node;
33
34
  }
34
35
  if (this.isPrimitive(node)) {
@@ -267,22 +268,46 @@ var QdrantVector = class extends vector.MastraVector {
267
268
  vector,
268
269
  payload: metadata?.[i] || {}
269
270
  }));
270
- for (let i = 0; i < records.length; i += BATCH_SIZE) {
271
- const batch = records.slice(i, i + BATCH_SIZE);
272
- await this.client.upsert(indexName, {
273
- // @ts-expect-error
274
- points: batch,
275
- wait: true
276
- });
271
+ try {
272
+ for (let i = 0; i < records.length; i += BATCH_SIZE) {
273
+ const batch = records.slice(i, i + BATCH_SIZE);
274
+ await this.client.upsert(indexName, {
275
+ // @ts-expect-error
276
+ points: batch,
277
+ wait: true
278
+ });
279
+ }
280
+ return pointIds;
281
+ } catch (error$1) {
282
+ throw new error.MastraError(
283
+ {
284
+ id: "STORAGE_QDRANT_VECTOR_UPSERT_FAILED",
285
+ domain: error.ErrorDomain.STORAGE,
286
+ category: error.ErrorCategory.THIRD_PARTY,
287
+ details: { indexName, vectorCount: vectors.length }
288
+ },
289
+ error$1
290
+ );
277
291
  }
278
- return pointIds;
279
292
  }
280
293
  async createIndex({ indexName, dimension, metric = "cosine" }) {
281
- if (!Number.isInteger(dimension) || dimension <= 0) {
282
- throw new Error("Dimension must be a positive integer");
283
- }
284
- if (!DISTANCE_MAPPING[metric]) {
285
- throw new Error(`Invalid metric: "${metric}". Must be one of: cosine, euclidean, dotproduct`);
294
+ try {
295
+ if (!Number.isInteger(dimension) || dimension <= 0) {
296
+ throw new Error("Dimension must be a positive integer");
297
+ }
298
+ if (!DISTANCE_MAPPING[metric]) {
299
+ throw new Error(`Invalid metric: "${metric}". Must be one of: cosine, euclidean, dotproduct`);
300
+ }
301
+ } catch (validationError) {
302
+ throw new error.MastraError(
303
+ {
304
+ id: "STORAGE_QDRANT_VECTOR_CREATE_INDEX_INVALID_ARGS",
305
+ domain: error.ErrorDomain.STORAGE,
306
+ category: error.ErrorCategory.USER,
307
+ details: { indexName, dimension, metric }
308
+ },
309
+ validationError
310
+ );
286
311
  }
287
312
  try {
288
313
  await this.client.createCollection(indexName, {
@@ -291,12 +316,21 @@ var QdrantVector = class extends vector.MastraVector {
291
316
  distance: DISTANCE_MAPPING[metric]
292
317
  }
293
318
  });
294
- } catch (error) {
295
- const message = error?.message || error?.toString();
296
- if (error?.status === 409 || typeof message === "string" && message.toLowerCase().includes("exists")) {
319
+ } catch (error$1) {
320
+ const message = error$1?.message || error$1?.toString();
321
+ if (error$1?.status === 409 || typeof message === "string" && message.toLowerCase().includes("exists")) {
297
322
  await this.validateExistingIndex(indexName, dimension, metric);
298
323
  return;
299
324
  }
325
+ throw new error.MastraError(
326
+ {
327
+ id: "STORAGE_QDRANT_VECTOR_CREATE_INDEX_FAILED",
328
+ domain: error.ErrorDomain.STORAGE,
329
+ category: error.ErrorCategory.THIRD_PARTY,
330
+ details: { indexName, dimension, metric }
331
+ },
332
+ error$1
333
+ );
300
334
  }
301
335
  }
302
336
  transformFilter(filter) {
@@ -311,33 +345,56 @@ var QdrantVector = class extends vector.MastraVector {
311
345
  includeVector = false
312
346
  }) {
313
347
  const translatedFilter = this.transformFilter(filter) ?? {};
314
- const results = (await this.client.query(indexName, {
315
- query: queryVector,
316
- limit: topK,
317
- filter: translatedFilter,
318
- with_payload: true,
319
- with_vector: includeVector
320
- })).points;
321
- return results.map((match) => {
322
- let vector = [];
323
- if (includeVector) {
324
- if (Array.isArray(match.vector)) {
325
- vector = match.vector;
326
- } else if (typeof match.vector === "object" && match.vector !== null) {
327
- vector = Object.values(match.vector).filter((v) => typeof v === "number");
348
+ try {
349
+ const results = (await this.client.query(indexName, {
350
+ query: queryVector,
351
+ limit: topK,
352
+ filter: translatedFilter,
353
+ with_payload: true,
354
+ with_vector: includeVector
355
+ })).points;
356
+ return results.map((match) => {
357
+ let vector = [];
358
+ if (includeVector) {
359
+ if (Array.isArray(match.vector)) {
360
+ vector = match.vector;
361
+ } else if (typeof match.vector === "object" && match.vector !== null) {
362
+ vector = Object.values(match.vector).filter((v) => typeof v === "number");
363
+ }
328
364
  }
329
- }
330
- return {
331
- id: match.id,
332
- score: match.score || 0,
333
- metadata: match.payload,
334
- ...includeVector && { vector }
335
- };
336
- });
365
+ return {
366
+ id: match.id,
367
+ score: match.score || 0,
368
+ metadata: match.payload,
369
+ ...includeVector && { vector }
370
+ };
371
+ });
372
+ } catch (error$1) {
373
+ throw new error.MastraError(
374
+ {
375
+ id: "STORAGE_QDRANT_VECTOR_QUERY_FAILED",
376
+ domain: error.ErrorDomain.STORAGE,
377
+ category: error.ErrorCategory.THIRD_PARTY,
378
+ details: { indexName, topK }
379
+ },
380
+ error$1
381
+ );
382
+ }
337
383
  }
338
384
  async listIndexes() {
339
- const response = await this.client.getCollections();
340
- return response.collections.map((collection) => collection.name) || [];
385
+ try {
386
+ const response = await this.client.getCollections();
387
+ return response.collections.map((collection) => collection.name) || [];
388
+ } catch (error$1) {
389
+ throw new error.MastraError(
390
+ {
391
+ id: "STORAGE_QDRANT_VECTOR_LIST_INDEXES_FAILED",
392
+ domain: error.ErrorDomain.STORAGE,
393
+ category: error.ErrorCategory.THIRD_PARTY
394
+ },
395
+ error$1
396
+ );
397
+ }
341
398
  }
342
399
  /**
343
400
  * Retrieves statistics about a vector index.
@@ -346,17 +403,41 @@ var QdrantVector = class extends vector.MastraVector {
346
403
  * @returns A promise that resolves to the index statistics including dimension, count and metric
347
404
  */
348
405
  async describeIndex({ indexName }) {
349
- const { config, points_count } = await this.client.getCollection(indexName);
350
- const distance = config.params.vectors?.distance;
351
- return {
352
- dimension: config.params.vectors?.size,
353
- count: points_count || 0,
354
- // @ts-expect-error
355
- metric: Object.keys(DISTANCE_MAPPING).find((key) => DISTANCE_MAPPING[key] === distance)
356
- };
406
+ try {
407
+ const { config, points_count } = await this.client.getCollection(indexName);
408
+ const distance = config.params.vectors?.distance;
409
+ return {
410
+ dimension: config.params.vectors?.size,
411
+ count: points_count || 0,
412
+ // @ts-expect-error
413
+ metric: Object.keys(DISTANCE_MAPPING).find((key) => DISTANCE_MAPPING[key] === distance)
414
+ };
415
+ } catch (error$1) {
416
+ throw new error.MastraError(
417
+ {
418
+ id: "STORAGE_QDRANT_VECTOR_DESCRIBE_INDEX_FAILED",
419
+ domain: error.ErrorDomain.STORAGE,
420
+ category: error.ErrorCategory.THIRD_PARTY,
421
+ details: { indexName }
422
+ },
423
+ error$1
424
+ );
425
+ }
357
426
  }
358
427
  async deleteIndex({ indexName }) {
359
- await this.client.deleteCollection(indexName);
428
+ try {
429
+ await this.client.deleteCollection(indexName);
430
+ } catch (error$1) {
431
+ throw new error.MastraError(
432
+ {
433
+ id: "STORAGE_QDRANT_VECTOR_DELETE_INDEX_FAILED",
434
+ domain: error.ErrorDomain.STORAGE,
435
+ category: error.ErrorCategory.THIRD_PARTY,
436
+ details: { indexName }
437
+ },
438
+ error$1
439
+ );
440
+ }
360
441
  }
361
442
  /**
362
443
  * Updates a vector by its ID with the provided vector and/or metadata.
@@ -369,8 +450,20 @@ var QdrantVector = class extends vector.MastraVector {
369
450
  * @throws Will throw an error if no updates are provided or if the update operation fails.
370
451
  */
371
452
  async updateVector({ indexName, id, update }) {
372
- if (!update.vector && !update.metadata) {
373
- throw new Error("No updates provided");
453
+ try {
454
+ if (!update.vector && !update.metadata) {
455
+ throw new Error("No updates provided");
456
+ }
457
+ } catch (validationError) {
458
+ throw new error.MastraError(
459
+ {
460
+ id: "STORAGE_QDRANT_VECTOR_UPDATE_VECTOR_INVALID_ARGS",
461
+ domain: error.ErrorDomain.STORAGE,
462
+ category: error.ErrorCategory.USER,
463
+ details: { indexName, id }
464
+ },
465
+ validationError
466
+ );
374
467
  }
375
468
  const pointId = this.parsePointId(id);
376
469
  try {
@@ -400,9 +493,16 @@ var QdrantVector = class extends vector.MastraVector {
400
493
  });
401
494
  return;
402
495
  }
403
- } catch (error) {
404
- console.error(`Failed to update vector by id: ${id} for index name: ${indexName}:`, error);
405
- throw error;
496
+ } catch (error$1) {
497
+ throw new error.MastraError(
498
+ {
499
+ id: "STORAGE_QDRANT_VECTOR_UPDATE_VECTOR_FAILED",
500
+ domain: error.ErrorDomain.STORAGE,
501
+ category: error.ErrorCategory.THIRD_PARTY,
502
+ details: { indexName, id }
503
+ },
504
+ error$1
505
+ );
406
506
  }
407
507
  }
408
508
  /**
@@ -418,8 +518,16 @@ var QdrantVector = class extends vector.MastraVector {
418
518
  await this.client.delete(indexName, {
419
519
  points: [pointId]
420
520
  });
421
- } catch (error) {
422
- throw new Error(`Failed to delete vector by id: ${id} for index name: ${indexName}: ${error.message}`);
521
+ } catch (error$1) {
522
+ throw new error.MastraError(
523
+ {
524
+ id: "STORAGE_QDRANT_VECTOR_DELETE_VECTOR_FAILED",
525
+ domain: error.ErrorDomain.STORAGE,
526
+ category: error.ErrorCategory.THIRD_PARTY,
527
+ details: { indexName, id }
528
+ },
529
+ error$1
530
+ );
423
531
  }
424
532
  }
425
533
  /**