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