@mastra/clickhouse 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/clickhouse
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
@@ -1529,19 +1529,33 @@ var ScoresStorageClickhouse = class extends storage.ScoresStorage {
1529
1529
  id: storage.createStorageErrorId("CLICKHOUSE", "SAVE_SCORE", "VALIDATION_FAILED"),
1530
1530
  domain: error.ErrorDomain.STORAGE,
1531
1531
  category: error.ErrorCategory.USER,
1532
- details: { scoreId: score.id }
1532
+ details: {
1533
+ scorer: score.scorer?.id ?? "unknown",
1534
+ entityId: score.entityId ?? "unknown",
1535
+ entityType: score.entityType ?? "unknown",
1536
+ traceId: score.traceId ?? "",
1537
+ spanId: score.spanId ?? ""
1538
+ }
1533
1539
  },
1534
1540
  error$1
1535
1541
  );
1536
1542
  }
1543
+ const now = /* @__PURE__ */ new Date();
1544
+ const id = crypto.randomUUID();
1545
+ const createdAt = now;
1546
+ const updatedAt = now;
1537
1547
  try {
1538
1548
  const record = {};
1539
1549
  for (const key of Object.keys(storage.SCORERS_SCHEMA)) {
1540
- const value = parsedScore[key];
1550
+ if (key === "id") {
1551
+ record[key] = id;
1552
+ continue;
1553
+ }
1541
1554
  if (key === "createdAt" || key === "updatedAt") {
1542
- record[key] = (/* @__PURE__ */ new Date()).toISOString();
1555
+ record[key] = now.toISOString();
1543
1556
  continue;
1544
1557
  }
1558
+ const value = parsedScore[key];
1545
1559
  record[key] = value === void 0 || value === null ? "_null_" : value;
1546
1560
  }
1547
1561
  await this.client.insert({
@@ -1554,14 +1568,14 @@ var ScoresStorageClickhouse = class extends storage.ScoresStorage {
1554
1568
  output_format_json_quote_64bit_integers: 0
1555
1569
  }
1556
1570
  });
1557
- return { score };
1571
+ return { score: { ...parsedScore, id, createdAt, updatedAt } };
1558
1572
  } catch (error$1) {
1559
1573
  throw new error.MastraError(
1560
1574
  {
1561
1575
  id: storage.createStorageErrorId("CLICKHOUSE", "SAVE_SCORE", "FAILED"),
1562
1576
  domain: error.ErrorDomain.STORAGE,
1563
1577
  category: error.ErrorCategory.THIRD_PARTY,
1564
- details: { scoreId: score.id }
1578
+ details: { scoreId: id }
1565
1579
  },
1566
1580
  error$1
1567
1581
  );
@@ -2324,8 +2338,8 @@ var ClickhouseStore = class extends storage.MastraStorage {
2324
2338
  async getScoreById({ id }) {
2325
2339
  return this.stores.scores.getScoreById({ id });
2326
2340
  }
2327
- async saveScore(_score) {
2328
- return this.stores.scores.saveScore(_score);
2341
+ async saveScore(score) {
2342
+ return this.stores.scores.saveScore(score);
2329
2343
  }
2330
2344
  async listScoresByRunId({
2331
2345
  runId,