@mastra/cloudflare 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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/cloudflare
2
2
 
3
+ ## 1.0.0-beta.5
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.4
4
20
 
5
21
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1557,13 +1557,19 @@ var ScoresStorageCloudflare = class extends storage.ScoresStorage {
1557
1557
  id: storage.createStorageErrorId("CLOUDFLARE", "SAVE_SCORE", "VALIDATION_FAILED"),
1558
1558
  domain: error.ErrorDomain.STORAGE,
1559
1559
  category: error.ErrorCategory.USER,
1560
- details: { scoreId: score.id }
1560
+ details: {
1561
+ scorer: score.scorer?.id ?? "unknown",
1562
+ entityId: score.entityId ?? "unknown",
1563
+ entityType: score.entityType ?? "unknown",
1564
+ traceId: score.traceId ?? "",
1565
+ spanId: score.spanId ?? ""
1566
+ }
1561
1567
  },
1562
1568
  error$1
1563
1569
  );
1564
1570
  }
1571
+ const id = crypto.randomUUID();
1565
1572
  try {
1566
- const id = crypto.randomUUID();
1567
1573
  const serializedRecord = {};
1568
1574
  for (const [key, value] of Object.entries(parsedScore)) {
1569
1575
  if (value !== null && value !== void 0) {
@@ -1576,23 +1582,23 @@ var ScoresStorageCloudflare = class extends storage.ScoresStorage {
1576
1582
  serializedRecord[key] = null;
1577
1583
  }
1578
1584
  }
1585
+ const now = /* @__PURE__ */ new Date();
1579
1586
  serializedRecord.id = id;
1580
- serializedRecord.createdAt = (/* @__PURE__ */ new Date()).toISOString();
1581
- serializedRecord.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
1587
+ serializedRecord.createdAt = now.toISOString();
1588
+ serializedRecord.updatedAt = now.toISOString();
1582
1589
  await this.operations.putKV({
1583
1590
  tableName: storage.TABLE_SCORERS,
1584
1591
  key: id,
1585
1592
  value: serializedRecord
1586
1593
  });
1587
- const scoreFromDb = await this.getScoreById({ id: score.id });
1588
- return { score: scoreFromDb };
1594
+ return { score: { ...parsedScore, id, createdAt: now, updatedAt: now } };
1589
1595
  } catch (error$1) {
1590
1596
  const mastraError = new error.MastraError(
1591
1597
  {
1592
1598
  id: storage.createStorageErrorId("CLOUDFLARE", "SAVE_SCORE", "FAILED"),
1593
1599
  domain: error.ErrorDomain.STORAGE,
1594
1600
  category: error.ErrorCategory.THIRD_PARTY,
1595
- text: `Failed to save score: ${score.id}`
1601
+ details: { id }
1596
1602
  },
1597
1603
  error$1
1598
1604
  );