@mastra/upstash 0.10.2-alpha.2 → 0.10.3-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.
@@ -1,19 +1,19 @@
1
1
 
2
- > @mastra/upstash@0.10.2-alpha.2 build /home/runner/work/mastra/mastra/stores/upstash
2
+ > @mastra/upstash@0.10.3-alpha.0 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
- CLI tsup v8.4.0
7
+ CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 9127ms
9
+ TSC ⚡️ Build success in 9952ms
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 11663ms
16
+ DTS ⚡️ Build success in 11839ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
@@ -26,8 +26,8 @@ dist/index.cjs (1651:18): Use of eval in "dist/index.cjs" is strongly discourage
26
26
  ESM dist/chunk-IGKEDEDE.js 452.00 B
27
27
  ESM dist/getMachineId-unsupported-VPWBQCK7.js 700.00 B
28
28
  ESM dist/chunk-HSTZWXH7.js 61.52 KB
29
- ESM dist/index.js 1.62 MB
30
- ESM ⚡️ Build success in 22560ms
29
+ ESM dist/index.js 1.64 MB
30
+ ESM ⚡️ Build success in 23482ms
31
31
  CJS dist/getMachineId-darwin-3PL23DL6.cjs 1.19 KB
32
32
  CJS dist/getMachineId-linux-KYLPK3HC.cjs 813.00 B
33
33
  CJS dist/getMachineId-bsd-HDZ73WR7.cjs 1015.00 B
@@ -35,5 +35,5 @@ dist/index.cjs (1651:18): Use of eval in "dist/index.cjs" is strongly discourage
35
35
  CJS dist/chunk-N2CPQVE3.cjs 1.09 KB
36
36
  CJS dist/getMachineId-unsupported-DEDJN4ZS.cjs 777.00 B
37
37
  CJS dist/chunk-U74OJRHU.cjs 62.08 KB
38
- CJS dist/index.cjs 1.63 MB
39
- CJS ⚡️ Build success in 22554ms
38
+ CJS dist/index.cjs 1.65 MB
39
+ CJS ⚡️ Build success in 23523ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 0.10.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 1a35518: dependencies updates:
8
+ - Updated dependency [`@upstash/redis@^1.35.0` ↗︎](https://www.npmjs.com/package/@upstash/redis/v/1.35.0) (from `^1.34.5`, in `dependencies`)
9
+ - Updated dependencies [d1ed912]
10
+ - Updated dependencies [f1f1f1b]
11
+ - Updated dependencies [f9816ae]
12
+ - Updated dependencies [82090c1]
13
+ - Updated dependencies [1b443fd]
14
+ - Updated dependencies [ce97900]
15
+ - Updated dependencies [14a2566]
16
+ - @mastra/core@0.10.4-alpha.0
17
+
18
+ ## 0.10.2
19
+
20
+ ### Patch Changes
21
+
22
+ - e5dc18d: Added a backwards compatible layer to begin storing/retrieving UIMessages in storage instead of CoreMessages
23
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
24
+ - f0d559f: Fix peerdeps for alpha channel
25
+ - Updated dependencies [ee77e78]
26
+ - Updated dependencies [592a2db]
27
+ - Updated dependencies [e5dc18d]
28
+ - Updated dependencies [ab5adbe]
29
+ - Updated dependencies [1e8bb40]
30
+ - Updated dependencies [1b5fc55]
31
+ - Updated dependencies [195c428]
32
+ - Updated dependencies [f73e11b]
33
+ - Updated dependencies [37643b8]
34
+ - Updated dependencies [99fd6cf]
35
+ - Updated dependencies [c5bf1ce]
36
+ - Updated dependencies [add596e]
37
+ - Updated dependencies [8dc94d8]
38
+ - Updated dependencies [ecebbeb]
39
+ - Updated dependencies [79d5145]
40
+ - Updated dependencies [12b7002]
41
+ - Updated dependencies [2901125]
42
+ - @mastra/core@0.10.2
43
+
3
44
  ## 0.10.2-alpha.2
4
45
 
5
46
  ### Patch Changes
package/PAGINATION.md ADDED
@@ -0,0 +1,397 @@
1
+ # Upstash Store Pagination Features
2
+
3
+ This document describes the pagination capabilities added to the UpstashStore class for efficient data retrieval from Upstash Redis.
4
+
5
+ ## Overview
6
+
7
+ The UpstashStore now supports comprehensive pagination across all major data retrieval methods. Pagination helps manage large datasets by:
8
+
9
+ - Reducing memory usage by loading data in chunks
10
+ - Improving response times for large collections
11
+ - Supporting both cursor-based and offset-based pagination patterns
12
+ - Providing total count information for UI pagination controls
13
+
14
+ ## Pagination Patterns
15
+
16
+ The implementation supports two pagination patterns to match different use cases:
17
+
18
+ ### 1. Page-based Pagination (page/perPage)
19
+
20
+ ```typescript
21
+ const result = await store.getEvals({
22
+ agentName: 'my-agent',
23
+ page: 0, // First page (0-based)
24
+ perPage: 20, // 20 items per page
25
+ });
26
+ ```
27
+
28
+ ### 2. Offset-based Pagination (limit/offset)
29
+
30
+ ```typescript
31
+ const result = await store.getEvals({
32
+ agentName: 'my-agent',
33
+ limit: 20, // Maximum items to return
34
+ offset: 40, // Skip first 40 items
35
+ });
36
+ ```
37
+
38
+ ## Enhanced Methods
39
+
40
+ ### 1. getEvals() - New Comprehensive Evaluation Retrieval
41
+
42
+ ```typescript
43
+ const result = await store.getEvals({
44
+ agentName?: string; // Filter by agent name
45
+ type?: 'test' | 'live'; // Filter by evaluation type
46
+ page?: number; // Page number (0-based)
47
+ perPage?: number; // Items per page
48
+ limit?: number; // Alternative: max items
49
+ offset?: number; // Alternative: items to skip
50
+ fromDate?: Date; // Filter by date range
51
+ toDate?: Date;
52
+ });
53
+
54
+ // Returns:
55
+ {
56
+ evals: EvalRow[]; // Evaluation results
57
+ total: number; // Total count (before pagination)
58
+ page?: number; // Current page (page-based)
59
+ perPage?: number; // Items per page (page-based)
60
+ hasMore: boolean; // Whether more data exists
61
+ }
62
+ ```
63
+
64
+ ### 2. getMessages() - Enhanced with Pagination Support
65
+
66
+ The existing `getMessages` function now supports pagination while maintaining full backward compatibility:
67
+
68
+ ```typescript
69
+ // Original usage (backward compatible) - returns message array
70
+ const messages = await store.getMessages({
71
+ threadId: 'thread-id',
72
+ format: 'v2'
73
+ });
74
+
75
+ // New paginated usage - returns pagination object
76
+ const result = await store.getMessages({
77
+ threadId: 'thread-id',
78
+ page: 0, // Page number (0-based)
79
+ perPage: 20, // Items per page (default: 40)
80
+ format: 'v2', // Message format
81
+ fromDate?: Date, // Filter by creation date
82
+ toDate?: Date, // Filter by creation date
83
+ });
84
+
85
+ // Paginated result format:
86
+ {
87
+ messages: MastraMessageV1[] | MastraMessageV2[];
88
+ total: number; // Total count
89
+ page: number; // Current page
90
+ perPage: number; // Items per page
91
+ hasMore: boolean; // Whether more data exists
92
+ }
93
+ ```
94
+
95
+ **Key Features:**
96
+
97
+ - **Backward Compatible**: Existing code continues to work unchanged
98
+ - **Conditional Return Type**: Returns array when no pagination params, object when paginated
99
+ - **Date Filtering**: Combine pagination with date range filtering
100
+ - **Maintains Message Order**: Preserves chronological order from Redis sorted sets
101
+ - **Efficient Pipelines**: Uses Redis pipelines for batch operations
102
+
103
+ ### 3. getThreads() - New Comprehensive Thread Retrieval
104
+
105
+ ```typescript
106
+ const result = await store.getThreads({
107
+ resourceId?: string; // Filter by resource ID
108
+ page?: number; // Page number (0-based)
109
+ perPage?: number; // Items per page
110
+ limit?: number; // Alternative: max items
111
+ offset?: number; // Alternative: items to skip
112
+ fromDate?: Date; // Filter by creation date
113
+ toDate?: Date;
114
+ });
115
+
116
+ // Returns:
117
+ {
118
+ threads: StorageThreadType[]; // Thread results
119
+ total: number; // Total count
120
+ page?: number;
121
+ perPage?: number;
122
+ hasMore: boolean;
123
+ }
124
+ ```
125
+
126
+ ### 4. getTracesWithCount() - Enhanced Trace Retrieval
127
+
128
+ ```typescript
129
+ const result = await store.getTracesWithCount({
130
+ name?: string; // Filter by trace name
131
+ scope?: string; // Filter by scope
132
+ page?: number; // Page number (0-based)
133
+ perPage?: number; // Items per page (default: 100)
134
+ attributes?: Record<string, string>; // Filter by attributes
135
+ filters?: Record<string, any>; // Custom filters
136
+ fromDate?: Date; // Date range filtering
137
+ toDate?: Date;
138
+ });
139
+
140
+ // Returns:
141
+ {
142
+ traces: any[]; // Trace results
143
+ total: number; // Total count
144
+ page: number;
145
+ perPage: number;
146
+ hasMore: boolean;
147
+ }
148
+ ```
149
+
150
+ ## Enhanced Existing Methods
151
+
152
+ ### 1. getEvalsByAgentName() - Now with Pagination
153
+
154
+ ```typescript
155
+ const evals = await store.getEvalsByAgentName(
156
+ 'agent-name',
157
+ 'test' | 'live',
158
+ {
159
+ page?: number;
160
+ perPage?: number;
161
+ limit?: number;
162
+ offset?: number;
163
+ }
164
+ );
165
+ ```
166
+
167
+ ### 2. getThreadsByResourceId() - Now with Pagination
168
+
169
+ ```typescript
170
+ const threads = await store.getThreadsByResourceId({
171
+ resourceId: 'resource-id',
172
+ page?: number;
173
+ perPage?: number;
174
+ limit?: number;
175
+ offset?: number;
176
+ });
177
+ ```
178
+
179
+ ### 3. getWorkflowRuns() - Improved Performance
180
+
181
+ The existing method now uses Redis pipelines for better performance:
182
+
183
+ ```typescript
184
+ const result = await store.getWorkflowRuns({
185
+ namespace?: string; // Default: 'workflows'
186
+ workflowName?: string;
187
+ fromDate?: Date;
188
+ toDate?: Date;
189
+ limit?: number;
190
+ offset?: number;
191
+ resourceId?: string;
192
+ });
193
+ ```
194
+
195
+ ## Utility Methods
196
+
197
+ ### 1. scanWithCursor() - Cursor-based Key Scanning
198
+
199
+ ```typescript
200
+ const result = await store.scanWithCursor(
201
+ 'pattern:*', // Redis key pattern
202
+ '0', // Cursor (use '0' for first scan)
203
+ 1000 // Count hint
204
+ );
205
+
206
+ // Returns:
207
+ {
208
+ keys: string[]; // Found keys
209
+ nextCursor: string; // Cursor for next iteration
210
+ hasMore: boolean; // Whether more keys exist
211
+ }
212
+ ```
213
+
214
+ ### 2. getPaginatedResults() - Generic Pagination Utility
215
+
216
+ ```typescript
217
+ const result = await store.getPaginatedResults<TransformedType>(
218
+ 'pattern:*', // Redis key pattern
219
+ 0, // Page number
220
+ 20, // Items per page
221
+ (record) => ({ // Optional transformer function
222
+ // Transform raw record to desired format
223
+ id: record.id,
224
+ name: record.name
225
+ })
226
+ );
227
+
228
+ // Returns:
229
+ {
230
+ data: TransformedType[];
231
+ total: number;
232
+ page: number;
233
+ perPage: number;
234
+ hasMore: boolean;
235
+ }
236
+ ```
237
+
238
+ ## Performance Optimizations
239
+
240
+ ### Redis Pipeline Usage
241
+
242
+ All pagination methods use Redis pipelines to batch multiple GET operations, significantly improving performance when retrieving multiple records.
243
+
244
+ ```typescript
245
+ // Instead of multiple individual calls:
246
+ // const result1 = await redis.get(key1);
247
+ // const result2 = await redis.get(key2);
248
+
249
+ // We use pipelines:
250
+ const pipeline = redis.pipeline();
251
+ keys.forEach(key => pipeline.get(key));
252
+ const results = await pipeline.exec();
253
+ ```
254
+
255
+ ### Efficient Scanning
256
+
257
+ The implementation uses Redis SCAN operations with cursor-based iteration to efficiently handle large key spaces without blocking the Redis server.
258
+
259
+ ### Memory Management
260
+
261
+ - Results are filtered and transformed only after pagination is applied
262
+ - Large datasets are processed in chunks to prevent memory issues
263
+ - Unnecessary data transformations are avoided for better performance
264
+
265
+ ## Example Usage
266
+
267
+ ### Basic Message Pagination
268
+
269
+ ```typescript
270
+ // Get first page of messages with pagination metadata
271
+ const page1 = await store.getMessages({
272
+ threadId: 'thread-123',
273
+ page: 0,
274
+ perPage: 20,
275
+ format: 'v2',
276
+ });
277
+
278
+ console.log(`Showing ${page1.messages.length} of ${page1.total} messages`);
279
+ console.log(`Has more: ${page1.hasMore}`);
280
+
281
+ // Backward compatible usage (no pagination metadata)
282
+ const allMessages = await store.getMessages({
283
+ threadId: 'thread-123',
284
+ format: 'v2',
285
+ });
286
+ console.log(`Retrieved ${allMessages.length} messages`);
287
+ ```
288
+
289
+ ### Basic Evaluation Pagination
290
+
291
+ ```typescript
292
+ // Get first page of evaluations for an agent
293
+ const page1 = await store.getEvals({
294
+ agentName: 'my-agent',
295
+ page: 0,
296
+ perPage: 20,
297
+ });
298
+
299
+ console.log(`Showing ${page1.evals.length} of ${page1.total} evaluations`);
300
+ console.log(`Has more: ${page1.hasMore}`);
301
+ ```
302
+
303
+ ### Date Range with Pagination
304
+
305
+ ```typescript
306
+ // Get recent threads with pagination
307
+ const recentThreads = await store.getThreads({
308
+ fromDate: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), // Last 7 days
309
+ page: 0,
310
+ perPage: 10,
311
+ });
312
+ ```
313
+
314
+ ### Filtered Traces with Pagination
315
+
316
+ ```typescript
317
+ // Get production traces with specific attributes
318
+ const prodTraces = await store.getTracesWithCount({
319
+ scope: 'production',
320
+ attributes: { environment: 'prod', service: 'api' },
321
+ page: 1,
322
+ perPage: 50,
323
+ });
324
+ ```
325
+
326
+ ### Message Date Filtering
327
+
328
+ ```typescript
329
+ // Get recent messages from a thread
330
+ const recentMessages = await store.getMessages({
331
+ threadId: 'thread-123',
332
+ page: 0,
333
+ perPage: 10,
334
+ fromDate: new Date(Date.now() - 24 * 60 * 60 * 1000), // Last 24 hours
335
+ format: 'v2',
336
+ });
337
+ ```
338
+
339
+ ## Best Practices
340
+
341
+ 1. **Use appropriate page sizes**: Start with 20-100 items per page depending on data size
342
+ 2. **Implement client-side caching**: Cache paginated results to reduce server load
343
+ 3. **Handle empty results**: Always check if the returned array is empty
344
+ 4. **Use date filters**: Combine pagination with date filters for better performance
345
+ 5. **Monitor total counts**: Use the `total` field to implement proper pagination UI
346
+ 6. **Choose the right pattern**: Use page/perPage for UI pagination, limit/offset for data processing
347
+ 7. **Leverage backward compatibility**: Existing `getMessages` calls work unchanged
348
+ 8. **Check return types**: Use TypeScript overloads to get proper type inference
349
+
350
+ ## Migration Guide
351
+
352
+ The enhanced `getMessages` function is fully backward compatible. No changes are required for existing code, but you can opt into pagination features:
353
+
354
+ ### For Messages
355
+
356
+ ```typescript
357
+ // Existing code (continues to work unchanged)
358
+ const messages = await store.getMessages({
359
+ threadId: 'thread-123',
360
+ format: 'v2',
361
+ });
362
+
363
+ // Enhanced with pagination (new functionality)
364
+ const result = await store.getMessages({
365
+ threadId: 'thread-123',
366
+ page: 0,
367
+ perPage: 20,
368
+ format: 'v2',
369
+ });
370
+ const messages = result.messages;
371
+ const total = result.total;
372
+ ```
373
+
374
+ ### For Other Methods
375
+
376
+ If you're using existing methods, they remain backward compatible. To take advantage of new pagination features:
377
+
378
+ 1. **Replace** `getEvalsByAgentName()` calls with `getEvals()` for better filtering and pagination
379
+ 2. **Replace** `getThreadsByResourceId()` calls with `getThreads()` for date filtering and total counts
380
+ 3. **Use** `getMessages()` with pagination parameters instead of complex `selectBy` logic when appropriate
381
+ 4. **Use** `getTracesWithCount()` instead of `getTraces()` when you need total counts
382
+
383
+ Example migration:
384
+
385
+ ```typescript
386
+ // Before:
387
+ const evals = await store.getEvalsByAgentName('agent-name');
388
+
389
+ // After:
390
+ const result = await store.getEvals({
391
+ agentName: 'agent-name',
392
+ page: 0,
393
+ perPage: 20,
394
+ });
395
+ const evals = result.evals;
396
+ const total = result.total;
397
+ ```
@@ -76,17 +76,37 @@ declare class UpstashStore extends MastraStorage {
76
76
  private getThreadMessagesKey;
77
77
  private parseWorkflowRun;
78
78
  private processRecord;
79
+ /**
80
+ * @deprecated Use getEvals instead
81
+ */
79
82
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
80
- getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }?: {
83
+ getTraces(args: {
81
84
  name?: string;
82
85
  scope?: string;
83
- page: number;
84
- perPage: number;
85
86
  attributes?: Record<string, string>;
86
87
  filters?: Record<string, any>;
88
+ page: number;
89
+ perPage?: number;
87
90
  fromDate?: Date;
88
91
  toDate?: Date;
89
92
  }): Promise<any[]>;
93
+ getTraces(args: {
94
+ name?: string;
95
+ scope?: string;
96
+ page: number;
97
+ perPage?: number;
98
+ attributes?: Record<string, string>;
99
+ filters?: Record<string, any>;
100
+ fromDate?: Date;
101
+ toDate?: Date;
102
+ returnPaginationResults: true;
103
+ }): Promise<{
104
+ traces: any[];
105
+ total: number;
106
+ page: number;
107
+ perPage: number;
108
+ hasMore: boolean;
109
+ }>;
90
110
  createTable({ tableName, schema, }: {
91
111
  tableName: TABLE_NAMES;
92
112
  schema: Record<string, StorageColumn>;
@@ -109,9 +129,20 @@ declare class UpstashStore extends MastraStorage {
109
129
  getThreadById({ threadId }: {
110
130
  threadId: string;
111
131
  }): Promise<StorageThreadType | null>;
112
- getThreadsByResourceId({ resourceId }: {
132
+ getThreadsByResourceId(args: {
113
133
  resourceId: string;
114
134
  }): Promise<StorageThreadType[]>;
135
+ getThreadsByResourceId(args: {
136
+ resourceId: string;
137
+ page: number;
138
+ perPage?: number;
139
+ }): Promise<{
140
+ threads: StorageThreadType[];
141
+ total: number;
142
+ page: number;
143
+ perPage: number;
144
+ hasMore: boolean;
145
+ }>;
115
146
  saveThread({ thread }: {
116
147
  thread: StorageThreadType;
117
148
  }): Promise<StorageThreadType>;
@@ -137,6 +168,19 @@ declare class UpstashStore extends MastraStorage {
137
168
  getMessages(args: StorageGetMessagesArg & {
138
169
  format: 'v2';
139
170
  }): Promise<MastraMessageV2[]>;
171
+ getMessages(args: StorageGetMessagesArg & {
172
+ format?: 'v1' | 'v2';
173
+ page: number;
174
+ perPage?: number;
175
+ fromDate?: Date;
176
+ toDate?: Date;
177
+ }): Promise<{
178
+ messages: MastraMessageV1[] | MastraMessageV2[];
179
+ total: number;
180
+ page: number;
181
+ perPage: number;
182
+ hasMore: boolean;
183
+ }>;
140
184
  persistWorkflowSnapshot(params: {
141
185
  namespace: string;
142
186
  workflowName: string;
@@ -148,6 +192,27 @@ declare class UpstashStore extends MastraStorage {
148
192
  workflowName: string;
149
193
  runId: string;
150
194
  }): Promise<WorkflowRunState | null>;
195
+ /**
196
+ * Get all evaluations with pagination and total count
197
+ * @param options Pagination and filtering options
198
+ * @returns Object with evals array and total count
199
+ */
200
+ getEvals(options?: {
201
+ agentName?: string;
202
+ type?: 'test' | 'live';
203
+ page?: number;
204
+ perPage?: number;
205
+ limit?: number;
206
+ offset?: number;
207
+ fromDate?: Date;
208
+ toDate?: Date;
209
+ }): Promise<{
210
+ evals: EvalRow[];
211
+ total: number;
212
+ page?: number;
213
+ perPage?: number;
214
+ hasMore?: boolean;
215
+ }>;
151
216
  getWorkflowRuns({ namespace, workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
152
217
  namespace: string;
153
218
  workflowName?: string;
@@ -76,17 +76,37 @@ declare class UpstashStore extends MastraStorage {
76
76
  private getThreadMessagesKey;
77
77
  private parseWorkflowRun;
78
78
  private processRecord;
79
+ /**
80
+ * @deprecated Use getEvals instead
81
+ */
79
82
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
80
- getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }?: {
83
+ getTraces(args: {
81
84
  name?: string;
82
85
  scope?: string;
83
- page: number;
84
- perPage: number;
85
86
  attributes?: Record<string, string>;
86
87
  filters?: Record<string, any>;
88
+ page: number;
89
+ perPage?: number;
87
90
  fromDate?: Date;
88
91
  toDate?: Date;
89
92
  }): Promise<any[]>;
93
+ getTraces(args: {
94
+ name?: string;
95
+ scope?: string;
96
+ page: number;
97
+ perPage?: number;
98
+ attributes?: Record<string, string>;
99
+ filters?: Record<string, any>;
100
+ fromDate?: Date;
101
+ toDate?: Date;
102
+ returnPaginationResults: true;
103
+ }): Promise<{
104
+ traces: any[];
105
+ total: number;
106
+ page: number;
107
+ perPage: number;
108
+ hasMore: boolean;
109
+ }>;
90
110
  createTable({ tableName, schema, }: {
91
111
  tableName: TABLE_NAMES;
92
112
  schema: Record<string, StorageColumn>;
@@ -109,9 +129,20 @@ declare class UpstashStore extends MastraStorage {
109
129
  getThreadById({ threadId }: {
110
130
  threadId: string;
111
131
  }): Promise<StorageThreadType | null>;
112
- getThreadsByResourceId({ resourceId }: {
132
+ getThreadsByResourceId(args: {
113
133
  resourceId: string;
114
134
  }): Promise<StorageThreadType[]>;
135
+ getThreadsByResourceId(args: {
136
+ resourceId: string;
137
+ page: number;
138
+ perPage?: number;
139
+ }): Promise<{
140
+ threads: StorageThreadType[];
141
+ total: number;
142
+ page: number;
143
+ perPage: number;
144
+ hasMore: boolean;
145
+ }>;
115
146
  saveThread({ thread }: {
116
147
  thread: StorageThreadType;
117
148
  }): Promise<StorageThreadType>;
@@ -137,6 +168,19 @@ declare class UpstashStore extends MastraStorage {
137
168
  getMessages(args: StorageGetMessagesArg & {
138
169
  format: 'v2';
139
170
  }): Promise<MastraMessageV2[]>;
171
+ getMessages(args: StorageGetMessagesArg & {
172
+ format?: 'v1' | 'v2';
173
+ page: number;
174
+ perPage?: number;
175
+ fromDate?: Date;
176
+ toDate?: Date;
177
+ }): Promise<{
178
+ messages: MastraMessageV1[] | MastraMessageV2[];
179
+ total: number;
180
+ page: number;
181
+ perPage: number;
182
+ hasMore: boolean;
183
+ }>;
140
184
  persistWorkflowSnapshot(params: {
141
185
  namespace: string;
142
186
  workflowName: string;
@@ -148,6 +192,27 @@ declare class UpstashStore extends MastraStorage {
148
192
  workflowName: string;
149
193
  runId: string;
150
194
  }): Promise<WorkflowRunState | null>;
195
+ /**
196
+ * Get all evaluations with pagination and total count
197
+ * @param options Pagination and filtering options
198
+ * @returns Object with evals array and total count
199
+ */
200
+ getEvals(options?: {
201
+ agentName?: string;
202
+ type?: 'test' | 'live';
203
+ page?: number;
204
+ perPage?: number;
205
+ limit?: number;
206
+ offset?: number;
207
+ fromDate?: Date;
208
+ toDate?: Date;
209
+ }): Promise<{
210
+ evals: EvalRow[];
211
+ total: number;
212
+ page?: number;
213
+ perPage?: number;
214
+ hasMore?: boolean;
215
+ }>;
151
216
  getWorkflowRuns({ namespace, workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
152
217
  namespace: string;
153
218
  workflowName?: string;