@mastra/clickhouse 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-transpile-packages-20250724123433

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.
@@ -1,16 +1,32 @@
1
1
  import type { ClickHouseClient } from '@clickhouse/client';
2
2
  import type { EvalRow } from '@mastra/core/storage';
3
+ import { LegacyEvalsStorage } from '@mastra/core/storage';
4
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
5
  import type { MastraMessageV1 } from '@mastra/core/memory';
4
- import type { MastraMessageV2 } from '@mastra/core/agent';
6
+ import type { MastraMessageV2 } from '@mastra/core/memory';
5
7
  import { MastraStorage } from '@mastra/core/storage';
8
+ import { MemoryStorage } from '@mastra/core/storage';
9
+ import type { PaginationArgs } from '@mastra/core/storage';
10
+ import type { PaginationInfo } from '@mastra/core/storage';
11
+ import type { ScoreRowData } from '@mastra/core/scores';
12
+ import { ScoresStorage } from '@mastra/core/storage';
6
13
  import type { StorageColumn } from '@mastra/core/storage';
14
+ import type { StorageDomains } from '@mastra/core/storage';
7
15
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
16
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
17
+ import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
18
+ import type { StoragePagination } from '@mastra/core/storage';
19
+ import type { StorageResourceType } from '@mastra/core/storage';
8
20
  import type { StorageThreadType } from '@mastra/core/memory';
21
+ import { StoreOperations } from '@mastra/core/storage';
9
22
  import type { TABLE_NAMES } from '@mastra/core/storage';
10
- import { TABLE_SCHEMAS } from '@mastra/core/storage';
23
+ import type { TABLE_SCHEMAS } from '@mastra/core/storage';
24
+ import type { Trace } from '@mastra/core/telemetry';
25
+ import { TracesStorage } from '@mastra/core/storage';
11
26
  import type { WorkflowRun } from '@mastra/core/storage';
12
27
  import type { WorkflowRuns } from '@mastra/core/storage';
13
28
  import type { WorkflowRunState } from '@mastra/core/workflows';
29
+ import { WorkflowsStorage } from '@mastra/core/storage';
14
30
 
15
31
  declare type ClickhouseConfig = {
16
32
  url: string;
@@ -20,13 +36,13 @@ declare type ClickhouseConfig = {
20
36
  [TableKey in TABLE_NAMES]?: {
21
37
  row?: {
22
38
  interval: number;
23
- unit: IntervalUnit;
39
+ unit: IntervalUnit_2;
24
40
  ttlKey?: string;
25
41
  };
26
42
  columns?: Partial<{
27
43
  [ColumnKey in keyof (typeof TABLE_SCHEMAS)[TableKey]]: {
28
44
  interval: number;
29
- unit: IntervalUnit;
45
+ unit: IntervalUnit_2;
30
46
  ttlKey?: string;
31
47
  };
32
48
  }>;
@@ -36,26 +52,50 @@ declare type ClickhouseConfig = {
36
52
  export { ClickhouseConfig }
37
53
  export { ClickhouseConfig as ClickhouseConfig_alias_1 }
38
54
 
55
+ export declare type ClickhouseConfig_alias_2 = {
56
+ url: string;
57
+ username: string;
58
+ password: string;
59
+ ttl?: {
60
+ [TableKey in TABLE_NAMES]?: {
61
+ row?: {
62
+ interval: number;
63
+ unit: IntervalUnit;
64
+ ttlKey?: string;
65
+ };
66
+ columns?: Partial<{
67
+ [ColumnKey in keyof (typeof TABLE_SCHEMAS)[TableKey]]: {
68
+ interval: number;
69
+ unit: IntervalUnit;
70
+ ttlKey?: string;
71
+ };
72
+ }>;
73
+ };
74
+ };
75
+ };
76
+
39
77
  declare class ClickhouseStore extends MastraStorage {
40
78
  protected db: ClickHouseClient;
41
79
  protected ttl: ClickhouseConfig['ttl'];
80
+ stores: StorageDomains;
42
81
  constructor(config: ClickhouseConfig);
43
- private transformEvalRow;
82
+ get supports(): {
83
+ selectByIncludeResourceScope: boolean;
84
+ resourceWorkingMemory: boolean;
85
+ hasColumn: boolean;
86
+ createTable: boolean;
87
+ };
44
88
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
89
+ getEvals(options: {
90
+ agentName?: string;
91
+ type?: 'test' | 'live';
92
+ } & PaginationArgs): Promise<PaginationInfo & {
93
+ evals: EvalRow[];
94
+ }>;
45
95
  batchInsert({ tableName, records }: {
46
96
  tableName: TABLE_NAMES;
47
97
  records: Record<string, any>[];
48
98
  }): Promise<void>;
49
- getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
50
- name?: string;
51
- scope?: string;
52
- page: number;
53
- perPage: number;
54
- attributes?: Record<string, string>;
55
- filters?: Record<string, any>;
56
- fromDate?: Date;
57
- toDate?: Date;
58
- }): Promise<any[]>;
59
99
  optimizeTable({ tableName }: {
60
100
  tableName: TABLE_NAMES;
61
101
  }): Promise<void>;
@@ -66,6 +106,14 @@ declare class ClickhouseStore extends MastraStorage {
66
106
  tableName: TABLE_NAMES;
67
107
  schema: Record<string, StorageColumn>;
68
108
  }): Promise<void>;
109
+ dropTable({ tableName }: {
110
+ tableName: TABLE_NAMES;
111
+ }): Promise<void>;
112
+ alterTable({ tableName, schema, ifNotExists, }: {
113
+ tableName: TABLE_NAMES;
114
+ schema: Record<string, StorageColumn>;
115
+ ifNotExists: string[];
116
+ }): Promise<void>;
69
117
  clearTable({ tableName }: {
70
118
  tableName: TABLE_NAMES;
71
119
  }): Promise<void>;
@@ -77,6 +125,34 @@ declare class ClickhouseStore extends MastraStorage {
77
125
  tableName: TABLE_NAMES;
78
126
  keys: Record<string, string>;
79
127
  }): Promise<R | null>;
128
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
129
+ workflowName: string;
130
+ runId: string;
131
+ snapshot: WorkflowRunState;
132
+ }): Promise<void>;
133
+ loadWorkflowSnapshot({ workflowName, runId, }: {
134
+ workflowName: string;
135
+ runId: string;
136
+ }): Promise<WorkflowRunState | null>;
137
+ getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
138
+ workflowName?: string;
139
+ fromDate?: Date;
140
+ toDate?: Date;
141
+ limit?: number;
142
+ offset?: number;
143
+ resourceId?: string;
144
+ }): Promise<WorkflowRuns>;
145
+ getWorkflowRunById({ runId, workflowName, }: {
146
+ runId: string;
147
+ workflowName?: string;
148
+ }): Promise<WorkflowRun | null>;
149
+ getTraces(args: StorageGetTracesArg): Promise<any[]>;
150
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
151
+ traces: Trace[];
152
+ }>;
153
+ batchTraceInsert(args: {
154
+ records: Trace[];
155
+ }): Promise<void>;
80
156
  getThreadById({ threadId }: {
81
157
  threadId: string;
82
158
  }): Promise<StorageThreadType | null>;
@@ -94,6 +170,13 @@ declare class ClickhouseStore extends MastraStorage {
94
170
  deleteThread({ threadId }: {
95
171
  threadId: string;
96
172
  }): Promise<void>;
173
+ getThreadsByResourceIdPaginated(args: {
174
+ resourceId: string;
175
+ page: number;
176
+ perPage: number;
177
+ }): Promise<PaginationInfo & {
178
+ threads: StorageThreadType[];
179
+ }>;
97
180
  getMessages(args: StorageGetMessagesArg & {
98
181
  format?: 'v1';
99
182
  }): Promise<MastraMessageV1[]>;
@@ -108,6 +191,266 @@ declare class ClickhouseStore extends MastraStorage {
108
191
  messages: MastraMessageV2[];
109
192
  format: 'v2';
110
193
  }): Promise<MastraMessageV2[]>;
194
+ getMessagesPaginated(args: StorageGetMessagesArg & {
195
+ format?: 'v1' | 'v2';
196
+ }): Promise<PaginationInfo & {
197
+ messages: MastraMessageV1[] | MastraMessageV2[];
198
+ }>;
199
+ updateMessages(args: {
200
+ messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
201
+ id: string;
202
+ threadId?: string;
203
+ content?: {
204
+ metadata?: MastraMessageContentV2['metadata'];
205
+ content?: MastraMessageContentV2['content'];
206
+ };
207
+ })[];
208
+ }): Promise<MastraMessageV2[]>;
209
+ getResourceById({ resourceId }: {
210
+ resourceId: string;
211
+ }): Promise<StorageResourceType | null>;
212
+ saveResource({ resource }: {
213
+ resource: StorageResourceType;
214
+ }): Promise<StorageResourceType>;
215
+ updateResource({ resourceId, workingMemory, metadata, }: {
216
+ resourceId: string;
217
+ workingMemory?: string;
218
+ metadata?: Record<string, unknown>;
219
+ }): Promise<StorageResourceType>;
220
+ getScoreById({ id }: {
221
+ id: string;
222
+ }): Promise<ScoreRowData | null>;
223
+ saveScore(_score: ScoreRowData): Promise<{
224
+ score: ScoreRowData;
225
+ }>;
226
+ getScoresByRunId({ runId, pagination, }: {
227
+ runId: string;
228
+ pagination: StoragePagination;
229
+ }): Promise<{
230
+ pagination: PaginationInfo;
231
+ scores: ScoreRowData[];
232
+ }>;
233
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
234
+ pagination: StoragePagination;
235
+ entityId: string;
236
+ entityType: string;
237
+ }): Promise<{
238
+ pagination: PaginationInfo;
239
+ scores: ScoreRowData[];
240
+ }>;
241
+ getScoresByScorerId({ scorerId, pagination, }: {
242
+ scorerId: string;
243
+ pagination: StoragePagination;
244
+ }): Promise<{
245
+ pagination: PaginationInfo;
246
+ scores: ScoreRowData[];
247
+ }>;
248
+ close(): Promise<void>;
249
+ }
250
+ export { ClickhouseStore }
251
+ export { ClickhouseStore as ClickhouseStore_alias_1 }
252
+
253
+ export declare const COLUMN_TYPES: Record<StorageColumn['type'], string>;
254
+
255
+ export declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
256
+
257
+ declare type IntervalUnit_2 = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
258
+
259
+ export declare class LegacyEvalsStorageClickhouse extends LegacyEvalsStorage {
260
+ protected client: ClickHouseClient;
261
+ protected operations: StoreOperationsClickhouse;
262
+ constructor({ client, operations }: {
263
+ client: ClickHouseClient;
264
+ operations: StoreOperationsClickhouse;
265
+ });
266
+ private transformEvalRow;
267
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
268
+ getEvals(options?: {
269
+ agentName?: string;
270
+ type?: 'test' | 'live';
271
+ } & PaginationArgs): Promise<PaginationInfo & {
272
+ evals: EvalRow[];
273
+ }>;
274
+ }
275
+
276
+ export declare class MemoryStorageClickhouse extends MemoryStorage {
277
+ protected client: ClickHouseClient;
278
+ protected operations: StoreOperationsClickhouse;
279
+ constructor({ client, operations }: {
280
+ client: ClickHouseClient;
281
+ operations: StoreOperationsClickhouse;
282
+ });
283
+ getMessages(args: StorageGetMessagesArg & {
284
+ format?: 'v1';
285
+ }): Promise<MastraMessageV1[]>;
286
+ getMessages(args: StorageGetMessagesArg & {
287
+ format: 'v2';
288
+ }): Promise<MastraMessageV2[]>;
289
+ saveMessages(args: {
290
+ messages: MastraMessageV1[];
291
+ format?: undefined | 'v1';
292
+ }): Promise<MastraMessageV1[]>;
293
+ saveMessages(args: {
294
+ messages: MastraMessageV2[];
295
+ format: 'v2';
296
+ }): Promise<MastraMessageV2[]>;
297
+ getThreadById({ threadId }: {
298
+ threadId: string;
299
+ }): Promise<StorageThreadType | null>;
300
+ getThreadsByResourceId({ resourceId }: {
301
+ resourceId: string;
302
+ }): Promise<StorageThreadType[]>;
303
+ saveThread({ thread }: {
304
+ thread: StorageThreadType;
305
+ }): Promise<StorageThreadType>;
306
+ updateThread({ id, title, metadata, }: {
307
+ id: string;
308
+ title: string;
309
+ metadata: Record<string, unknown>;
310
+ }): Promise<StorageThreadType>;
311
+ deleteThread({ threadId }: {
312
+ threadId: string;
313
+ }): Promise<void>;
314
+ getThreadsByResourceIdPaginated(args: {
315
+ resourceId: string;
316
+ page?: number;
317
+ perPage?: number;
318
+ }): Promise<PaginationInfo & {
319
+ threads: StorageThreadType[];
320
+ }>;
321
+ getMessagesPaginated(args: StorageGetMessagesArg & {
322
+ format?: 'v1' | 'v2';
323
+ }): Promise<PaginationInfo & {
324
+ messages: MastraMessageV1[] | MastraMessageV2[];
325
+ }>;
326
+ updateMessages(args: {
327
+ messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
328
+ id: string;
329
+ threadId?: string;
330
+ content?: {
331
+ metadata?: MastraMessageContentV2['metadata'];
332
+ content?: MastraMessageContentV2['content'];
333
+ };
334
+ })[];
335
+ }): Promise<MastraMessageV2[]>;
336
+ getResourceById({ resourceId }: {
337
+ resourceId: string;
338
+ }): Promise<StorageResourceType | null>;
339
+ saveResource({ resource }: {
340
+ resource: StorageResourceType;
341
+ }): Promise<StorageResourceType>;
342
+ updateResource({ resourceId, workingMemory, metadata, }: {
343
+ resourceId: string;
344
+ workingMemory?: string;
345
+ metadata?: Record<string, unknown>;
346
+ }): Promise<StorageResourceType>;
347
+ }
348
+
349
+ export declare class ScoresStorageClickhouse extends ScoresStorage {
350
+ protected client: ClickHouseClient;
351
+ protected operations: StoreOperationsClickhouse;
352
+ constructor({ client, operations }: {
353
+ client: ClickHouseClient;
354
+ operations: StoreOperationsClickhouse;
355
+ });
356
+ private transformScoreRow;
357
+ getScoreById({ id }: {
358
+ id: string;
359
+ }): Promise<ScoreRowData | null>;
360
+ saveScore(score: ScoreRowData): Promise<{
361
+ score: ScoreRowData;
362
+ }>;
363
+ getScoresByRunId({ runId, pagination, }: {
364
+ runId: string;
365
+ pagination: StoragePagination;
366
+ }): Promise<{
367
+ pagination: PaginationInfo;
368
+ scores: ScoreRowData[];
369
+ }>;
370
+ getScoresByScorerId({ scorerId, pagination, }: {
371
+ scorerId: string;
372
+ pagination: StoragePagination;
373
+ }): Promise<{
374
+ pagination: PaginationInfo;
375
+ scores: ScoreRowData[];
376
+ }>;
377
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
378
+ pagination: StoragePagination;
379
+ entityId: string;
380
+ entityType: string;
381
+ }): Promise<{
382
+ pagination: PaginationInfo;
383
+ scores: ScoreRowData[];
384
+ }>;
385
+ }
386
+
387
+ export declare class StoreOperationsClickhouse extends StoreOperations {
388
+ protected ttl: ClickhouseConfig_alias_2['ttl'];
389
+ protected client: ClickHouseClient;
390
+ constructor({ client, ttl }: {
391
+ client: ClickHouseClient;
392
+ ttl: ClickhouseConfig_alias_2['ttl'];
393
+ });
394
+ hasColumn(table: string, column: string): Promise<boolean>;
395
+ protected getSqlType(type: StorageColumn['type']): string;
396
+ createTable({ tableName, schema, }: {
397
+ tableName: TABLE_NAMES;
398
+ schema: Record<string, StorageColumn>;
399
+ }): Promise<void>;
400
+ alterTable({ tableName, schema, ifNotExists, }: {
401
+ tableName: TABLE_NAMES;
402
+ schema: Record<string, StorageColumn>;
403
+ ifNotExists: string[];
404
+ }): Promise<void>;
405
+ clearTable({ tableName }: {
406
+ tableName: TABLE_NAMES;
407
+ }): Promise<void>;
408
+ dropTable({ tableName }: {
409
+ tableName: TABLE_NAMES;
410
+ }): Promise<void>;
411
+ insert({ tableName, record }: {
412
+ tableName: TABLE_NAMES;
413
+ record: Record<string, any>;
414
+ }): Promise<void>;
415
+ batchInsert({ tableName, records }: {
416
+ tableName: TABLE_NAMES;
417
+ records: Record<string, any>[];
418
+ }): Promise<void>;
419
+ load<R>({ tableName, keys }: {
420
+ tableName: TABLE_NAMES;
421
+ keys: Record<string, string>;
422
+ }): Promise<R | null>;
423
+ }
424
+
425
+ export declare const TABLE_ENGINES: Record<TABLE_NAMES, string>;
426
+
427
+ export declare class TracesStorageClickhouse extends TracesStorage {
428
+ protected client: ClickHouseClient;
429
+ protected operations: StoreOperationsClickhouse;
430
+ constructor({ client, operations }: {
431
+ client: ClickHouseClient;
432
+ operations: StoreOperationsClickhouse;
433
+ });
434
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
435
+ traces: Trace[];
436
+ }>;
437
+ getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: StorageGetTracesArg): Promise<any[]>;
438
+ batchTraceInsert(args: {
439
+ records: Trace[];
440
+ }): Promise<void>;
441
+ }
442
+
443
+ export declare function transformRow<R>(row: any): R;
444
+
445
+ export declare function transformRows<R>(rows: any[]): R[];
446
+
447
+ export declare class WorkflowsStorageClickhouse extends WorkflowsStorage {
448
+ protected client: ClickHouseClient;
449
+ protected operations: StoreOperationsClickhouse;
450
+ constructor({ client, operations }: {
451
+ client: ClickHouseClient;
452
+ operations: StoreOperationsClickhouse;
453
+ });
111
454
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
112
455
  workflowName: string;
113
456
  runId: string;
@@ -130,20 +473,6 @@ declare class ClickhouseStore extends MastraStorage {
130
473
  runId: string;
131
474
  workflowName?: string;
132
475
  }): Promise<WorkflowRun | null>;
133
- private hasColumn;
134
- close(): Promise<void>;
135
476
  }
136
- export { ClickhouseStore }
137
- export { ClickhouseStore as ClickhouseStore_alias_1 }
138
-
139
- declare const COLUMN_TYPES: Record<StorageColumn['type'], string>;
140
- export { COLUMN_TYPES }
141
- export { COLUMN_TYPES as COLUMN_TYPES_alias_1 }
142
-
143
- declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
144
-
145
- declare const TABLE_ENGINES: Record<TABLE_NAMES, string>;
146
- export { TABLE_ENGINES }
147
- export { TABLE_ENGINES as TABLE_ENGINES_alias_1 }
148
477
 
149
478
  export { }