@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/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MastraStorage, StoreOperations, ScoresStorage, TABLE_SCORERS, normalizePerPage, calculatePagination, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, MemoryStorage, TABLE_THREADS, TABLE_RESOURCES, TABLE_MESSAGES, serializeDate, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
|
|
1
|
+
import { MastraStorage, createVectorErrorId, StoreOperations, createStorageErrorId, ScoresStorage, TABLE_SCORERS, normalizePerPage, calculatePagination, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, MemoryStorage, TABLE_THREADS, TABLE_RESOURCES, TABLE_MESSAGES, serializeDate, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
|
|
2
2
|
import { Redis } from '@upstash/redis';
|
|
3
3
|
import { MessageList } from '@mastra/core/agent';
|
|
4
4
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
@@ -32,7 +32,7 @@ function processRecord(tableName, record) {
|
|
|
32
32
|
...record.resourceId ? { resourceId: record.resourceId } : {}
|
|
33
33
|
});
|
|
34
34
|
} else if (tableName === TABLE_SCORERS) {
|
|
35
|
-
key = getKey(tableName, {
|
|
35
|
+
key = getKey(tableName, { id: record.id });
|
|
36
36
|
} else {
|
|
37
37
|
key = getKey(tableName, { id: record.id });
|
|
38
38
|
}
|
|
@@ -79,7 +79,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
79
79
|
} catch (error) {
|
|
80
80
|
throw new MastraError(
|
|
81
81
|
{
|
|
82
|
-
id: "
|
|
82
|
+
id: createStorageErrorId("UPSTASH", "GET_THREAD_BY_ID", "FAILED"),
|
|
83
83
|
domain: ErrorDomain.STORAGE,
|
|
84
84
|
category: ErrorCategory.THIRD_PARTY,
|
|
85
85
|
details: {
|
|
@@ -97,7 +97,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
97
97
|
if (page < 0) {
|
|
98
98
|
throw new MastraError(
|
|
99
99
|
{
|
|
100
|
-
id: "
|
|
100
|
+
id: createStorageErrorId("UPSTASH", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
101
101
|
domain: ErrorDomain.STORAGE,
|
|
102
102
|
category: ErrorCategory.USER,
|
|
103
103
|
details: { page }
|
|
@@ -139,7 +139,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
139
139
|
} catch (error) {
|
|
140
140
|
const mastraError = new MastraError(
|
|
141
141
|
{
|
|
142
|
-
id: "
|
|
142
|
+
id: createStorageErrorId("UPSTASH", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
143
143
|
domain: ErrorDomain.STORAGE,
|
|
144
144
|
category: ErrorCategory.THIRD_PARTY,
|
|
145
145
|
details: {
|
|
@@ -171,7 +171,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
171
171
|
} catch (error) {
|
|
172
172
|
const mastraError = new MastraError(
|
|
173
173
|
{
|
|
174
|
-
id: "
|
|
174
|
+
id: createStorageErrorId("UPSTASH", "SAVE_THREAD", "FAILED"),
|
|
175
175
|
domain: ErrorDomain.STORAGE,
|
|
176
176
|
category: ErrorCategory.THIRD_PARTY,
|
|
177
177
|
details: {
|
|
@@ -193,7 +193,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
193
193
|
const thread = await this.getThreadById({ threadId: id });
|
|
194
194
|
if (!thread) {
|
|
195
195
|
throw new MastraError({
|
|
196
|
-
id: "
|
|
196
|
+
id: createStorageErrorId("UPSTASH", "UPDATE_THREAD", "FAILED"),
|
|
197
197
|
domain: ErrorDomain.STORAGE,
|
|
198
198
|
category: ErrorCategory.USER,
|
|
199
199
|
text: `Thread ${id} not found`,
|
|
@@ -216,7 +216,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
216
216
|
} catch (error) {
|
|
217
217
|
throw new MastraError(
|
|
218
218
|
{
|
|
219
|
-
id: "
|
|
219
|
+
id: createStorageErrorId("UPSTASH", "UPDATE_THREAD", "FAILED"),
|
|
220
220
|
domain: ErrorDomain.STORAGE,
|
|
221
221
|
category: ErrorCategory.THIRD_PARTY,
|
|
222
222
|
details: {
|
|
@@ -245,7 +245,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
245
245
|
} catch (error) {
|
|
246
246
|
throw new MastraError(
|
|
247
247
|
{
|
|
248
|
-
id: "
|
|
248
|
+
id: createStorageErrorId("UPSTASH", "DELETE_THREAD", "FAILED"),
|
|
249
249
|
domain: ErrorDomain.STORAGE,
|
|
250
250
|
category: ErrorCategory.THIRD_PARTY,
|
|
251
251
|
details: {
|
|
@@ -271,7 +271,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
271
271
|
} catch (error) {
|
|
272
272
|
throw new MastraError(
|
|
273
273
|
{
|
|
274
|
-
id: "
|
|
274
|
+
id: createStorageErrorId("UPSTASH", "SAVE_MESSAGES", "INVALID_ARGS"),
|
|
275
275
|
domain: ErrorDomain.STORAGE,
|
|
276
276
|
category: ErrorCategory.USER
|
|
277
277
|
},
|
|
@@ -341,7 +341,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
341
341
|
} catch (error) {
|
|
342
342
|
throw new MastraError(
|
|
343
343
|
{
|
|
344
|
-
id: "
|
|
344
|
+
id: createStorageErrorId("UPSTASH", "SAVE_MESSAGES", "FAILED"),
|
|
345
345
|
domain: ErrorDomain.STORAGE,
|
|
346
346
|
category: ErrorCategory.THIRD_PARTY,
|
|
347
347
|
details: {
|
|
@@ -467,7 +467,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
467
467
|
} catch (error) {
|
|
468
468
|
throw new MastraError(
|
|
469
469
|
{
|
|
470
|
-
id: "
|
|
470
|
+
id: createStorageErrorId("UPSTASH", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
471
471
|
domain: ErrorDomain.STORAGE,
|
|
472
472
|
category: ErrorCategory.THIRD_PARTY,
|
|
473
473
|
details: {
|
|
@@ -484,7 +484,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
484
484
|
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
485
485
|
throw new MastraError(
|
|
486
486
|
{
|
|
487
|
-
id: "
|
|
487
|
+
id: createStorageErrorId("UPSTASH", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
488
488
|
domain: ErrorDomain.STORAGE,
|
|
489
489
|
category: ErrorCategory.THIRD_PARTY,
|
|
490
490
|
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
@@ -498,7 +498,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
498
498
|
if (page < 0) {
|
|
499
499
|
throw new MastraError(
|
|
500
500
|
{
|
|
501
|
-
id: "
|
|
501
|
+
id: createStorageErrorId("UPSTASH", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
502
502
|
domain: ErrorDomain.STORAGE,
|
|
503
503
|
category: ErrorCategory.USER,
|
|
504
504
|
details: { page }
|
|
@@ -601,7 +601,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
601
601
|
} catch (error) {
|
|
602
602
|
const mastraError = new MastraError(
|
|
603
603
|
{
|
|
604
|
-
id: "
|
|
604
|
+
id: createStorageErrorId("UPSTASH", "LIST_MESSAGES", "FAILED"),
|
|
605
605
|
domain: ErrorDomain.STORAGE,
|
|
606
606
|
category: ErrorCategory.THIRD_PARTY,
|
|
607
607
|
details: {
|
|
@@ -792,7 +792,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
792
792
|
} catch (error) {
|
|
793
793
|
throw new MastraError(
|
|
794
794
|
{
|
|
795
|
-
id: "
|
|
795
|
+
id: createStorageErrorId("UPSTASH", "UPDATE_MESSAGES", "FAILED"),
|
|
796
796
|
domain: ErrorDomain.STORAGE,
|
|
797
797
|
category: ErrorCategory.THIRD_PARTY,
|
|
798
798
|
details: {
|
|
@@ -871,7 +871,7 @@ var StoreMemoryUpstash = class extends MemoryStorage {
|
|
|
871
871
|
} catch (error) {
|
|
872
872
|
throw new MastraError(
|
|
873
873
|
{
|
|
874
|
-
id: "
|
|
874
|
+
id: createStorageErrorId("UPSTASH", "DELETE_MESSAGES", "FAILED"),
|
|
875
875
|
domain: ErrorDomain.STORAGE,
|
|
876
876
|
category: ErrorCategory.THIRD_PARTY,
|
|
877
877
|
details: { messageIds: messageIds.join(", ") }
|
|
@@ -916,7 +916,7 @@ var StoreOperationsUpstash = class extends StoreOperations {
|
|
|
916
916
|
} catch (error) {
|
|
917
917
|
throw new MastraError(
|
|
918
918
|
{
|
|
919
|
-
id: "
|
|
919
|
+
id: createStorageErrorId("UPSTASH", "CLEAR_TABLE", "FAILED"),
|
|
920
920
|
domain: ErrorDomain.STORAGE,
|
|
921
921
|
category: ErrorCategory.THIRD_PARTY,
|
|
922
922
|
details: {
|
|
@@ -937,7 +937,7 @@ var StoreOperationsUpstash = class extends StoreOperations {
|
|
|
937
937
|
} catch (error) {
|
|
938
938
|
throw new MastraError(
|
|
939
939
|
{
|
|
940
|
-
id: "
|
|
940
|
+
id: createStorageErrorId("UPSTASH", "INSERT", "FAILED"),
|
|
941
941
|
domain: ErrorDomain.STORAGE,
|
|
942
942
|
category: ErrorCategory.THIRD_PARTY,
|
|
943
943
|
details: {
|
|
@@ -965,7 +965,7 @@ var StoreOperationsUpstash = class extends StoreOperations {
|
|
|
965
965
|
} catch (error) {
|
|
966
966
|
throw new MastraError(
|
|
967
967
|
{
|
|
968
|
-
id: "
|
|
968
|
+
id: createStorageErrorId("UPSTASH", "BATCH_INSERT", "FAILED"),
|
|
969
969
|
domain: ErrorDomain.STORAGE,
|
|
970
970
|
category: ErrorCategory.THIRD_PARTY,
|
|
971
971
|
details: {
|
|
@@ -984,7 +984,7 @@ var StoreOperationsUpstash = class extends StoreOperations {
|
|
|
984
984
|
} catch (error) {
|
|
985
985
|
throw new MastraError(
|
|
986
986
|
{
|
|
987
|
-
id: "
|
|
987
|
+
id: createStorageErrorId("UPSTASH", "LOAD", "FAILED"),
|
|
988
988
|
domain: ErrorDomain.STORAGE,
|
|
989
989
|
category: ErrorCategory.THIRD_PARTY,
|
|
990
990
|
details: {
|
|
@@ -1050,7 +1050,7 @@ var ScoresUpstash = class extends ScoresStorage {
|
|
|
1050
1050
|
} catch (error) {
|
|
1051
1051
|
throw new MastraError(
|
|
1052
1052
|
{
|
|
1053
|
-
id: "
|
|
1053
|
+
id: createStorageErrorId("UPSTASH", "GET_SCORE_BY_ID", "FAILED"),
|
|
1054
1054
|
domain: ErrorDomain.STORAGE,
|
|
1055
1055
|
category: ErrorCategory.THIRD_PARTY,
|
|
1056
1056
|
details: {
|
|
@@ -1121,24 +1121,41 @@ var ScoresUpstash = class extends ScoresStorage {
|
|
|
1121
1121
|
} catch (error) {
|
|
1122
1122
|
throw new MastraError(
|
|
1123
1123
|
{
|
|
1124
|
-
id: "
|
|
1124
|
+
id: createStorageErrorId("UPSTASH", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1125
1125
|
domain: ErrorDomain.STORAGE,
|
|
1126
|
-
category: ErrorCategory.
|
|
1126
|
+
category: ErrorCategory.USER,
|
|
1127
|
+
details: {
|
|
1128
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1129
|
+
entityId: score.entityId ?? "unknown",
|
|
1130
|
+
entityType: score.entityType ?? "unknown",
|
|
1131
|
+
traceId: score.traceId ?? "",
|
|
1132
|
+
spanId: score.spanId ?? ""
|
|
1133
|
+
}
|
|
1127
1134
|
},
|
|
1128
1135
|
error
|
|
1129
1136
|
);
|
|
1130
1137
|
}
|
|
1131
|
-
const
|
|
1138
|
+
const now = /* @__PURE__ */ new Date();
|
|
1139
|
+
const id = crypto.randomUUID();
|
|
1140
|
+
const createdAt = now;
|
|
1141
|
+
const updatedAt = now;
|
|
1142
|
+
const scoreWithId = {
|
|
1143
|
+
...validatedScore,
|
|
1144
|
+
id,
|
|
1145
|
+
createdAt,
|
|
1146
|
+
updatedAt
|
|
1147
|
+
};
|
|
1148
|
+
const { key, processedRecord } = processRecord(TABLE_SCORERS, scoreWithId);
|
|
1132
1149
|
try {
|
|
1133
1150
|
await this.client.set(key, processedRecord);
|
|
1134
|
-
return { score };
|
|
1151
|
+
return { score: { ...validatedScore, id, createdAt, updatedAt } };
|
|
1135
1152
|
} catch (error) {
|
|
1136
1153
|
throw new MastraError(
|
|
1137
1154
|
{
|
|
1138
|
-
id: "
|
|
1155
|
+
id: createStorageErrorId("UPSTASH", "SAVE_SCORE", "FAILED"),
|
|
1139
1156
|
domain: ErrorDomain.STORAGE,
|
|
1140
1157
|
category: ErrorCategory.THIRD_PARTY,
|
|
1141
|
-
details: { id
|
|
1158
|
+
details: { id }
|
|
1142
1159
|
},
|
|
1143
1160
|
error
|
|
1144
1161
|
);
|
|
@@ -1346,7 +1363,7 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
|
|
|
1346
1363
|
} catch (error) {
|
|
1347
1364
|
throw new MastraError(
|
|
1348
1365
|
{
|
|
1349
|
-
id: "
|
|
1366
|
+
id: createStorageErrorId("UPSTASH", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1350
1367
|
domain: ErrorDomain.STORAGE,
|
|
1351
1368
|
category: ErrorCategory.THIRD_PARTY,
|
|
1352
1369
|
details: {
|
|
@@ -1373,7 +1390,7 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
|
|
|
1373
1390
|
} catch (error) {
|
|
1374
1391
|
throw new MastraError(
|
|
1375
1392
|
{
|
|
1376
|
-
id: "
|
|
1393
|
+
id: createStorageErrorId("UPSTASH", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1377
1394
|
domain: ErrorDomain.STORAGE,
|
|
1378
1395
|
category: ErrorCategory.THIRD_PARTY,
|
|
1379
1396
|
details: {
|
|
@@ -1405,7 +1422,7 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
|
|
|
1405
1422
|
} catch (error) {
|
|
1406
1423
|
throw new MastraError(
|
|
1407
1424
|
{
|
|
1408
|
-
id: "
|
|
1425
|
+
id: createStorageErrorId("UPSTASH", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
1409
1426
|
domain: ErrorDomain.STORAGE,
|
|
1410
1427
|
category: ErrorCategory.THIRD_PARTY,
|
|
1411
1428
|
details: {
|
|
@@ -1431,7 +1448,7 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
|
|
|
1431
1448
|
if (page !== void 0 && page < 0) {
|
|
1432
1449
|
throw new MastraError(
|
|
1433
1450
|
{
|
|
1434
|
-
id: "
|
|
1451
|
+
id: createStorageErrorId("UPSTASH", "LIST_WORKFLOW_RUNS", "INVALID_PAGE"),
|
|
1435
1452
|
domain: ErrorDomain.STORAGE,
|
|
1436
1453
|
category: ErrorCategory.USER,
|
|
1437
1454
|
details: { page }
|
|
@@ -1491,9 +1508,10 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
|
|
|
1491
1508
|
}
|
|
1492
1509
|
return { runs, total };
|
|
1493
1510
|
} catch (error) {
|
|
1511
|
+
if (error instanceof MastraError) throw error;
|
|
1494
1512
|
throw new MastraError(
|
|
1495
1513
|
{
|
|
1496
|
-
id: "
|
|
1514
|
+
id: createStorageErrorId("UPSTASH", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
1497
1515
|
domain: ErrorDomain.STORAGE,
|
|
1498
1516
|
category: ErrorCategory.THIRD_PARTY,
|
|
1499
1517
|
details: {
|
|
@@ -1513,7 +1531,7 @@ var UpstashStore = class extends MastraStorage {
|
|
|
1513
1531
|
redis;
|
|
1514
1532
|
stores;
|
|
1515
1533
|
constructor(config) {
|
|
1516
|
-
super({ id: config.id, name: "Upstash" });
|
|
1534
|
+
super({ id: config.id, name: "Upstash", disableInit: config.disableInit });
|
|
1517
1535
|
this.redis = new Redis({
|
|
1518
1536
|
url: config.url,
|
|
1519
1537
|
token: config.token
|
|
@@ -1919,7 +1937,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
1919
1937
|
} catch (error) {
|
|
1920
1938
|
throw new MastraError(
|
|
1921
1939
|
{
|
|
1922
|
-
id: "
|
|
1940
|
+
id: createVectorErrorId("UPSTASH", "UPSERT", "FAILED"),
|
|
1923
1941
|
domain: ErrorDomain.STORAGE,
|
|
1924
1942
|
category: ErrorCategory.THIRD_PARTY,
|
|
1925
1943
|
details: { namespace, vectorCount: vectors.length }
|
|
@@ -1982,7 +2000,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
1982
2000
|
} catch (error) {
|
|
1983
2001
|
throw new MastraError(
|
|
1984
2002
|
{
|
|
1985
|
-
id: "
|
|
2003
|
+
id: createVectorErrorId("UPSTASH", "QUERY", "FAILED"),
|
|
1986
2004
|
domain: ErrorDomain.STORAGE,
|
|
1987
2005
|
category: ErrorCategory.THIRD_PARTY,
|
|
1988
2006
|
details: { namespace, topK }
|
|
@@ -2002,7 +2020,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2002
2020
|
} catch (error) {
|
|
2003
2021
|
throw new MastraError(
|
|
2004
2022
|
{
|
|
2005
|
-
id: "
|
|
2023
|
+
id: createVectorErrorId("UPSTASH", "LIST_INDEXES", "FAILED"),
|
|
2006
2024
|
domain: ErrorDomain.STORAGE,
|
|
2007
2025
|
category: ErrorCategory.THIRD_PARTY
|
|
2008
2026
|
},
|
|
@@ -2027,7 +2045,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2027
2045
|
} catch (error) {
|
|
2028
2046
|
throw new MastraError(
|
|
2029
2047
|
{
|
|
2030
|
-
id: "
|
|
2048
|
+
id: createVectorErrorId("UPSTASH", "DESCRIBE_INDEX", "FAILED"),
|
|
2031
2049
|
domain: ErrorDomain.STORAGE,
|
|
2032
2050
|
category: ErrorCategory.THIRD_PARTY,
|
|
2033
2051
|
details: { namespace }
|
|
@@ -2052,7 +2070,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2052
2070
|
}
|
|
2053
2071
|
throw new MastraError(
|
|
2054
2072
|
{
|
|
2055
|
-
id: "
|
|
2073
|
+
id: createVectorErrorId("UPSTASH", "DELETE_INDEX", "FAILED"),
|
|
2056
2074
|
domain: ErrorDomain.STORAGE,
|
|
2057
2075
|
category: ErrorCategory.THIRD_PARTY,
|
|
2058
2076
|
details: { namespace }
|
|
@@ -2077,7 +2095,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2077
2095
|
const sparseVector = upstashUpdate.sparseVector;
|
|
2078
2096
|
if ("id" in params && params.id && "filter" in params && params.filter) {
|
|
2079
2097
|
throw new MastraError({
|
|
2080
|
-
id: "
|
|
2098
|
+
id: createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
|
|
2081
2099
|
text: "Cannot specify both id and filter - they are mutually exclusive",
|
|
2082
2100
|
domain: ErrorDomain.STORAGE,
|
|
2083
2101
|
category: ErrorCategory.USER,
|
|
@@ -2086,7 +2104,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2086
2104
|
}
|
|
2087
2105
|
if (!("id" in params && params.id) && !("filter" in params && params.filter)) {
|
|
2088
2106
|
throw new MastraError({
|
|
2089
|
-
id: "
|
|
2107
|
+
id: createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "NO_TARGET"),
|
|
2090
2108
|
text: "Either id or filter must be provided",
|
|
2091
2109
|
domain: ErrorDomain.STORAGE,
|
|
2092
2110
|
category: ErrorCategory.USER,
|
|
@@ -2095,7 +2113,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2095
2113
|
}
|
|
2096
2114
|
if (!update.vector && !update.metadata && !sparseVector) {
|
|
2097
2115
|
throw new MastraError({
|
|
2098
|
-
id: "
|
|
2116
|
+
id: createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "NO_PAYLOAD"),
|
|
2099
2117
|
text: "No update data provided",
|
|
2100
2118
|
domain: ErrorDomain.STORAGE,
|
|
2101
2119
|
category: ErrorCategory.USER,
|
|
@@ -2104,7 +2122,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2104
2122
|
}
|
|
2105
2123
|
if ("filter" in params && params.filter && Object.keys(params.filter).length === 0) {
|
|
2106
2124
|
throw new MastraError({
|
|
2107
|
-
id: "
|
|
2125
|
+
id: createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "EMPTY_FILTER"),
|
|
2108
2126
|
text: "Filter cannot be an empty filter object",
|
|
2109
2127
|
domain: ErrorDomain.STORAGE,
|
|
2110
2128
|
category: ErrorCategory.USER,
|
|
@@ -2172,7 +2190,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2172
2190
|
if (error instanceof MastraError) throw error;
|
|
2173
2191
|
throw new MastraError(
|
|
2174
2192
|
{
|
|
2175
|
-
id: "
|
|
2193
|
+
id: createVectorErrorId("UPSTASH", "UPDATE_VECTOR", "FAILED"),
|
|
2176
2194
|
domain: ErrorDomain.STORAGE,
|
|
2177
2195
|
category: ErrorCategory.THIRD_PARTY,
|
|
2178
2196
|
details: {
|
|
@@ -2199,7 +2217,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2199
2217
|
} catch (error) {
|
|
2200
2218
|
const mastraError = new MastraError(
|
|
2201
2219
|
{
|
|
2202
|
-
id: "
|
|
2220
|
+
id: createVectorErrorId("UPSTASH", "DELETE_VECTOR", "FAILED"),
|
|
2203
2221
|
domain: ErrorDomain.STORAGE,
|
|
2204
2222
|
category: ErrorCategory.THIRD_PARTY,
|
|
2205
2223
|
details: {
|
|
@@ -2223,7 +2241,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2223
2241
|
async deleteVectors({ indexName: namespace, filter, ids }) {
|
|
2224
2242
|
if (ids && filter) {
|
|
2225
2243
|
throw new MastraError({
|
|
2226
|
-
id: "
|
|
2244
|
+
id: createVectorErrorId("UPSTASH", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
|
|
2227
2245
|
text: "Cannot specify both ids and filter - they are mutually exclusive",
|
|
2228
2246
|
domain: ErrorDomain.STORAGE,
|
|
2229
2247
|
category: ErrorCategory.USER,
|
|
@@ -2232,7 +2250,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2232
2250
|
}
|
|
2233
2251
|
if (!ids && !filter) {
|
|
2234
2252
|
throw new MastraError({
|
|
2235
|
-
id: "
|
|
2253
|
+
id: createVectorErrorId("UPSTASH", "DELETE_VECTORS", "NO_TARGET"),
|
|
2236
2254
|
text: "Either filter or ids must be provided",
|
|
2237
2255
|
domain: ErrorDomain.STORAGE,
|
|
2238
2256
|
category: ErrorCategory.USER,
|
|
@@ -2241,7 +2259,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2241
2259
|
}
|
|
2242
2260
|
if (ids && ids.length === 0) {
|
|
2243
2261
|
throw new MastraError({
|
|
2244
|
-
id: "
|
|
2262
|
+
id: createVectorErrorId("UPSTASH", "DELETE_VECTORS", "EMPTY_IDS"),
|
|
2245
2263
|
text: "Cannot delete with empty ids array",
|
|
2246
2264
|
domain: ErrorDomain.STORAGE,
|
|
2247
2265
|
category: ErrorCategory.USER,
|
|
@@ -2250,7 +2268,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2250
2268
|
}
|
|
2251
2269
|
if (filter && Object.keys(filter).length === 0) {
|
|
2252
2270
|
throw new MastraError({
|
|
2253
|
-
id: "
|
|
2271
|
+
id: createVectorErrorId("UPSTASH", "DELETE_VECTORS", "EMPTY_FILTER"),
|
|
2254
2272
|
text: "Cannot delete with empty filter object",
|
|
2255
2273
|
domain: ErrorDomain.STORAGE,
|
|
2256
2274
|
category: ErrorCategory.USER,
|
|
@@ -2284,7 +2302,7 @@ var UpstashVector = class extends MastraVector {
|
|
|
2284
2302
|
if (error instanceof MastraError) throw error;
|
|
2285
2303
|
throw new MastraError(
|
|
2286
2304
|
{
|
|
2287
|
-
id: "
|
|
2305
|
+
id: createVectorErrorId("UPSTASH", "DELETE_VECTORS", "FAILED"),
|
|
2288
2306
|
domain: ErrorDomain.STORAGE,
|
|
2289
2307
|
category: ErrorCategory.THIRD_PARTY,
|
|
2290
2308
|
details: {
|