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