@mastra/clickhouse 0.0.0-zod-v4-compat-part-2-20250822105954 → 0.0.0-zod-v4-stuff-20250825154219
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 +154 -2
- package/dist/index.cjs +98 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -11
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/legacy-evals/index.d.ts +1 -1
- package/dist/storage/domains/memory/index.d.ts +9 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts +1 -1
- package/dist/storage/domains/scores/index.d.ts +6 -3
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/traces/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +13 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/index.ts +1 -0
- package/src/storage/domains/memory/index.ts +80 -0
- package/src/storage/domains/operations/index.ts +1 -1
- package/src/storage/domains/scores/index.ts +31 -6
- package/src/storage/domains/traces/index.ts +10 -10
- package/src/storage/domains/workflows/index.ts +1 -0
- package/src/storage/index.ts +20 -2
- package/tsup.config.ts +2 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
2
|
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { EvalRow, PaginationArgs, PaginationInfo } from '@mastra/core/storage';
|
|
4
|
-
import type { StoreOperationsClickhouse } from '../operations';
|
|
4
|
+
import type { StoreOperationsClickhouse } from '../operations/index.js';
|
|
5
5
|
export declare class LegacyEvalsStorageClickhouse extends LegacyEvalsStorage {
|
|
6
6
|
protected client: ClickHouseClient;
|
|
7
7
|
protected operations: StoreOperationsClickhouse;
|
|
@@ -3,7 +3,7 @@ import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
|
3
3
|
import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
|
|
4
4
|
import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType } from '@mastra/core/storage';
|
|
5
5
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
6
|
-
import type { StoreOperationsClickhouse } from '../operations';
|
|
6
|
+
import type { StoreOperationsClickhouse } from '../operations/index.js';
|
|
7
7
|
export declare class MemoryStorageClickhouse extends MemoryStorage {
|
|
8
8
|
protected client: ClickHouseClient;
|
|
9
9
|
protected operations: StoreOperationsClickhouse;
|
|
@@ -17,6 +17,14 @@ export declare class MemoryStorageClickhouse extends MemoryStorage {
|
|
|
17
17
|
getMessages(args: StorageGetMessagesArg & {
|
|
18
18
|
format: 'v2';
|
|
19
19
|
}): Promise<MastraMessageV2[]>;
|
|
20
|
+
getMessagesById({ messageIds, format, }: {
|
|
21
|
+
messageIds: string[];
|
|
22
|
+
format: 'v1';
|
|
23
|
+
}): Promise<MastraMessageV1[]>;
|
|
24
|
+
getMessagesById({ messageIds, format, }: {
|
|
25
|
+
messageIds: string[];
|
|
26
|
+
format?: 'v2';
|
|
27
|
+
}): Promise<MastraMessageV2[]>;
|
|
20
28
|
saveMessages(args: {
|
|
21
29
|
messages: MastraMessageV1[];
|
|
22
30
|
format?: undefined | 'v1';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KA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A;aAAE,CAAC;SAC1G,CAAC,EAAE,CAAC;KACN,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAmWxB,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA6C5F,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmC3F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAuEjC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
2
|
import { StoreOperations } from '@mastra/core/storage';
|
|
3
3
|
import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
|
|
4
|
-
import type { ClickhouseConfig } from '../utils';
|
|
4
|
+
import type { ClickhouseConfig } from '../utils.js';
|
|
5
5
|
export declare class StoreOperationsClickhouse extends StoreOperations {
|
|
6
6
|
protected ttl: ClickhouseConfig['ttl'];
|
|
7
7
|
protected client: ClickHouseClient;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
2
|
+
import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
|
|
3
3
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
4
4
|
import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
|
|
5
|
-
import type { StoreOperationsClickhouse } from '../operations';
|
|
5
|
+
import type { StoreOperationsClickhouse } from '../operations/index.js';
|
|
6
6
|
export declare class ScoresStorageClickhouse extends ScoresStorage {
|
|
7
7
|
protected client: ClickHouseClient;
|
|
8
8
|
protected operations: StoreOperationsClickhouse;
|
|
@@ -24,9 +24,12 @@ export declare class ScoresStorageClickhouse extends ScoresStorage {
|
|
|
24
24
|
pagination: PaginationInfo;
|
|
25
25
|
scores: ScoreRowData[];
|
|
26
26
|
}>;
|
|
27
|
-
getScoresByScorerId({ scorerId, pagination, }: {
|
|
27
|
+
getScoresByScorerId({ scorerId, entityId, entityType, source, pagination, }: {
|
|
28
28
|
scorerId: string;
|
|
29
29
|
pagination: StoragePagination;
|
|
30
|
+
entityId?: string;
|
|
31
|
+
entityType?: string;
|
|
32
|
+
source?: ScoringSource;
|
|
30
33
|
}): Promise<{
|
|
31
34
|
pagination: PaginationInfo;
|
|
32
35
|
scores: ScoreRowData[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAkC,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,SAAS,CAAC,MAAM,EAAE,gBA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,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAkEpE"}
|
|
@@ -2,7 +2,7 @@ import type { ClickHouseClient } from '@clickhouse/client';
|
|
|
2
2
|
import { TracesStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { PaginationInfo, StorageGetTracesPaginatedArg, StorageGetTracesArg } from '@mastra/core/storage';
|
|
4
4
|
import type { Trace } from '@mastra/core/telemetry';
|
|
5
|
-
import type { StoreOperationsClickhouse } from '../operations';
|
|
5
|
+
import type { StoreOperationsClickhouse } from '../operations/index.js';
|
|
6
6
|
export declare class TracesStorageClickhouse extends TracesStorage {
|
|
7
7
|
protected client: ClickHouseClient;
|
|
8
8
|
protected operations: StoreOperationsClickhouse;
|
|
@@ -2,7 +2,7 @@ import type { ClickHouseClient } from '@clickhouse/client';
|
|
|
2
2
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
|
|
4
4
|
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
5
|
-
import type { StoreOperationsClickhouse } from '../operations';
|
|
5
|
+
import type { StoreOperationsClickhouse } from '../operations/index.js';
|
|
6
6
|
export declare class WorkflowsStorageClickhouse extends WorkflowsStorage {
|
|
7
7
|
protected client: ClickHouseClient;
|
|
8
8
|
protected operations: StoreOperationsClickhouse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAA2B,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,e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C;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,YAAY,CAAC;IAuFxB,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAoDhC"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
2
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
3
3
|
import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
|
|
4
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
4
|
+
import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
|
|
5
5
|
import { MastraStorage } from '@mastra/core/storage';
|
|
6
6
|
import type { TABLE_SCHEMAS, EvalRow, PaginationInfo, StorageColumn, StorageGetMessagesArg, TABLE_NAMES, WorkflowRun, WorkflowRuns, StorageGetTracesArg, StorageGetTracesPaginatedArg, StoragePagination, StorageDomains, PaginationArgs, StorageResourceType } from '@mastra/core/storage';
|
|
7
7
|
import type { Trace } from '@mastra/core/telemetry';
|
|
@@ -138,6 +138,14 @@ export declare class ClickhouseStore extends MastraStorage {
|
|
|
138
138
|
getMessages(args: StorageGetMessagesArg & {
|
|
139
139
|
format: 'v2';
|
|
140
140
|
}): Promise<MastraMessageV2[]>;
|
|
141
|
+
getMessagesById({ messageIds, format }: {
|
|
142
|
+
messageIds: string[];
|
|
143
|
+
format: 'v1';
|
|
144
|
+
}): Promise<MastraMessageV1[]>;
|
|
145
|
+
getMessagesById({ messageIds, format }: {
|
|
146
|
+
messageIds: string[];
|
|
147
|
+
format?: 'v2';
|
|
148
|
+
}): Promise<MastraMessageV2[]>;
|
|
141
149
|
saveMessages(args: {
|
|
142
150
|
messages: MastraMessageV1[];
|
|
143
151
|
format?: undefined | 'v1';
|
|
@@ -193,9 +201,12 @@ export declare class ClickhouseStore extends MastraStorage {
|
|
|
193
201
|
pagination: PaginationInfo;
|
|
194
202
|
scores: ScoreRowData[];
|
|
195
203
|
}>;
|
|
196
|
-
getScoresByScorerId({ scorerId, pagination, }: {
|
|
204
|
+
getScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
197
205
|
scorerId: string;
|
|
198
206
|
pagination: StoragePagination;
|
|
207
|
+
entityId?: string;
|
|
208
|
+
entityType?: string;
|
|
209
|
+
source?: ScoringSource;
|
|
199
210
|
}): Promise<{
|
|
200
211
|
pagination: PaginationInfo;
|
|
201
212
|
scores: ScoreRowData[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EACV,aA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AAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAIjE,gBAAgB,CAAC,EACrB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,GACP,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/clickhouse",
|
|
3
|
-
"version": "0.0.0-zod-v4-
|
|
3
|
+
"version": "0.0.0-zod-v4-stuff-20250825154219",
|
|
4
4
|
"description": "Clickhouse provider for Mastra - includes db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"require": {
|
|
15
|
-
"types": "./dist/index.d.
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
16
|
"default": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@clickhouse/client": "^1.
|
|
23
|
+
"@clickhouse/client": "^1.12.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@microsoft/api-extractor": "^7.52.8",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"tsup": "^8.5.0",
|
|
30
30
|
"typescript": "^5.8.3",
|
|
31
31
|
"vitest": "^3.2.4",
|
|
32
|
-
"@internal/lint": "0.0.0-zod-v4-
|
|
33
|
-
"@internal/storage-test-utils": "0.0.
|
|
34
|
-
"@mastra/core": "0.0.0-zod-v4-
|
|
32
|
+
"@internal/lint": "0.0.0-zod-v4-stuff-20250825154219",
|
|
33
|
+
"@internal/storage-test-utils": "0.0.27",
|
|
34
|
+
"@mastra/core": "0.0.0-zod-v4-stuff-20250825154219",
|
|
35
|
+
"@internal/types-builder": "0.0.0-zod-v4-stuff-20250825154219"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"@mastra/core": "0.0.0-zod-v4-
|
|
38
|
+
"@mastra/core": "0.0.0-zod-v4-stuff-20250825154219"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "tsup --silent --config tsup.config.ts",
|
package/src/index.ts
CHANGED
|
@@ -169,6 +169,86 @@ export class MemoryStorageClickhouse extends MemoryStorage {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
public async getMessagesById({
|
|
173
|
+
messageIds,
|
|
174
|
+
format,
|
|
175
|
+
}: {
|
|
176
|
+
messageIds: string[];
|
|
177
|
+
format: 'v1';
|
|
178
|
+
}): Promise<MastraMessageV1[]>;
|
|
179
|
+
public async getMessagesById({
|
|
180
|
+
messageIds,
|
|
181
|
+
format,
|
|
182
|
+
}: {
|
|
183
|
+
messageIds: string[];
|
|
184
|
+
format?: 'v2';
|
|
185
|
+
}): Promise<MastraMessageV2[]>;
|
|
186
|
+
public async getMessagesById({
|
|
187
|
+
messageIds,
|
|
188
|
+
format,
|
|
189
|
+
}: {
|
|
190
|
+
messageIds: string[];
|
|
191
|
+
format?: 'v1' | 'v2';
|
|
192
|
+
}): Promise<MastraMessageV1[] | MastraMessageV2[]> {
|
|
193
|
+
if (messageIds.length === 0) return [];
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
const result = await this.client.query({
|
|
197
|
+
query: `
|
|
198
|
+
SELECT
|
|
199
|
+
id,
|
|
200
|
+
content,
|
|
201
|
+
role,
|
|
202
|
+
type,
|
|
203
|
+
toDateTime64(createdAt, 3) as createdAt,
|
|
204
|
+
thread_id AS "threadId",
|
|
205
|
+
"resourceId"
|
|
206
|
+
FROM "${TABLE_MESSAGES}"
|
|
207
|
+
WHERE id IN {messageIds:Array(String)}
|
|
208
|
+
ORDER BY "createdAt" DESC
|
|
209
|
+
`,
|
|
210
|
+
query_params: {
|
|
211
|
+
messageIds,
|
|
212
|
+
},
|
|
213
|
+
clickhouse_settings: {
|
|
214
|
+
// Allows to insert serialized JS Dates (such as '2023-12-06T10:54:48.000Z')
|
|
215
|
+
date_time_input_format: 'best_effort',
|
|
216
|
+
date_time_output_format: 'iso',
|
|
217
|
+
use_client_time_zone: 1,
|
|
218
|
+
output_format_json_quote_64bit_integers: 0,
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const rows = await result.json();
|
|
223
|
+
const messages: any[] = transformRows(rows.data);
|
|
224
|
+
|
|
225
|
+
// Parse message content
|
|
226
|
+
messages.forEach(message => {
|
|
227
|
+
if (typeof message.content === 'string') {
|
|
228
|
+
try {
|
|
229
|
+
message.content = JSON.parse(message.content);
|
|
230
|
+
} catch {
|
|
231
|
+
// If parsing fails, leave as string
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
const list = new MessageList().add(messages, 'memory');
|
|
237
|
+
if (format === `v1`) return list.get.all.v1();
|
|
238
|
+
return list.get.all.v2();
|
|
239
|
+
} catch (error) {
|
|
240
|
+
throw new MastraError(
|
|
241
|
+
{
|
|
242
|
+
id: 'CLICKHOUSE_STORAGE_GET_MESSAGES_BY_ID_FAILED',
|
|
243
|
+
domain: ErrorDomain.STORAGE,
|
|
244
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
245
|
+
details: { messageIds: JSON.stringify(messageIds) },
|
|
246
|
+
},
|
|
247
|
+
error,
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
172
252
|
async saveMessages(args: { messages: MastraMessageV1[]; format?: undefined | 'v1' }): Promise<MastraMessageV1[]>;
|
|
173
253
|
async saveMessages(args: { messages: MastraMessageV2[]; format: 'v2' }): Promise<MastraMessageV2[]>;
|
|
174
254
|
async saveMessages(
|
|
@@ -274,7 +274,7 @@ export class StoreOperationsClickhouse extends StoreOperations {
|
|
|
274
274
|
const selectClause = `SELECT *, toDateTime64(createdAt, 3) as createdAt${hasUpdatedAt ? ', toDateTime64(updatedAt, 3) as updatedAt' : ''}`;
|
|
275
275
|
|
|
276
276
|
const result = await this.client.query({
|
|
277
|
-
query: `${selectClause} FROM ${tableName} ${engine.startsWith('ReplacingMergeTree') ? 'FINAL' : ''} WHERE ${conditions}`,
|
|
277
|
+
query: `${selectClause} FROM ${tableName} ${engine.startsWith('ReplacingMergeTree') ? 'FINAL' : ''} WHERE ${conditions} ORDER BY createdAt DESC LIMIT 1`,
|
|
278
278
|
query_params: values,
|
|
279
279
|
clickhouse_settings: {
|
|
280
280
|
// Allows to insert serialized JS Dates (such as '2023-12-06T10:54:48.000Z')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
2
|
import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
|
|
3
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
3
|
+
import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
|
|
4
4
|
import { ScoresStorage, TABLE_SCORERS, safelyParseJSON } from '@mastra/core/storage';
|
|
5
5
|
import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
|
|
6
6
|
import type { StoreOperationsClickhouse } from '../operations';
|
|
@@ -16,7 +16,7 @@ export class ScoresStorageClickhouse extends ScoresStorage {
|
|
|
16
16
|
|
|
17
17
|
private transformScoreRow(row: any): ScoreRowData {
|
|
18
18
|
const scorer = safelyParseJSON(row.scorer);
|
|
19
|
-
const
|
|
19
|
+
const preprocessStepResult = safelyParseJSON(row.preprocessStepResult);
|
|
20
20
|
const analyzeStepResult = safelyParseJSON(row.analyzeStepResult);
|
|
21
21
|
const metadata = safelyParseJSON(row.metadata);
|
|
22
22
|
const input = safelyParseJSON(row.input);
|
|
@@ -28,7 +28,7 @@ export class ScoresStorageClickhouse extends ScoresStorage {
|
|
|
28
28
|
return {
|
|
29
29
|
...row,
|
|
30
30
|
scorer,
|
|
31
|
-
|
|
31
|
+
preprocessStepResult,
|
|
32
32
|
analyzeStepResult,
|
|
33
33
|
metadata,
|
|
34
34
|
input,
|
|
@@ -179,16 +179,38 @@ export class ScoresStorageClickhouse extends ScoresStorage {
|
|
|
179
179
|
|
|
180
180
|
async getScoresByScorerId({
|
|
181
181
|
scorerId,
|
|
182
|
+
entityId,
|
|
183
|
+
entityType,
|
|
184
|
+
source,
|
|
182
185
|
pagination,
|
|
183
186
|
}: {
|
|
184
187
|
scorerId: string;
|
|
185
188
|
pagination: StoragePagination;
|
|
189
|
+
entityId?: string;
|
|
190
|
+
entityType?: string;
|
|
191
|
+
source?: ScoringSource;
|
|
186
192
|
}): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
|
|
193
|
+
let whereClause = `scorerId = {var_scorerId:String}`;
|
|
194
|
+
if (entityId) {
|
|
195
|
+
whereClause += ` AND entityId = {var_entityId:String}`;
|
|
196
|
+
}
|
|
197
|
+
if (entityType) {
|
|
198
|
+
whereClause += ` AND entityType = {var_entityType:String}`;
|
|
199
|
+
}
|
|
200
|
+
if (source) {
|
|
201
|
+
whereClause += ` AND source = {var_source:String}`;
|
|
202
|
+
}
|
|
203
|
+
|
|
187
204
|
try {
|
|
188
205
|
// Get total count
|
|
189
206
|
const countResult = await this.client.query({
|
|
190
|
-
query: `SELECT COUNT(*) as count FROM ${TABLE_SCORERS} WHERE
|
|
191
|
-
query_params: {
|
|
207
|
+
query: `SELECT COUNT(*) as count FROM ${TABLE_SCORERS} WHERE ${whereClause}`,
|
|
208
|
+
query_params: {
|
|
209
|
+
var_scorerId: scorerId,
|
|
210
|
+
var_entityId: entityId,
|
|
211
|
+
var_entityType: entityType,
|
|
212
|
+
var_source: source,
|
|
213
|
+
},
|
|
192
214
|
format: 'JSONEachRow',
|
|
193
215
|
});
|
|
194
216
|
const countRows = await countResult.json();
|
|
@@ -211,11 +233,14 @@ export class ScoresStorageClickhouse extends ScoresStorage {
|
|
|
211
233
|
// Get paginated results
|
|
212
234
|
const offset = pagination.page * pagination.perPage;
|
|
213
235
|
const result = await this.client.query({
|
|
214
|
-
query: `SELECT * FROM ${TABLE_SCORERS} WHERE
|
|
236
|
+
query: `SELECT * FROM ${TABLE_SCORERS} WHERE ${whereClause} ORDER BY createdAt DESC LIMIT {var_limit:Int64} OFFSET {var_offset:Int64}`,
|
|
215
237
|
query_params: {
|
|
216
238
|
var_scorerId: scorerId,
|
|
217
239
|
var_limit: pagination.perPage,
|
|
218
240
|
var_offset: offset,
|
|
241
|
+
var_entityId: entityId,
|
|
242
|
+
var_entityType: entityType,
|
|
243
|
+
var_source: source,
|
|
219
244
|
},
|
|
220
245
|
format: 'JSONEachRow',
|
|
221
246
|
clickhouse_settings: {
|
|
@@ -112,13 +112,13 @@ export class TracesStorageClickhouse extends TracesStorage {
|
|
|
112
112
|
name: row.name,
|
|
113
113
|
scope: row.scope,
|
|
114
114
|
kind: row.kind,
|
|
115
|
-
status: safelyParseJSON(row.status
|
|
116
|
-
events: safelyParseJSON(row.events
|
|
117
|
-
links: safelyParseJSON(row.links
|
|
118
|
-
attributes: safelyParseJSON(row.attributes
|
|
115
|
+
status: safelyParseJSON(row.status),
|
|
116
|
+
events: safelyParseJSON(row.events),
|
|
117
|
+
links: safelyParseJSON(row.links),
|
|
118
|
+
attributes: safelyParseJSON(row.attributes),
|
|
119
119
|
startTime: row.startTime,
|
|
120
120
|
endTime: row.endTime,
|
|
121
|
-
other: safelyParseJSON(row.other
|
|
121
|
+
other: safelyParseJSON(row.other),
|
|
122
122
|
createdAt: row.createdAt,
|
|
123
123
|
}));
|
|
124
124
|
|
|
@@ -235,13 +235,13 @@ export class TracesStorageClickhouse extends TracesStorage {
|
|
|
235
235
|
name: row.name,
|
|
236
236
|
scope: row.scope,
|
|
237
237
|
kind: row.kind,
|
|
238
|
-
status: safelyParseJSON(row.status
|
|
239
|
-
events: safelyParseJSON(row.events
|
|
240
|
-
links: safelyParseJSON(row.links
|
|
241
|
-
attributes: safelyParseJSON(row.attributes
|
|
238
|
+
status: safelyParseJSON(row.status),
|
|
239
|
+
events: safelyParseJSON(row.events),
|
|
240
|
+
links: safelyParseJSON(row.links),
|
|
241
|
+
attributes: safelyParseJSON(row.attributes),
|
|
242
242
|
startTime: row.startTime,
|
|
243
243
|
endTime: row.endTime,
|
|
244
|
-
other: safelyParseJSON(row.other
|
|
244
|
+
other: safelyParseJSON(row.other),
|
|
245
245
|
createdAt: row.createdAt,
|
|
246
246
|
}));
|
|
247
247
|
} catch (error: any) {
|
|
@@ -260,6 +260,7 @@ export class WorkflowsStorageClickhouse extends WorkflowsStorage {
|
|
|
260
260
|
resourceId
|
|
261
261
|
FROM ${TABLE_WORKFLOW_SNAPSHOT} ${TABLE_ENGINES[TABLE_WORKFLOW_SNAPSHOT].startsWith('ReplacingMergeTree') ? 'FINAL' : ''}
|
|
262
262
|
${whereClause}
|
|
263
|
+
ORDER BY createdAt DESC LIMIT 1
|
|
263
264
|
`,
|
|
264
265
|
query_params: values,
|
|
265
266
|
format: 'JSONEachRow',
|
package/src/storage/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { createClient } from '@clickhouse/client';
|
|
|
3
3
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
4
4
|
import { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';
|
|
5
5
|
import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
|
|
6
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
6
|
+
import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
|
|
7
7
|
import { MastraStorage } from '@mastra/core/storage';
|
|
8
8
|
import type {
|
|
9
9
|
TABLE_SCHEMAS,
|
|
@@ -314,6 +314,18 @@ export class ClickhouseStore extends MastraStorage {
|
|
|
314
314
|
return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format });
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
async getMessagesById({ messageIds, format }: { messageIds: string[]; format: 'v1' }): Promise<MastraMessageV1[]>;
|
|
318
|
+
async getMessagesById({ messageIds, format }: { messageIds: string[]; format?: 'v2' }): Promise<MastraMessageV2[]>;
|
|
319
|
+
async getMessagesById({
|
|
320
|
+
messageIds,
|
|
321
|
+
format,
|
|
322
|
+
}: {
|
|
323
|
+
messageIds: string[];
|
|
324
|
+
format?: 'v1' | 'v2';
|
|
325
|
+
}): Promise<MastraMessageV1[] | MastraMessageV2[]> {
|
|
326
|
+
return this.stores.memory.getMessagesById({ messageIds, format });
|
|
327
|
+
}
|
|
328
|
+
|
|
317
329
|
async saveMessages(args: { messages: MastraMessageV1[]; format?: undefined | 'v1' }): Promise<MastraMessageV1[]>;
|
|
318
330
|
async saveMessages(args: { messages: MastraMessageV2[]; format: 'v2' }): Promise<MastraMessageV2[]>;
|
|
319
331
|
async saveMessages(
|
|
@@ -391,11 +403,17 @@ export class ClickhouseStore extends MastraStorage {
|
|
|
391
403
|
async getScoresByScorerId({
|
|
392
404
|
scorerId,
|
|
393
405
|
pagination,
|
|
406
|
+
entityId,
|
|
407
|
+
entityType,
|
|
408
|
+
source,
|
|
394
409
|
}: {
|
|
395
410
|
scorerId: string;
|
|
396
411
|
pagination: StoragePagination;
|
|
412
|
+
entityId?: string;
|
|
413
|
+
entityType?: string;
|
|
414
|
+
source?: ScoringSource;
|
|
397
415
|
}): Promise<{ pagination: PaginationInfo; scores: ScoreRowData[] }> {
|
|
398
|
-
return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
|
|
416
|
+
return this.stores.scores.getScoresByScorerId({ scorerId, pagination, entityId, entityType, source });
|
|
399
417
|
}
|
|
400
418
|
|
|
401
419
|
async close(): Promise<void> {
|
package/tsup.config.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promisify } from 'util';
|
|
1
|
+
import { generateTypes } from '@internal/types-builder';
|
|
3
2
|
import { defineConfig } from 'tsup';
|
|
4
3
|
|
|
5
|
-
const exec = promisify(spawn);
|
|
6
|
-
|
|
7
4
|
export default defineConfig({
|
|
8
5
|
entry: ['src/index.ts'],
|
|
9
6
|
format: ['esm', 'cjs'],
|
|
@@ -15,8 +12,6 @@ export default defineConfig({
|
|
|
15
12
|
},
|
|
16
13
|
sourcemap: true,
|
|
17
14
|
onSuccess: async () => {
|
|
18
|
-
await
|
|
19
|
-
stdio: 'inherit',
|
|
20
|
-
});
|
|
15
|
+
await generateTypes(process.cwd());
|
|
21
16
|
},
|
|
22
17
|
});
|