@mastra/upstash 0.10.2 → 0.10.3-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 +17 -17
- package/CHANGELOG.md +26 -0
- package/PAGINATION.md +397 -0
- package/dist/_tsup-dts-rollup.d.cts +80 -6
- package/dist/_tsup-dts-rollup.d.ts +80 -6
- package/dist/index.cjs +1794 -1267
- package/dist/index.js +1794 -1267
- package/package.json +11 -10
- package/src/storage/index.ts +576 -121
- package/src/storage/upstash.test.ts +428 -53
|
@@ -58,8 +58,6 @@ declare class UpstashStore extends MastraStorage {
|
|
|
58
58
|
private transformEvalRecord;
|
|
59
59
|
private parseJSON;
|
|
60
60
|
private getKey;
|
|
61
|
-
private ensureDate;
|
|
62
|
-
private serializeDate;
|
|
63
61
|
/**
|
|
64
62
|
* Scans for keys matching the given pattern using SCAN and returns them as an array.
|
|
65
63
|
* @param pattern Redis key pattern, e.g. "table:*"
|
|
@@ -76,21 +74,52 @@ declare class UpstashStore extends MastraStorage {
|
|
|
76
74
|
private getThreadMessagesKey;
|
|
77
75
|
private parseWorkflowRun;
|
|
78
76
|
private processRecord;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated Use getEvals instead
|
|
79
|
+
*/
|
|
79
80
|
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
80
|
-
getTraces(
|
|
81
|
+
getTraces(args: {
|
|
81
82
|
name?: string;
|
|
82
83
|
scope?: string;
|
|
83
|
-
page: number;
|
|
84
|
-
perPage: number;
|
|
85
84
|
attributes?: Record<string, string>;
|
|
86
85
|
filters?: Record<string, any>;
|
|
86
|
+
page: number;
|
|
87
|
+
perPage?: number;
|
|
87
88
|
fromDate?: Date;
|
|
88
89
|
toDate?: Date;
|
|
89
90
|
}): Promise<any[]>;
|
|
91
|
+
getTraces(args: {
|
|
92
|
+
name?: string;
|
|
93
|
+
scope?: string;
|
|
94
|
+
page: number;
|
|
95
|
+
perPage?: number;
|
|
96
|
+
attributes?: Record<string, string>;
|
|
97
|
+
filters?: Record<string, any>;
|
|
98
|
+
fromDate?: Date;
|
|
99
|
+
toDate?: Date;
|
|
100
|
+
returnPaginationResults: true;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
traces: any[];
|
|
103
|
+
total: number;
|
|
104
|
+
page: number;
|
|
105
|
+
perPage: number;
|
|
106
|
+
hasMore: boolean;
|
|
107
|
+
}>;
|
|
90
108
|
createTable({ tableName, schema, }: {
|
|
91
109
|
tableName: TABLE_NAMES;
|
|
92
110
|
schema: Record<string, StorageColumn>;
|
|
93
111
|
}): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* No-op: This backend is schemaless and does not require schema changes.
|
|
114
|
+
* @param tableName Name of the table
|
|
115
|
+
* @param schema Schema of the table
|
|
116
|
+
* @param ifNotExists Array of column names to add if they don't exist
|
|
117
|
+
*/
|
|
118
|
+
alterTable(_args: {
|
|
119
|
+
tableName: TABLE_NAMES;
|
|
120
|
+
schema: Record<string, StorageColumn>;
|
|
121
|
+
ifNotExists: string[];
|
|
122
|
+
}): Promise<void>;
|
|
94
123
|
clearTable({ tableName }: {
|
|
95
124
|
tableName: TABLE_NAMES;
|
|
96
125
|
}): Promise<void>;
|
|
@@ -109,9 +138,20 @@ declare class UpstashStore extends MastraStorage {
|
|
|
109
138
|
getThreadById({ threadId }: {
|
|
110
139
|
threadId: string;
|
|
111
140
|
}): Promise<StorageThreadType | null>;
|
|
112
|
-
getThreadsByResourceId(
|
|
141
|
+
getThreadsByResourceId(args: {
|
|
113
142
|
resourceId: string;
|
|
114
143
|
}): Promise<StorageThreadType[]>;
|
|
144
|
+
getThreadsByResourceId(args: {
|
|
145
|
+
resourceId: string;
|
|
146
|
+
page: number;
|
|
147
|
+
perPage?: number;
|
|
148
|
+
}): Promise<{
|
|
149
|
+
threads: StorageThreadType[];
|
|
150
|
+
total: number;
|
|
151
|
+
page: number;
|
|
152
|
+
perPage: number;
|
|
153
|
+
hasMore: boolean;
|
|
154
|
+
}>;
|
|
115
155
|
saveThread({ thread }: {
|
|
116
156
|
thread: StorageThreadType;
|
|
117
157
|
}): Promise<StorageThreadType>;
|
|
@@ -137,6 +177,19 @@ declare class UpstashStore extends MastraStorage {
|
|
|
137
177
|
getMessages(args: StorageGetMessagesArg & {
|
|
138
178
|
format: 'v2';
|
|
139
179
|
}): Promise<MastraMessageV2[]>;
|
|
180
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
181
|
+
format?: 'v1' | 'v2';
|
|
182
|
+
page: number;
|
|
183
|
+
perPage?: number;
|
|
184
|
+
fromDate?: Date;
|
|
185
|
+
toDate?: Date;
|
|
186
|
+
}): Promise<{
|
|
187
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
188
|
+
total: number;
|
|
189
|
+
page: number;
|
|
190
|
+
perPage: number;
|
|
191
|
+
hasMore: boolean;
|
|
192
|
+
}>;
|
|
140
193
|
persistWorkflowSnapshot(params: {
|
|
141
194
|
namespace: string;
|
|
142
195
|
workflowName: string;
|
|
@@ -148,6 +201,27 @@ declare class UpstashStore extends MastraStorage {
|
|
|
148
201
|
workflowName: string;
|
|
149
202
|
runId: string;
|
|
150
203
|
}): Promise<WorkflowRunState | null>;
|
|
204
|
+
/**
|
|
205
|
+
* Get all evaluations with pagination and total count
|
|
206
|
+
* @param options Pagination and filtering options
|
|
207
|
+
* @returns Object with evals array and total count
|
|
208
|
+
*/
|
|
209
|
+
getEvals(options?: {
|
|
210
|
+
agentName?: string;
|
|
211
|
+
type?: 'test' | 'live';
|
|
212
|
+
page?: number;
|
|
213
|
+
perPage?: number;
|
|
214
|
+
limit?: number;
|
|
215
|
+
offset?: number;
|
|
216
|
+
fromDate?: Date;
|
|
217
|
+
toDate?: Date;
|
|
218
|
+
}): Promise<{
|
|
219
|
+
evals: EvalRow[];
|
|
220
|
+
total: number;
|
|
221
|
+
page?: number;
|
|
222
|
+
perPage?: number;
|
|
223
|
+
hasMore?: boolean;
|
|
224
|
+
}>;
|
|
151
225
|
getWorkflowRuns({ namespace, workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
152
226
|
namespace: string;
|
|
153
227
|
workflowName?: string;
|