@mastra/upstash 1.0.0-beta.4 → 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 +16 -0
- package/dist/index.cjs +24 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -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/index.d.ts +2 -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
|
);
|