@mastra/upstash 1.0.0-beta.3 → 1.0.0-beta.5
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/CHANGELOG.md +47 -0
- package/dist/index.cjs +69 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +68 -50
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +2 -2
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +22 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
|
|
8
|
+
|
|
9
|
+
**What Changed**
|
|
10
|
+
- saveScore now correctly returns scores that can be retrieved with getScoreById
|
|
11
|
+
- Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
|
|
12
|
+
|
|
13
|
+
**Impact**
|
|
14
|
+
Previously, calling getScoreById after saveScore would return null because the generated ID wasn't persisted to the database. This is now fixed across all store implementations, ensuring consistent behavior and data integrity.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`0d41fe2`](https://github.com/mastra-ai/mastra/commit/0d41fe245355dfc66d61a0d9c85d9400aac351ff), [`6b3ba91`](https://github.com/mastra-ai/mastra/commit/6b3ba91494cc10394df96782f349a4f7b1e152cc), [`7907fd1`](https://github.com/mastra-ai/mastra/commit/7907fd1c5059813b7b870b81ca71041dc807331b)]:
|
|
17
|
+
- @mastra/core@1.0.0-beta.8
|
|
18
|
+
|
|
19
|
+
## 1.0.0-beta.4
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Add `disableInit` option to all storage adapters ([#10851](https://github.com/mastra-ai/mastra/pull/10851))
|
|
24
|
+
|
|
25
|
+
Adds a new `disableInit` config option to all storage providers that allows users to disable automatic table creation/migrations at runtime. This is useful for CI/CD pipelines where you want to run migrations during deployment with elevated credentials, then run the application with `disableInit: true` so it doesn't attempt schema changes at runtime.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// CI/CD script - run migrations
|
|
29
|
+
const storage = new PostgresStore({
|
|
30
|
+
connectionString: DATABASE_URL,
|
|
31
|
+
id: 'pg-storage',
|
|
32
|
+
});
|
|
33
|
+
await storage.init();
|
|
34
|
+
|
|
35
|
+
// Runtime - skip auto-init
|
|
36
|
+
const storage = new PostgresStore({
|
|
37
|
+
connectionString: DATABASE_URL,
|
|
38
|
+
id: 'pg-storage',
|
|
39
|
+
disableInit: true,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Standardize error IDs across all storage and vector stores using centralized helper functions (`createStorageErrorId` and `createVectorErrorId`). This ensures consistent error ID patterns (`MASTRA_STORAGE_{STORE}_{OPERATION}_{STATUS}` and `MASTRA_VECTOR_{STORE}_{OPERATION}_{STATUS}`) across the codebase for better error tracking and debugging. ([#10913](https://github.com/mastra-ai/mastra/pull/10913))
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`85d7ee1`](https://github.com/mastra-ai/mastra/commit/85d7ee18ff4e14d625a8a30ec6656bb49804989b), [`c6c1092`](https://github.com/mastra-ai/mastra/commit/c6c1092f8fbf76109303f69e000e96fd1960c4ce), [`81dc110`](https://github.com/mastra-ai/mastra/commit/81dc11008d147cf5bdc8996ead1aa61dbdebb6fc), [`7aedb74`](https://github.com/mastra-ai/mastra/commit/7aedb74883adf66af38e270e4068fd42e7a37036), [`8f02d80`](https://github.com/mastra-ai/mastra/commit/8f02d800777397e4b45d7f1ad041988a8b0c6630), [`d7aad50`](https://github.com/mastra-ai/mastra/commit/d7aad501ce61646b76b4b511e558ac4eea9884d0), [`ce0a73a`](https://github.com/mastra-ai/mastra/commit/ce0a73abeaa75b10ca38f9e40a255a645d50ebfb), [`a02e542`](https://github.com/mastra-ai/mastra/commit/a02e542d23179bad250b044b17ff023caa61739f), [`a372c64`](https://github.com/mastra-ai/mastra/commit/a372c640ad1fd12e8f0613cebdc682fc156b4d95), [`8846867`](https://github.com/mastra-ai/mastra/commit/8846867ffa9a3746767618e314bebac08eb77d87), [`42a42cf`](https://github.com/mastra-ai/mastra/commit/42a42cf3132b9786feecbb8c13c583dce5b0e198), [`ae08bf0`](https://github.com/mastra-ai/mastra/commit/ae08bf0ebc6a4e4da992b711c4a389c32ba84cf4), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`1d877b8`](https://github.com/mastra-ai/mastra/commit/1d877b8d7b536a251c1a7a18db7ddcf4f68d6f8b)]:
|
|
48
|
+
- @mastra/core@1.0.0-beta.7
|
|
49
|
+
|
|
3
50
|
## 1.0.0-beta.3
|
|
4
51
|
|
|
5
52
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var redis = require('@upstash/redis');
|
|
|
5
5
|
var agent = require('@mastra/core/agent');
|
|
6
6
|
var error = require('@mastra/core/error');
|
|
7
7
|
var evals = require('@mastra/core/evals');
|
|
8
|
-
var crypto = require('crypto');
|
|
8
|
+
var crypto$1 = require('crypto');
|
|
9
9
|
var vector = require('@mastra/core/vector');
|
|
10
10
|
var vector$1 = require('@upstash/vector');
|
|
11
11
|
var filter = require('@mastra/core/vector/filter');
|
|
@@ -34,7 +34,7 @@ function processRecord(tableName, record) {
|
|
|
34
34
|
...record.resourceId ? { resourceId: record.resourceId } : {}
|
|
35
35
|
});
|
|
36
36
|
} else if (tableName === storage.TABLE_SCORERS) {
|
|
37
|
-
key = getKey(tableName, {
|
|
37
|
+
key = getKey(tableName, { id: record.id });
|
|
38
38
|
} else {
|
|
39
39
|
key = getKey(tableName, { id: record.id });
|
|
40
40
|
}
|
|
@@ -81,7 +81,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
81
81
|
} catch (error$1) {
|
|
82
82
|
throw new error.MastraError(
|
|
83
83
|
{
|
|
84
|
-
id: "
|
|
84
|
+
id: storage.createStorageErrorId("UPSTASH", "GET_THREAD_BY_ID", "FAILED"),
|
|
85
85
|
domain: error.ErrorDomain.STORAGE,
|
|
86
86
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
87
87
|
details: {
|
|
@@ -99,7 +99,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
99
99
|
if (page < 0) {
|
|
100
100
|
throw new error.MastraError(
|
|
101
101
|
{
|
|
102
|
-
id: "
|
|
102
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
103
103
|
domain: error.ErrorDomain.STORAGE,
|
|
104
104
|
category: error.ErrorCategory.USER,
|
|
105
105
|
details: { page }
|
|
@@ -141,7 +141,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
141
141
|
} catch (error$1) {
|
|
142
142
|
const mastraError = new error.MastraError(
|
|
143
143
|
{
|
|
144
|
-
id: "
|
|
144
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
145
145
|
domain: error.ErrorDomain.STORAGE,
|
|
146
146
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
147
147
|
details: {
|
|
@@ -173,7 +173,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
173
173
|
} catch (error$1) {
|
|
174
174
|
const mastraError = new error.MastraError(
|
|
175
175
|
{
|
|
176
|
-
id: "
|
|
176
|
+
id: storage.createStorageErrorId("UPSTASH", "SAVE_THREAD", "FAILED"),
|
|
177
177
|
domain: error.ErrorDomain.STORAGE,
|
|
178
178
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
179
179
|
details: {
|
|
@@ -195,7 +195,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
195
195
|
const thread = await this.getThreadById({ threadId: id });
|
|
196
196
|
if (!thread) {
|
|
197
197
|
throw new error.MastraError({
|
|
198
|
-
id: "
|
|
198
|
+
id: storage.createStorageErrorId("UPSTASH", "UPDATE_THREAD", "FAILED"),
|
|
199
199
|
domain: error.ErrorDomain.STORAGE,
|
|
200
200
|
category: error.ErrorCategory.USER,
|
|
201
201
|
text: `Thread ${id} not found`,
|
|
@@ -218,7 +218,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
218
218
|
} catch (error$1) {
|
|
219
219
|
throw new error.MastraError(
|
|
220
220
|
{
|
|
221
|
-
id: "
|
|
221
|
+
id: storage.createStorageErrorId("UPSTASH", "UPDATE_THREAD", "FAILED"),
|
|
222
222
|
domain: error.ErrorDomain.STORAGE,
|
|
223
223
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
224
224
|
details: {
|
|
@@ -247,7 +247,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
247
247
|
} catch (error$1) {
|
|
248
248
|
throw new error.MastraError(
|
|
249
249
|
{
|
|
250
|
-
id: "
|
|
250
|
+
id: storage.createStorageErrorId("UPSTASH", "DELETE_THREAD", "FAILED"),
|
|
251
251
|
domain: error.ErrorDomain.STORAGE,
|
|
252
252
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
253
253
|
details: {
|
|
@@ -273,7 +273,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
273
273
|
} catch (error$1) {
|
|
274
274
|
throw new error.MastraError(
|
|
275
275
|
{
|
|
276
|
-
id: "
|
|
276
|
+
id: storage.createStorageErrorId("UPSTASH", "SAVE_MESSAGES", "INVALID_ARGS"),
|
|
277
277
|
domain: error.ErrorDomain.STORAGE,
|
|
278
278
|
category: error.ErrorCategory.USER
|
|
279
279
|
},
|
|
@@ -343,7 +343,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
343
343
|
} catch (error$1) {
|
|
344
344
|
throw new error.MastraError(
|
|
345
345
|
{
|
|
346
|
-
id: "
|
|
346
|
+
id: storage.createStorageErrorId("UPSTASH", "SAVE_MESSAGES", "FAILED"),
|
|
347
347
|
domain: error.ErrorDomain.STORAGE,
|
|
348
348
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
349
349
|
details: {
|
|
@@ -469,7 +469,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
469
469
|
} catch (error$1) {
|
|
470
470
|
throw new error.MastraError(
|
|
471
471
|
{
|
|
472
|
-
id: "
|
|
472
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
473
473
|
domain: error.ErrorDomain.STORAGE,
|
|
474
474
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
475
475
|
details: {
|
|
@@ -486,7 +486,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
486
486
|
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
487
487
|
throw new error.MastraError(
|
|
488
488
|
{
|
|
489
|
-
id: "
|
|
489
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
490
490
|
domain: error.ErrorDomain.STORAGE,
|
|
491
491
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
492
492
|
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
@@ -500,7 +500,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
500
500
|
if (page < 0) {
|
|
501
501
|
throw new error.MastraError(
|
|
502
502
|
{
|
|
503
|
-
id: "
|
|
503
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
504
504
|
domain: error.ErrorDomain.STORAGE,
|
|
505
505
|
category: error.ErrorCategory.USER,
|
|
506
506
|
details: { page }
|
|
@@ -603,7 +603,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
603
603
|
} catch (error$1) {
|
|
604
604
|
const mastraError = new error.MastraError(
|
|
605
605
|
{
|
|
606
|
-
id: "
|
|
606
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_MESSAGES", "FAILED"),
|
|
607
607
|
domain: error.ErrorDomain.STORAGE,
|
|
608
608
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
609
609
|
details: {
|
|
@@ -794,7 +794,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
794
794
|
} catch (error$1) {
|
|
795
795
|
throw new error.MastraError(
|
|
796
796
|
{
|
|
797
|
-
id: "
|
|
797
|
+
id: storage.createStorageErrorId("UPSTASH", "UPDATE_MESSAGES", "FAILED"),
|
|
798
798
|
domain: error.ErrorDomain.STORAGE,
|
|
799
799
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
800
800
|
details: {
|
|
@@ -873,7 +873,7 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
873
873
|
} catch (error$1) {
|
|
874
874
|
throw new error.MastraError(
|
|
875
875
|
{
|
|
876
|
-
id: "
|
|
876
|
+
id: storage.createStorageErrorId("UPSTASH", "DELETE_MESSAGES", "FAILED"),
|
|
877
877
|
domain: error.ErrorDomain.STORAGE,
|
|
878
878
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
879
879
|
details: { messageIds: messageIds.join(", ") }
|
|
@@ -918,7 +918,7 @@ var StoreOperationsUpstash = class extends storage.StoreOperations {
|
|
|
918
918
|
} catch (error$1) {
|
|
919
919
|
throw new error.MastraError(
|
|
920
920
|
{
|
|
921
|
-
id: "
|
|
921
|
+
id: storage.createStorageErrorId("UPSTASH", "CLEAR_TABLE", "FAILED"),
|
|
922
922
|
domain: error.ErrorDomain.STORAGE,
|
|
923
923
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
924
924
|
details: {
|
|
@@ -939,7 +939,7 @@ var StoreOperationsUpstash = class extends storage.StoreOperations {
|
|
|
939
939
|
} catch (error$1) {
|
|
940
940
|
throw new error.MastraError(
|
|
941
941
|
{
|
|
942
|
-
id: "
|
|
942
|
+
id: storage.createStorageErrorId("UPSTASH", "INSERT", "FAILED"),
|
|
943
943
|
domain: error.ErrorDomain.STORAGE,
|
|
944
944
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
945
945
|
details: {
|
|
@@ -967,7 +967,7 @@ var StoreOperationsUpstash = class extends storage.StoreOperations {
|
|
|
967
967
|
} catch (error$1) {
|
|
968
968
|
throw new error.MastraError(
|
|
969
969
|
{
|
|
970
|
-
id: "
|
|
970
|
+
id: storage.createStorageErrorId("UPSTASH", "BATCH_INSERT", "FAILED"),
|
|
971
971
|
domain: error.ErrorDomain.STORAGE,
|
|
972
972
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
973
973
|
details: {
|
|
@@ -986,7 +986,7 @@ var StoreOperationsUpstash = class extends storage.StoreOperations {
|
|
|
986
986
|
} catch (error$1) {
|
|
987
987
|
throw new error.MastraError(
|
|
988
988
|
{
|
|
989
|
-
id: "
|
|
989
|
+
id: storage.createStorageErrorId("UPSTASH", "LOAD", "FAILED"),
|
|
990
990
|
domain: error.ErrorDomain.STORAGE,
|
|
991
991
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
992
992
|
details: {
|
|
@@ -1052,7 +1052,7 @@ var ScoresUpstash = class extends storage.ScoresStorage {
|
|
|
1052
1052
|
} catch (error$1) {
|
|
1053
1053
|
throw new error.MastraError(
|
|
1054
1054
|
{
|
|
1055
|
-
id: "
|
|
1055
|
+
id: storage.createStorageErrorId("UPSTASH", "GET_SCORE_BY_ID", "FAILED"),
|
|
1056
1056
|
domain: error.ErrorDomain.STORAGE,
|
|
1057
1057
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1058
1058
|
details: {
|
|
@@ -1123,24 +1123,41 @@ var ScoresUpstash = class extends storage.ScoresStorage {
|
|
|
1123
1123
|
} catch (error$1) {
|
|
1124
1124
|
throw new error.MastraError(
|
|
1125
1125
|
{
|
|
1126
|
-
id: "
|
|
1126
|
+
id: storage.createStorageErrorId("UPSTASH", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1127
1127
|
domain: error.ErrorDomain.STORAGE,
|
|
1128
|
-
category: error.ErrorCategory.
|
|
1128
|
+
category: error.ErrorCategory.USER,
|
|
1129
|
+
details: {
|
|
1130
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1131
|
+
entityId: score.entityId ?? "unknown",
|
|
1132
|
+
entityType: score.entityType ?? "unknown",
|
|
1133
|
+
traceId: score.traceId ?? "",
|
|
1134
|
+
spanId: score.spanId ?? ""
|
|
1135
|
+
}
|
|
1129
1136
|
},
|
|
1130
1137
|
error$1
|
|
1131
1138
|
);
|
|
1132
1139
|
}
|
|
1133
|
-
const
|
|
1140
|
+
const now = /* @__PURE__ */ new Date();
|
|
1141
|
+
const id = crypto.randomUUID();
|
|
1142
|
+
const createdAt = now;
|
|
1143
|
+
const updatedAt = now;
|
|
1144
|
+
const scoreWithId = {
|
|
1145
|
+
...validatedScore,
|
|
1146
|
+
id,
|
|
1147
|
+
createdAt,
|
|
1148
|
+
updatedAt
|
|
1149
|
+
};
|
|
1150
|
+
const { key, processedRecord } = processRecord(storage.TABLE_SCORERS, scoreWithId);
|
|
1134
1151
|
try {
|
|
1135
1152
|
await this.client.set(key, processedRecord);
|
|
1136
|
-
return { score };
|
|
1153
|
+
return { score: { ...validatedScore, id, createdAt, updatedAt } };
|
|
1137
1154
|
} catch (error$1) {
|
|
1138
1155
|
throw new error.MastraError(
|
|
1139
1156
|
{
|
|
1140
|
-
id: "
|
|
1157
|
+
id: storage.createStorageErrorId("UPSTASH", "SAVE_SCORE", "FAILED"),
|
|
1141
1158
|
domain: error.ErrorDomain.STORAGE,
|
|
1142
1159
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1143
|
-
details: { id
|
|
1160
|
+
details: { id }
|
|
1144
1161
|
},
|
|
1145
1162
|
error$1
|
|
1146
1163
|
);
|
|
@@ -1348,7 +1365,7 @@ var WorkflowsUpstash = class extends storage.WorkflowsStorage {
|
|
|
1348
1365
|
} catch (error$1) {
|
|
1349
1366
|
throw new error.MastraError(
|
|
1350
1367
|
{
|
|
1351
|
-
id: "
|
|
1368
|
+
id: storage.createStorageErrorId("UPSTASH", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1352
1369
|
domain: error.ErrorDomain.STORAGE,
|
|
1353
1370
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1354
1371
|
details: {
|
|
@@ -1375,7 +1392,7 @@ var WorkflowsUpstash = class extends storage.WorkflowsStorage {
|
|
|
1375
1392
|
} catch (error$1) {
|
|
1376
1393
|
throw new error.MastraError(
|
|
1377
1394
|
{
|
|
1378
|
-
id: "
|
|
1395
|
+
id: storage.createStorageErrorId("UPSTASH", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1379
1396
|
domain: error.ErrorDomain.STORAGE,
|
|
1380
1397
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1381
1398
|
details: {
|
|
@@ -1407,7 +1424,7 @@ var WorkflowsUpstash = class extends storage.WorkflowsStorage {
|
|
|
1407
1424
|
} catch (error$1) {
|
|
1408
1425
|
throw new error.MastraError(
|
|
1409
1426
|
{
|
|
1410
|
-
id: "
|
|
1427
|
+
id: storage.createStorageErrorId("UPSTASH", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
1411
1428
|
domain: error.ErrorDomain.STORAGE,
|
|
1412
1429
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1413
1430
|
details: {
|
|
@@ -1433,7 +1450,7 @@ var WorkflowsUpstash = class extends storage.WorkflowsStorage {
|
|
|
1433
1450
|
if (page !== void 0 && page < 0) {
|
|
1434
1451
|
throw new error.MastraError(
|
|
1435
1452
|
{
|
|
1436
|
-
id: "
|
|
1453
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_WORKFLOW_RUNS", "INVALID_PAGE"),
|
|
1437
1454
|
domain: error.ErrorDomain.STORAGE,
|
|
1438
1455
|
category: error.ErrorCategory.USER,
|
|
1439
1456
|
details: { page }
|
|
@@ -1493,9 +1510,10 @@ var WorkflowsUpstash = class extends storage.WorkflowsStorage {
|
|
|
1493
1510
|
}
|
|
1494
1511
|
return { runs, total };
|
|
1495
1512
|
} catch (error$1) {
|
|
1513
|
+
if (error$1 instanceof error.MastraError) throw error$1;
|
|
1496
1514
|
throw new error.MastraError(
|
|
1497
1515
|
{
|
|
1498
|
-
id: "
|
|
1516
|
+
id: storage.createStorageErrorId("UPSTASH", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
1499
1517
|
domain: error.ErrorDomain.STORAGE,
|
|
1500
1518
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1501
1519
|
details: {
|
|
@@ -1515,7 +1533,7 @@ var UpstashStore = class extends storage.MastraStorage {
|
|
|
1515
1533
|
redis;
|
|
1516
1534
|
stores;
|
|
1517
1535
|
constructor(config) {
|
|
1518
|
-
super({ id: config.id, name: "Upstash" });
|
|
1536
|
+
super({ id: config.id, name: "Upstash", disableInit: config.disableInit });
|
|
1519
1537
|
this.redis = new redis.Redis({
|
|
1520
1538
|
url: config.url,
|
|
1521
1539
|
token: config.token
|
|
@@ -1906,7 +1924,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
1906
1924
|
ids,
|
|
1907
1925
|
sparseVectors
|
|
1908
1926
|
}) {
|
|
1909
|
-
const generatedIds = ids || vectors.map(() => crypto.randomUUID());
|
|
1927
|
+
const generatedIds = ids || vectors.map(() => crypto$1.randomUUID());
|
|
1910
1928
|
const points = vectors.map((vector, index) => ({
|
|
1911
1929
|
id: generatedIds[index],
|
|
1912
1930
|
vector,
|
|
@@ -1921,7 +1939,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
1921
1939
|
} catch (error$1) {
|
|
1922
1940
|
throw new error.MastraError(
|
|
1923
1941
|
{
|
|
1924
|
-
id: "
|
|
1942
|
+
id: storage.createVectorErrorId("UPSTASH", "UPSERT", "FAILED"),
|
|
1925
1943
|
domain: error.ErrorDomain.STORAGE,
|
|
1926
1944
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1927
1945
|
details: { namespace, vectorCount: vectors.length }
|
|
@@ -1984,7 +2002,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
1984
2002
|
} catch (error$1) {
|
|
1985
2003
|
throw new error.MastraError(
|
|
1986
2004
|
{
|
|
1987
|
-
id: "
|
|
2005
|
+
id: storage.createVectorErrorId("UPSTASH", "QUERY", "FAILED"),
|
|
1988
2006
|
domain: error.ErrorDomain.STORAGE,
|
|
1989
2007
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1990
2008
|
details: { namespace, topK }
|
|
@@ -2004,7 +2022,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2004
2022
|
} catch (error$1) {
|
|
2005
2023
|
throw new error.MastraError(
|
|
2006
2024
|
{
|
|
2007
|
-
id: "
|
|
2025
|
+
id: storage.createVectorErrorId("UPSTASH", "LIST_INDEXES", "FAILED"),
|
|
2008
2026
|
domain: error.ErrorDomain.STORAGE,
|
|
2009
2027
|
category: error.ErrorCategory.THIRD_PARTY
|
|
2010
2028
|
},
|
|
@@ -2029,7 +2047,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2029
2047
|
} catch (error$1) {
|
|
2030
2048
|
throw new error.MastraError(
|
|
2031
2049
|
{
|
|
2032
|
-
id: "
|
|
2050
|
+
id: storage.createVectorErrorId("UPSTASH", "DESCRIBE_INDEX", "FAILED"),
|
|
2033
2051
|
domain: error.ErrorDomain.STORAGE,
|
|
2034
2052
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2035
2053
|
details: { namespace }
|
|
@@ -2054,7 +2072,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2054
2072
|
}
|
|
2055
2073
|
throw new error.MastraError(
|
|
2056
2074
|
{
|
|
2057
|
-
id: "
|
|
2075
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_INDEX", "FAILED"),
|
|
2058
2076
|
domain: error.ErrorDomain.STORAGE,
|
|
2059
2077
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2060
2078
|
details: { namespace }
|
|
@@ -2079,7 +2097,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2079
2097
|
const sparseVector = upstashUpdate.sparseVector;
|
|
2080
2098
|
if ("id" in params && params.id && "filter" in params && params.filter) {
|
|
2081
2099
|
throw new error.MastraError({
|
|
2082
|
-
id: "
|
|
2100
|
+
id: storage.createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
|
|
2083
2101
|
text: "Cannot specify both id and filter - they are mutually exclusive",
|
|
2084
2102
|
domain: error.ErrorDomain.STORAGE,
|
|
2085
2103
|
category: error.ErrorCategory.USER,
|
|
@@ -2088,7 +2106,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2088
2106
|
}
|
|
2089
2107
|
if (!("id" in params && params.id) && !("filter" in params && params.filter)) {
|
|
2090
2108
|
throw new error.MastraError({
|
|
2091
|
-
id: "
|
|
2109
|
+
id: storage.createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "NO_TARGET"),
|
|
2092
2110
|
text: "Either id or filter must be provided",
|
|
2093
2111
|
domain: error.ErrorDomain.STORAGE,
|
|
2094
2112
|
category: error.ErrorCategory.USER,
|
|
@@ -2097,7 +2115,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2097
2115
|
}
|
|
2098
2116
|
if (!update.vector && !update.metadata && !sparseVector) {
|
|
2099
2117
|
throw new error.MastraError({
|
|
2100
|
-
id: "
|
|
2118
|
+
id: storage.createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "NO_PAYLOAD"),
|
|
2101
2119
|
text: "No update data provided",
|
|
2102
2120
|
domain: error.ErrorDomain.STORAGE,
|
|
2103
2121
|
category: error.ErrorCategory.USER,
|
|
@@ -2106,7 +2124,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2106
2124
|
}
|
|
2107
2125
|
if ("filter" in params && params.filter && Object.keys(params.filter).length === 0) {
|
|
2108
2126
|
throw new error.MastraError({
|
|
2109
|
-
id: "
|
|
2127
|
+
id: storage.createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "EMPTY_FILTER"),
|
|
2110
2128
|
text: "Filter cannot be an empty filter object",
|
|
2111
2129
|
domain: error.ErrorDomain.STORAGE,
|
|
2112
2130
|
category: error.ErrorCategory.USER,
|
|
@@ -2174,7 +2192,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2174
2192
|
if (error$1 instanceof error.MastraError) throw error$1;
|
|
2175
2193
|
throw new error.MastraError(
|
|
2176
2194
|
{
|
|
2177
|
-
id: "
|
|
2195
|
+
id: storage.createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "FAILED"),
|
|
2178
2196
|
domain: error.ErrorDomain.STORAGE,
|
|
2179
2197
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2180
2198
|
details: {
|
|
@@ -2201,7 +2219,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2201
2219
|
} catch (error$1) {
|
|
2202
2220
|
const mastraError = new error.MastraError(
|
|
2203
2221
|
{
|
|
2204
|
-
id: "
|
|
2222
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_VECTOR", "FAILED"),
|
|
2205
2223
|
domain: error.ErrorDomain.STORAGE,
|
|
2206
2224
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2207
2225
|
details: {
|
|
@@ -2225,7 +2243,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2225
2243
|
async deleteVectors({ indexName: namespace, filter, ids }) {
|
|
2226
2244
|
if (ids && filter) {
|
|
2227
2245
|
throw new error.MastraError({
|
|
2228
|
-
id: "
|
|
2246
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
|
|
2229
2247
|
text: "Cannot specify both ids and filter - they are mutually exclusive",
|
|
2230
2248
|
domain: error.ErrorDomain.STORAGE,
|
|
2231
2249
|
category: error.ErrorCategory.USER,
|
|
@@ -2234,7 +2252,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2234
2252
|
}
|
|
2235
2253
|
if (!ids && !filter) {
|
|
2236
2254
|
throw new error.MastraError({
|
|
2237
|
-
id: "
|
|
2255
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_VECTORS", "NO_TARGET"),
|
|
2238
2256
|
text: "Either filter or ids must be provided",
|
|
2239
2257
|
domain: error.ErrorDomain.STORAGE,
|
|
2240
2258
|
category: error.ErrorCategory.USER,
|
|
@@ -2243,7 +2261,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2243
2261
|
}
|
|
2244
2262
|
if (ids && ids.length === 0) {
|
|
2245
2263
|
throw new error.MastraError({
|
|
2246
|
-
id: "
|
|
2264
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_VECTORS", "EMPTY_IDS"),
|
|
2247
2265
|
text: "Cannot delete with empty ids array",
|
|
2248
2266
|
domain: error.ErrorDomain.STORAGE,
|
|
2249
2267
|
category: error.ErrorCategory.USER,
|
|
@@ -2252,7 +2270,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2252
2270
|
}
|
|
2253
2271
|
if (filter && Object.keys(filter).length === 0) {
|
|
2254
2272
|
throw new error.MastraError({
|
|
2255
|
-
id: "
|
|
2273
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_VECTORS", "EMPTY_FILTER"),
|
|
2256
2274
|
text: "Cannot delete with empty filter object",
|
|
2257
2275
|
domain: error.ErrorDomain.STORAGE,
|
|
2258
2276
|
category: error.ErrorCategory.USER,
|
|
@@ -2286,7 +2304,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
2286
2304
|
if (error$1 instanceof error.MastraError) throw error$1;
|
|
2287
2305
|
throw new error.MastraError(
|
|
2288
2306
|
{
|
|
2289
|
-
id: "
|
|
2307
|
+
id: storage.createVectorErrorId("UPSTASH", "DELETE_VECTORS", "FAILED"),
|
|
2290
2308
|
domain: error.ErrorDomain.STORAGE,
|
|
2291
2309
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2292
2310
|
details: {
|