@mastra/clickhouse 1.30.0-alpha.1 → 1.30.0-alpha.2

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.30.0-alpha.1"
6
+ version: "1.30.0-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.30.0-alpha.1",
2
+ "version": "1.30.0-alpha.2",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {
5
5
  "COLUMN_TYPES": {
@@ -10,12 +10,12 @@
10
10
  "ClickhouseStore": {
11
11
  "types": "dist/storage/index.d.ts",
12
12
  "implementation": "dist/index.js",
13
- "line": 11912
13
+ "line": 11920
14
14
  },
15
15
  "ClickhouseStoreVNext": {
16
16
  "types": "dist/storage/index.d.ts",
17
17
  "implementation": "dist/index.js",
18
- "line": 12028
18
+ "line": 12036
19
19
  },
20
20
  "MemoryStorageClickhouse": {
21
21
  "types": "dist/storage/domains/memory/index.d.ts",
@@ -30,12 +30,12 @@
30
30
  "ObservabilityStorageClickhouseVNext": {
31
31
  "types": "dist/storage/domains/observability/v-next/index.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 10332
33
+ "line": 10338
34
34
  },
35
35
  "ScoresStorageClickhouse": {
36
36
  "types": "dist/storage/domains/scores/index.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 11216
38
+ "line": 11224
39
39
  },
40
40
  "TABLE_DELETION_REQUESTS": {
41
41
  "types": "dist/storage/domains/observability/v-next/ddl.d.ts",
@@ -50,12 +50,12 @@
50
50
  "WorkflowsStorageClickhouse": {
51
51
  "types": "dist/storage/domains/workflows/index.d.ts",
52
52
  "implementation": "dist/index.js",
53
- "line": 11617
53
+ "line": 11625
54
54
  },
55
55
  "applyClickHouseRetention": {
56
56
  "types": "dist/storage/domains/observability/v-next/index.d.ts",
57
57
  "implementation": "dist/index.js",
58
- "line": 10157
58
+ "line": 10163
59
59
  },
60
60
  "markDeletionRequestApplied": {
61
61
  "types": "dist/storage/domains/observability/v-next/deletion-requests.d.ts",
package/dist/index.cjs CHANGED
@@ -5092,7 +5092,7 @@ async function queryJson$2(client, query, params, settings = {}) {
5092
5092
  }
5093
5093
  })).json();
5094
5094
  }
5095
- async function feedbackRowsWithWriteVersions(client, feedbacks) {
5095
+ async function feedbackRowsWithWriteVersions(client, feedbacks, onConflict) {
5096
5096
  const identifiedFeedback = feedbacks.map((feedback) => ({
5097
5097
  ...feedback,
5098
5098
  feedbackId: feedback.feedbackId ?? ""
@@ -5103,23 +5103,29 @@ async function feedbackRowsWithWriteVersions(client, feedbacks) {
5103
5103
  WHERE feedbackId IN ({feedbackIds:Array(String)})
5104
5104
  GROUP BY feedbackId`, { feedbackIds });
5105
5105
  const versions = new Map(existingVersions.map((row) => [row.feedbackId, BigInt(row.writeVersion)]));
5106
- return identifiedFeedback.map((feedback) => {
5106
+ return identifiedFeedback.flatMap((feedback) => {
5107
+ if (onConflict === "ignore" && versions.has(feedback.feedbackId)) return [];
5107
5108
  const writeVersion = (versions.get(feedback.feedbackId) ?? 0n) + 1n;
5108
5109
  versions.set(feedback.feedbackId, writeVersion);
5109
- return {
5110
+ return [{
5110
5111
  ...feedbackRecordToRow(feedback),
5111
5112
  writeVersion: writeVersion.toString()
5112
- };
5113
+ }];
5113
5114
  });
5114
5115
  }
5115
5116
  async function createFeedback(client, args) {
5116
- await batchCreateFeedback(client, { feedbacks: [args.feedback] });
5117
+ await batchCreateFeedback(client, {
5118
+ feedbacks: [args.feedback],
5119
+ onConflict: args.onConflict
5120
+ });
5117
5121
  }
5118
5122
  async function batchCreateFeedback(client, args) {
5119
5123
  if (args.feedbacks.length === 0) return;
5124
+ const values = await feedbackRowsWithWriteVersions(client, args.feedbacks, args.onConflict);
5125
+ if (values.length === 0) return;
5120
5126
  await client.insert({
5121
5127
  table: TABLE_FEEDBACK_EVENTS,
5122
- values: await feedbackRowsWithWriteVersions(client, args.feedbacks),
5128
+ values,
5123
5129
  format: "JSONEachRow",
5124
5130
  clickhouse_settings: CH_INSERT_SETTINGS
5125
5131
  });
@@ -10497,6 +10503,7 @@ var ObservabilityStorageClickhouseVNext = class extends _mastra_core_storage.Obs
10497
10503
  "thread-query",
10498
10504
  "trace-query-tenant-scope",
10499
10505
  "feedback",
10506
+ "feedback-replacement",
10500
10507
  "trace-query-context-ids",
10501
10508
  ...contextFieldFeatures,
10502
10509
  ...timingFeatures,
@@ -10525,6 +10532,7 @@ var ObservabilityStorageClickhouseVNext = class extends _mastra_core_storage.Obs
10525
10532
  "thread-query",
10526
10533
  "trace-query-tenant-scope",
10527
10534
  "feedback",
10535
+ "feedback-replacement",
10528
10536
  "trace-query-context-ids",
10529
10537
  ...contextFieldFeatures,
10530
10538
  ...timingFeatures,