@mastra/dynamodb 1.0.0-beta.3 → 1.0.0-beta.4

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/dynamodb
2
2
 
3
+ ## 1.0.0-beta.4
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
+
3
19
  ## 1.0.0-beta.3
4
20
 
5
21
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2018,13 +2018,20 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
2018
2018
  {
2019
2019
  id: storage.createStorageErrorId("DYNAMODB", "SAVE_SCORE", "VALIDATION_FAILED"),
2020
2020
  domain: error.ErrorDomain.STORAGE,
2021
- category: error.ErrorCategory.THIRD_PARTY
2021
+ category: error.ErrorCategory.USER,
2022
+ details: {
2023
+ scorer: score.scorer?.id ?? "unknown",
2024
+ entityId: score.entityId ?? "unknown",
2025
+ entityType: score.entityType ?? "unknown",
2026
+ traceId: score.traceId ?? "",
2027
+ spanId: score.spanId ?? ""
2028
+ }
2022
2029
  },
2023
2030
  error$1
2024
2031
  );
2025
2032
  }
2026
2033
  const now = /* @__PURE__ */ new Date();
2027
- const scoreId = `score-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
2034
+ const scoreId = crypto.randomUUID();
2028
2035
  const scorer = typeof validatedScore.scorer === "string" ? validatedScore.scorer : JSON.stringify(validatedScore.scorer);
2029
2036
  const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? validatedScore.preprocessStepResult : JSON.stringify(validatedScore.preprocessStepResult);
2030
2037
  const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? validatedScore.analyzeStepResult : JSON.stringify(validatedScore.analyzeStepResult);
@@ -2054,13 +2061,14 @@ var ScoresStorageDynamoDB = class extends storage.ScoresStorage {
2054
2061
  );
2055
2062
  try {
2056
2063
  await this.service.entities.score.upsert(scoreData).go();
2057
- const savedScore = {
2058
- ...score,
2059
- id: scoreId,
2060
- createdAt: now,
2061
- updatedAt: now
2064
+ return {
2065
+ score: {
2066
+ ...validatedScore,
2067
+ id: scoreId,
2068
+ createdAt: now,
2069
+ updatedAt: now
2070
+ }
2062
2071
  };
2063
- return { score: savedScore };
2064
2072
  } catch (error$1) {
2065
2073
  throw new error.MastraError(
2066
2074
  {
@@ -2730,8 +2738,8 @@ var DynamoDBStore = class extends storage.MastraStorage {
2730
2738
  async getScoreById({ id: _id }) {
2731
2739
  return this.stores.scores.getScoreById({ id: _id });
2732
2740
  }
2733
- async saveScore(_score) {
2734
- return this.stores.scores.saveScore(_score);
2741
+ async saveScore(score) {
2742
+ return this.stores.scores.saveScore(score);
2735
2743
  }
2736
2744
  async listScoresByRunId({
2737
2745
  runId: _runId,