@mastra/clickhouse 1.29.0 → 1.30.0-alpha.1

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
@@ -4462,7 +4462,7 @@ function scoreRecordToRow(score) {
4462
4462
  function rowToFeedbackRecord(row) {
4463
4463
  const hasNumber = row.valueNumber != null;
4464
4464
  const feedbackSource = nullableString(row.feedbackSource);
4465
- const feedbackUserId = nullableString(row.feedbackUserId) ?? nullableString(row.userId);
4465
+ const feedbackUserId = row.feedbackUserId !== void 0 ? nullableString(row.feedbackUserId) : nullableString(row.userId);
4466
4466
  return {
4467
4467
  feedbackId: row.feedbackId,
4468
4468
  timestamp: toDate(row.timestamp),
@@ -4506,7 +4506,7 @@ function rowToFeedbackRecord(row) {
4506
4506
  function feedbackRecordToRow(feedback) {
4507
4507
  const metadata = feedback.metadata ?? null;
4508
4508
  const feedbackSource = feedback.feedbackSource ?? feedback.source ?? "";
4509
- const feedbackUserId = feedback.feedbackUserId ?? feedback.userId ?? null;
4509
+ const feedbackUserId = feedback.feedbackUserId !== void 0 ? feedback.feedbackUserId : feedback.userId ?? null;
4510
4510
  return {
4511
4511
  feedbackId: feedback.feedbackId,
4512
4512
  timestamp: toISOString(feedback.timestamp),
@@ -4525,7 +4525,7 @@ function feedbackRecordToRow(feedback) {
4525
4525
  rootEntityType: feedback.rootEntityType ?? null,
4526
4526
  rootEntityId: feedback.rootEntityId ?? null,
4527
4527
  rootEntityName: feedback.rootEntityName ?? null,
4528
- userId: feedbackUserId,
4528
+ userId: feedback.userId ?? null,
4529
4529
  organizationId: feedback.organizationId ?? null,
4530
4530
  resourceId: feedback.resourceId ?? null,
4531
4531
  runId: feedback.runId ?? null,
@@ -5178,6 +5178,13 @@ async function hasFeedbackDeletionRequest(client, feedbackId, organizationId, re
5178
5178
  resourceId: resourceId ?? ""
5179
5179
  }, FINAL_SKIP_INDEX_SETTINGS)).length > 0;
5180
5180
  }
5181
+ /** Retrieves the latest feedback record with this ID, or null when missing. */
5182
+ async function getFeedbackById(client, feedbackId) {
5183
+ const rows = await queryJson$2(client, `SELECT * FROM ${TABLE_FEEDBACK_EVENTS} FINAL
5184
+ WHERE feedbackId = {feedbackId:String}
5185
+ ORDER BY writeVersion DESC, timestamp DESC LIMIT 1`, { feedbackId }, FINAL_SKIP_INDEX_SETTINGS);
5186
+ return rows[0] ? rowToFeedbackRecord(rows[0]) : null;
5187
+ }
5181
5188
  /**
5182
5189
  * Review updates insert a replacement row, so they need only `INSERT` and the
5183
5190
  * insert materialized view publishes the delta cursor.
@@ -10843,6 +10850,19 @@ var ObservabilityStorageClickhouseVNext = class extends ObservabilityStorage {
10843
10850
  }, error);
10844
10851
  }
10845
10852
  }
10853
+ async getFeedbackById(feedbackId) {
10854
+ try {
10855
+ return await getFeedbackById(this.#client, feedbackId);
10856
+ } catch (error) {
10857
+ if (error instanceof MastraError) throw error;
10858
+ throw new MastraError({
10859
+ id: createStorageErrorId("CLICKHOUSE", "GET_FEEDBACK_BY_ID", "FAILED"),
10860
+ domain: ErrorDomain.STORAGE,
10861
+ category: ErrorCategory.THIRD_PARTY,
10862
+ details: { feedbackId }
10863
+ }, error);
10864
+ }
10865
+ }
10846
10866
  async createFeedback(args) {
10847
10867
  try {
10848
10868
  await createFeedback(this.#client, args);