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