@mastra/turbopuffer 1.2.1 → 1.2.2-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.
@@ -3,7 +3,7 @@ name: mastra-turbopuffer
3
3
  description: Documentation for @mastra/turbopuffer. Use when working with @mastra/turbopuffer APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/turbopuffer"
6
- version: "1.2.1"
6
+ version: "1.2.2-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.1",
2
+ "version": "1.2.2-alpha.0",
3
3
  "package": "@mastra/turbopuffer",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -28,11 +28,13 @@ The TurbopufferVector class provides vector search using [Turbopuffer](https://t
28
28
 
29
29
  ### `createIndex()`
30
30
 
31
+ Turbopuffer has no explicit create-index operation. `createIndex()` validates the arguments and records the dimension and metric locally; the namespace is created in Turbopuffer on the first `upsert()`.
32
+
31
33
  **indexName** (`string`): Name of the index to create
32
34
 
33
35
  **dimension** (`number`): Vector dimension (must match your embedding model)
34
36
 
35
- **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
37
+ **metric** (`'cosine' | 'euclidean'`): Distance metric for similarity search. 'dotproduct' isn't supported and throws an error. (Default: `cosine`)
36
38
 
37
39
  ### `upsert()`
38
40
 
@@ -80,7 +82,7 @@ interface IndexStats {
80
82
 
81
83
  ### `updateVector()`
82
84
 
83
- Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
85
+ Update a single vector by ID, or every vector that matches a metadata filter. Either `id` or `filter` must be provided, but not both.
84
86
 
85
87
  **indexName** (`string`): Name of the index containing the vector
86
88
 
@@ -114,7 +116,7 @@ Query results are returned in this format:
114
116
  interface QueryResult {
115
117
  id: string
116
118
  score: number
117
- metadata: Record<string, any>
119
+ metadata?: Record<string, any>
118
120
  vector?: number[] // Only included if includeVector is true
119
121
  }
120
122
  ```
@@ -144,17 +146,21 @@ schemaConfigForIndex: (indexName: string) => {
144
146
 
145
147
  ## Error handling
146
148
 
147
- The store throws typed errors that can be caught:
149
+ The store throws `MastraError` instances from `@mastra/core/error`:
148
150
 
149
151
  ```typescript
152
+ import { MastraError } from '@mastra/core/error'
153
+
150
154
  try {
151
155
  await store.query({
152
156
  indexName: 'index_name',
153
157
  queryVector: queryVector,
154
158
  })
155
159
  } catch (error) {
156
- if (error instanceof VectorStoreError) {
157
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
160
+ if (error instanceof MastraError) {
161
+ console.log(error.id) // 'MASTRA_VECTOR_TURBOPUFFER_QUERY_FAILED'
162
+ console.log(error.domain) // 'STORAGE'
163
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
158
164
  console.log(error.details) // Additional error context
159
165
  }
160
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/turbopuffer",
3
- "version": "1.2.1",
3
+ "version": "1.2.2-alpha.0",
4
4
  "description": "Turbopuffer vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,18 +27,18 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "22.20.1",
30
- "@vitest/coverage-v8": "4.1.10",
31
- "@vitest/ui": "4.1.10",
30
+ "@vitest/coverage-v8": "4.1.11",
31
+ "@vitest/ui": "4.1.11",
32
32
  "dotenv": "^17.4.2",
33
33
  "eslint": "^10.7.0",
34
34
  "tsdown": "0.22.9",
35
35
  "tsx": "^4.23.1",
36
36
  "typescript": "^7.0.2",
37
- "vitest": "4.1.10",
38
- "@internal/lint": "0.0.130",
39
- "@mastra/core": "1.64.0",
40
- "@internal/types-builder": "0.0.105",
41
- "@internal/storage-test-utils": "0.0.126"
37
+ "vitest": "4.1.11",
38
+ "@internal/storage-test-utils": "0.0.140",
39
+ "@internal/lint": "0.0.144",
40
+ "@internal/types-builder": "0.0.119",
41
+ "@mastra/core": "1.78.1-alpha.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@mastra/core": ">=1.0.0-0 <2.0.0-0"