@mastra/upstash 0.12.1 → 0.12.2-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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +25 -0
- package/dist/_tsup-dts-rollup.d.cts +342 -40
- package/dist/_tsup-dts-rollup.d.ts +342 -40
- package/dist/index.cjs +1133 -612
- package/dist/index.js +1134 -613
- package/docker-compose.yaml +1 -1
- package/package.json +5 -5
- package/src/storage/domains/legacy-evals/index.ts +279 -0
- package/src/storage/domains/memory/index.ts +902 -0
- package/src/storage/domains/operations/index.ts +168 -0
- package/src/storage/domains/scores/index.ts +216 -0
- package/src/storage/domains/traces/index.ts +172 -0
- package/src/storage/domains/utils.ts +57 -0
- package/src/storage/domains/workflows/index.ts +243 -0
- package/src/storage/index.test.ts +13 -0
- package/src/storage/index.ts +143 -1416
- package/src/storage/upstash.test.ts +0 -1461
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/upstash@0.12.
|
|
2
|
+
> @mastra/upstash@0.12.2-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
|
[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 11238ms
|
|
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 13538ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
23
|
-
[32mESM[39m ⚡️ Build success in
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m74.17 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 1946ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m73.33 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 1947ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 0.12.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7ba91fa: Throw mastra errors methods not implemented yet
|
|
8
|
+
- Updated dependencies [f248d53]
|
|
9
|
+
- Updated dependencies [2affc57]
|
|
10
|
+
- Updated dependencies [66e13e3]
|
|
11
|
+
- Updated dependencies [edd9482]
|
|
12
|
+
- Updated dependencies [18344d7]
|
|
13
|
+
- Updated dependencies [9d372c2]
|
|
14
|
+
- Updated dependencies [40c2525]
|
|
15
|
+
- Updated dependencies [e473f27]
|
|
16
|
+
- Updated dependencies [032cb66]
|
|
17
|
+
- Updated dependencies [703ac71]
|
|
18
|
+
- Updated dependencies [a723d69]
|
|
19
|
+
- Updated dependencies [5889a31]
|
|
20
|
+
- Updated dependencies [65e3395]
|
|
21
|
+
- Updated dependencies [4933192]
|
|
22
|
+
- Updated dependencies [d1c77a4]
|
|
23
|
+
- Updated dependencies [bea9dd1]
|
|
24
|
+
- Updated dependencies [dcd4802]
|
|
25
|
+
- Updated dependencies [7ba91fa]
|
|
26
|
+
- @mastra/core@0.11.0-alpha.2
|
|
27
|
+
|
|
3
28
|
## 0.12.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -5,29 +5,282 @@ import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
|
5
5
|
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
6
6
|
import type { EvalRow } from '@mastra/core/storage';
|
|
7
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
8
|
+
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
8
9
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
9
10
|
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
10
11
|
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
12
|
+
import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
|
|
11
13
|
import { MastraStorage } from '@mastra/core/storage';
|
|
12
14
|
import { MastraVector } from '@mastra/core/vector';
|
|
15
|
+
import { MemoryStorage } from '@mastra/core/storage';
|
|
13
16
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
14
17
|
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
15
18
|
import type { PaginationArgs } from '@mastra/core/storage';
|
|
16
19
|
import type { PaginationInfo } from '@mastra/core/storage';
|
|
17
20
|
import type { QueryResult } from '@mastra/core/vector';
|
|
18
21
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
22
|
+
import type { Redis } from '@upstash/redis';
|
|
23
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
24
|
+
import { ScoresStorage } from '@mastra/core/storage';
|
|
19
25
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
26
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
20
27
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
21
28
|
import type { StorageGetTracesArg } from '@mastra/core/storage';
|
|
29
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
22
30
|
import type { StorageResourceType } from '@mastra/core/storage';
|
|
23
31
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
32
|
+
import { StoreOperations } from '@mastra/core/storage';
|
|
24
33
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
34
|
+
import { TracesStorage } from '@mastra/core/storage';
|
|
25
35
|
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
26
36
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
27
37
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
28
38
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
39
|
+
import type { WorkflowRun as WorkflowRun_2 } from '@mastra/core';
|
|
29
40
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
41
|
+
import type { WorkflowRuns as WorkflowRuns_2 } from '@mastra/core';
|
|
30
42
|
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
43
|
+
import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
|
|
44
|
+
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
45
|
+
|
|
46
|
+
export declare function ensureDate(value: any): Date | null;
|
|
47
|
+
|
|
48
|
+
export declare function getKey(tableName: TABLE_NAMES, keys: Record<string, any>): string;
|
|
49
|
+
|
|
50
|
+
export declare function parseJSON(value: any): any;
|
|
51
|
+
|
|
52
|
+
export declare function processRecord(tableName: TABLE_NAMES, record: Record<string, any>): {
|
|
53
|
+
key: string;
|
|
54
|
+
processedRecord: {
|
|
55
|
+
createdAt: string | undefined;
|
|
56
|
+
updatedAt: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export declare class ScoresUpstash extends ScoresStorage {
|
|
61
|
+
private client;
|
|
62
|
+
private operations;
|
|
63
|
+
constructor({ client, operations }: {
|
|
64
|
+
client: Redis;
|
|
65
|
+
operations: StoreOperationsUpstash;
|
|
66
|
+
});
|
|
67
|
+
getScoreById({ id }: {
|
|
68
|
+
id: string;
|
|
69
|
+
}): Promise<ScoreRowData | null>;
|
|
70
|
+
getScoresByScorerId({ scorerId, pagination, }: {
|
|
71
|
+
scorerId: string;
|
|
72
|
+
pagination?: {
|
|
73
|
+
page: number;
|
|
74
|
+
perPage: number;
|
|
75
|
+
};
|
|
76
|
+
}): Promise<{
|
|
77
|
+
scores: ScoreRowData[];
|
|
78
|
+
pagination: {
|
|
79
|
+
total: number;
|
|
80
|
+
page: number;
|
|
81
|
+
perPage: number;
|
|
82
|
+
hasMore: boolean;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
saveScore(score: ScoreRowData): Promise<{
|
|
86
|
+
score: ScoreRowData;
|
|
87
|
+
}>;
|
|
88
|
+
getScoresByRunId({ runId, pagination, }: {
|
|
89
|
+
runId: string;
|
|
90
|
+
pagination?: {
|
|
91
|
+
page: number;
|
|
92
|
+
perPage: number;
|
|
93
|
+
};
|
|
94
|
+
}): Promise<{
|
|
95
|
+
scores: ScoreRowData[];
|
|
96
|
+
pagination: {
|
|
97
|
+
total: number;
|
|
98
|
+
page: number;
|
|
99
|
+
perPage: number;
|
|
100
|
+
hasMore: boolean;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
104
|
+
entityId: string;
|
|
105
|
+
entityType?: string;
|
|
106
|
+
pagination?: {
|
|
107
|
+
page: number;
|
|
108
|
+
perPage: number;
|
|
109
|
+
};
|
|
110
|
+
}): Promise<{
|
|
111
|
+
scores: ScoreRowData[];
|
|
112
|
+
pagination: {
|
|
113
|
+
total: number;
|
|
114
|
+
page: number;
|
|
115
|
+
perPage: number;
|
|
116
|
+
hasMore: boolean;
|
|
117
|
+
};
|
|
118
|
+
}>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export declare class StoreLegacyEvalsUpstash extends LegacyEvalsStorage {
|
|
122
|
+
private client;
|
|
123
|
+
private operations;
|
|
124
|
+
constructor({ client, operations }: {
|
|
125
|
+
client: Redis;
|
|
126
|
+
operations: StoreOperationsUpstash;
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated Use getEvals instead
|
|
130
|
+
*/
|
|
131
|
+
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
132
|
+
/**
|
|
133
|
+
* Get all evaluations with pagination and total count
|
|
134
|
+
* @param options Pagination and filtering options
|
|
135
|
+
* @returns Object with evals array and total count
|
|
136
|
+
*/
|
|
137
|
+
getEvals(options?: {
|
|
138
|
+
agentName?: string;
|
|
139
|
+
type?: 'test' | 'live';
|
|
140
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
141
|
+
evals: EvalRow[];
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export declare class StoreMemoryUpstash extends MemoryStorage {
|
|
146
|
+
private client;
|
|
147
|
+
private operations;
|
|
148
|
+
constructor({ client, operations }: {
|
|
149
|
+
client: Redis;
|
|
150
|
+
operations: StoreOperationsUpstash;
|
|
151
|
+
});
|
|
152
|
+
getThreadById({ threadId }: {
|
|
153
|
+
threadId: string;
|
|
154
|
+
}): Promise<StorageThreadType | null>;
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
157
|
+
*/
|
|
158
|
+
getThreadsByResourceId({ resourceId }: {
|
|
159
|
+
resourceId: string;
|
|
160
|
+
}): Promise<StorageThreadType[]>;
|
|
161
|
+
getThreadsByResourceIdPaginated(args: {
|
|
162
|
+
resourceId: string;
|
|
163
|
+
page: number;
|
|
164
|
+
perPage: number;
|
|
165
|
+
}): Promise<PaginationInfo & {
|
|
166
|
+
threads: StorageThreadType[];
|
|
167
|
+
}>;
|
|
168
|
+
saveThread({ thread }: {
|
|
169
|
+
thread: StorageThreadType;
|
|
170
|
+
}): Promise<StorageThreadType>;
|
|
171
|
+
updateThread({ id, title, metadata, }: {
|
|
172
|
+
id: string;
|
|
173
|
+
title: string;
|
|
174
|
+
metadata: Record<string, unknown>;
|
|
175
|
+
}): Promise<StorageThreadType>;
|
|
176
|
+
deleteThread({ threadId }: {
|
|
177
|
+
threadId: string;
|
|
178
|
+
}): Promise<void>;
|
|
179
|
+
saveMessages(args: {
|
|
180
|
+
messages: MastraMessageV1[];
|
|
181
|
+
format?: undefined | 'v1';
|
|
182
|
+
}): Promise<MastraMessageV1[]>;
|
|
183
|
+
saveMessages(args: {
|
|
184
|
+
messages: MastraMessageV2_2[];
|
|
185
|
+
format: 'v2';
|
|
186
|
+
}): Promise<MastraMessageV2_2[]>;
|
|
187
|
+
private _getIncludedMessages;
|
|
188
|
+
/**
|
|
189
|
+
* @deprecated use getMessagesPaginated instead
|
|
190
|
+
*/
|
|
191
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
192
|
+
format?: 'v1';
|
|
193
|
+
}): Promise<MastraMessageV1[]>;
|
|
194
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
195
|
+
format: 'v2';
|
|
196
|
+
}): Promise<MastraMessageV2_2[]>;
|
|
197
|
+
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
198
|
+
format?: 'v1' | 'v2';
|
|
199
|
+
}): Promise<PaginationInfo & {
|
|
200
|
+
messages: MastraMessageV1[] | MastraMessageV2_2[];
|
|
201
|
+
}>;
|
|
202
|
+
getResourceById({ resourceId }: {
|
|
203
|
+
resourceId: string;
|
|
204
|
+
}): Promise<StorageResourceType | null>;
|
|
205
|
+
saveResource({ resource }: {
|
|
206
|
+
resource: StorageResourceType;
|
|
207
|
+
}): Promise<StorageResourceType>;
|
|
208
|
+
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
209
|
+
resourceId: string;
|
|
210
|
+
workingMemory?: string;
|
|
211
|
+
metadata?: Record<string, unknown>;
|
|
212
|
+
}): Promise<StorageResourceType>;
|
|
213
|
+
updateMessages(args: {
|
|
214
|
+
messages: (Partial<Omit<MastraMessageV2_2, 'createdAt'>> & {
|
|
215
|
+
id: string;
|
|
216
|
+
content?: {
|
|
217
|
+
metadata?: MastraMessageContentV2['metadata'];
|
|
218
|
+
content?: MastraMessageContentV2['content'];
|
|
219
|
+
};
|
|
220
|
+
})[];
|
|
221
|
+
}): Promise<MastraMessageV2_2[]>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export declare class StoreOperationsUpstash extends StoreOperations {
|
|
225
|
+
private client;
|
|
226
|
+
constructor({ client }: {
|
|
227
|
+
client: Redis;
|
|
228
|
+
});
|
|
229
|
+
createTable({ tableName: _tableName, schema: _schema, }: {
|
|
230
|
+
tableName: TABLE_NAMES;
|
|
231
|
+
schema: Record<string, StorageColumn>;
|
|
232
|
+
}): Promise<void>;
|
|
233
|
+
alterTable({ tableName: _tableName, schema: _schema, ifNotExists: _ifNotExists, }: {
|
|
234
|
+
tableName: TABLE_NAMES;
|
|
235
|
+
schema: Record<string, StorageColumn>;
|
|
236
|
+
ifNotExists: string[];
|
|
237
|
+
}): Promise<void>;
|
|
238
|
+
clearTable({ tableName }: {
|
|
239
|
+
tableName: TABLE_NAMES;
|
|
240
|
+
}): Promise<void>;
|
|
241
|
+
dropTable({ tableName }: {
|
|
242
|
+
tableName: TABLE_NAMES;
|
|
243
|
+
}): Promise<void>;
|
|
244
|
+
insert({ tableName, record }: {
|
|
245
|
+
tableName: TABLE_NAMES;
|
|
246
|
+
record: Record<string, any>;
|
|
247
|
+
}): Promise<void>;
|
|
248
|
+
batchInsert(input: {
|
|
249
|
+
tableName: TABLE_NAMES;
|
|
250
|
+
records: Record<string, any>[];
|
|
251
|
+
}): Promise<void>;
|
|
252
|
+
load<R>({ tableName, keys }: {
|
|
253
|
+
tableName: TABLE_NAMES;
|
|
254
|
+
keys: Record<string, string>;
|
|
255
|
+
}): Promise<R | null>;
|
|
256
|
+
hasColumn(_tableName: TABLE_NAMES, _column: string): Promise<boolean>;
|
|
257
|
+
scanKeys(pattern: string, batchSize?: number): Promise<string[]>;
|
|
258
|
+
scanAndDelete(pattern: string, batchSize?: number): Promise<number>;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export declare class TracesUpstash extends TracesStorage {
|
|
262
|
+
private client;
|
|
263
|
+
private operations;
|
|
264
|
+
constructor({ client, operations }: {
|
|
265
|
+
client: Redis;
|
|
266
|
+
operations: StoreOperationsUpstash;
|
|
267
|
+
});
|
|
268
|
+
/**
|
|
269
|
+
* @deprecated use getTracesPaginated instead
|
|
270
|
+
*/
|
|
271
|
+
getTraces(args: StorageGetTracesArg): Promise<any[]>;
|
|
272
|
+
getTracesPaginated(args: {
|
|
273
|
+
name?: string;
|
|
274
|
+
scope?: string;
|
|
275
|
+
attributes?: Record<string, string>;
|
|
276
|
+
filters?: Record<string, any>;
|
|
277
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
278
|
+
traces: any[];
|
|
279
|
+
}>;
|
|
280
|
+
batchTraceInsert(args: {
|
|
281
|
+
records: Record<string, any>[];
|
|
282
|
+
}): Promise<void>;
|
|
283
|
+
}
|
|
31
284
|
|
|
32
285
|
/**
|
|
33
286
|
* Vector store specific prompt that details supported operators and examples.
|
|
@@ -66,34 +319,29 @@ declare type UpstashQueryVectorParams = QueryVectorParams<UpstashVectorFilter>;
|
|
|
66
319
|
|
|
67
320
|
declare class UpstashStore extends MastraStorage {
|
|
68
321
|
private redis;
|
|
322
|
+
stores: StorageDomains;
|
|
69
323
|
constructor(config: UpstashConfig);
|
|
70
324
|
get supports(): {
|
|
71
325
|
selectByIncludeResourceScope: boolean;
|
|
72
326
|
resourceWorkingMemory: boolean;
|
|
327
|
+
hasColumn: boolean;
|
|
328
|
+
createTable: boolean;
|
|
73
329
|
};
|
|
74
|
-
private transformEvalRecord;
|
|
75
|
-
private parseJSON;
|
|
76
|
-
private getKey;
|
|
77
|
-
/**
|
|
78
|
-
* Scans for keys matching the given pattern using SCAN and returns them as an array.
|
|
79
|
-
* @param pattern Redis key pattern, e.g. "table:*"
|
|
80
|
-
* @param batchSize Number of keys to scan per batch (default: 1000)
|
|
81
|
-
*/
|
|
82
|
-
private scanKeys;
|
|
83
|
-
/**
|
|
84
|
-
* Deletes all keys matching the given pattern using SCAN and DEL in batches.
|
|
85
|
-
* @param pattern Redis key pattern, e.g. "table:*"
|
|
86
|
-
* @param batchSize Number of keys to delete per batch (default: 1000)
|
|
87
|
-
*/
|
|
88
|
-
private scanAndDelete;
|
|
89
|
-
private getMessageKey;
|
|
90
|
-
private getThreadMessagesKey;
|
|
91
|
-
private parseWorkflowRun;
|
|
92
|
-
private processRecord;
|
|
93
330
|
/**
|
|
94
331
|
* @deprecated Use getEvals instead
|
|
95
332
|
*/
|
|
96
333
|
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
334
|
+
/**
|
|
335
|
+
* Get all evaluations with pagination and total count
|
|
336
|
+
* @param options Pagination and filtering options
|
|
337
|
+
* @returns Object with evals array and total count
|
|
338
|
+
*/
|
|
339
|
+
getEvals(options: {
|
|
340
|
+
agentName?: string;
|
|
341
|
+
type?: 'test' | 'live';
|
|
342
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
343
|
+
evals: EvalRow[];
|
|
344
|
+
}>;
|
|
97
345
|
/**
|
|
98
346
|
* @deprecated use getTracesPaginated instead
|
|
99
347
|
*/
|
|
@@ -106,6 +354,9 @@ declare class UpstashStore extends MastraStorage {
|
|
|
106
354
|
} & PaginationArgs): Promise<PaginationInfo & {
|
|
107
355
|
traces: any[];
|
|
108
356
|
}>;
|
|
357
|
+
batchTraceInsert(args: {
|
|
358
|
+
records: Record<string, any>[];
|
|
359
|
+
}): Promise<void>;
|
|
109
360
|
createTable({ tableName, schema, }: {
|
|
110
361
|
tableName: TABLE_NAMES;
|
|
111
362
|
schema: Record<string, StorageColumn>;
|
|
@@ -116,7 +367,7 @@ declare class UpstashStore extends MastraStorage {
|
|
|
116
367
|
* @param schema Schema of the table
|
|
117
368
|
* @param ifNotExists Array of column names to add if they don't exist
|
|
118
369
|
*/
|
|
119
|
-
alterTable(
|
|
370
|
+
alterTable(args: {
|
|
120
371
|
tableName: TABLE_NAMES;
|
|
121
372
|
schema: Record<string, StorageColumn>;
|
|
122
373
|
ifNotExists: string[];
|
|
@@ -124,6 +375,9 @@ declare class UpstashStore extends MastraStorage {
|
|
|
124
375
|
clearTable({ tableName }: {
|
|
125
376
|
tableName: TABLE_NAMES;
|
|
126
377
|
}): Promise<void>;
|
|
378
|
+
dropTable({ tableName }: {
|
|
379
|
+
tableName: TABLE_NAMES;
|
|
380
|
+
}): Promise<void>;
|
|
127
381
|
insert({ tableName, record }: {
|
|
128
382
|
tableName: TABLE_NAMES;
|
|
129
383
|
record: Record<string, any>;
|
|
@@ -147,7 +401,9 @@ declare class UpstashStore extends MastraStorage {
|
|
|
147
401
|
}): Promise<StorageThreadType[]>;
|
|
148
402
|
getThreadsByResourceIdPaginated(args: {
|
|
149
403
|
resourceId: string;
|
|
150
|
-
|
|
404
|
+
page: number;
|
|
405
|
+
perPage: number;
|
|
406
|
+
}): Promise<PaginationInfo & {
|
|
151
407
|
threads: StorageThreadType[];
|
|
152
408
|
}>;
|
|
153
409
|
saveThread({ thread }: {
|
|
@@ -169,7 +425,6 @@ declare class UpstashStore extends MastraStorage {
|
|
|
169
425
|
messages: MastraMessageV2[];
|
|
170
426
|
format: 'v2';
|
|
171
427
|
}): Promise<MastraMessageV2[]>;
|
|
172
|
-
private _getIncludedMessages;
|
|
173
428
|
/**
|
|
174
429
|
* @deprecated use getMessagesPaginated instead
|
|
175
430
|
*/
|
|
@@ -195,19 +450,7 @@ declare class UpstashStore extends MastraStorage {
|
|
|
195
450
|
workflowName: string;
|
|
196
451
|
runId: string;
|
|
197
452
|
}): Promise<WorkflowRunState | null>;
|
|
198
|
-
|
|
199
|
-
* Get all evaluations with pagination and total count
|
|
200
|
-
* @param options Pagination and filtering options
|
|
201
|
-
* @returns Object with evals array and total count
|
|
202
|
-
*/
|
|
203
|
-
getEvals(options?: {
|
|
204
|
-
agentName?: string;
|
|
205
|
-
type?: 'test' | 'live';
|
|
206
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
207
|
-
evals: EvalRow[];
|
|
208
|
-
}>;
|
|
209
|
-
getWorkflowRuns({ namespace, workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
210
|
-
namespace: string;
|
|
453
|
+
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
211
454
|
workflowName?: string;
|
|
212
455
|
fromDate?: Date;
|
|
213
456
|
toDate?: Date;
|
|
@@ -215,20 +458,19 @@ declare class UpstashStore extends MastraStorage {
|
|
|
215
458
|
offset?: number;
|
|
216
459
|
resourceId?: string;
|
|
217
460
|
}): Promise<WorkflowRuns>;
|
|
218
|
-
getWorkflowRunById({
|
|
219
|
-
namespace: string;
|
|
461
|
+
getWorkflowRunById({ runId, workflowName, }: {
|
|
220
462
|
runId: string;
|
|
221
463
|
workflowName?: string;
|
|
222
464
|
}): Promise<WorkflowRun | null>;
|
|
223
465
|
close(): Promise<void>;
|
|
224
|
-
updateMessages(
|
|
225
|
-
messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
466
|
+
updateMessages(args: {
|
|
467
|
+
messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
226
468
|
id: string;
|
|
227
469
|
content?: {
|
|
228
470
|
metadata?: MastraMessageContentV2['metadata'];
|
|
229
471
|
content?: MastraMessageContentV2['content'];
|
|
230
472
|
};
|
|
231
|
-
}[];
|
|
473
|
+
})[];
|
|
232
474
|
}): Promise<MastraMessageV2[]>;
|
|
233
475
|
getResourceById({ resourceId }: {
|
|
234
476
|
resourceId: string;
|
|
@@ -241,6 +483,34 @@ declare class UpstashStore extends MastraStorage {
|
|
|
241
483
|
workingMemory?: string;
|
|
242
484
|
metadata?: Record<string, unknown>;
|
|
243
485
|
}): Promise<StorageResourceType>;
|
|
486
|
+
getScoreById({ id: _id }: {
|
|
487
|
+
id: string;
|
|
488
|
+
}): Promise<ScoreRowData | null>;
|
|
489
|
+
saveScore(score: ScoreRowData): Promise<{
|
|
490
|
+
score: ScoreRowData;
|
|
491
|
+
}>;
|
|
492
|
+
getScoresByRunId({ runId, pagination, }: {
|
|
493
|
+
runId: string;
|
|
494
|
+
pagination: StoragePagination;
|
|
495
|
+
}): Promise<{
|
|
496
|
+
pagination: PaginationInfo;
|
|
497
|
+
scores: ScoreRowData[];
|
|
498
|
+
}>;
|
|
499
|
+
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
500
|
+
pagination: StoragePagination;
|
|
501
|
+
entityId: string;
|
|
502
|
+
entityType: string;
|
|
503
|
+
}): Promise<{
|
|
504
|
+
pagination: PaginationInfo;
|
|
505
|
+
scores: ScoreRowData[];
|
|
506
|
+
}>;
|
|
507
|
+
getScoresByScorerId({ scorerId, pagination, }: {
|
|
508
|
+
scorerId: string;
|
|
509
|
+
pagination: StoragePagination;
|
|
510
|
+
}): Promise<{
|
|
511
|
+
pagination: PaginationInfo;
|
|
512
|
+
scores: ScoreRowData[];
|
|
513
|
+
}>;
|
|
244
514
|
}
|
|
245
515
|
export { UpstashStore }
|
|
246
516
|
export { UpstashStore as UpstashStore_alias_1 }
|
|
@@ -324,4 +594,36 @@ export { UpstashVector as UpstashVector_alias_1 }
|
|
|
324
594
|
|
|
325
595
|
export declare type UpstashVectorFilter = VectorFilter<keyof UpstashOperatorValueMap, UpstashOperatorValueMap>;
|
|
326
596
|
|
|
597
|
+
export declare class WorkflowsUpstash extends WorkflowsStorage {
|
|
598
|
+
private client;
|
|
599
|
+
private operations;
|
|
600
|
+
constructor({ client, operations }: {
|
|
601
|
+
client: Redis;
|
|
602
|
+
operations: StoreOperationsUpstash;
|
|
603
|
+
});
|
|
604
|
+
persistWorkflowSnapshot(params: {
|
|
605
|
+
namespace: string;
|
|
606
|
+
workflowName: string;
|
|
607
|
+
runId: string;
|
|
608
|
+
snapshot: WorkflowRunState_2;
|
|
609
|
+
}): Promise<void>;
|
|
610
|
+
loadWorkflowSnapshot(params: {
|
|
611
|
+
namespace: string;
|
|
612
|
+
workflowName: string;
|
|
613
|
+
runId: string;
|
|
614
|
+
}): Promise<WorkflowRunState_2 | null>;
|
|
615
|
+
getWorkflowRunById({ runId, workflowName, }: {
|
|
616
|
+
runId: string;
|
|
617
|
+
workflowName?: string;
|
|
618
|
+
}): Promise<WorkflowRun_2 | null>;
|
|
619
|
+
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }: {
|
|
620
|
+
workflowName?: string;
|
|
621
|
+
fromDate?: Date;
|
|
622
|
+
toDate?: Date;
|
|
623
|
+
limit?: number;
|
|
624
|
+
offset?: number;
|
|
625
|
+
resourceId?: string;
|
|
626
|
+
}): Promise<WorkflowRuns_2>;
|
|
627
|
+
}
|
|
628
|
+
|
|
327
629
|
export { }
|