@mastra/mongodb 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/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { saveScorePayloadSchema } from '@mastra/core/evals';
11
11
 
12
12
  // package.json
13
13
  var package_default = {
14
- version: "1.0.0-beta.4"};
14
+ version: "1.0.0-beta.5"};
15
15
  var MongoDBFilterTranslator = class extends BaseFilterTranslator {
16
16
  getSupportedOperators() {
17
17
  return {
@@ -1937,14 +1937,21 @@ var ScoresStorageMongoDB = class extends ScoresStorage {
1937
1937
  {
1938
1938
  id: createStorageErrorId("MONGODB", "SAVE_SCORE", "VALIDATION_FAILED"),
1939
1939
  domain: ErrorDomain.STORAGE,
1940
- category: ErrorCategory.THIRD_PARTY
1940
+ category: ErrorCategory.USER,
1941
+ details: {
1942
+ scorer: score.scorer?.id ?? "unknown",
1943
+ entityId: score.entityId ?? "unknown",
1944
+ entityType: score.entityType ?? "unknown",
1945
+ traceId: score.traceId ?? "",
1946
+ spanId: score.spanId ?? ""
1947
+ }
1941
1948
  },
1942
1949
  error
1943
1950
  );
1944
1951
  }
1945
1952
  try {
1946
1953
  const now = /* @__PURE__ */ new Date();
1947
- const scoreId = `score-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1954
+ const scoreId = crypto.randomUUID();
1948
1955
  const scorer = typeof validatedScore.scorer === "string" ? safelyParseJSON(validatedScore.scorer) : validatedScore.scorer;
1949
1956
  const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? safelyParseJSON(validatedScore.preprocessStepResult) : validatedScore.preprocessStepResult;
1950
1957
  const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? safelyParseJSON(validatedScore.analyzeStepResult) : validatedScore.analyzeStepResult;
@@ -1956,6 +1963,7 @@ var ScoresStorageMongoDB = class extends ScoresStorage {
1956
1963
  const updatedAt = now;
1957
1964
  const dataToSave = {
1958
1965
  ...validatedScore,
1966
+ id: scoreId,
1959
1967
  scorer,
1960
1968
  preprocessStepResult,
1961
1969
  analyzeStepResult,
@@ -1968,13 +1976,7 @@ var ScoresStorageMongoDB = class extends ScoresStorage {
1968
1976
  };
1969
1977
  const collection = await this.operations.getCollection(TABLE_SCORERS);
1970
1978
  await collection.insertOne(dataToSave);
1971
- const savedScore = {
1972
- ...score,
1973
- id: scoreId,
1974
- createdAt: now,
1975
- updatedAt: now
1976
- };
1977
- return { score: savedScore };
1979
+ return { score: dataToSave };
1978
1980
  } catch (error) {
1979
1981
  throw new MastraError(
1980
1982
  {