@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.
@@ -1,39 +1,39 @@
1
1
 
2
- > @mastra/upstash@0.10.3-alpha.4 build /home/runner/work/mastra/mastra/stores/upstash
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
  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 8571ms
9
+ TSC ⚡️ Build success in 10304ms
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/upstash/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/upstash/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 10508ms
16
+ DTS ⚡️ Build success in 12195ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- dist/index.cjs (1651: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 (1651:18): Use of eval in "dist/index.js" is strongly discouraged as it poses security risks and may cause issues with minification.
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
  CJS dist/getMachineId-darwin-3PL23DL6.cjs 1.19 KB
23
23
  CJS dist/getMachineId-linux-KYLPK3HC.cjs 813.00 B
24
+ CJS dist/getMachineId-bsd-HDZ73WR7.cjs 1015.00 B
24
25
  CJS dist/getMachineId-win-ZTI2LRDJ.cjs 1.66 KB
25
26
  CJS dist/chunk-N2CPQVE3.cjs 1.09 KB
26
27
  CJS dist/getMachineId-unsupported-DEDJN4ZS.cjs 777.00 B
27
- CJS dist/getMachineId-bsd-HDZ73WR7.cjs 1015.00 B
28
28
  CJS dist/chunk-U74OJRHU.cjs 62.08 KB
29
- CJS dist/index.cjs 1.65 MB
30
- CJS ⚡️ Build success in 17305ms
31
- ESM dist/getMachineId-darwin-UTKBTJ2U.js 1.08 KB
29
+ CJS dist/index.cjs 1.67 MB
30
+ CJS ⚡️ Build success in 22539ms
32
31
  ESM dist/getMachineId-linux-K3QXQYAB.js 740.00 B
32
+ ESM dist/getMachineId-darwin-UTKBTJ2U.js 1.08 KB
33
+ ESM dist/getMachineId-win-L2EYIM5A.js 1.04 KB
33
34
  ESM dist/getMachineId-bsd-KKIDU47O.js 896.00 B
34
35
  ESM dist/chunk-IGKEDEDE.js 452.00 B
35
- ESM dist/getMachineId-win-L2EYIM5A.js 1.04 KB
36
36
  ESM dist/chunk-HSTZWXH7.js 61.52 KB
37
37
  ESM dist/getMachineId-unsupported-VPWBQCK7.js 700.00 B
38
- ESM dist/index.js 1.64 MB
39
- ESM ⚡️ Build success in 17306ms
38
+ ESM dist/index.js 1.67 MB
39
+ ESM ⚡️ 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
- upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
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
- query({ indexName, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
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 index to describe
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
- deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
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 index containing the vector.
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 index containing the vector.
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
- upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
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
- query({ indexName, queryVector, topK, filter, includeVector, }: QueryVectorParams): Promise<QueryResult[]>;
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 index to describe
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
- deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
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 index containing the vector.
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 index containing the vector.
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 }