@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.
@@ -3,7 +3,7 @@ name: mastra-clickhouse
3
3
  description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/clickhouse"
6
- version: "1.29.0"
6
+ version: "1.30.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -18,10 +18,5 @@ Read the individual reference documents for detailed explanations and code examp
18
18
 
19
19
  - [ClickHouse](references/integrations-databases-clickhouse.md) - Use ClickHouse as a Mastra analytical storage backend for observability, scores, and metrics with vNext or legacy storage domain configuration.
20
20
 
21
- ### Reference
22
-
23
- - [Reference: Composite storage](references/reference-storage-composite.md) - MastraCompositeStore can compose storage domains from different providers. Use it when you need different databases for different purposes.
24
- - [Reference: Storage retention (prune)](references/reference-storage-retention.md) - prune() deletes rows. It caps growth and is safe to run against large tables (batched, bounded, resumable, cancellable).
25
-
26
21
 
27
22
  Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,6 +1,72 @@
1
1
  {
2
- "version": "1.29.0",
2
+ "version": "1.30.0-alpha.1",
3
3
  "package": "@mastra/clickhouse",
4
- "exports": {},
4
+ "exports": {
5
+ "COLUMN_TYPES": {
6
+ "types": "dist/storage/db/utils.d.ts",
7
+ "implementation": "dist/index.js",
8
+ "line": 286
9
+ },
10
+ "ClickhouseStore": {
11
+ "types": "dist/storage/index.d.ts",
12
+ "implementation": "dist/index.js",
13
+ "line": 11912
14
+ },
15
+ "ClickhouseStoreVNext": {
16
+ "types": "dist/storage/index.d.ts",
17
+ "implementation": "dist/index.js",
18
+ "line": 12028
19
+ },
20
+ "MemoryStorageClickhouse": {
21
+ "types": "dist/storage/domains/memory/index.d.ts",
22
+ "implementation": "dist/index.js",
23
+ "line": 890
24
+ },
25
+ "ObservabilityStorageClickhouse": {
26
+ "types": "dist/storage/domains/observability/index.d.ts",
27
+ "implementation": "dist/index.js",
28
+ "line": 1992
29
+ },
30
+ "ObservabilityStorageClickhouseVNext": {
31
+ "types": "dist/storage/domains/observability/v-next/index.d.ts",
32
+ "implementation": "dist/index.js",
33
+ "line": 10332
34
+ },
35
+ "ScoresStorageClickhouse": {
36
+ "types": "dist/storage/domains/scores/index.d.ts",
37
+ "implementation": "dist/index.js",
38
+ "line": 11216
39
+ },
40
+ "TABLE_DELETION_REQUESTS": {
41
+ "types": "dist/storage/domains/observability/v-next/ddl.d.ts",
42
+ "implementation": "dist/index.js",
43
+ "line": 2608
44
+ },
45
+ "TABLE_ENGINES": {
46
+ "types": "dist/storage/db/utils.d.ts",
47
+ "implementation": "dist/index.js",
48
+ "line": 212
49
+ },
50
+ "WorkflowsStorageClickhouse": {
51
+ "types": "dist/storage/domains/workflows/index.d.ts",
52
+ "implementation": "dist/index.js",
53
+ "line": 11617
54
+ },
55
+ "applyClickHouseRetention": {
56
+ "types": "dist/storage/domains/observability/v-next/index.d.ts",
57
+ "implementation": "dist/index.js",
58
+ "line": 10157
59
+ },
60
+ "markDeletionRequestApplied": {
61
+ "types": "dist/storage/domains/observability/v-next/deletion-requests.d.ts",
62
+ "implementation": "dist/index.js",
63
+ "line": 4578
64
+ },
65
+ "recordDeletionRequest": {
66
+ "types": "dist/storage/domains/observability/v-next/deletion-requests.d.ts",
67
+ "implementation": "dist/index.js",
68
+ "line": 4553
69
+ }
70
+ },
5
71
  "modules": {}
6
72
  }
package/dist/index.cjs CHANGED
@@ -4484,7 +4484,7 @@ function scoreRecordToRow(score) {
4484
4484
  function rowToFeedbackRecord(row) {
4485
4485
  const hasNumber = row.valueNumber != null;
4486
4486
  const feedbackSource = nullableString(row.feedbackSource);
4487
- const feedbackUserId = nullableString(row.feedbackUserId) ?? nullableString(row.userId);
4487
+ const feedbackUserId = row.feedbackUserId !== void 0 ? nullableString(row.feedbackUserId) : nullableString(row.userId);
4488
4488
  return {
4489
4489
  feedbackId: row.feedbackId,
4490
4490
  timestamp: toDate(row.timestamp),
@@ -4528,7 +4528,7 @@ function rowToFeedbackRecord(row) {
4528
4528
  function feedbackRecordToRow(feedback) {
4529
4529
  const metadata = feedback.metadata ?? null;
4530
4530
  const feedbackSource = feedback.feedbackSource ?? feedback.source ?? "";
4531
- const feedbackUserId = feedback.feedbackUserId ?? feedback.userId ?? null;
4531
+ const feedbackUserId = feedback.feedbackUserId !== void 0 ? feedback.feedbackUserId : feedback.userId ?? null;
4532
4532
  return {
4533
4533
  feedbackId: feedback.feedbackId,
4534
4534
  timestamp: toISOString(feedback.timestamp),
@@ -4547,7 +4547,7 @@ function feedbackRecordToRow(feedback) {
4547
4547
  rootEntityType: feedback.rootEntityType ?? null,
4548
4548
  rootEntityId: feedback.rootEntityId ?? null,
4549
4549
  rootEntityName: feedback.rootEntityName ?? null,
4550
- userId: feedbackUserId,
4550
+ userId: feedback.userId ?? null,
4551
4551
  organizationId: feedback.organizationId ?? null,
4552
4552
  resourceId: feedback.resourceId ?? null,
4553
4553
  runId: feedback.runId ?? null,
@@ -5200,6 +5200,13 @@ async function hasFeedbackDeletionRequest(client, feedbackId, organizationId, re
5200
5200
  resourceId: resourceId ?? ""
5201
5201
  }, FINAL_SKIP_INDEX_SETTINGS)).length > 0;
5202
5202
  }
5203
+ /** Retrieves the latest feedback record with this ID, or null when missing. */
5204
+ async function getFeedbackById(client, feedbackId) {
5205
+ const rows = await queryJson$2(client, `SELECT * FROM ${TABLE_FEEDBACK_EVENTS} FINAL
5206
+ WHERE feedbackId = {feedbackId:String}
5207
+ ORDER BY writeVersion DESC, timestamp DESC LIMIT 1`, { feedbackId }, FINAL_SKIP_INDEX_SETTINGS);
5208
+ return rows[0] ? rowToFeedbackRecord(rows[0]) : null;
5209
+ }
5203
5210
  /**
5204
5211
  * Review updates insert a replacement row, so they need only `INSERT` and the
5205
5212
  * insert materialized view publishes the delta cursor.
@@ -10865,6 +10872,19 @@ var ObservabilityStorageClickhouseVNext = class extends _mastra_core_storage.Obs
10865
10872
  }, error);
10866
10873
  }
10867
10874
  }
10875
+ async getFeedbackById(feedbackId) {
10876
+ try {
10877
+ return await getFeedbackById(this.#client, feedbackId);
10878
+ } catch (error) {
10879
+ if (error instanceof _mastra_core_error.MastraError) throw error;
10880
+ throw new _mastra_core_error.MastraError({
10881
+ id: (0, _mastra_core_storage.createStorageErrorId)("CLICKHOUSE", "GET_FEEDBACK_BY_ID", "FAILED"),
10882
+ domain: _mastra_core_error.ErrorDomain.STORAGE,
10883
+ category: _mastra_core_error.ErrorCategory.THIRD_PARTY,
10884
+ details: { feedbackId }
10885
+ }, error);
10886
+ }
10887
+ }
10868
10888
  async createFeedback(args) {
10869
10889
  try {
10870
10890
  await createFeedback(this.#client, args);