@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/dist/index.js
CHANGED
|
@@ -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
|
}
|
|
@@ -1123,22 +1123,39 @@ var ScoresUpstash = class extends ScoresStorage {
|
|
|
1123
1123
|
{
|
|
1124
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
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
|
);
|
|
@@ -1418,6 +1435,26 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
|
|
|
1418
1435
|
);
|
|
1419
1436
|
}
|
|
1420
1437
|
}
|
|
1438
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
1439
|
+
const key = getKey(TABLE_WORKFLOW_SNAPSHOT, { namespace: "workflows", workflow_name: workflowName, run_id: runId });
|
|
1440
|
+
try {
|
|
1441
|
+
await this.client.del(key);
|
|
1442
|
+
} catch (error) {
|
|
1443
|
+
throw new MastraError(
|
|
1444
|
+
{
|
|
1445
|
+
id: createStorageErrorId("UPSTASH", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
1446
|
+
domain: ErrorDomain.STORAGE,
|
|
1447
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
1448
|
+
details: {
|
|
1449
|
+
namespace: "workflows",
|
|
1450
|
+
runId,
|
|
1451
|
+
workflowName
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
error
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1421
1458
|
async listWorkflowRuns({
|
|
1422
1459
|
workflowName,
|
|
1423
1460
|
fromDate,
|
|
@@ -1614,6 +1651,9 @@ var UpstashStore = class extends MastraStorage {
|
|
|
1614
1651
|
async loadWorkflowSnapshot(params) {
|
|
1615
1652
|
return this.stores.workflows.loadWorkflowSnapshot(params);
|
|
1616
1653
|
}
|
|
1654
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
1655
|
+
return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
|
|
1656
|
+
}
|
|
1617
1657
|
async listWorkflowRuns(args = {}) {
|
|
1618
1658
|
return this.stores.workflows.listWorkflowRuns(args);
|
|
1619
1659
|
}
|