@mastra/clickhouse 0.12.0 → 0.12.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +53 -0
- package/LICENSE.md +12 -4
- package/dist/_tsup-dts-rollup.d.cts +351 -64
- package/dist/_tsup-dts-rollup.d.ts +351 -64
- package/dist/index.cjs +2052 -609
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +2051 -606
- package/package.json +6 -6
- package/src/storage/domains/legacy-evals/index.ts +246 -0
- package/src/storage/domains/memory/index.ts +1393 -0
- package/src/storage/domains/operations/index.ts +319 -0
- package/src/storage/domains/scores/index.ts +326 -0
- package/src/storage/domains/traces/index.ts +275 -0
- package/src/storage/domains/utils.ts +86 -0
- package/src/storage/domains/workflows/index.ts +285 -0
- package/src/storage/index.test.ts +15 -1091
- package/src/storage/index.ts +184 -1246
|
@@ -1,21 +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';
|
|
3
4
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
4
5
|
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
5
6
|
import type { MastraMessageV2 } from '@mastra/core/memory';
|
|
6
7
|
import { MastraStorage } from '@mastra/core/storage';
|
|
8
|
+
import { MemoryStorage } from '@mastra/core/storage';
|
|
9
|
+
import type { PaginationArgs } from '@mastra/core/storage';
|
|
7
10
|
import type { PaginationInfo } from '@mastra/core/storage';
|
|
11
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
12
|
+
import { ScoresStorage } from '@mastra/core/storage';
|
|
8
13
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
14
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
9
15
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
10
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';
|
|
11
20
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
21
|
+
import { StoreOperations } from '@mastra/core/storage';
|
|
12
22
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
13
|
-
import type {
|
|
14
|
-
import { TABLE_SCHEMAS } from '@mastra/core/storage';
|
|
23
|
+
import type { TABLE_SCHEMAS } from '@mastra/core/storage';
|
|
15
24
|
import type { Trace } from '@mastra/core/telemetry';
|
|
25
|
+
import { TracesStorage } from '@mastra/core/storage';
|
|
16
26
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
17
27
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
18
28
|
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
29
|
+
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
19
30
|
|
|
20
31
|
declare type ClickhouseConfig = {
|
|
21
32
|
url: string;
|
|
@@ -25,13 +36,13 @@ declare type ClickhouseConfig = {
|
|
|
25
36
|
[TableKey in TABLE_NAMES]?: {
|
|
26
37
|
row?: {
|
|
27
38
|
interval: number;
|
|
28
|
-
unit:
|
|
39
|
+
unit: IntervalUnit_2;
|
|
29
40
|
ttlKey?: string;
|
|
30
41
|
};
|
|
31
42
|
columns?: Partial<{
|
|
32
43
|
[ColumnKey in keyof (typeof TABLE_SCHEMAS)[TableKey]]: {
|
|
33
44
|
interval: number;
|
|
34
|
-
unit:
|
|
45
|
+
unit: IntervalUnit_2;
|
|
35
46
|
ttlKey?: string;
|
|
36
47
|
};
|
|
37
48
|
}>;
|
|
@@ -41,27 +52,50 @@ declare type ClickhouseConfig = {
|
|
|
41
52
|
export { ClickhouseConfig }
|
|
42
53
|
export { ClickhouseConfig as ClickhouseConfig_alias_1 }
|
|
43
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
|
+
|
|
44
77
|
declare class ClickhouseStore extends MastraStorage {
|
|
45
78
|
protected db: ClickHouseClient;
|
|
46
79
|
protected ttl: ClickhouseConfig['ttl'];
|
|
80
|
+
stores: StorageDomains;
|
|
47
81
|
constructor(config: ClickhouseConfig);
|
|
48
|
-
|
|
49
|
-
|
|
82
|
+
get supports(): {
|
|
83
|
+
selectByIncludeResourceScope: boolean;
|
|
84
|
+
resourceWorkingMemory: boolean;
|
|
85
|
+
hasColumn: boolean;
|
|
86
|
+
createTable: boolean;
|
|
87
|
+
};
|
|
50
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
|
+
}>;
|
|
51
95
|
batchInsert({ tableName, records }: {
|
|
52
96
|
tableName: TABLE_NAMES;
|
|
53
97
|
records: Record<string, any>[];
|
|
54
98
|
}): Promise<void>;
|
|
55
|
-
getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
|
|
56
|
-
name?: string;
|
|
57
|
-
scope?: string;
|
|
58
|
-
page: number;
|
|
59
|
-
perPage: number;
|
|
60
|
-
attributes?: Record<string, string>;
|
|
61
|
-
filters?: Record<string, any>;
|
|
62
|
-
fromDate?: Date;
|
|
63
|
-
toDate?: Date;
|
|
64
|
-
}): Promise<any[]>;
|
|
65
99
|
optimizeTable({ tableName }: {
|
|
66
100
|
tableName: TABLE_NAMES;
|
|
67
101
|
}): Promise<void>;
|
|
@@ -69,16 +103,12 @@ declare class ClickhouseStore extends MastraStorage {
|
|
|
69
103
|
tableName: TABLE_NAMES;
|
|
70
104
|
}): Promise<void>;
|
|
71
105
|
createTable({ tableName, schema, }: {
|
|
72
|
-
tableName:
|
|
106
|
+
tableName: TABLE_NAMES;
|
|
73
107
|
schema: Record<string, StorageColumn>;
|
|
74
108
|
}): Promise<void>;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
*/
|
|
109
|
+
dropTable({ tableName }: {
|
|
110
|
+
tableName: TABLE_NAMES;
|
|
111
|
+
}): Promise<void>;
|
|
82
112
|
alterTable({ tableName, schema, ifNotExists, }: {
|
|
83
113
|
tableName: TABLE_NAMES;
|
|
84
114
|
schema: Record<string, StorageColumn>;
|
|
@@ -91,10 +121,38 @@ declare class ClickhouseStore extends MastraStorage {
|
|
|
91
121
|
tableName: TABLE_NAMES;
|
|
92
122
|
record: Record<string, any>;
|
|
93
123
|
}): Promise<void>;
|
|
94
|
-
load<R>({ tableName, keys
|
|
95
|
-
tableName:
|
|
124
|
+
load<R>({ tableName, keys }: {
|
|
125
|
+
tableName: TABLE_NAMES;
|
|
96
126
|
keys: Record<string, string>;
|
|
97
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>;
|
|
98
156
|
getThreadById({ threadId }: {
|
|
99
157
|
threadId: string;
|
|
100
158
|
}): Promise<StorageThreadType | null>;
|
|
@@ -112,6 +170,116 @@ declare class ClickhouseStore extends MastraStorage {
|
|
|
112
170
|
deleteThread({ threadId }: {
|
|
113
171
|
threadId: string;
|
|
114
172
|
}): Promise<void>;
|
|
173
|
+
getThreadsByResourceIdPaginated(args: {
|
|
174
|
+
resourceId: string;
|
|
175
|
+
page: number;
|
|
176
|
+
perPage: number;
|
|
177
|
+
}): Promise<PaginationInfo & {
|
|
178
|
+
threads: StorageThreadType[];
|
|
179
|
+
}>;
|
|
180
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
181
|
+
format?: 'v1';
|
|
182
|
+
}): Promise<MastraMessageV1[]>;
|
|
183
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
184
|
+
format: 'v2';
|
|
185
|
+
}): Promise<MastraMessageV2[]>;
|
|
186
|
+
saveMessages(args: {
|
|
187
|
+
messages: MastraMessageV1[];
|
|
188
|
+
format?: undefined | 'v1';
|
|
189
|
+
}): Promise<MastraMessageV1[]>;
|
|
190
|
+
saveMessages(args: {
|
|
191
|
+
messages: MastraMessageV2[];
|
|
192
|
+
format: 'v2';
|
|
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
|
+
});
|
|
115
283
|
getMessages(args: StorageGetMessagesArg & {
|
|
116
284
|
format?: 'v1';
|
|
117
285
|
}): Promise<MastraMessageV1[]>;
|
|
@@ -126,6 +294,163 @@ declare class ClickhouseStore extends MastraStorage {
|
|
|
126
294
|
messages: MastraMessageV2[];
|
|
127
295
|
format: 'v2';
|
|
128
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
|
+
});
|
|
129
454
|
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
130
455
|
workflowName: string;
|
|
131
456
|
runId: string;
|
|
@@ -148,44 +473,6 @@ declare class ClickhouseStore extends MastraStorage {
|
|
|
148
473
|
runId: string;
|
|
149
474
|
workflowName?: string;
|
|
150
475
|
}): Promise<WorkflowRun | null>;
|
|
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
|
-
}>;
|
|
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[]>;
|
|
175
476
|
}
|
|
176
|
-
export { ClickhouseStore }
|
|
177
|
-
export { ClickhouseStore as ClickhouseStore_alias_1 }
|
|
178
|
-
|
|
179
|
-
declare const COLUMN_TYPES: Record<StorageColumn['type'], string>;
|
|
180
|
-
export { COLUMN_TYPES }
|
|
181
|
-
export { COLUMN_TYPES as COLUMN_TYPES_alias_1 }
|
|
182
|
-
|
|
183
|
-
declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
|
|
184
|
-
|
|
185
|
-
declare type SUPPORTED_TABLE_NAMES = Exclude<TABLE_NAMES, typeof TABLE_RESOURCES>;
|
|
186
|
-
|
|
187
|
-
declare const TABLE_ENGINES: Record<SUPPORTED_TABLE_NAMES, string>;
|
|
188
|
-
export { TABLE_ENGINES }
|
|
189
|
-
export { TABLE_ENGINES as TABLE_ENGINES_alias_1 }
|
|
190
477
|
|
|
191
478
|
export { }
|