@mastra/upstash 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.
- package/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +24 -0
- package/README.md +4 -0
- package/dist/_tsup-dts-rollup.d.cts +44 -9
- package/dist/_tsup-dts-rollup.d.ts +44 -9
- package/dist/index.cjs +1130 -482
- package/dist/index.js +1131 -483
- package/package.json +7 -7
- package/src/storage/index.ts +14 -0
- package/src/storage/upstash.test.ts +25 -1
- package/src/vector/index.ts +54 -19
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/upstash@0.
|
|
2
|
+
> @mastra/upstash@0.11.0-alpha.1 build /home/runner/work/mastra/mastra/stores/upstash
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 10304ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/upstash/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/upstash/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 12195ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
dist/index.cjs (
|
|
21
|
-
dist/index.js (
|
|
20
|
+
dist/index.cjs (1729:18): Use of eval in "dist/index.cjs" is strongly discouraged as it poses security risks and may cause issues with minification.
|
|
21
|
+
dist/index.js (1729:18): Use of eval in "dist/index.js" is strongly discouraged as it poses security risks and may cause issues with minification.
|
|
22
22
|
[32mCJS[39m [1mdist/getMachineId-darwin-3PL23DL6.cjs [22m[32m1.19 KB[39m
|
|
23
23
|
[32mCJS[39m [1mdist/getMachineId-linux-KYLPK3HC.cjs [22m[32m813.00 B[39m
|
|
24
|
+
[32mCJS[39m [1mdist/getMachineId-bsd-HDZ73WR7.cjs [22m[32m1015.00 B[39m
|
|
24
25
|
[32mCJS[39m [1mdist/getMachineId-win-ZTI2LRDJ.cjs [22m[32m1.66 KB[39m
|
|
25
26
|
[32mCJS[39m [1mdist/chunk-N2CPQVE3.cjs [22m[32m1.09 KB[39m
|
|
26
27
|
[32mCJS[39m [1mdist/getMachineId-unsupported-DEDJN4ZS.cjs [22m[32m777.00 B[39m
|
|
27
|
-
[32mCJS[39m [1mdist/getMachineId-bsd-HDZ73WR7.cjs [22m[32m1015.00 B[39m
|
|
28
28
|
[32mCJS[39m [1mdist/chunk-U74OJRHU.cjs [22m[32m62.08 KB[39m
|
|
29
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m1.
|
|
30
|
-
[32mCJS[39m ⚡️ Build success in
|
|
31
|
-
[32mESM[39m [1mdist/getMachineId-darwin-UTKBTJ2U.js [22m[32m1.08 KB[39m
|
|
29
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m1.67 MB[39m
|
|
30
|
+
[32mCJS[39m ⚡️ Build success in 22539ms
|
|
32
31
|
[32mESM[39m [1mdist/getMachineId-linux-K3QXQYAB.js [22m[32m740.00 B[39m
|
|
32
|
+
[32mESM[39m [1mdist/getMachineId-darwin-UTKBTJ2U.js [22m[32m1.08 KB[39m
|
|
33
|
+
[32mESM[39m [1mdist/getMachineId-win-L2EYIM5A.js [22m[32m1.04 KB[39m
|
|
33
34
|
[32mESM[39m [1mdist/getMachineId-bsd-KKIDU47O.js [22m[32m896.00 B[39m
|
|
34
35
|
[32mESM[39m [1mdist/chunk-IGKEDEDE.js [22m[32m452.00 B[39m
|
|
35
|
-
[32mESM[39m [1mdist/getMachineId-win-L2EYIM5A.js [22m[32m1.04 KB[39m
|
|
36
36
|
[32mESM[39m [1mdist/chunk-HSTZWXH7.js [22m[32m61.52 KB[39m
|
|
37
37
|
[32mESM[39m [1mdist/getMachineId-unsupported-VPWBQCK7.js [22m[32m700.00 B[39m
|
|
38
|
-
[32mESM[39m [1mdist/index.js [22m[32m1.
|
|
39
|
-
[32mESM[39m ⚡️ Build success in
|
|
38
|
+
[32mESM[39m [1mdist/index.js [22m[32m1.67 MB[39m
|
|
39
|
+
[32mESM[39m ⚡️ Build success in 22541ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 0.11.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2fda031: Clarify upstash argument concepts.
|
|
8
|
+
- Updated dependencies [ee9af57]
|
|
9
|
+
- Updated dependencies [751c894]
|
|
10
|
+
- Updated dependencies [577ce3a]
|
|
11
|
+
- Updated dependencies [9260b3a]
|
|
12
|
+
- @mastra/core@0.10.6-alpha.1
|
|
13
|
+
|
|
14
|
+
## 0.11.0-alpha.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 704d1ca: Thread Timestamp Auto-Update Enhancement
|
|
19
|
+
Added automatic thread updatedAt timestamp updates when messages are saved across all storage providers
|
|
20
|
+
Enhanced user experience: Threads now accurately reflect their latest activity with automatic timestamp updates when new messages are added
|
|
21
|
+
Universal implementation: Consistent behavior across all 7 storage backends (ClickHouse, Cloudflare D1, DynamoDB, MongoDB, PostgreSQL, Upstash, LibSQL)
|
|
22
|
+
Performance optimized: Updates execute in parallel with message saving operations for minimal performance impact
|
|
23
|
+
Backwards compatible: No breaking changes - existing code continues to work unchanged
|
|
24
|
+
Improved conversation ordering: Chat interfaces can now properly sort threads by actual last activity
|
|
25
|
+
This enhancement resolves the issue where active conversations appeared stale due to outdated thread timestamps, providing better conversation management and user experience in chat applications.
|
|
26
|
+
|
|
3
27
|
## 0.10.3
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ npm install @mastra/upstash
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { UpstashVector } from '@mastra/upstash';
|
|
15
15
|
|
|
16
|
+
// In upstash they refer to the store as an index
|
|
16
17
|
const vectorStore = new UpstashVector({
|
|
17
18
|
url: process.env.UPSTASH_VECTOR_REST_URL,
|
|
18
19
|
token: process.env.UPSTASH_VECTOR_TOKEN
|
|
@@ -27,6 +28,9 @@ const ids = await vectorStore.upsert({
|
|
|
27
28
|
metadata
|
|
28
29
|
});
|
|
29
30
|
|
|
31
|
+
// There is no store.createIndex call here, Upstash creates indexes (known as namespaces in Upstash) automatically
|
|
32
|
+
// when you upsert if that namespace does not exist yet.
|
|
33
|
+
|
|
30
34
|
// Query vectors
|
|
31
35
|
const results = await vectorStore.query({
|
|
32
36
|
indexName: 'my-namespace',
|
|
@@ -217,26 +217,61 @@ export { UpstashStore as UpstashStore_alias_1 }
|
|
|
217
217
|
|
|
218
218
|
declare class UpstashVector extends MastraVector {
|
|
219
219
|
private client;
|
|
220
|
+
/**
|
|
221
|
+
* Creates a new UpstashVector instance.
|
|
222
|
+
* @param {object} params - The parameters for the UpstashVector.
|
|
223
|
+
* @param {string} params.url - The URL of the Upstash vector index.
|
|
224
|
+
* @param {string} params.token - The token for the Upstash vector index.
|
|
225
|
+
*/
|
|
220
226
|
constructor({ url, token }: {
|
|
221
227
|
url: string;
|
|
222
228
|
token: string;
|
|
223
229
|
});
|
|
224
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Upserts vectors into the index.
|
|
232
|
+
* @param {UpsertVectorParams} params - The parameters for the upsert operation.
|
|
233
|
+
* @returns {Promise<string[]>} A promise that resolves to the IDs of the upserted vectors.
|
|
234
|
+
*/
|
|
235
|
+
upsert({ indexName: namespace, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
236
|
+
/**
|
|
237
|
+
* Transforms a Mastra vector filter into an Upstash-compatible filter string.
|
|
238
|
+
* @param {VectorFilter} [filter] - The filter to transform.
|
|
239
|
+
* @returns {string | undefined} The transformed filter string, or undefined if no filter is provided.
|
|
240
|
+
*/
|
|
225
241
|
transformFilter(filter?: VectorFilter): string | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* Creates a new index. For Upstash, this is a no-op as indexes (known as namespaces in Upstash) are created on-the-fly.
|
|
244
|
+
* @param {CreateIndexParams} _params - The parameters for creating the index (ignored).
|
|
245
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
246
|
+
*/
|
|
226
247
|
createIndex(_params: CreateIndexParams): Promise<void>;
|
|
227
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Queries the vector index.
|
|
250
|
+
* @param {QueryVectorParams} params - The parameters for the query operation. indexName is the namespace in Upstash.
|
|
251
|
+
* @returns {Promise<QueryResult[]>} A promise that resolves to the query results.
|
|
252
|
+
*/
|
|
253
|
+
query({ indexName: namespace, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
|
|
254
|
+
/**
|
|
255
|
+
* Lists all namespaces in the Upstash vector index, which correspond to indexes.
|
|
256
|
+
* @returns {Promise<string[]>} A promise that resolves to a list of index names.
|
|
257
|
+
*/
|
|
228
258
|
listIndexes(): Promise<string[]>;
|
|
229
259
|
/**
|
|
230
260
|
* Retrieves statistics about a vector index.
|
|
231
261
|
*
|
|
232
|
-
* @param {string} indexName - The name of the
|
|
262
|
+
* @param {string} indexName - The name of the namespace to describe
|
|
233
263
|
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
234
264
|
*/
|
|
235
|
-
describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
|
|
236
|
-
|
|
265
|
+
describeIndex({ indexName: namespace }: DescribeIndexParams): Promise<IndexStats>;
|
|
266
|
+
/**
|
|
267
|
+
* Deletes an index (namespace).
|
|
268
|
+
* @param {DeleteIndexParams} params - The parameters for the delete operation.
|
|
269
|
+
* @returns {Promise<void>} A promise that resolves when the deletion is complete.
|
|
270
|
+
*/
|
|
271
|
+
deleteIndex({ indexName: namespace }: DeleteIndexParams): Promise<void>;
|
|
237
272
|
/**
|
|
238
273
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
239
|
-
* @param indexName - The name of the
|
|
274
|
+
* @param indexName - The name of the namespace containing the vector.
|
|
240
275
|
* @param id - The ID of the vector to update.
|
|
241
276
|
* @param update - An object containing the vector and/or metadata to update.
|
|
242
277
|
* @param update.vector - An optional array of numbers representing the new vector.
|
|
@@ -244,15 +279,15 @@ declare class UpstashVector extends MastraVector {
|
|
|
244
279
|
* @returns A promise that resolves when the update is complete.
|
|
245
280
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
246
281
|
*/
|
|
247
|
-
updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
|
|
282
|
+
updateVector({ indexName: namespace, id, update }: UpdateVectorParams): Promise<void>;
|
|
248
283
|
/**
|
|
249
284
|
* Deletes a vector by its ID.
|
|
250
|
-
* @param indexName - The name of the
|
|
285
|
+
* @param indexName - The name of the namespace containing the vector.
|
|
251
286
|
* @param id - The ID of the vector to delete.
|
|
252
287
|
* @returns A promise that resolves when the deletion is complete.
|
|
253
288
|
* @throws Will throw an error if the deletion operation fails.
|
|
254
289
|
*/
|
|
255
|
-
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
290
|
+
deleteVector({ indexName: namespace, id }: DeleteVectorParams): Promise<void>;
|
|
256
291
|
}
|
|
257
292
|
export { UpstashVector }
|
|
258
293
|
export { UpstashVector as UpstashVector_alias_1 }
|
|
@@ -217,26 +217,61 @@ export { UpstashStore as UpstashStore_alias_1 }
|
|
|
217
217
|
|
|
218
218
|
declare class UpstashVector extends MastraVector {
|
|
219
219
|
private client;
|
|
220
|
+
/**
|
|
221
|
+
* Creates a new UpstashVector instance.
|
|
222
|
+
* @param {object} params - The parameters for the UpstashVector.
|
|
223
|
+
* @param {string} params.url - The URL of the Upstash vector index.
|
|
224
|
+
* @param {string} params.token - The token for the Upstash vector index.
|
|
225
|
+
*/
|
|
220
226
|
constructor({ url, token }: {
|
|
221
227
|
url: string;
|
|
222
228
|
token: string;
|
|
223
229
|
});
|
|
224
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Upserts vectors into the index.
|
|
232
|
+
* @param {UpsertVectorParams} params - The parameters for the upsert operation.
|
|
233
|
+
* @returns {Promise<string[]>} A promise that resolves to the IDs of the upserted vectors.
|
|
234
|
+
*/
|
|
235
|
+
upsert({ indexName: namespace, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
236
|
+
/**
|
|
237
|
+
* Transforms a Mastra vector filter into an Upstash-compatible filter string.
|
|
238
|
+
* @param {VectorFilter} [filter] - The filter to transform.
|
|
239
|
+
* @returns {string | undefined} The transformed filter string, or undefined if no filter is provided.
|
|
240
|
+
*/
|
|
225
241
|
transformFilter(filter?: VectorFilter): string | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* Creates a new index. For Upstash, this is a no-op as indexes (known as namespaces in Upstash) are created on-the-fly.
|
|
244
|
+
* @param {CreateIndexParams} _params - The parameters for creating the index (ignored).
|
|
245
|
+
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
246
|
+
*/
|
|
226
247
|
createIndex(_params: CreateIndexParams): Promise<void>;
|
|
227
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Queries the vector index.
|
|
250
|
+
* @param {QueryVectorParams} params - The parameters for the query operation. indexName is the namespace in Upstash.
|
|
251
|
+
* @returns {Promise<QueryResult[]>} A promise that resolves to the query results.
|
|
252
|
+
*/
|
|
253
|
+
query({ indexName: namespace, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
|
|
254
|
+
/**
|
|
255
|
+
* Lists all namespaces in the Upstash vector index, which correspond to indexes.
|
|
256
|
+
* @returns {Promise<string[]>} A promise that resolves to a list of index names.
|
|
257
|
+
*/
|
|
228
258
|
listIndexes(): Promise<string[]>;
|
|
229
259
|
/**
|
|
230
260
|
* Retrieves statistics about a vector index.
|
|
231
261
|
*
|
|
232
|
-
* @param {string} indexName - The name of the
|
|
262
|
+
* @param {string} indexName - The name of the namespace to describe
|
|
233
263
|
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
234
264
|
*/
|
|
235
|
-
describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
|
|
236
|
-
|
|
265
|
+
describeIndex({ indexName: namespace }: DescribeIndexParams): Promise<IndexStats>;
|
|
266
|
+
/**
|
|
267
|
+
* Deletes an index (namespace).
|
|
268
|
+
* @param {DeleteIndexParams} params - The parameters for the delete operation.
|
|
269
|
+
* @returns {Promise<void>} A promise that resolves when the deletion is complete.
|
|
270
|
+
*/
|
|
271
|
+
deleteIndex({ indexName: namespace }: DeleteIndexParams): Promise<void>;
|
|
237
272
|
/**
|
|
238
273
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
239
|
-
* @param indexName - The name of the
|
|
274
|
+
* @param indexName - The name of the namespace containing the vector.
|
|
240
275
|
* @param id - The ID of the vector to update.
|
|
241
276
|
* @param update - An object containing the vector and/or metadata to update.
|
|
242
277
|
* @param update.vector - An optional array of numbers representing the new vector.
|
|
@@ -244,15 +279,15 @@ declare class UpstashVector extends MastraVector {
|
|
|
244
279
|
* @returns A promise that resolves when the update is complete.
|
|
245
280
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
246
281
|
*/
|
|
247
|
-
updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
|
|
282
|
+
updateVector({ indexName: namespace, id, update }: UpdateVectorParams): Promise<void>;
|
|
248
283
|
/**
|
|
249
284
|
* Deletes a vector by its ID.
|
|
250
|
-
* @param indexName - The name of the
|
|
285
|
+
* @param indexName - The name of the namespace containing the vector.
|
|
251
286
|
* @param id - The ID of the vector to delete.
|
|
252
287
|
* @returns A promise that resolves when the deletion is complete.
|
|
253
288
|
* @throws Will throw an error if the deletion operation fails.
|
|
254
289
|
*/
|
|
255
|
-
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
290
|
+
deleteVector({ indexName: namespace, id }: DeleteVectorParams): Promise<void>;
|
|
256
291
|
}
|
|
257
292
|
export { UpstashVector }
|
|
258
293
|
export { UpstashVector as UpstashVector_alias_1 }
|