@mastra/clickhouse 0.0.0-vector-query-sources-20250516172905 → 0.0.0-vector-query-tool-provider-options-20250828222356

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +603 -2
  2. package/LICENSE.md +12 -4
  3. package/dist/index.cjs +2366 -442
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +3 -4
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +2349 -425
  8. package/dist/index.js.map +1 -0
  9. package/dist/storage/domains/legacy-evals/index.d.ts +21 -0
  10. package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
  11. package/dist/storage/domains/memory/index.d.ts +87 -0
  12. package/dist/storage/domains/memory/index.d.ts.map +1 -0
  13. package/dist/storage/domains/operations/index.d.ts +42 -0
  14. package/dist/storage/domains/operations/index.d.ts.map +1 -0
  15. package/dist/storage/domains/scores/index.d.ts +46 -0
  16. package/dist/storage/domains/scores/index.d.ts.map +1 -0
  17. package/dist/storage/domains/traces/index.d.ts +21 -0
  18. package/dist/storage/domains/traces/index.d.ts.map +1 -0
  19. package/dist/storage/domains/utils.d.ts +28 -0
  20. package/dist/storage/domains/utils.d.ts.map +1 -0
  21. package/dist/storage/domains/workflows/index.d.ts +54 -0
  22. package/dist/storage/domains/workflows/index.d.ts.map +1 -0
  23. package/dist/storage/index.d.ts +235 -0
  24. package/dist/storage/index.d.ts.map +1 -0
  25. package/package.json +18 -13
  26. package/src/index.ts +1 -0
  27. package/src/storage/domains/legacy-evals/index.ts +246 -0
  28. package/src/storage/domains/memory/index.ts +1473 -0
  29. package/src/storage/domains/operations/index.ts +319 -0
  30. package/src/storage/domains/scores/index.ts +351 -0
  31. package/src/storage/domains/traces/index.ts +275 -0
  32. package/src/storage/domains/utils.ts +90 -0
  33. package/src/storage/domains/workflows/index.ts +323 -0
  34. package/src/storage/index.test.ts +14 -844
  35. package/src/storage/index.ts +290 -890
  36. package/tsconfig.build.json +9 -0
  37. package/tsconfig.json +1 -1
  38. package/tsup.config.ts +17 -0
  39. package/dist/_tsup-dts-rollup.d.cts +0 -138
  40. package/dist/_tsup-dts-rollup.d.ts +0 -138
  41. package/dist/index.d.cts +0 -4
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": ["./tsconfig.json", "../../tsconfig.build.json"],
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "**/*.test.ts", "src/**/*.mock.ts"]
9
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "extends": "../../tsconfig.node.json",
3
- "include": ["src/**/*"],
3
+ "include": ["src/**/*", "tsup.config.ts"],
4
4
  "exclude": ["node_modules", "**/*.test.ts"]
5
5
  }
package/tsup.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { generateTypes } from '@internal/types-builder';
2
+ import { defineConfig } from 'tsup';
3
+
4
+ export default defineConfig({
5
+ entry: ['src/index.ts'],
6
+ format: ['esm', 'cjs'],
7
+ clean: true,
8
+ dts: false,
9
+ splitting: true,
10
+ treeshake: {
11
+ preset: 'smallest',
12
+ },
13
+ sourcemap: true,
14
+ onSuccess: async () => {
15
+ await generateTypes(process.cwd());
16
+ },
17
+ });
@@ -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
@@ -1,4 +0,0 @@
1
- export { ClickhouseConfig } from './_tsup-dts-rollup.cjs';
2
- export { TABLE_ENGINES } from './_tsup-dts-rollup.cjs';
3
- export { COLUMN_TYPES } from './_tsup-dts-rollup.cjs';
4
- export { ClickhouseStore } from './_tsup-dts-rollup.cjs';