@mastra/clickhouse 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-unified-sidebar-20251010130811
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 +946 -2
- package/LICENSE.md +12 -4
- package/dist/index.cjs +2471 -439
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2455 -423
- package/dist/index.js.map +1 -0
- package/dist/storage/domains/legacy-evals/index.d.ts +21 -0
- package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +87 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -0
- package/dist/storage/domains/operations/index.d.ts +42 -0
- package/dist/storage/domains/operations/index.d.ts.map +1 -0
- package/dist/storage/domains/scores/index.d.ts +54 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -0
- package/dist/storage/domains/traces/index.d.ts +21 -0
- package/dist/storage/domains/traces/index.d.ts.map +1 -0
- package/dist/storage/domains/utils.d.ts +28 -0
- package/dist/storage/domains/utils.d.ts.map +1 -0
- package/dist/storage/domains/workflows/index.d.ts +55 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -0
- package/dist/storage/index.d.ts +245 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/package.json +32 -14
- package/dist/_tsup-dts-rollup.d.cts +0 -138
- package/dist/_tsup-dts-rollup.d.ts +0 -138
- package/dist/index.d.cts +0 -4
- package/docker-compose.yaml +0 -15
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -1
- package/src/storage/index.test.ts +0 -856
- package/src/storage/index.ts +0 -1058
- package/tsconfig.json +0 -5
- package/vitest.config.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/clickhouse",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-unified-sidebar-20251010130811",
|
|
4
4
|
"description": "Clickhouse provider for Mastra - includes db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,29 +12,47 @@
|
|
|
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
|
},
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
|
-
"license": "
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@clickhouse/client": "^1.
|
|
24
|
-
"@mastra/core": "0.0.0-trigger-playground-ui-package-20250506151043"
|
|
23
|
+
"@clickhouse/client": "^1.12.1"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@microsoft/api-extractor": "^7.52.
|
|
28
|
-
"@types/node": "^20.
|
|
29
|
-
"eslint": "^9.
|
|
30
|
-
"tsup": "^8.
|
|
31
|
-
"typescript": "^5.8.
|
|
32
|
-
"vitest": "^3.
|
|
33
|
-
"@internal/lint": "0.0.0-
|
|
26
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
27
|
+
"@types/node": "^20.19.0",
|
|
28
|
+
"eslint": "^9.36.0",
|
|
29
|
+
"tsup": "^8.5.0",
|
|
30
|
+
"typescript": "^5.8.3",
|
|
31
|
+
"vitest": "^3.2.4",
|
|
32
|
+
"@internal/lint": "0.0.0-unified-sidebar-20251010130811",
|
|
33
|
+
"@internal/storage-test-utils": "0.0.44",
|
|
34
|
+
"@internal/types-builder": "0.0.0-unified-sidebar-20251010130811",
|
|
35
|
+
"@mastra/core": "0.0.0-unified-sidebar-20251010130811"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@mastra/core": "0.0.0-unified-sidebar-20251010130811"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"CHANGELOG.md"
|
|
43
|
+
],
|
|
44
|
+
"homepage": "https://mastra.ai",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
48
|
+
"directory": "stores/clickhouse"
|
|
49
|
+
},
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
34
52
|
},
|
|
35
53
|
"scripts": {
|
|
36
|
-
"build": "tsup
|
|
37
|
-
"build:watch": "
|
|
54
|
+
"build": "tsup --silent --config tsup.config.ts",
|
|
55
|
+
"build:watch": "tsup --watch --silent --config tsup.config.ts",
|
|
38
56
|
"pretest": "docker compose up -d && (for i in $(seq 1 30); do docker compose exec -T db clickhouse-client --query 'SELECT 1' && break || (sleep 1; [ $i -eq 30 ] && exit 1); done)",
|
|
39
57
|
"test": "vitest run",
|
|
40
58
|
"posttest": "docker compose down -v",
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
|
-
import type { EvalRow } from '@mastra/core/storage';
|
|
3
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
4
|
-
import type { MessageType } from '@mastra/core/memory';
|
|
5
|
-
import type { StorageColumn } from '@mastra/core/storage';
|
|
6
|
-
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
7
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
8
|
-
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
9
|
-
import { TABLE_SCHEMAS } from '@mastra/core/storage';
|
|
10
|
-
import type { WorkflowRun } from '@mastra/core/storage';
|
|
11
|
-
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
12
|
-
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
13
|
-
|
|
14
|
-
declare type ClickhouseConfig = {
|
|
15
|
-
url: string;
|
|
16
|
-
username: string;
|
|
17
|
-
password: string;
|
|
18
|
-
ttl?: {
|
|
19
|
-
[TableKey in TABLE_NAMES]?: {
|
|
20
|
-
row?: {
|
|
21
|
-
interval: number;
|
|
22
|
-
unit: IntervalUnit;
|
|
23
|
-
ttlKey?: string;
|
|
24
|
-
};
|
|
25
|
-
columns?: Partial<{
|
|
26
|
-
[ColumnKey in keyof (typeof TABLE_SCHEMAS)[TableKey]]: {
|
|
27
|
-
interval: number;
|
|
28
|
-
unit: IntervalUnit;
|
|
29
|
-
ttlKey?: string;
|
|
30
|
-
};
|
|
31
|
-
}>;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export { ClickhouseConfig }
|
|
36
|
-
export { ClickhouseConfig as ClickhouseConfig_alias_1 }
|
|
37
|
-
|
|
38
|
-
declare class ClickhouseStore extends MastraStorage {
|
|
39
|
-
protected db: ClickHouseClient;
|
|
40
|
-
protected ttl: ClickhouseConfig['ttl'];
|
|
41
|
-
constructor(config: ClickhouseConfig);
|
|
42
|
-
private transformEvalRow;
|
|
43
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
44
|
-
batchInsert({ tableName, records }: {
|
|
45
|
-
tableName: TABLE_NAMES;
|
|
46
|
-
records: Record<string, any>[];
|
|
47
|
-
}): Promise<void>;
|
|
48
|
-
getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
|
|
49
|
-
name?: string;
|
|
50
|
-
scope?: string;
|
|
51
|
-
page: number;
|
|
52
|
-
perPage: number;
|
|
53
|
-
attributes?: Record<string, string>;
|
|
54
|
-
filters?: Record<string, any>;
|
|
55
|
-
fromDate?: Date;
|
|
56
|
-
toDate?: Date;
|
|
57
|
-
}): Promise<any[]>;
|
|
58
|
-
optimizeTable({ tableName }: {
|
|
59
|
-
tableName: TABLE_NAMES;
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
materializeTtl({ tableName }: {
|
|
62
|
-
tableName: TABLE_NAMES;
|
|
63
|
-
}): Promise<void>;
|
|
64
|
-
createTable({ tableName, schema, }: {
|
|
65
|
-
tableName: TABLE_NAMES;
|
|
66
|
-
schema: Record<string, StorageColumn>;
|
|
67
|
-
}): Promise<void>;
|
|
68
|
-
clearTable({ tableName }: {
|
|
69
|
-
tableName: TABLE_NAMES;
|
|
70
|
-
}): Promise<void>;
|
|
71
|
-
insert({ tableName, record }: {
|
|
72
|
-
tableName: TABLE_NAMES;
|
|
73
|
-
record: Record<string, any>;
|
|
74
|
-
}): Promise<void>;
|
|
75
|
-
load<R>({ tableName, keys }: {
|
|
76
|
-
tableName: TABLE_NAMES;
|
|
77
|
-
keys: Record<string, string>;
|
|
78
|
-
}): Promise<R | null>;
|
|
79
|
-
getThreadById({ threadId }: {
|
|
80
|
-
threadId: string;
|
|
81
|
-
}): Promise<StorageThreadType | null>;
|
|
82
|
-
getThreadsByResourceId({ resourceId }: {
|
|
83
|
-
resourceId: string;
|
|
84
|
-
}): Promise<StorageThreadType[]>;
|
|
85
|
-
saveThread({ thread }: {
|
|
86
|
-
thread: StorageThreadType;
|
|
87
|
-
}): Promise<StorageThreadType>;
|
|
88
|
-
updateThread({ id, title, metadata, }: {
|
|
89
|
-
id: string;
|
|
90
|
-
title: string;
|
|
91
|
-
metadata: Record<string, unknown>;
|
|
92
|
-
}): Promise<StorageThreadType>;
|
|
93
|
-
deleteThread({ threadId }: {
|
|
94
|
-
threadId: string;
|
|
95
|
-
}): Promise<void>;
|
|
96
|
-
getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
|
|
97
|
-
saveMessages({ messages }: {
|
|
98
|
-
messages: MessageType[];
|
|
99
|
-
}): Promise<MessageType[]>;
|
|
100
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
101
|
-
workflowName: string;
|
|
102
|
-
runId: string;
|
|
103
|
-
snapshot: WorkflowRunState;
|
|
104
|
-
}): Promise<void>;
|
|
105
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
106
|
-
workflowName: string;
|
|
107
|
-
runId: string;
|
|
108
|
-
}): Promise<WorkflowRunState | null>;
|
|
109
|
-
private parseWorkflowRun;
|
|
110
|
-
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
111
|
-
workflowName?: string;
|
|
112
|
-
fromDate?: Date;
|
|
113
|
-
toDate?: Date;
|
|
114
|
-
limit?: number;
|
|
115
|
-
offset?: number;
|
|
116
|
-
resourceId?: string;
|
|
117
|
-
}): Promise<WorkflowRuns>;
|
|
118
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
119
|
-
runId: string;
|
|
120
|
-
workflowName?: string;
|
|
121
|
-
}): Promise<WorkflowRun | null>;
|
|
122
|
-
private hasColumn;
|
|
123
|
-
close(): Promise<void>;
|
|
124
|
-
}
|
|
125
|
-
export { ClickhouseStore }
|
|
126
|
-
export { ClickhouseStore as ClickhouseStore_alias_1 }
|
|
127
|
-
|
|
128
|
-
declare const COLUMN_TYPES: Record<StorageColumn['type'], string>;
|
|
129
|
-
export { COLUMN_TYPES }
|
|
130
|
-
export { COLUMN_TYPES as COLUMN_TYPES_alias_1 }
|
|
131
|
-
|
|
132
|
-
declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
|
|
133
|
-
|
|
134
|
-
declare const TABLE_ENGINES: Record<TABLE_NAMES, string>;
|
|
135
|
-
export { TABLE_ENGINES }
|
|
136
|
-
export { TABLE_ENGINES as TABLE_ENGINES_alias_1 }
|
|
137
|
-
|
|
138
|
-
export { }
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import type { ClickHouseClient } from '@clickhouse/client';
|
|
2
|
-
import type { EvalRow } from '@mastra/core/storage';
|
|
3
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
4
|
-
import type { MessageType } from '@mastra/core/memory';
|
|
5
|
-
import type { StorageColumn } from '@mastra/core/storage';
|
|
6
|
-
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
7
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
8
|
-
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
9
|
-
import { TABLE_SCHEMAS } from '@mastra/core/storage';
|
|
10
|
-
import type { WorkflowRun } from '@mastra/core/storage';
|
|
11
|
-
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
12
|
-
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
13
|
-
|
|
14
|
-
declare type ClickhouseConfig = {
|
|
15
|
-
url: string;
|
|
16
|
-
username: string;
|
|
17
|
-
password: string;
|
|
18
|
-
ttl?: {
|
|
19
|
-
[TableKey in TABLE_NAMES]?: {
|
|
20
|
-
row?: {
|
|
21
|
-
interval: number;
|
|
22
|
-
unit: IntervalUnit;
|
|
23
|
-
ttlKey?: string;
|
|
24
|
-
};
|
|
25
|
-
columns?: Partial<{
|
|
26
|
-
[ColumnKey in keyof (typeof TABLE_SCHEMAS)[TableKey]]: {
|
|
27
|
-
interval: number;
|
|
28
|
-
unit: IntervalUnit;
|
|
29
|
-
ttlKey?: string;
|
|
30
|
-
};
|
|
31
|
-
}>;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export { ClickhouseConfig }
|
|
36
|
-
export { ClickhouseConfig as ClickhouseConfig_alias_1 }
|
|
37
|
-
|
|
38
|
-
declare class ClickhouseStore extends MastraStorage {
|
|
39
|
-
protected db: ClickHouseClient;
|
|
40
|
-
protected ttl: ClickhouseConfig['ttl'];
|
|
41
|
-
constructor(config: ClickhouseConfig);
|
|
42
|
-
private transformEvalRow;
|
|
43
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
44
|
-
batchInsert({ tableName, records }: {
|
|
45
|
-
tableName: TABLE_NAMES;
|
|
46
|
-
records: Record<string, any>[];
|
|
47
|
-
}): Promise<void>;
|
|
48
|
-
getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
|
|
49
|
-
name?: string;
|
|
50
|
-
scope?: string;
|
|
51
|
-
page: number;
|
|
52
|
-
perPage: number;
|
|
53
|
-
attributes?: Record<string, string>;
|
|
54
|
-
filters?: Record<string, any>;
|
|
55
|
-
fromDate?: Date;
|
|
56
|
-
toDate?: Date;
|
|
57
|
-
}): Promise<any[]>;
|
|
58
|
-
optimizeTable({ tableName }: {
|
|
59
|
-
tableName: TABLE_NAMES;
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
materializeTtl({ tableName }: {
|
|
62
|
-
tableName: TABLE_NAMES;
|
|
63
|
-
}): Promise<void>;
|
|
64
|
-
createTable({ tableName, schema, }: {
|
|
65
|
-
tableName: TABLE_NAMES;
|
|
66
|
-
schema: Record<string, StorageColumn>;
|
|
67
|
-
}): Promise<void>;
|
|
68
|
-
clearTable({ tableName }: {
|
|
69
|
-
tableName: TABLE_NAMES;
|
|
70
|
-
}): Promise<void>;
|
|
71
|
-
insert({ tableName, record }: {
|
|
72
|
-
tableName: TABLE_NAMES;
|
|
73
|
-
record: Record<string, any>;
|
|
74
|
-
}): Promise<void>;
|
|
75
|
-
load<R>({ tableName, keys }: {
|
|
76
|
-
tableName: TABLE_NAMES;
|
|
77
|
-
keys: Record<string, string>;
|
|
78
|
-
}): Promise<R | null>;
|
|
79
|
-
getThreadById({ threadId }: {
|
|
80
|
-
threadId: string;
|
|
81
|
-
}): Promise<StorageThreadType | null>;
|
|
82
|
-
getThreadsByResourceId({ resourceId }: {
|
|
83
|
-
resourceId: string;
|
|
84
|
-
}): Promise<StorageThreadType[]>;
|
|
85
|
-
saveThread({ thread }: {
|
|
86
|
-
thread: StorageThreadType;
|
|
87
|
-
}): Promise<StorageThreadType>;
|
|
88
|
-
updateThread({ id, title, metadata, }: {
|
|
89
|
-
id: string;
|
|
90
|
-
title: string;
|
|
91
|
-
metadata: Record<string, unknown>;
|
|
92
|
-
}): Promise<StorageThreadType>;
|
|
93
|
-
deleteThread({ threadId }: {
|
|
94
|
-
threadId: string;
|
|
95
|
-
}): Promise<void>;
|
|
96
|
-
getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
|
|
97
|
-
saveMessages({ messages }: {
|
|
98
|
-
messages: MessageType[];
|
|
99
|
-
}): Promise<MessageType[]>;
|
|
100
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
101
|
-
workflowName: string;
|
|
102
|
-
runId: string;
|
|
103
|
-
snapshot: WorkflowRunState;
|
|
104
|
-
}): Promise<void>;
|
|
105
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
106
|
-
workflowName: string;
|
|
107
|
-
runId: string;
|
|
108
|
-
}): Promise<WorkflowRunState | null>;
|
|
109
|
-
private parseWorkflowRun;
|
|
110
|
-
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
111
|
-
workflowName?: string;
|
|
112
|
-
fromDate?: Date;
|
|
113
|
-
toDate?: Date;
|
|
114
|
-
limit?: number;
|
|
115
|
-
offset?: number;
|
|
116
|
-
resourceId?: string;
|
|
117
|
-
}): Promise<WorkflowRuns>;
|
|
118
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
119
|
-
runId: string;
|
|
120
|
-
workflowName?: string;
|
|
121
|
-
}): Promise<WorkflowRun | null>;
|
|
122
|
-
private hasColumn;
|
|
123
|
-
close(): Promise<void>;
|
|
124
|
-
}
|
|
125
|
-
export { ClickhouseStore }
|
|
126
|
-
export { ClickhouseStore as ClickhouseStore_alias_1 }
|
|
127
|
-
|
|
128
|
-
declare const COLUMN_TYPES: Record<StorageColumn['type'], string>;
|
|
129
|
-
export { COLUMN_TYPES }
|
|
130
|
-
export { COLUMN_TYPES as COLUMN_TYPES_alias_1 }
|
|
131
|
-
|
|
132
|
-
declare type IntervalUnit = 'NANOSECOND' | 'MICROSECOND' | 'MILLISECOND' | 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
|
|
133
|
-
|
|
134
|
-
declare const TABLE_ENGINES: Record<TABLE_NAMES, string>;
|
|
135
|
-
export { TABLE_ENGINES }
|
|
136
|
-
export { TABLE_ENGINES as TABLE_ENGINES_alias_1 }
|
|
137
|
-
|
|
138
|
-
export { }
|
package/dist/index.d.cts
DELETED
package/docker-compose.yaml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
db:
|
|
3
|
-
image: clickhouse/clickhouse-server:latest
|
|
4
|
-
container_name: 'clickhouse-test-db'
|
|
5
|
-
ports:
|
|
6
|
-
- '8123:8123'
|
|
7
|
-
- '9000:9000'
|
|
8
|
-
environment:
|
|
9
|
-
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
|
|
10
|
-
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
|
|
11
|
-
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-password}
|
|
12
|
-
volumes:
|
|
13
|
-
- clickhouse_data:/var/lib/clickhouse
|
|
14
|
-
volumes:
|
|
15
|
-
clickhouse_data:
|
package/eslint.config.js
DELETED
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './storage';
|