@mastra/clickhouse 1.5.2 → 1.6.0-alpha.0
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 +27 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-storage-clickhouse.md +40 -14
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/index.d.ts +29 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @mastra/clickhouse
|
|
2
2
|
|
|
3
|
+
## 1.6.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added ClickhouseStoreVNext, a ClickHouse storage adapter that uses the vNext observability domain by default. Equivalent to constructing a ClickhouseStore and overriding the observability domain manually, but exposed as a single class for new projects. ([#15984](https://github.com/mastra-ai/mastra/pull/15984))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from '@mastra/core';
|
|
11
|
+
import { ClickhouseStoreVNext } from '@mastra/clickhouse';
|
|
12
|
+
|
|
13
|
+
export const mastra = new Mastra({
|
|
14
|
+
storage: new ClickhouseStoreVNext({
|
|
15
|
+
id: 'clickhouse-storage',
|
|
16
|
+
url: process.env.CLICKHOUSE_URL!,
|
|
17
|
+
username: process.env.CLICKHOUSE_USERNAME!,
|
|
18
|
+
password: process.env.CLICKHOUSE_PASSWORD!,
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
ClickhouseStoreVNext accepts the same configuration as ClickhouseStore and reuses the same ClickHouse client across every domain. ClickhouseStore continues to work for projects on the legacy observability schema.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`1723e09`](https://github.com/mastra-ai/mastra/commit/1723e099829892419ddbfe49287acfeac2522724), [`629f9e9`](https://github.com/mastra-ai/mastra/commit/629f9e9a7e56aa8f129515a3923c5813298790c7), [`25168fb`](https://github.com/mastra-ai/mastra/commit/25168fb9c1de9db7f8171df4f58ceb842c53aa29), [`ab34b5a`](https://github.com/mastra-ai/mastra/commit/ab34b5a2191b8e4353df1dbf7b9155e7d6628d79), [`5fb6c2a`](https://github.com/mastra-ai/mastra/commit/5fb6c2a95c1843cc231704b91354311fc1f34a71), [`394f0cf`](https://github.com/mastra-ai/mastra/commit/394f0cfc31e6b4d801219fdef2e9cc69e5bc8682), [`3d7f709`](https://github.com/mastra-ai/mastra/commit/3d7f709b615e588050bb6283c4ee5cfe2978cbde), [`48a42f1`](https://github.com/mastra-ai/mastra/commit/48a42f114a4006a95e0b7a1b5ad1a24815a175c2), [`2c83efc`](https://github.com/mastra-ai/mastra/commit/2c83efc4482b3efe50830e3b8b4ba9a8d219edff), [`282a10c`](https://github.com/mastra-ai/mastra/commit/282a10c9446e9922afe80e10e3770481c8ac8a28)]:
|
|
28
|
+
- @mastra/core@1.31.0-alpha.0
|
|
29
|
+
|
|
3
30
|
## 1.5.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-clickhouse
|
|
|
3
3
|
description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/clickhouse"
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.6.0-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
[ClickHouse](https://clickhouse.com/) is a columnar database designed for analytical workloads. The `@mastra/clickhouse` package provides storage adapters for several Mastra storage domains and is the recommended backend for production observability.
|
|
4
4
|
|
|
5
|
-
ClickHouse is most commonly used as the dedicated observability backend in a [composite storage](https://mastra.ai/reference/storage/composite) setup, with another database serving the remaining domains.
|
|
5
|
+
ClickHouse is most commonly used as the dedicated observability backend in a [composite storage](https://mastra.ai/reference/storage/composite) setup, with another database serving the remaining domains.
|
|
6
6
|
|
|
7
7
|
## When to use ClickHouse
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- Append-heavy workloads where columnar storage and compression help keep costs down.
|
|
11
|
-
- Deployment platforms with ephemeral filesystems (such as [Railway](#deploying-with-railway-and-similar-platforms), Fly.io, Render, Heroku, or container schedulers) where embedded backends like DuckDB cannot persist data.
|
|
9
|
+
Production observability for traces, logs, metrics, scores, and feedback.
|
|
12
10
|
|
|
13
|
-
For local development, [LibSQL](https://mastra.ai/reference/storage/libsql)
|
|
11
|
+
For local development, use a composite store that combines [LibSQL](https://mastra.ai/reference/storage/libsql) (for memory and workflows) and `@mastra/duckdb` (for observability). Neither alone covers a development setup: LibSQL does not implement the observability domain, and DuckDB does not implement the other domains. See the [observability overview](https://mastra.ai/docs/observability/overview) for an example.
|
|
14
12
|
|
|
15
13
|
## Installation
|
|
16
14
|
|
|
@@ -51,7 +49,7 @@ Compose it with another storage adapter so observability writes do not contend w
|
|
|
51
49
|
```typescript
|
|
52
50
|
import { Mastra } from '@mastra/core'
|
|
53
51
|
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
54
|
-
import {
|
|
52
|
+
import { PostgresStore } from '@mastra/pg'
|
|
55
53
|
import { ObservabilityStorageClickhouseVNext } from '@mastra/clickhouse'
|
|
56
54
|
import { Observability, DefaultExporter } from '@mastra/observability'
|
|
57
55
|
|
|
@@ -64,9 +62,9 @@ const observabilityStore = new ObservabilityStorageClickhouseVNext({
|
|
|
64
62
|
export const mastra = new Mastra({
|
|
65
63
|
storage: new MastraCompositeStore({
|
|
66
64
|
id: 'composite-storage',
|
|
67
|
-
default: new
|
|
68
|
-
id: '
|
|
69
|
-
|
|
65
|
+
default: new PostgresStore({
|
|
66
|
+
id: 'pg',
|
|
67
|
+
connectionString: process.env.DATABASE_URL!,
|
|
70
68
|
}),
|
|
71
69
|
domains: {
|
|
72
70
|
observability: observabilityStore,
|
|
@@ -101,16 +99,16 @@ const observabilityStore = new ObservabilityStorageClickhouse({
|
|
|
101
99
|
|
|
102
100
|
New projects should use `ObservabilityStorageClickhouseVNext` instead.
|
|
103
101
|
|
|
104
|
-
###
|
|
102
|
+
### ClickHouse for every domain
|
|
105
103
|
|
|
106
|
-
`
|
|
104
|
+
`ClickhouseStoreVNext` backs the `memory`, `workflows`, and `observability` domains with ClickHouse and uses the vNext observability adapter automatically. Use it when you want ClickHouse to back the entire application without wiring a composite store manually.
|
|
107
105
|
|
|
108
106
|
```typescript
|
|
109
107
|
import { Mastra } from '@mastra/core'
|
|
110
|
-
import {
|
|
108
|
+
import { ClickhouseStoreVNext } from '@mastra/clickhouse'
|
|
111
109
|
|
|
112
110
|
export const mastra = new Mastra({
|
|
113
|
-
storage: new
|
|
111
|
+
storage: new ClickhouseStoreVNext({
|
|
114
112
|
id: 'clickhouse-storage',
|
|
115
113
|
url: process.env.CLICKHOUSE_URL!,
|
|
116
114
|
username: process.env.CLICKHOUSE_USERNAME!,
|
|
@@ -119,6 +117,34 @@ export const mastra = new Mastra({
|
|
|
119
117
|
})
|
|
120
118
|
```
|
|
121
119
|
|
|
120
|
+
`ClickhouseStoreVNext` accepts the same configuration as `ClickhouseStore` and reuses the same ClickHouse client across every domain.
|
|
121
|
+
|
|
122
|
+
#### Manual composition
|
|
123
|
+
|
|
124
|
+
`ClickhouseStore` is the long-standing class that backs every domain with the legacy observability adapter. New projects should prefer `ClickhouseStoreVNext`. If you need to customize the composite (for example, to override one domain with a different backend), build it manually:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { Mastra } from '@mastra/core'
|
|
128
|
+
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
129
|
+
import { ClickhouseStore, ObservabilityStorageClickhouseVNext } from '@mastra/clickhouse'
|
|
130
|
+
|
|
131
|
+
const credentials = {
|
|
132
|
+
url: process.env.CLICKHOUSE_URL!,
|
|
133
|
+
username: process.env.CLICKHOUSE_USERNAME!,
|
|
134
|
+
password: process.env.CLICKHOUSE_PASSWORD!,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const mastra = new Mastra({
|
|
138
|
+
storage: new MastraCompositeStore({
|
|
139
|
+
id: 'composite-storage',
|
|
140
|
+
default: new ClickhouseStore({ id: 'clickhouse-storage', ...credentials }),
|
|
141
|
+
domains: {
|
|
142
|
+
observability: new ObservabilityStorageClickhouseVNext(credentials),
|
|
143
|
+
},
|
|
144
|
+
}),
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
122
148
|
### Bring your own ClickHouse client
|
|
123
149
|
|
|
124
150
|
Pass a pre-configured client when you need custom connection settings such as request timeouts, compression, or interceptors:
|
|
@@ -150,7 +176,7 @@ The same `client` form is accepted by `ObservabilityStorageClickhouse` and `Obse
|
|
|
150
176
|
|
|
151
177
|
**username** (`string`): ClickHouse username. Required when not passing a pre-configured \`client\`.
|
|
152
178
|
|
|
153
|
-
**password** (`string`): ClickHouse password. Required when not passing a pre-configured \`client\`.
|
|
179
|
+
**password** (`string`): ClickHouse password. Required when not passing a pre-configured \`client\`. It can be an empty string for the default user on a local instance.
|
|
154
180
|
|
|
155
181
|
**client** (`ClickHouseClient`): Pre-configured ClickHouse client from \`@clickhouse/client\`. Use this when you need custom request settings. Mutually exclusive with the credential fields above.
|
|
156
182
|
|
package/dist/index.cjs
CHANGED
|
@@ -7152,10 +7152,22 @@ var ClickhouseStore = class extends storage.MastraCompositeStore {
|
|
|
7152
7152
|
}
|
|
7153
7153
|
}
|
|
7154
7154
|
};
|
|
7155
|
+
var ClickhouseStoreVNext = class extends ClickhouseStore {
|
|
7156
|
+
constructor(config) {
|
|
7157
|
+
super(config);
|
|
7158
|
+
this.name = "ClickhouseStoreVNext";
|
|
7159
|
+
const observability = new ObservabilityStorageClickhouseVNext({ client: this.db });
|
|
7160
|
+
this.stores = {
|
|
7161
|
+
...this.stores,
|
|
7162
|
+
observability
|
|
7163
|
+
};
|
|
7164
|
+
}
|
|
7165
|
+
};
|
|
7155
7166
|
|
|
7156
7167
|
exports.BackgroundTasksStorageClickhouse = BackgroundTasksStorageClickhouse;
|
|
7157
7168
|
exports.COLUMN_TYPES = COLUMN_TYPES;
|
|
7158
7169
|
exports.ClickhouseStore = ClickhouseStore;
|
|
7170
|
+
exports.ClickhouseStoreVNext = ClickhouseStoreVNext;
|
|
7159
7171
|
exports.MemoryStorageClickhouse = MemoryStorageClickhouse;
|
|
7160
7172
|
exports.ObservabilityStorageClickhouse = ObservabilityStorageClickhouse;
|
|
7161
7173
|
exports.ObservabilityStorageClickhouseVNext = ObservabilityStorageClickhouseVNext;
|