@mastra/turbopuffer 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-extension-schema-20250922130418

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/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@mastra/turbopuffer",
3
- "version": "0.0.0-vector-sources-20250516175436",
3
+ "version": "0.0.0-vector-extension-schema-20250922130418",
4
4
  "description": "Turbopuffer vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "files": [
7
- "dist"
7
+ "dist",
8
+ "CHANGELOG.md"
8
9
  ],
9
10
  "main": "dist/index.js",
10
11
  "types": "dist/index.d.ts",
@@ -15,30 +16,43 @@
15
16
  "default": "./dist/index.js"
16
17
  },
17
18
  "require": {
18
- "types": "./dist/index.d.cts",
19
+ "types": "./dist/index.d.ts",
19
20
  "default": "./dist/index.cjs"
20
21
  }
21
22
  },
22
23
  "./package.json": "./package.json"
23
24
  },
24
- "license": "MIT",
25
+ "license": "Apache-2.0",
25
26
  "dependencies": {
26
- "@turbopuffer/turbopuffer": "^0.6.4",
27
- "@mastra/core": "0.0.0-vector-sources-20250516175436"
27
+ "@turbopuffer/turbopuffer": "^0.6.17"
28
28
  },
29
29
  "devDependencies": {
30
- "@microsoft/api-extractor": "^7.52.5",
31
- "@types/node": "^20.17.27",
32
- "dotenv": "^16.4.7",
33
- "eslint": "^9.23.0",
34
- "tsup": "^8.4.0",
35
- "typescript": "^5.8.2",
36
- "vitest": "^3.1.2",
37
- "@internal/lint": "0.0.0-vector-sources-20250516175436"
30
+ "@microsoft/api-extractor": "^7.52.8",
31
+ "@types/node": "^20.19.0",
32
+ "dotenv": "^17.0.0",
33
+ "eslint": "^9.35.0",
34
+ "tsup": "^8.5.0",
35
+ "typescript": "^5.8.3",
36
+ "vitest": "^3.2.4",
37
+ "@internal/lint": "0.0.0-vector-extension-schema-20250922130418",
38
+ "@mastra/core": "0.0.0-vector-extension-schema-20250922130418",
39
+ "@internal/types-builder": "0.0.0-vector-extension-schema-20250922130418"
40
+ },
41
+ "peerDependencies": {
42
+ "@mastra/core": "0.0.0-vector-extension-schema-20250922130418"
43
+ },
44
+ "homepage": "https://mastra.ai",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/mastra-ai/mastra.git",
48
+ "directory": "stores/turbopuffer"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/mastra-ai/mastra/issues"
38
52
  },
39
53
  "scripts": {
40
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
41
- "build:watch": "pnpm build --watch",
54
+ "build": "tsup --silent --config tsup.config.ts",
55
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
42
56
  "test": "vitest run",
43
57
  "lint": "eslint ."
44
58
  }
@@ -1,147 +0,0 @@
1
- import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
- import type { CreateIndexParams } from '@mastra/core/vector';
3
- import type { DeleteIndexParams } from '@mastra/core/vector';
4
- import type { DeleteVectorParams } from '@mastra/core/vector';
5
- import type { DescribeIndexParams } from '@mastra/core/vector';
6
- import type { Filters } from '@turbopuffer/turbopuffer';
7
- import type { IndexStats } from '@mastra/core/vector';
8
- import { MastraVector } from '@mastra/core/vector';
9
- import type { OperatorSupport } from '@mastra/core/vector/filter';
10
- import type { ParamsToArgs } from '@mastra/core/vector';
11
- import type { QueryResult } from '@mastra/core/vector';
12
- import type { QueryVectorParams } from '@mastra/core/vector';
13
- import type { Schema } from '@turbopuffer/turbopuffer';
14
- import type { UpdateVectorParams } from '@mastra/core/vector';
15
- import type { UpsertVectorParams } from '@mastra/core/vector';
16
- import type { VectorFilter } from '@mastra/core/vector/filter';
17
-
18
- /**
19
- * Translator for converting Mastra filters to Turbopuffer format
20
- *
21
- * Mastra filters: { field: { $gt: 10 } }
22
- * Turbopuffer filters: ["And", [["field", "Gt", 10]]]
23
- */
24
- export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
25
- protected getSupportedOperators(): OperatorSupport;
26
- /**
27
- * Map Mastra operators to Turbopuffer operators
28
- */
29
- private operatorMap;
30
- /**
31
- * Convert the Mastra filter to Turbopuffer format
32
- */
33
- translate(filter?: VectorFilter): Filters | undefined;
34
- /**
35
- * Recursively translate a filter node
36
- */
37
- private translateNode;
38
- /**
39
- * Translate a field condition
40
- */
41
- private translateFieldCondition;
42
- /**
43
- * Translate a logical operator
44
- */
45
- private translateLogical;
46
- /**
47
- * Translate a specific operator
48
- */
49
- private translateOperator;
50
- /**
51
- * Normalize a value for comparison operations
52
- */
53
- protected normalizeValue(value: any): any;
54
- /**
55
- * Normalize array values
56
- */
57
- protected normalizeArrayValues(values: any[]): any[];
58
- }
59
-
60
- declare class TurbopufferVector extends MastraVector {
61
- private client;
62
- private filterTranslator;
63
- private createIndexCache;
64
- private opts;
65
- constructor(opts: TurbopufferVectorOptions);
66
- createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
67
- upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
68
- query({ indexName, queryVector, topK, filter, includeVector }: QueryVectorParams): Promise<QueryResult[]>;
69
- listIndexes(): Promise<string[]>;
70
- /**
71
- * Retrieves statistics about a vector index.
72
- *
73
- * @param params - The parameters for describing an index
74
- * @param params.indexName - The name of the index to describe
75
- * @returns A promise that resolves to the index statistics including dimension, count and metric
76
- */
77
- describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
78
- deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
79
- /**
80
- * Updates a vector by its ID with the provided vector and/or metadata.
81
- * @param indexName - The name of the index containing the vector.
82
- * @param id - The ID of the vector to update.
83
- * @param update - An object containing the vector and/or metadata to update.
84
- * @param update.vector - An optional array of numbers representing the new vector.
85
- * @param update.metadata - An optional record containing the new metadata.
86
- * @returns A promise that resolves when the update is complete.
87
- * @throws Will throw an error if no updates are provided or if the update operation fails.
88
- */
89
- updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
90
- /**
91
- * Deletes a vector by its ID.
92
- * @param indexName - The name of the index containing the vector.
93
- * @param id - The ID of the vector to delete.
94
- * @returns A promise that resolves when the deletion is complete.
95
- * @throws Will throw an error if the deletion operation fails.
96
- */
97
- deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
98
- }
99
- export { TurbopufferVector }
100
- export { TurbopufferVector as TurbopufferVector_alias_1 }
101
-
102
- declare interface TurbopufferVectorOptions {
103
- /** The API key to authenticate with. */
104
- apiKey: string;
105
- /** The base URL. Default is https://api.turbopuffer.com. */
106
- baseUrl?: string;
107
- /** The timeout to establish a connection, in ms. Default is 10_000. Only applicable in Node and Deno.*/
108
- connectTimeout?: number;
109
- /** The socket idle timeout, in ms. Default is 60_000. Only applicable in Node and Deno.*/
110
- connectionIdleTimeout?: number;
111
- /** The number of connections to open initially when creating a new client. Default is 0. */
112
- warmConnections?: number;
113
- /** Whether to compress requests and accept compressed responses. Default is true. */
114
- compression?: boolean;
115
- /**
116
- * A callback function that takes an index name and returns a config object for that index.
117
- * This allows you to define explicit schemas per index.
118
- *
119
- * Example:
120
- * ```typescript
121
- * schemaConfigForIndex: (indexName: string) => {
122
- * // Mastra's default embedding model and index for memory messages:
123
- * if (indexName === "memory_messages_384") {
124
- * return {
125
- * dimensions: 384,
126
- * schema: {
127
- * thread_id: {
128
- * type: "string",
129
- * filterable: true,
130
- * },
131
- * },
132
- * };
133
- * } else {
134
- * throw new Error(`TODO: add schema for index: ${indexName}`);
135
- * }
136
- * },
137
- * ```
138
- */
139
- schemaConfigForIndex?: (indexName: string) => {
140
- dimensions: number;
141
- schema: Schema;
142
- };
143
- }
144
- export { TurbopufferVectorOptions }
145
- export { TurbopufferVectorOptions as TurbopufferVectorOptions_alias_1 }
146
-
147
- export { }
package/dist/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export { TurbopufferVectorOptions } from './_tsup-dts-rollup.cjs';
2
- export { TurbopufferVector } from './_tsup-dts-rollup.cjs';