@mastra/upstash 0.1.0-alpha.9 → 0.1.1-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 +18 -0
- package/CHANGELOG.md +283 -0
- package/dist/_tsup-dts-rollup.d.ts +129 -0
- package/dist/index.d.ts +3 -88
- package/dist/index.js +24 -9
- package/package.json +6 -5
- package/src/storage/index.ts +28 -1
- package/src/vector/filter.ts +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
> @mastra/upstash@0.1.0-alpha.5 build C:\Users\Ward\projects\mastra\mastra\stores\upstash
|
|
3
|
+
> tsup src/index.ts --format esm --experimental-dts --clean --treeshake
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.3.6
|
|
8
|
+
[34mTSC[39m Build start
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 2872ms
|
|
10
|
+
[34mDTS[39m Build start
|
|
11
|
+
[34mCLI[39m Target: es2022
|
|
12
|
+
Analysis will use the bundled TypeScript version 5.7.3
|
|
13
|
+
[36mWriting package typings: C:\Users\Ward\projects\mastra\mastra\stores\upstash\dist\_tsup-dts-rollup.d.ts[39m
|
|
14
|
+
[32mDTS[39m ⚡️ Build success in 2613ms
|
|
15
|
+
[34mCLI[39m Cleaning output folder
|
|
16
|
+
[34mESM[39m Build start
|
|
17
|
+
[32mESM[39m [1mdist\index.js [22m[32m15.82 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 166ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,288 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 0.1.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d59f1a8]
|
|
8
|
+
- Updated dependencies [91ef439]
|
|
9
|
+
- Updated dependencies [4a25be4]
|
|
10
|
+
- Updated dependencies [bf2e88f]
|
|
11
|
+
- Updated dependencies [2f0d707]
|
|
12
|
+
- Updated dependencies [aac1667]
|
|
13
|
+
- @mastra/core@0.2.1-alpha.0
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- c87eb4e: Combine Upstash packages into `@mastra/upstash`.
|
|
20
|
+
|
|
21
|
+
- Move and combine packages to `stores/upstash`
|
|
22
|
+
- Reorganize source files into `src/vector` and `src/store`
|
|
23
|
+
- Add deprecation notices to old packages
|
|
24
|
+
- Update documentation and examples
|
|
25
|
+
- No breaking changes in functionality
|
|
26
|
+
|
|
27
|
+
- 8b416d9: Breaking changes
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- b97ca96: Tracing into default storage
|
|
32
|
+
- 07c069d: Update build script
|
|
33
|
+
- 9c10484: update all packages
|
|
34
|
+
- 70dabd9: Fix broken publish
|
|
35
|
+
- 4f1d1a1: Enforce types ann cleanup package.json
|
|
36
|
+
- Updated dependencies [f537e33]
|
|
37
|
+
- Updated dependencies [6f2c0f5]
|
|
38
|
+
- Updated dependencies [e4d4ede]
|
|
39
|
+
- Updated dependencies [0be7181]
|
|
40
|
+
- Updated dependencies [dd6d87f]
|
|
41
|
+
- Updated dependencies [9029796]
|
|
42
|
+
- Updated dependencies [6fa4bd2]
|
|
43
|
+
- Updated dependencies [f031a1f]
|
|
44
|
+
- Updated dependencies [8151f44]
|
|
45
|
+
- Updated dependencies [d7d465a]
|
|
46
|
+
- Updated dependencies [4d4f6b6]
|
|
47
|
+
- Updated dependencies [73d112c]
|
|
48
|
+
- Updated dependencies [592e3cf]
|
|
49
|
+
- Updated dependencies [9d1796d]
|
|
50
|
+
- Updated dependencies [e897f1c]
|
|
51
|
+
- Updated dependencies [4a54c82]
|
|
52
|
+
- Updated dependencies [3967e69]
|
|
53
|
+
- Updated dependencies [8ae2bbc]
|
|
54
|
+
- Updated dependencies [e9d1b47]
|
|
55
|
+
- Updated dependencies [016493a]
|
|
56
|
+
- Updated dependencies [bc40916]
|
|
57
|
+
- Updated dependencies [93a3719]
|
|
58
|
+
- Updated dependencies [7d83b92]
|
|
59
|
+
- Updated dependencies [9fb3039]
|
|
60
|
+
- Updated dependencies [d5e12de]
|
|
61
|
+
- Updated dependencies [e1dd94a]
|
|
62
|
+
- Updated dependencies [07c069d]
|
|
63
|
+
- Updated dependencies [5cdfb88]
|
|
64
|
+
- Updated dependencies [837a288]
|
|
65
|
+
- Updated dependencies [685108a]
|
|
66
|
+
- Updated dependencies [c8ff2f5]
|
|
67
|
+
- Updated dependencies [5fdc87c]
|
|
68
|
+
- Updated dependencies [ae7bf94]
|
|
69
|
+
- Updated dependencies [8e7814f]
|
|
70
|
+
- Updated dependencies [66a03ec]
|
|
71
|
+
- Updated dependencies [7d87a15]
|
|
72
|
+
- Updated dependencies [b97ca96]
|
|
73
|
+
- Updated dependencies [23dcb23]
|
|
74
|
+
- Updated dependencies [033eda6]
|
|
75
|
+
- Updated dependencies [8105fae]
|
|
76
|
+
- Updated dependencies [e097800]
|
|
77
|
+
- Updated dependencies [1944807]
|
|
78
|
+
- Updated dependencies [30322ce]
|
|
79
|
+
- Updated dependencies [1874f40]
|
|
80
|
+
- Updated dependencies [685108a]
|
|
81
|
+
- Updated dependencies [f7d1131]
|
|
82
|
+
- Updated dependencies [79acad0]
|
|
83
|
+
- Updated dependencies [7a19083]
|
|
84
|
+
- Updated dependencies [382f4dc]
|
|
85
|
+
- Updated dependencies [1ebd071]
|
|
86
|
+
- Updated dependencies [0b74006]
|
|
87
|
+
- Updated dependencies [2f17a5f]
|
|
88
|
+
- Updated dependencies [f368477]
|
|
89
|
+
- Updated dependencies [7892533]
|
|
90
|
+
- Updated dependencies [9c10484]
|
|
91
|
+
- Updated dependencies [b726bf5]
|
|
92
|
+
- Updated dependencies [70dabd9]
|
|
93
|
+
- Updated dependencies [21fe536]
|
|
94
|
+
- Updated dependencies [176bc42]
|
|
95
|
+
- Updated dependencies [401a4d9]
|
|
96
|
+
- Updated dependencies [2e099d2]
|
|
97
|
+
- Updated dependencies [0b826f6]
|
|
98
|
+
- Updated dependencies [d68b532]
|
|
99
|
+
- Updated dependencies [75bf3f0]
|
|
100
|
+
- Updated dependencies [e6d8055]
|
|
101
|
+
- Updated dependencies [e2e76de]
|
|
102
|
+
- Updated dependencies [ccbc581]
|
|
103
|
+
- Updated dependencies [5950de5]
|
|
104
|
+
- Updated dependencies [fe3dcb0]
|
|
105
|
+
- Updated dependencies [78eec7c]
|
|
106
|
+
- Updated dependencies [a8a459a]
|
|
107
|
+
- Updated dependencies [0be7181]
|
|
108
|
+
- Updated dependencies [7b87567]
|
|
109
|
+
- Updated dependencies [b524c22]
|
|
110
|
+
- Updated dependencies [d7d465a]
|
|
111
|
+
- Updated dependencies [df843d3]
|
|
112
|
+
- Updated dependencies [4534e77]
|
|
113
|
+
- Updated dependencies [d6d8159]
|
|
114
|
+
- Updated dependencies [0bd142c]
|
|
115
|
+
- Updated dependencies [9625602]
|
|
116
|
+
- Updated dependencies [72d1990]
|
|
117
|
+
- Updated dependencies [f6ba259]
|
|
118
|
+
- Updated dependencies [2712098]
|
|
119
|
+
- Updated dependencies [eedb829]
|
|
120
|
+
- Updated dependencies [5285356]
|
|
121
|
+
- Updated dependencies [74b3078]
|
|
122
|
+
- Updated dependencies [cb290ee]
|
|
123
|
+
- Updated dependencies [b4d7416]
|
|
124
|
+
- Updated dependencies [e608d8c]
|
|
125
|
+
- Updated dependencies [06b2c0a]
|
|
126
|
+
- Updated dependencies [002d6d8]
|
|
127
|
+
- Updated dependencies [e448a26]
|
|
128
|
+
- Updated dependencies [8b416d9]
|
|
129
|
+
- Updated dependencies [fd494a3]
|
|
130
|
+
- Updated dependencies [dc90663]
|
|
131
|
+
- Updated dependencies [c872875]
|
|
132
|
+
- Updated dependencies [3c4488b]
|
|
133
|
+
- Updated dependencies [a7b016d]
|
|
134
|
+
- Updated dependencies [fd75f3c]
|
|
135
|
+
- Updated dependencies [7f24c29]
|
|
136
|
+
- Updated dependencies [2017553]
|
|
137
|
+
- Updated dependencies [a10b7a3]
|
|
138
|
+
- Updated dependencies [cf6d825]
|
|
139
|
+
- Updated dependencies [963c15a]
|
|
140
|
+
- Updated dependencies [7365b6c]
|
|
141
|
+
- Updated dependencies [5ee67d3]
|
|
142
|
+
- Updated dependencies [d38f7a6]
|
|
143
|
+
- Updated dependencies [38b7f66]
|
|
144
|
+
- Updated dependencies [2fa7f53]
|
|
145
|
+
- Updated dependencies [1420ae2]
|
|
146
|
+
- Updated dependencies [f6da688]
|
|
147
|
+
- Updated dependencies [3700be1]
|
|
148
|
+
- Updated dependencies [9ade36e]
|
|
149
|
+
- Updated dependencies [10870bc]
|
|
150
|
+
- Updated dependencies [2b01511]
|
|
151
|
+
- Updated dependencies [a870123]
|
|
152
|
+
- Updated dependencies [ccf115c]
|
|
153
|
+
- Updated dependencies [04434b6]
|
|
154
|
+
- Updated dependencies [5811de6]
|
|
155
|
+
- Updated dependencies [9f3ab05]
|
|
156
|
+
- Updated dependencies [66a5392]
|
|
157
|
+
- Updated dependencies [4b1ce2c]
|
|
158
|
+
- Updated dependencies [14064f2]
|
|
159
|
+
- Updated dependencies [f5dfa20]
|
|
160
|
+
- Updated dependencies [327ece7]
|
|
161
|
+
- Updated dependencies [da2e8d3]
|
|
162
|
+
- Updated dependencies [95a4697]
|
|
163
|
+
- Updated dependencies [d5fccfb]
|
|
164
|
+
- Updated dependencies [3427b95]
|
|
165
|
+
- Updated dependencies [538a136]
|
|
166
|
+
- Updated dependencies [e66643a]
|
|
167
|
+
- Updated dependencies [b5393f1]
|
|
168
|
+
- Updated dependencies [d2cd535]
|
|
169
|
+
- Updated dependencies [c2dd6b5]
|
|
170
|
+
- Updated dependencies [67637ba]
|
|
171
|
+
- Updated dependencies [836f4e3]
|
|
172
|
+
- Updated dependencies [5ee2e78]
|
|
173
|
+
- Updated dependencies [cd02c56]
|
|
174
|
+
- Updated dependencies [01502b0]
|
|
175
|
+
- Updated dependencies [16e5b04]
|
|
176
|
+
- Updated dependencies [d9c8dd0]
|
|
177
|
+
- Updated dependencies [9fb59d6]
|
|
178
|
+
- Updated dependencies [a9345f9]
|
|
179
|
+
- Updated dependencies [99f1847]
|
|
180
|
+
- Updated dependencies [04f3171]
|
|
181
|
+
- Updated dependencies [8769a62]
|
|
182
|
+
- Updated dependencies [d5ec619]
|
|
183
|
+
- Updated dependencies [27275c9]
|
|
184
|
+
- Updated dependencies [ae7bf94]
|
|
185
|
+
- Updated dependencies [4f1d1a1]
|
|
186
|
+
- Updated dependencies [ee4de15]
|
|
187
|
+
- Updated dependencies [202d404]
|
|
188
|
+
- Updated dependencies [a221426]
|
|
189
|
+
- @mastra/core@0.2.0
|
|
190
|
+
|
|
191
|
+
## 0.1.0-alpha.20
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- Updated dependencies [016493a]
|
|
196
|
+
- Updated dependencies [382f4dc]
|
|
197
|
+
- Updated dependencies [176bc42]
|
|
198
|
+
- Updated dependencies [d68b532]
|
|
199
|
+
- Updated dependencies [fe3dcb0]
|
|
200
|
+
- Updated dependencies [e448a26]
|
|
201
|
+
- Updated dependencies [fd75f3c]
|
|
202
|
+
- Updated dependencies [ccf115c]
|
|
203
|
+
- Updated dependencies [a221426]
|
|
204
|
+
- @mastra/core@0.2.0-alpha.110
|
|
205
|
+
|
|
206
|
+
## 0.1.0-alpha.19
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- Updated dependencies [d5fccfb]
|
|
211
|
+
- @mastra/core@0.2.0-alpha.109
|
|
212
|
+
|
|
213
|
+
## 0.1.0-alpha.18
|
|
214
|
+
|
|
215
|
+
### Patch Changes
|
|
216
|
+
|
|
217
|
+
- Updated dependencies [5ee67d3]
|
|
218
|
+
- Updated dependencies [95a4697]
|
|
219
|
+
- @mastra/core@0.2.0-alpha.108
|
|
220
|
+
|
|
221
|
+
## 0.1.0-alpha.17
|
|
222
|
+
|
|
223
|
+
### Patch Changes
|
|
224
|
+
|
|
225
|
+
- Updated dependencies [66a5392]
|
|
226
|
+
- @mastra/core@0.2.0-alpha.107
|
|
227
|
+
|
|
228
|
+
## 0.1.0-alpha.16
|
|
229
|
+
|
|
230
|
+
### Patch Changes
|
|
231
|
+
|
|
232
|
+
- Updated dependencies [6f2c0f5]
|
|
233
|
+
- Updated dependencies [a8a459a]
|
|
234
|
+
- @mastra/core@0.2.0-alpha.106
|
|
235
|
+
|
|
236
|
+
## 0.1.0-alpha.15
|
|
237
|
+
|
|
238
|
+
### Patch Changes
|
|
239
|
+
|
|
240
|
+
- Updated dependencies [1420ae2]
|
|
241
|
+
- Updated dependencies [99f1847]
|
|
242
|
+
- @mastra/core@0.2.0-alpha.105
|
|
243
|
+
|
|
244
|
+
## 0.1.0-alpha.14
|
|
245
|
+
|
|
246
|
+
### Patch Changes
|
|
247
|
+
|
|
248
|
+
- b97ca96: Tracing into default storage
|
|
249
|
+
- Updated dependencies [5fdc87c]
|
|
250
|
+
- Updated dependencies [b97ca96]
|
|
251
|
+
- Updated dependencies [72d1990]
|
|
252
|
+
- Updated dependencies [cf6d825]
|
|
253
|
+
- Updated dependencies [10870bc]
|
|
254
|
+
- @mastra/core@0.2.0-alpha.104
|
|
255
|
+
|
|
256
|
+
## 0.1.0-alpha.13
|
|
257
|
+
|
|
258
|
+
### Patch Changes
|
|
259
|
+
|
|
260
|
+
- Updated dependencies [4534e77]
|
|
261
|
+
- @mastra/core@0.2.0-alpha.103
|
|
262
|
+
|
|
263
|
+
## 0.1.0-alpha.12
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- Updated dependencies [a9345f9]
|
|
268
|
+
- @mastra/core@0.2.0-alpha.102
|
|
269
|
+
|
|
270
|
+
## 0.1.0-alpha.11
|
|
271
|
+
|
|
272
|
+
### Patch Changes
|
|
273
|
+
|
|
274
|
+
- 4f1d1a1: Enforce types ann cleanup package.json
|
|
275
|
+
- Updated dependencies [66a03ec]
|
|
276
|
+
- Updated dependencies [4f1d1a1]
|
|
277
|
+
- @mastra/core@0.2.0-alpha.101
|
|
278
|
+
|
|
279
|
+
## 0.1.0-alpha.10
|
|
280
|
+
|
|
281
|
+
### Patch Changes
|
|
282
|
+
|
|
283
|
+
- Updated dependencies [9d1796d]
|
|
284
|
+
- @mastra/core@0.2.0-alpha.100
|
|
285
|
+
|
|
3
286
|
## 0.1.0-alpha.9
|
|
4
287
|
|
|
5
288
|
### Patch Changes
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { BaseFilterTranslator } from '@mastra/core/filter';
|
|
2
|
+
import { EvalRow } from '@mastra/core/storage';
|
|
3
|
+
import { Filter } from '@mastra/core/filter';
|
|
4
|
+
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
+
import { MastraVector } from '@mastra/core/vector';
|
|
6
|
+
import { MessageType } from '@mastra/core/memory';
|
|
7
|
+
import { OperatorSupport } from '@mastra/core/filter';
|
|
8
|
+
import type { QueryResult } from '@mastra/core/vector';
|
|
9
|
+
import { StorageColumn } from '@mastra/core/storage';
|
|
10
|
+
import { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
11
|
+
import { StorageThreadType } from '@mastra/core/memory';
|
|
12
|
+
import { TABLE_NAMES } from '@mastra/core/storage';
|
|
13
|
+
import { WorkflowRunState } from '@mastra/core/workflows';
|
|
14
|
+
|
|
15
|
+
declare interface UpstashConfig {
|
|
16
|
+
url: string;
|
|
17
|
+
token: string;
|
|
18
|
+
}
|
|
19
|
+
export { UpstashConfig }
|
|
20
|
+
export { UpstashConfig as UpstashConfig_alias_1 }
|
|
21
|
+
|
|
22
|
+
export declare class UpstashFilterTranslator extends BaseFilterTranslator {
|
|
23
|
+
protected getSupportedOperators(): OperatorSupport;
|
|
24
|
+
translate(filter?: Filter): string | undefined;
|
|
25
|
+
private translateNode;
|
|
26
|
+
private readonly COMPARISON_OPS;
|
|
27
|
+
private translateOperator;
|
|
28
|
+
private readonly NEGATED_OPERATORS;
|
|
29
|
+
private formatNot;
|
|
30
|
+
private formatValue;
|
|
31
|
+
private formatArray;
|
|
32
|
+
private formatComparison;
|
|
33
|
+
private joinConditions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class UpstashStore extends MastraStorage {
|
|
37
|
+
batchInsert({ tableName, records }: {
|
|
38
|
+
tableName: TABLE_NAMES;
|
|
39
|
+
records: Record<string, any>[];
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
42
|
+
getTraces({ name, scope, page, perPage, attributes, }: {
|
|
43
|
+
name?: string;
|
|
44
|
+
scope?: string;
|
|
45
|
+
page: number;
|
|
46
|
+
perPage: number;
|
|
47
|
+
attributes?: Record<string, string>;
|
|
48
|
+
}): Promise<any[]>;
|
|
49
|
+
private redis;
|
|
50
|
+
constructor(config: UpstashConfig);
|
|
51
|
+
private getKey;
|
|
52
|
+
private ensureDate;
|
|
53
|
+
private serializeDate;
|
|
54
|
+
createTable({ tableName, schema, }: {
|
|
55
|
+
tableName: TABLE_NAMES;
|
|
56
|
+
schema: Record<string, StorageColumn>;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
clearTable({ tableName }: {
|
|
59
|
+
tableName: TABLE_NAMES;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
insert({ tableName, record }: {
|
|
62
|
+
tableName: TABLE_NAMES;
|
|
63
|
+
record: Record<string, any>;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
load<R>({ tableName, keys }: {
|
|
66
|
+
tableName: TABLE_NAMES;
|
|
67
|
+
keys: Record<string, string>;
|
|
68
|
+
}): Promise<R | null>;
|
|
69
|
+
getThreadById({ threadId }: {
|
|
70
|
+
threadId: string;
|
|
71
|
+
}): Promise<StorageThreadType | null>;
|
|
72
|
+
getThreadsByResourceId({ resourceId }: {
|
|
73
|
+
resourceId: string;
|
|
74
|
+
}): Promise<StorageThreadType[]>;
|
|
75
|
+
saveThread({ thread }: {
|
|
76
|
+
thread: StorageThreadType;
|
|
77
|
+
}): Promise<StorageThreadType>;
|
|
78
|
+
updateThread({ id, title, metadata, }: {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
metadata: Record<string, unknown>;
|
|
82
|
+
}): Promise<StorageThreadType>;
|
|
83
|
+
deleteThread({ threadId }: {
|
|
84
|
+
threadId: string;
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
private getMessageKey;
|
|
87
|
+
private getThreadMessagesKey;
|
|
88
|
+
saveMessages({ messages }: {
|
|
89
|
+
messages: MessageType[];
|
|
90
|
+
}): Promise<MessageType[]>;
|
|
91
|
+
getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
|
|
92
|
+
persistWorkflowSnapshot(params: {
|
|
93
|
+
namespace: string;
|
|
94
|
+
workflowName: string;
|
|
95
|
+
runId: string;
|
|
96
|
+
snapshot: WorkflowRunState;
|
|
97
|
+
}): Promise<void>;
|
|
98
|
+
loadWorkflowSnapshot(params: {
|
|
99
|
+
namespace: string;
|
|
100
|
+
workflowName: string;
|
|
101
|
+
runId: string;
|
|
102
|
+
}): Promise<WorkflowRunState | null>;
|
|
103
|
+
close(): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
export { UpstashStore }
|
|
106
|
+
export { UpstashStore as UpstashStore_alias_1 }
|
|
107
|
+
|
|
108
|
+
declare class UpstashVector extends MastraVector {
|
|
109
|
+
private client;
|
|
110
|
+
constructor({ url, token }: {
|
|
111
|
+
url: string;
|
|
112
|
+
token: string;
|
|
113
|
+
});
|
|
114
|
+
upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
|
|
115
|
+
transformFilter(filter?: Filter): string | undefined;
|
|
116
|
+
createIndex(_indexName: string, _dimension: number, _metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
|
|
117
|
+
query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean): Promise<QueryResult[]>;
|
|
118
|
+
listIndexes(): Promise<string[]>;
|
|
119
|
+
describeIndex(indexName: string): Promise<{
|
|
120
|
+
dimension: number;
|
|
121
|
+
count: number;
|
|
122
|
+
metric: "cosine" | "euclidean" | "dotproduct";
|
|
123
|
+
}>;
|
|
124
|
+
deleteIndex(indexName: string): Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
export { UpstashVector }
|
|
127
|
+
export { UpstashVector as UpstashVector_alias_1 }
|
|
128
|
+
|
|
129
|
+
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,88 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { Filter } from '@mastra/core/filter';
|
|
5
|
-
import { MastraVector, QueryResult } from '@mastra/core/vector';
|
|
6
|
-
|
|
7
|
-
interface UpstashConfig {
|
|
8
|
-
url: string;
|
|
9
|
-
token: string;
|
|
10
|
-
}
|
|
11
|
-
declare class UpstashStore extends MastraStorage {
|
|
12
|
-
private redis;
|
|
13
|
-
constructor(config: UpstashConfig);
|
|
14
|
-
private getKey;
|
|
15
|
-
private ensureDate;
|
|
16
|
-
private serializeDate;
|
|
17
|
-
createTable({ tableName, schema, }: {
|
|
18
|
-
tableName: TABLE_NAMES;
|
|
19
|
-
schema: Record<string, StorageColumn>;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
clearTable({ tableName }: {
|
|
22
|
-
tableName: TABLE_NAMES;
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
insert({ tableName, record }: {
|
|
25
|
-
tableName: TABLE_NAMES;
|
|
26
|
-
record: Record<string, any>;
|
|
27
|
-
}): Promise<void>;
|
|
28
|
-
load<R>({ tableName, keys }: {
|
|
29
|
-
tableName: TABLE_NAMES;
|
|
30
|
-
keys: Record<string, string>;
|
|
31
|
-
}): Promise<R | null>;
|
|
32
|
-
getThreadById({ threadId }: {
|
|
33
|
-
threadId: string;
|
|
34
|
-
}): Promise<StorageThreadType | null>;
|
|
35
|
-
getThreadsByResourceId({ resourceId }: {
|
|
36
|
-
resourceId: string;
|
|
37
|
-
}): Promise<StorageThreadType[]>;
|
|
38
|
-
saveThread({ thread }: {
|
|
39
|
-
thread: StorageThreadType;
|
|
40
|
-
}): Promise<StorageThreadType>;
|
|
41
|
-
updateThread({ id, title, metadata, }: {
|
|
42
|
-
id: string;
|
|
43
|
-
title: string;
|
|
44
|
-
metadata: Record<string, unknown>;
|
|
45
|
-
}): Promise<StorageThreadType>;
|
|
46
|
-
deleteThread({ threadId }: {
|
|
47
|
-
threadId: string;
|
|
48
|
-
}): Promise<void>;
|
|
49
|
-
private getMessageKey;
|
|
50
|
-
private getThreadMessagesKey;
|
|
51
|
-
saveMessages({ messages }: {
|
|
52
|
-
messages: MessageType[];
|
|
53
|
-
}): Promise<MessageType[]>;
|
|
54
|
-
getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
|
|
55
|
-
persistWorkflowSnapshot(params: {
|
|
56
|
-
namespace: string;
|
|
57
|
-
workflowName: string;
|
|
58
|
-
runId: string;
|
|
59
|
-
snapshot: WorkflowRunState;
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
loadWorkflowSnapshot(params: {
|
|
62
|
-
namespace: string;
|
|
63
|
-
workflowName: string;
|
|
64
|
-
runId: string;
|
|
65
|
-
}): Promise<WorkflowRunState | null>;
|
|
66
|
-
close(): Promise<void>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
declare class UpstashVector extends MastraVector {
|
|
70
|
-
private client;
|
|
71
|
-
constructor({ url, token }: {
|
|
72
|
-
url: string;
|
|
73
|
-
token: string;
|
|
74
|
-
});
|
|
75
|
-
upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
|
|
76
|
-
transformFilter(filter?: Filter): string | undefined;
|
|
77
|
-
createIndex(_indexName: string, _dimension: number, _metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
|
|
78
|
-
query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean): Promise<QueryResult[]>;
|
|
79
|
-
listIndexes(): Promise<string[]>;
|
|
80
|
-
describeIndex(indexName: string): Promise<{
|
|
81
|
-
dimension: number;
|
|
82
|
-
count: number;
|
|
83
|
-
metric: "cosine" | "euclidean" | "dotproduct";
|
|
84
|
-
}>;
|
|
85
|
-
deleteIndex(indexName: string): Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { type UpstashConfig, UpstashStore, UpstashVector };
|
|
1
|
+
export { UpstashConfig } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { UpstashStore } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { UpstashVector } from './_tsup-dts-rollup.js';
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,21 @@ import { BaseFilterTranslator } from '@mastra/core/filter';
|
|
|
8
8
|
|
|
9
9
|
// src/storage/index.ts
|
|
10
10
|
var UpstashStore = class extends MastraStorage {
|
|
11
|
+
batchInsert({ tableName, records }) {
|
|
12
|
+
throw new Error("Method not implemented.");
|
|
13
|
+
}
|
|
14
|
+
getEvalsByAgentName(agentName, type) {
|
|
15
|
+
throw new Error("Method not implemented.");
|
|
16
|
+
}
|
|
17
|
+
getTraces({
|
|
18
|
+
name,
|
|
19
|
+
scope,
|
|
20
|
+
page,
|
|
21
|
+
perPage,
|
|
22
|
+
attributes
|
|
23
|
+
}) {
|
|
24
|
+
throw new Error("Method not implemented.");
|
|
25
|
+
}
|
|
11
26
|
redis;
|
|
12
27
|
constructor(config) {
|
|
13
28
|
super({ name: "Upstash" });
|
|
@@ -21,11 +36,11 @@ var UpstashStore = class extends MastraStorage {
|
|
|
21
36
|
return `${tableName}:${keyParts.join(":")}`;
|
|
22
37
|
}
|
|
23
38
|
ensureDate(date) {
|
|
24
|
-
if (!date) return
|
|
39
|
+
if (!date) return void 0;
|
|
25
40
|
return date instanceof Date ? date : new Date(date);
|
|
26
41
|
}
|
|
27
42
|
serializeDate(date) {
|
|
28
|
-
if (!date) return
|
|
43
|
+
if (!date) return void 0;
|
|
29
44
|
const dateObj = this.ensureDate(date);
|
|
30
45
|
return dateObj?.toISOString();
|
|
31
46
|
}
|
|
@@ -136,7 +151,7 @@ var UpstashStore = class extends MastraStorage {
|
|
|
136
151
|
}));
|
|
137
152
|
for (const message of messagesWithIndex) {
|
|
138
153
|
const key = this.getMessageKey(message.threadId, message.id);
|
|
139
|
-
const score = message._index !==
|
|
154
|
+
const score = message._index !== void 0 ? message._index : new Date(message.createdAt).getTime();
|
|
140
155
|
pipeline.set(key, message);
|
|
141
156
|
pipeline.zadd(this.getThreadMessagesKey(message.threadId), {
|
|
142
157
|
score,
|
|
@@ -214,7 +229,7 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
214
229
|
};
|
|
215
230
|
}
|
|
216
231
|
translate(filter) {
|
|
217
|
-
if (this.isEmpty(filter)) return
|
|
232
|
+
if (this.isEmpty(filter)) return void 0;
|
|
218
233
|
this.validateFilter(filter);
|
|
219
234
|
return this.translateNode(filter);
|
|
220
235
|
}
|
|
@@ -222,11 +237,11 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
222
237
|
if (this.isRegex(node)) {
|
|
223
238
|
throw new Error("Direct regex pattern format is not supported in Upstash");
|
|
224
239
|
}
|
|
225
|
-
if (node === null || node ===
|
|
240
|
+
if (node === null || node === void 0) {
|
|
226
241
|
throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|
|
227
242
|
}
|
|
228
243
|
if (this.isPrimitive(node)) {
|
|
229
|
-
if (node === null || node ===
|
|
244
|
+
if (node === null || node === void 0) {
|
|
230
245
|
throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|
|
231
246
|
}
|
|
232
247
|
return this.formatComparison(path, "=", node);
|
|
@@ -245,7 +260,7 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
245
260
|
conditions.push(this.translateOperator(key, value, path));
|
|
246
261
|
} else if (typeof value === "object" && value !== null) {
|
|
247
262
|
conditions.push(this.translateNode(value, newPath));
|
|
248
|
-
} else if (value === null || value ===
|
|
263
|
+
} else if (value === null || value === void 0) {
|
|
249
264
|
throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|
|
250
265
|
} else {
|
|
251
266
|
conditions.push(this.formatComparison(newPath, "=", value));
|
|
@@ -357,7 +372,7 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
357
372
|
return `${path} != ${this.formatValue(val)}`;
|
|
358
373
|
}
|
|
359
374
|
formatValue(value) {
|
|
360
|
-
if (value === null || value ===
|
|
375
|
+
if (value === null || value === void 0) {
|
|
361
376
|
throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|
|
362
377
|
}
|
|
363
378
|
if (typeof value === "string") {
|
|
@@ -381,7 +396,7 @@ var UpstashFilterTranslator = class extends BaseFilterTranslator {
|
|
|
381
396
|
}
|
|
382
397
|
formatArray(values) {
|
|
383
398
|
return values.map((value) => {
|
|
384
|
-
if (value === null || value ===
|
|
399
|
+
if (value === null || value === void 0) {
|
|
385
400
|
throw new Error("Filtering for null/undefined values is not supported by Upstash Vector");
|
|
386
401
|
}
|
|
387
402
|
return this.formatValue(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/upstash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-alpha.0",
|
|
4
4
|
"description": "Upstash provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@upstash/redis": "^1.28.3",
|
|
19
19
|
"@upstash/vector": "^1.1.7",
|
|
20
|
-
"@mastra/core": "^0.2.
|
|
20
|
+
"@mastra/core": "^0.2.1-alpha.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@types/node": "^22.
|
|
23
|
+
"@microsoft/api-extractor": "^7.49.2",
|
|
24
|
+
"@types/node": "^22.13.1",
|
|
25
25
|
"tsup": "^8.0.1",
|
|
26
|
+
"typescript": "^5.7.3",
|
|
26
27
|
"vitest": "^3.0.4"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"pretest": "docker compose up -d",
|
|
30
31
|
"test": "vitest run",
|
|
31
32
|
"posttest": "docker compose down",
|
|
32
|
-
"build": "tsup src/index.ts --format esm --dts --clean --treeshake",
|
|
33
|
+
"build": "tsup src/index.ts --format esm --experimental-dts --clean --treeshake",
|
|
33
34
|
"build:watch": "pnpm build --watch"
|
|
34
35
|
}
|
|
35
36
|
}
|
package/src/storage/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type StorageThreadType, type MessageType } from '@mastra/core/memory';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
MastraStorage,
|
|
4
|
+
type TABLE_NAMES,
|
|
5
|
+
type StorageColumn,
|
|
6
|
+
type StorageGetMessagesArg,
|
|
7
|
+
type EvalRow,
|
|
8
|
+
} from '@mastra/core/storage';
|
|
3
9
|
import { type WorkflowRunState } from '@mastra/core/workflows';
|
|
4
10
|
import { Redis } from '@upstash/redis';
|
|
5
11
|
|
|
@@ -9,6 +15,27 @@ export interface UpstashConfig {
|
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
export class UpstashStore extends MastraStorage {
|
|
18
|
+
batchInsert({ tableName, records }: { tableName: TABLE_NAMES; records: Record<string, any>[] }): Promise<void> {
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]> {
|
|
22
|
+
throw new Error('Method not implemented.');
|
|
23
|
+
}
|
|
24
|
+
getTraces({
|
|
25
|
+
name,
|
|
26
|
+
scope,
|
|
27
|
+
page,
|
|
28
|
+
perPage,
|
|
29
|
+
attributes,
|
|
30
|
+
}: {
|
|
31
|
+
name?: string;
|
|
32
|
+
scope?: string;
|
|
33
|
+
page: number;
|
|
34
|
+
perPage: number;
|
|
35
|
+
attributes?: Record<string, string>;
|
|
36
|
+
}): Promise<any[]> {
|
|
37
|
+
throw new Error('Method not implemented.');
|
|
38
|
+
}
|
|
12
39
|
private redis: Redis;
|
|
13
40
|
|
|
14
41
|
constructor(config: UpstashConfig) {
|
package/src/vector/filter.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseFilterTranslator, Filter, FieldCondition, OperatorSupport } from '@mastra/core/filter';
|
|
1
|
+
import { BaseFilterTranslator, type Filter, type FieldCondition, type OperatorSupport } from '@mastra/core/filter';
|
|
2
2
|
|
|
3
3
|
export class UpstashFilterTranslator extends BaseFilterTranslator {
|
|
4
4
|
protected override getSupportedOperators(): OperatorSupport {
|