@mastra/clickhouse 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-tsconfig-compile-20250703214351

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,6 +1,418 @@
1
1
  # @mastra/clickhouse
2
2
 
3
- ## 0.0.0-trigger-playground-ui-package-20250506151043
3
+ ## 0.0.0-tsconfig-compile-20250703214351
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b790fd1]
8
+ - Updated dependencies [f36e4f1]
9
+ - @mastra/core@0.0.0-tsconfig-compile-20250703214351
10
+
11
+ ## 0.12.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 8a3bfd2: Update peerdeps to latest core
16
+
17
+ ### Patch Changes
18
+
19
+ - 15e9d26: Added per-resource working memory for LibSQL, Upstash, and PG
20
+ - d8f2d19: Add updateMessages API to storage classes (only support for PG and LibSQL for now) and to memory class. Additionally allow for metadata to be saved in the content field of a message.
21
+ - 0fb9d64: [MASTRA-4018] Update saveMessages in storage adapters to upsert messages
22
+ - 2097952: [MASTRA-4021] Fix PG getMessages and update messageLimit for all storage adapters
23
+ - 0e17048: Throw mastra errors in storage packages
24
+ - Updated dependencies [15e9d26]
25
+ - Updated dependencies [d1baedb]
26
+ - Updated dependencies [d8f2d19]
27
+ - Updated dependencies [4d21bf2]
28
+ - Updated dependencies [07d6d88]
29
+ - Updated dependencies [9d52b17]
30
+ - Updated dependencies [2097952]
31
+ - Updated dependencies [792c4c0]
32
+ - Updated dependencies [5d74aab]
33
+ - Updated dependencies [a8b194f]
34
+ - Updated dependencies [4fb0cc2]
35
+ - Updated dependencies [d2a7a31]
36
+ - Updated dependencies [502fe05]
37
+ - Updated dependencies [144eb0b]
38
+ - Updated dependencies [8ba1b51]
39
+ - Updated dependencies [4efcfa0]
40
+ - Updated dependencies [0e17048]
41
+ - @mastra/core@0.10.7
42
+
43
+ ## 0.12.0-alpha.3
44
+
45
+ ### Minor Changes
46
+
47
+ - 8a3bfd2: Update peerdeps to latest core
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [792c4c0]
52
+ - Updated dependencies [502fe05]
53
+ - Updated dependencies [4efcfa0]
54
+ - @mastra/core@0.10.7-alpha.3
55
+
56
+ ## 0.11.1-alpha.2
57
+
58
+ ### Patch Changes
59
+
60
+ - 15e9d26: Added per-resource working memory for LibSQL, Upstash, and PG
61
+ - 0fb9d64: [MASTRA-4018] Update saveMessages in storage adapters to upsert messages
62
+ - Updated dependencies [15e9d26]
63
+ - Updated dependencies [07d6d88]
64
+ - Updated dependencies [5d74aab]
65
+ - Updated dependencies [144eb0b]
66
+ - @mastra/core@0.10.7-alpha.2
67
+
68
+ ## 0.11.1-alpha.1
69
+
70
+ ### Patch Changes
71
+
72
+ - 2097952: [MASTRA-4021] Fix PG getMessages and update messageLimit for all storage adapters
73
+ - 0e17048: Throw mastra errors in storage packages
74
+ - Updated dependencies [d1baedb]
75
+ - Updated dependencies [4d21bf2]
76
+ - Updated dependencies [2097952]
77
+ - Updated dependencies [4fb0cc2]
78
+ - Updated dependencies [d2a7a31]
79
+ - Updated dependencies [0e17048]
80
+ - @mastra/core@0.10.7-alpha.1
81
+
82
+ ## 0.11.1-alpha.0
83
+
84
+ ### Patch Changes
85
+
86
+ - d8f2d19: Add updateMessages API to storage classes (only support for PG and LibSQL for now) and to memory class. Additionally allow for metadata to be saved in the content field of a message.
87
+ - Updated dependencies [d8f2d19]
88
+ - Updated dependencies [9d52b17]
89
+ - Updated dependencies [8ba1b51]
90
+ - @mastra/core@0.10.7-alpha.0
91
+
92
+ ## 0.11.0
93
+
94
+ ### Minor Changes
95
+
96
+ - 704d1ca: Thread Timestamp Auto-Update Enhancement
97
+ Added automatic thread updatedAt timestamp updates when messages are saved across all storage providers
98
+ Enhanced user experience: Threads now accurately reflect their latest activity with automatic timestamp updates when new messages are added
99
+ Universal implementation: Consistent behavior across all 7 storage backends (ClickHouse, Cloudflare D1, DynamoDB, MongoDB, PostgreSQL, Upstash, LibSQL)
100
+ Performance optimized: Updates execute in parallel with message saving operations for minimal performance impact
101
+ Backwards compatible: No breaking changes - existing code continues to work unchanged
102
+ Improved conversation ordering: Chat interfaces can now properly sort threads by actual last activity
103
+ This enhancement resolves the issue where active conversations appeared stale due to outdated thread timestamps, providing better conversation management and user experience in chat applications.
104
+
105
+ ### Patch Changes
106
+
107
+ - 63f6b7d: dependencies updates:
108
+ - Updated dependency [`@clickhouse/client@^1.11.2` ↗︎](https://www.npmjs.com/package/@clickhouse/client/v/1.11.2) (from `^1.11.0`, in `dependencies`)
109
+ - Updated dependencies [63f6b7d]
110
+ - Updated dependencies [12a95fc]
111
+ - Updated dependencies [4b0f8a6]
112
+ - Updated dependencies [51264a5]
113
+ - Updated dependencies [8e6f677]
114
+ - Updated dependencies [d70c420]
115
+ - Updated dependencies [ee9af57]
116
+ - Updated dependencies [36f1c36]
117
+ - Updated dependencies [2a16996]
118
+ - Updated dependencies [10d352e]
119
+ - Updated dependencies [9589624]
120
+ - Updated dependencies [53d3c37]
121
+ - Updated dependencies [751c894]
122
+ - Updated dependencies [577ce3a]
123
+ - Updated dependencies [9260b3a]
124
+ - @mastra/core@0.10.6
125
+
126
+ ## 0.11.0-alpha.1
127
+
128
+ ### Minor Changes
129
+
130
+ - 704d1ca: Thread Timestamp Auto-Update Enhancement
131
+ Added automatic thread updatedAt timestamp updates when messages are saved across all storage providers
132
+ Enhanced user experience: Threads now accurately reflect their latest activity with automatic timestamp updates when new messages are added
133
+ Universal implementation: Consistent behavior across all 7 storage backends (ClickHouse, Cloudflare D1, DynamoDB, MongoDB, PostgreSQL, Upstash, LibSQL)
134
+ Performance optimized: Updates execute in parallel with message saving operations for minimal performance impact
135
+ Backwards compatible: No breaking changes - existing code continues to work unchanged
136
+ Improved conversation ordering: Chat interfaces can now properly sort threads by actual last activity
137
+ This enhancement resolves the issue where active conversations appeared stale due to outdated thread timestamps, providing better conversation management and user experience in chat applications.
138
+
139
+ ## 0.10.3-alpha.0
140
+
141
+ ### Patch Changes
142
+
143
+ - 63f6b7d: dependencies updates:
144
+ - Updated dependency [`@clickhouse/client@^1.11.2` ↗︎](https://www.npmjs.com/package/@clickhouse/client/v/1.11.2) (from `^1.11.0`, in `dependencies`)
145
+ - Updated dependencies [63f6b7d]
146
+ - Updated dependencies [36f1c36]
147
+ - Updated dependencies [10d352e]
148
+ - Updated dependencies [53d3c37]
149
+ - @mastra/core@0.10.6-alpha.0
150
+
151
+ ## 0.10.2
152
+
153
+ ### Patch Changes
154
+
155
+ - dffb67b: updated stores to add alter table and change tests
156
+ - 925ab94: added paginated functions to base class and added boilerplate and updated imports
157
+ - 66f4424: Update peerdeps
158
+ - Updated dependencies [d1ed912]
159
+ - Updated dependencies [f6fd25f]
160
+ - Updated dependencies [dffb67b]
161
+ - Updated dependencies [f1f1f1b]
162
+ - Updated dependencies [925ab94]
163
+ - Updated dependencies [f9816ae]
164
+ - Updated dependencies [82090c1]
165
+ - Updated dependencies [1b443fd]
166
+ - Updated dependencies [ce97900]
167
+ - Updated dependencies [f1309d3]
168
+ - Updated dependencies [14a2566]
169
+ - Updated dependencies [f7f8293]
170
+ - Updated dependencies [48eddb9]
171
+ - @mastra/core@0.10.4
172
+
173
+ ## 0.10.2-alpha.2
174
+
175
+ ### Patch Changes
176
+
177
+ - 66f4424: Update peerdeps
178
+
179
+ ## 0.10.2-alpha.1
180
+
181
+ ### Patch Changes
182
+
183
+ - 925ab94: added paginated functions to base class and added boilerplate and updated imports
184
+ - Updated dependencies [925ab94]
185
+ - @mastra/core@0.10.4-alpha.3
186
+
187
+ ## 0.10.2-alpha.0
188
+
189
+ ### Patch Changes
190
+
191
+ - dffb67b: updated stores to add alter table and change tests
192
+ - Updated dependencies [f6fd25f]
193
+ - Updated dependencies [dffb67b]
194
+ - Updated dependencies [f1309d3]
195
+ - Updated dependencies [f7f8293]
196
+ - @mastra/core@0.10.4-alpha.1
197
+
198
+ ## 0.10.1
199
+
200
+ ### Patch Changes
201
+
202
+ - e5dc18d: Added a backwards compatible layer to begin storing/retrieving UIMessages in storage instead of CoreMessages
203
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
204
+ - f0d559f: Fix peerdeps for alpha channel
205
+ - Updated dependencies [ee77e78]
206
+ - Updated dependencies [592a2db]
207
+ - Updated dependencies [e5dc18d]
208
+ - Updated dependencies [ab5adbe]
209
+ - Updated dependencies [1e8bb40]
210
+ - Updated dependencies [1b5fc55]
211
+ - Updated dependencies [195c428]
212
+ - Updated dependencies [f73e11b]
213
+ - Updated dependencies [37643b8]
214
+ - Updated dependencies [99fd6cf]
215
+ - Updated dependencies [c5bf1ce]
216
+ - Updated dependencies [add596e]
217
+ - Updated dependencies [8dc94d8]
218
+ - Updated dependencies [ecebbeb]
219
+ - Updated dependencies [79d5145]
220
+ - Updated dependencies [12b7002]
221
+ - Updated dependencies [2901125]
222
+ - @mastra/core@0.10.2
223
+
224
+ ## 0.10.1-alpha.2
225
+
226
+ ### Patch Changes
227
+
228
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
229
+ - Updated dependencies [c5bf1ce]
230
+ - Updated dependencies [12b7002]
231
+ - @mastra/core@0.10.2-alpha.4
232
+
233
+ ## 0.10.1-alpha.1
234
+
235
+ ### Patch Changes
236
+
237
+ - f0d559f: Fix peerdeps for alpha channel
238
+ - Updated dependencies [1e8bb40]
239
+ - @mastra/core@0.10.2-alpha.2
240
+
241
+ ## 0.10.1-alpha.0
242
+
243
+ ### Patch Changes
244
+
245
+ - e5dc18d: Added a backwards compatible layer to begin storing/retrieving UIMessages in storage instead of CoreMessages
246
+ - Updated dependencies [592a2db]
247
+ - Updated dependencies [e5dc18d]
248
+ - @mastra/core@0.10.2-alpha.0
249
+
250
+ ## 0.10.0
251
+
252
+ ### Minor Changes
253
+
254
+ - 83da932: Move @mastra/core to peerdeps
255
+
256
+ ### Patch Changes
257
+
258
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
259
+ - eabdcd9: [MASTRA-3451] SQL Injection Protection
260
+ - Updated dependencies [b3a3d63]
261
+ - Updated dependencies [344f453]
262
+ - Updated dependencies [0a3ae6d]
263
+ - Updated dependencies [95911be]
264
+ - Updated dependencies [f53a6ac]
265
+ - Updated dependencies [5eb5a99]
266
+ - Updated dependencies [7e632c5]
267
+ - Updated dependencies [1e9fbfa]
268
+ - Updated dependencies [eabdcd9]
269
+ - Updated dependencies [90be034]
270
+ - Updated dependencies [99f050a]
271
+ - Updated dependencies [d0ee3c6]
272
+ - Updated dependencies [b2ae5aa]
273
+ - Updated dependencies [23f258c]
274
+ - Updated dependencies [a7292b0]
275
+ - Updated dependencies [0dcb9f0]
276
+ - Updated dependencies [2672a05]
277
+ - @mastra/core@0.10.0
278
+
279
+ ## 0.4.0-alpha.1
280
+
281
+ ### Minor Changes
282
+
283
+ - 83da932: Move @mastra/core to peerdeps
284
+
285
+ ### Patch Changes
286
+
287
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
288
+ - Updated dependencies [b3a3d63]
289
+ - Updated dependencies [344f453]
290
+ - Updated dependencies [0a3ae6d]
291
+ - Updated dependencies [95911be]
292
+ - Updated dependencies [5eb5a99]
293
+ - Updated dependencies [7e632c5]
294
+ - Updated dependencies [1e9fbfa]
295
+ - Updated dependencies [b2ae5aa]
296
+ - Updated dependencies [a7292b0]
297
+ - Updated dependencies [0dcb9f0]
298
+ - @mastra/core@0.10.0-alpha.1
299
+
300
+ ## 0.3.5-alpha.0
301
+
302
+ ### Patch Changes
303
+
304
+ - eabdcd9: [MASTRA-3451] SQL Injection Protection
305
+ - Updated dependencies [f53a6ac]
306
+ - Updated dependencies [eabdcd9]
307
+ - Updated dependencies [90be034]
308
+ - Updated dependencies [99f050a]
309
+ - Updated dependencies [d0ee3c6]
310
+ - Updated dependencies [23f258c]
311
+ - Updated dependencies [2672a05]
312
+ - @mastra/core@0.9.5-alpha.0
313
+
314
+ ## 0.3.4
315
+
316
+ ### Patch Changes
317
+
318
+ - 302a9f0: fix: do not partition clickhouse trace table
319
+ - Updated dependencies [396be50]
320
+ - Updated dependencies [ab80e7e]
321
+ - Updated dependencies [c3bd795]
322
+ - Updated dependencies [da082f8]
323
+ - Updated dependencies [a5810ce]
324
+ - Updated dependencies [3e9c131]
325
+ - Updated dependencies [3171b5b]
326
+ - Updated dependencies [973e5ac]
327
+ - Updated dependencies [daf942f]
328
+ - Updated dependencies [0b8b868]
329
+ - Updated dependencies [9e1eff5]
330
+ - Updated dependencies [6fa1ad1]
331
+ - Updated dependencies [c28d7a0]
332
+ - Updated dependencies [edf1e88]
333
+ - @mastra/core@0.9.4
334
+
335
+ ## 0.3.4-alpha.4
336
+
337
+ ### Patch Changes
338
+
339
+ - Updated dependencies [3e9c131]
340
+ - @mastra/core@0.9.4-alpha.4
341
+
342
+ ## 0.3.4-alpha.3
343
+
344
+ ### Patch Changes
345
+
346
+ - 302a9f0: fix: do not partition clickhouse trace table
347
+ - Updated dependencies [396be50]
348
+ - Updated dependencies [c3bd795]
349
+ - Updated dependencies [da082f8]
350
+ - Updated dependencies [a5810ce]
351
+ - @mastra/core@0.9.4-alpha.3
352
+
353
+ ## 0.3.4-alpha.2
354
+
355
+ ### Patch Changes
356
+
357
+ - Updated dependencies [3171b5b]
358
+ - Updated dependencies [973e5ac]
359
+ - Updated dependencies [9e1eff5]
360
+ - @mastra/core@0.9.4-alpha.2
361
+
362
+ ## 0.3.4-alpha.1
363
+
364
+ ### Patch Changes
365
+
366
+ - Updated dependencies [ab80e7e]
367
+ - Updated dependencies [6fa1ad1]
368
+ - Updated dependencies [c28d7a0]
369
+ - Updated dependencies [edf1e88]
370
+ - @mastra/core@0.9.4-alpha.1
371
+
372
+ ## 0.3.4-alpha.0
373
+
374
+ ### Patch Changes
375
+
376
+ - Updated dependencies [daf942f]
377
+ - Updated dependencies [0b8b868]
378
+ - @mastra/core@0.9.4-alpha.0
379
+
380
+ ## 0.3.3
381
+
382
+ ### Patch Changes
383
+
384
+ - Updated dependencies [e450778]
385
+ - Updated dependencies [8902157]
386
+ - Updated dependencies [ca0dc88]
387
+ - Updated dependencies [526c570]
388
+ - Updated dependencies [d7a6a33]
389
+ - Updated dependencies [9cd1a46]
390
+ - Updated dependencies [b5d2de0]
391
+ - Updated dependencies [644f8ad]
392
+ - Updated dependencies [70dbf51]
393
+ - @mastra/core@0.9.3
394
+
395
+ ## 0.3.3-alpha.1
396
+
397
+ ### Patch Changes
398
+
399
+ - Updated dependencies [e450778]
400
+ - Updated dependencies [8902157]
401
+ - Updated dependencies [ca0dc88]
402
+ - Updated dependencies [9cd1a46]
403
+ - Updated dependencies [70dbf51]
404
+ - @mastra/core@0.9.3-alpha.1
405
+
406
+ ## 0.3.3-alpha.0
407
+
408
+ ### Patch Changes
409
+
410
+ - Updated dependencies [526c570]
411
+ - Updated dependencies [b5d2de0]
412
+ - Updated dependencies [644f8ad]
413
+ - @mastra/core@0.9.3-alpha.0
414
+
415
+ ## 0.3.2
4
416
 
5
417
  ### Patch Changes
6
418
 
@@ -20,8 +432,20 @@
20
432
  - Updated dependencies [17826a9]
21
433
  - Updated dependencies [7d8b7c7]
22
434
  - Updated dependencies [fba031f]
435
+ - Updated dependencies [3a5f1e1]
23
436
  - Updated dependencies [51e6923]
24
- - @mastra/core@0.0.0-trigger-playground-ui-package-20250506151043
437
+ - Updated dependencies [8398d89]
438
+ - @mastra/core@0.9.2
439
+
440
+ ## 0.3.2-alpha.6
441
+
442
+ ### Patch Changes
443
+
444
+ - Updated dependencies [6052aa6]
445
+ - Updated dependencies [7d8b7c7]
446
+ - Updated dependencies [3a5f1e1]
447
+ - Updated dependencies [8398d89]
448
+ - @mastra/core@0.9.2-alpha.6
25
449
 
26
450
  ## 0.3.2-alpha.5
27
451
 
@@ -1,12 +1,18 @@
1
1
  import type { ClickHouseClient } from '@clickhouse/client';
2
2
  import type { EvalRow } from '@mastra/core/storage';
3
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
+ import type { MastraMessageV1 } from '@mastra/core/memory';
5
+ import type { MastraMessageV2 } from '@mastra/core/memory';
3
6
  import { MastraStorage } from '@mastra/core/storage';
4
- import type { MessageType } from '@mastra/core/memory';
7
+ import type { PaginationInfo } from '@mastra/core/storage';
5
8
  import type { StorageColumn } from '@mastra/core/storage';
6
9
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
10
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
7
11
  import type { StorageThreadType } from '@mastra/core/memory';
8
12
  import type { TABLE_NAMES } from '@mastra/core/storage';
13
+ import type { TABLE_RESOURCES } from '@mastra/core/storage';
9
14
  import { TABLE_SCHEMAS } from '@mastra/core/storage';
15
+ import type { Trace } from '@mastra/core/telemetry';
10
16
  import type { WorkflowRun } from '@mastra/core/storage';
11
17
  import type { WorkflowRuns } from '@mastra/core/storage';
12
18
  import type { WorkflowRunState } from '@mastra/core/workflows';
@@ -40,6 +46,7 @@ declare class ClickhouseStore extends MastraStorage {
40
46
  protected ttl: ClickhouseConfig['ttl'];
41
47
  constructor(config: ClickhouseConfig);
42
48
  private transformEvalRow;
49
+ private escape;
43
50
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
44
51
  batchInsert({ tableName, records }: {
45
52
  tableName: TABLE_NAMES;
@@ -62,8 +69,20 @@ declare class ClickhouseStore extends MastraStorage {
62
69
  tableName: TABLE_NAMES;
63
70
  }): Promise<void>;
64
71
  createTable({ tableName, schema, }: {
72
+ tableName: SUPPORTED_TABLE_NAMES;
73
+ schema: Record<string, StorageColumn>;
74
+ }): Promise<void>;
75
+ protected getSqlType(type: StorageColumn['type']): string;
76
+ /**
77
+ * Alters table schema to add columns if they don't exist
78
+ * @param tableName Name of the table
79
+ * @param schema Schema of the table
80
+ * @param ifNotExists Array of column names to add if they don't exist
81
+ */
82
+ alterTable({ tableName, schema, ifNotExists, }: {
65
83
  tableName: TABLE_NAMES;
66
84
  schema: Record<string, StorageColumn>;
85
+ ifNotExists: string[];
67
86
  }): Promise<void>;
68
87
  clearTable({ tableName }: {
69
88
  tableName: TABLE_NAMES;
@@ -72,8 +91,8 @@ declare class ClickhouseStore extends MastraStorage {
72
91
  tableName: TABLE_NAMES;
73
92
  record: Record<string, any>;
74
93
  }): Promise<void>;
75
- load<R>({ tableName, keys }: {
76
- tableName: TABLE_NAMES;
94
+ load<R>({ tableName, keys, }: {
95
+ tableName: SUPPORTED_TABLE_NAMES;
77
96
  keys: Record<string, string>;
78
97
  }): Promise<R | null>;
79
98
  getThreadById({ threadId }: {
@@ -93,10 +112,20 @@ declare class ClickhouseStore extends MastraStorage {
93
112
  deleteThread({ threadId }: {
94
113
  threadId: string;
95
114
  }): Promise<void>;
96
- getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
97
- saveMessages({ messages }: {
98
- messages: MessageType[];
99
- }): Promise<MessageType[]>;
115
+ getMessages(args: StorageGetMessagesArg & {
116
+ format?: 'v1';
117
+ }): Promise<MastraMessageV1[]>;
118
+ getMessages(args: StorageGetMessagesArg & {
119
+ format: 'v2';
120
+ }): Promise<MastraMessageV2[]>;
121
+ saveMessages(args: {
122
+ messages: MastraMessageV1[];
123
+ format?: undefined | 'v1';
124
+ }): Promise<MastraMessageV1[]>;
125
+ saveMessages(args: {
126
+ messages: MastraMessageV2[];
127
+ format: 'v2';
128
+ }): Promise<MastraMessageV2[]>;
100
129
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
101
130
  workflowName: string;
102
131
  runId: string;
@@ -120,7 +149,29 @@ declare class ClickhouseStore extends MastraStorage {
120
149
  workflowName?: string;
121
150
  }): Promise<WorkflowRun | null>;
122
151
  private hasColumn;
152
+ getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & {
153
+ traces: Trace[];
154
+ }>;
155
+ getThreadsByResourceIdPaginated(_args: {
156
+ resourceId: string;
157
+ page?: number;
158
+ perPage?: number;
159
+ }): Promise<PaginationInfo & {
160
+ threads: StorageThreadType[];
161
+ }>;
162
+ getMessagesPaginated(_args: StorageGetMessagesArg): Promise<PaginationInfo & {
163
+ messages: MastraMessageV1[] | MastraMessageV2[];
164
+ }>;
123
165
  close(): Promise<void>;
166
+ updateMessages(_args: {
167
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
168
+ id: string;
169
+ content?: {
170
+ metadata?: MastraMessageContentV2['metadata'];
171
+ content?: MastraMessageContentV2['content'];
172
+ };
173
+ }[];
174
+ }): Promise<MastraMessageV2[]>;
124
175
  }
125
176
  export { ClickhouseStore }
126
177
  export { ClickhouseStore as ClickhouseStore_alias_1 }
@@ -131,7 +182,9 @@ export { COLUMN_TYPES as COLUMN_TYPES_alias_1 }
131
182
 
132
183
  declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
133
184
 
134
- declare const TABLE_ENGINES: Record<TABLE_NAMES, string>;
185
+ declare type SUPPORTED_TABLE_NAMES = Exclude<TABLE_NAMES, typeof TABLE_RESOURCES>;
186
+
187
+ declare const TABLE_ENGINES: Record<SUPPORTED_TABLE_NAMES, string>;
135
188
  export { TABLE_ENGINES }
136
189
  export { TABLE_ENGINES as TABLE_ENGINES_alias_1 }
137
190
 
@@ -1,12 +1,18 @@
1
1
  import type { ClickHouseClient } from '@clickhouse/client';
2
2
  import type { EvalRow } from '@mastra/core/storage';
3
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
+ import type { MastraMessageV1 } from '@mastra/core/memory';
5
+ import type { MastraMessageV2 } from '@mastra/core/memory';
3
6
  import { MastraStorage } from '@mastra/core/storage';
4
- import type { MessageType } from '@mastra/core/memory';
7
+ import type { PaginationInfo } from '@mastra/core/storage';
5
8
  import type { StorageColumn } from '@mastra/core/storage';
6
9
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
10
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
7
11
  import type { StorageThreadType } from '@mastra/core/memory';
8
12
  import type { TABLE_NAMES } from '@mastra/core/storage';
13
+ import type { TABLE_RESOURCES } from '@mastra/core/storage';
9
14
  import { TABLE_SCHEMAS } from '@mastra/core/storage';
15
+ import type { Trace } from '@mastra/core/telemetry';
10
16
  import type { WorkflowRun } from '@mastra/core/storage';
11
17
  import type { WorkflowRuns } from '@mastra/core/storage';
12
18
  import type { WorkflowRunState } from '@mastra/core/workflows';
@@ -40,6 +46,7 @@ declare class ClickhouseStore extends MastraStorage {
40
46
  protected ttl: ClickhouseConfig['ttl'];
41
47
  constructor(config: ClickhouseConfig);
42
48
  private transformEvalRow;
49
+ private escape;
43
50
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
44
51
  batchInsert({ tableName, records }: {
45
52
  tableName: TABLE_NAMES;
@@ -62,8 +69,20 @@ declare class ClickhouseStore extends MastraStorage {
62
69
  tableName: TABLE_NAMES;
63
70
  }): Promise<void>;
64
71
  createTable({ tableName, schema, }: {
72
+ tableName: SUPPORTED_TABLE_NAMES;
73
+ schema: Record<string, StorageColumn>;
74
+ }): Promise<void>;
75
+ protected getSqlType(type: StorageColumn['type']): string;
76
+ /**
77
+ * Alters table schema to add columns if they don't exist
78
+ * @param tableName Name of the table
79
+ * @param schema Schema of the table
80
+ * @param ifNotExists Array of column names to add if they don't exist
81
+ */
82
+ alterTable({ tableName, schema, ifNotExists, }: {
65
83
  tableName: TABLE_NAMES;
66
84
  schema: Record<string, StorageColumn>;
85
+ ifNotExists: string[];
67
86
  }): Promise<void>;
68
87
  clearTable({ tableName }: {
69
88
  tableName: TABLE_NAMES;
@@ -72,8 +91,8 @@ declare class ClickhouseStore extends MastraStorage {
72
91
  tableName: TABLE_NAMES;
73
92
  record: Record<string, any>;
74
93
  }): Promise<void>;
75
- load<R>({ tableName, keys }: {
76
- tableName: TABLE_NAMES;
94
+ load<R>({ tableName, keys, }: {
95
+ tableName: SUPPORTED_TABLE_NAMES;
77
96
  keys: Record<string, string>;
78
97
  }): Promise<R | null>;
79
98
  getThreadById({ threadId }: {
@@ -93,10 +112,20 @@ declare class ClickhouseStore extends MastraStorage {
93
112
  deleteThread({ threadId }: {
94
113
  threadId: string;
95
114
  }): Promise<void>;
96
- getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
97
- saveMessages({ messages }: {
98
- messages: MessageType[];
99
- }): Promise<MessageType[]>;
115
+ getMessages(args: StorageGetMessagesArg & {
116
+ format?: 'v1';
117
+ }): Promise<MastraMessageV1[]>;
118
+ getMessages(args: StorageGetMessagesArg & {
119
+ format: 'v2';
120
+ }): Promise<MastraMessageV2[]>;
121
+ saveMessages(args: {
122
+ messages: MastraMessageV1[];
123
+ format?: undefined | 'v1';
124
+ }): Promise<MastraMessageV1[]>;
125
+ saveMessages(args: {
126
+ messages: MastraMessageV2[];
127
+ format: 'v2';
128
+ }): Promise<MastraMessageV2[]>;
100
129
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
101
130
  workflowName: string;
102
131
  runId: string;
@@ -120,7 +149,29 @@ declare class ClickhouseStore extends MastraStorage {
120
149
  workflowName?: string;
121
150
  }): Promise<WorkflowRun | null>;
122
151
  private hasColumn;
152
+ getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & {
153
+ traces: Trace[];
154
+ }>;
155
+ getThreadsByResourceIdPaginated(_args: {
156
+ resourceId: string;
157
+ page?: number;
158
+ perPage?: number;
159
+ }): Promise<PaginationInfo & {
160
+ threads: StorageThreadType[];
161
+ }>;
162
+ getMessagesPaginated(_args: StorageGetMessagesArg): Promise<PaginationInfo & {
163
+ messages: MastraMessageV1[] | MastraMessageV2[];
164
+ }>;
123
165
  close(): Promise<void>;
166
+ updateMessages(_args: {
167
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
168
+ id: string;
169
+ content?: {
170
+ metadata?: MastraMessageContentV2['metadata'];
171
+ content?: MastraMessageContentV2['content'];
172
+ };
173
+ }[];
174
+ }): Promise<MastraMessageV2[]>;
124
175
  }
125
176
  export { ClickhouseStore }
126
177
  export { ClickhouseStore as ClickhouseStore_alias_1 }
@@ -131,7 +182,9 @@ export { COLUMN_TYPES as COLUMN_TYPES_alias_1 }
131
182
 
132
183
  declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
133
184
 
134
- declare const TABLE_ENGINES: Record<TABLE_NAMES, string>;
185
+ declare type SUPPORTED_TABLE_NAMES = Exclude<TABLE_NAMES, typeof TABLE_RESOURCES>;
186
+
187
+ declare const TABLE_ENGINES: Record<SUPPORTED_TABLE_NAMES, string>;
135
188
  export { TABLE_ENGINES }
136
189
  export { TABLE_ENGINES as TABLE_ENGINES_alias_1 }
137
190