@mastra/upstash 1.0.0-beta.4 → 1.0.0-beta.6
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 +29 -0
- package/dist/index.cjs +47 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -5
- package/dist/index.js.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 +4 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
await workflow.deleteWorkflowRunById(runId);
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
|
|
14
|
+
- @mastra/core@1.0.0-beta.10
|
|
15
|
+
|
|
16
|
+
## 1.0.0-beta.5
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
|
|
21
|
+
|
|
22
|
+
**What Changed**
|
|
23
|
+
- saveScore now correctly returns scores that can be retrieved with getScoreById
|
|
24
|
+
- Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
|
|
25
|
+
|
|
26
|
+
**Impact**
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
- 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)]:
|
|
30
|
+
- @mastra/core@1.0.0-beta.8
|
|
31
|
+
|
|
3
32
|
## 1.0.0-beta.4
|
|
4
33
|
|
|
5
34
|
### 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
|
}
|
|
@@ -1125,22 +1125,39 @@ var ScoresUpstash = class extends storage.ScoresStorage {
|
|
|
1125
1125
|
{
|
|
1126
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
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
|
);
|
|
@@ -1420,6 +1437,26 @@ var WorkflowsUpstash = class extends storage.WorkflowsStorage {
|
|
|
1420
1437
|
);
|
|
1421
1438
|
}
|
|
1422
1439
|
}
|
|
1440
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
1441
|
+
const key = getKey(storage.TABLE_WORKFLOW_SNAPSHOT, { namespace: "workflows", workflow_name: workflowName, run_id: runId });
|
|
1442
|
+
try {
|
|
1443
|
+
await this.client.del(key);
|
|
1444
|
+
} catch (error$1) {
|
|
1445
|
+
throw new error.MastraError(
|
|
1446
|
+
{
|
|
1447
|
+
id: storage.createStorageErrorId("UPSTASH", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
1448
|
+
domain: error.ErrorDomain.STORAGE,
|
|
1449
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
1450
|
+
details: {
|
|
1451
|
+
namespace: "workflows",
|
|
1452
|
+
runId,
|
|
1453
|
+
workflowName
|
|
1454
|
+
}
|
|
1455
|
+
},
|
|
1456
|
+
error$1
|
|
1457
|
+
);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1423
1460
|
async listWorkflowRuns({
|
|
1424
1461
|
workflowName,
|
|
1425
1462
|
fromDate,
|
|
@@ -1616,6 +1653,9 @@ var UpstashStore = class extends storage.MastraStorage {
|
|
|
1616
1653
|
async loadWorkflowSnapshot(params) {
|
|
1617
1654
|
return this.stores.workflows.loadWorkflowSnapshot(params);
|
|
1618
1655
|
}
|
|
1656
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
1657
|
+
return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
|
|
1658
|
+
}
|
|
1619
1659
|
async listWorkflowRuns(args = {}) {
|
|
1620
1660
|
return this.stores.workflows.listWorkflowRuns(args);
|
|
1621
1661
|
}
|
|
@@ -1907,7 +1947,7 @@ var UpstashVector = class extends vector.MastraVector {
|
|
|
1907
1947
|
ids,
|
|
1908
1948
|
sparseVectors
|
|
1909
1949
|
}) {
|
|
1910
|
-
const generatedIds = ids || vectors.map(() => crypto.randomUUID());
|
|
1950
|
+
const generatedIds = ids || vectors.map(() => crypto$1.randomUUID());
|
|
1911
1951
|
const points = vectors.map((vector, index) => ({
|
|
1912
1952
|
id: generatedIds[index],
|
|
1913
1953
|
vector,
|