@mastra/clickhouse 1.0.0-beta.4 → 1.0.0-beta.6
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 +57 -0
- package/README.md +3 -1
- package/dist/index.cjs +35 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +6 -8
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -8
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @mastra/clickhouse
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Preserve error details when thrown from workflow steps ([#10992](https://github.com/mastra-ai/mastra/pull/10992))
|
|
8
|
+
|
|
9
|
+
Workflow errors now retain custom properties like `statusCode`, `responseHeaders`, and `cause` chains. This enables error-specific recovery logic in your applications.
|
|
10
|
+
|
|
11
|
+
**Before:**
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const result = await workflow.execute({ input });
|
|
15
|
+
if (result.status === 'failed') {
|
|
16
|
+
// Custom error properties were lost
|
|
17
|
+
console.log(result.error); // "Step execution failed" (just a string)
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**After:**
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
const result = await workflow.execute({ input });
|
|
25
|
+
if (result.status === 'failed') {
|
|
26
|
+
// Custom properties are preserved
|
|
27
|
+
console.log(result.error.message); // "Step execution failed"
|
|
28
|
+
console.log(result.error.statusCode); // 429
|
|
29
|
+
console.log(result.error.cause?.name); // "RateLimitError"
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Type change:** `WorkflowState.error` and `WorkflowRunState.error` types changed from `string | Error` to `SerializedError`.
|
|
34
|
+
|
|
35
|
+
Other changes:
|
|
36
|
+
- Added `UpdateWorkflowStateOptions` type for workflow state updates
|
|
37
|
+
|
|
38
|
+
- fix: make getSqlType consistent across storage adapters ([#11112](https://github.com/mastra-ai/mastra/pull/11112))
|
|
39
|
+
- PostgreSQL: use `getSqlType()` in `createTable` instead of `toUpperCase()`
|
|
40
|
+
- LibSQL: use `getSqlType()` in `createTable`, return `JSONB` for jsonb type (matches SQLite 3.45+ support)
|
|
41
|
+
- ClickHouse: use `getSqlType()` in `createTable` instead of `COLUMN_TYPES` constant, add missing types (uuid, float, boolean)
|
|
42
|
+
- Remove unused `getSqlType()` and `getDefaultValue()` from `MastraStorage` base class (all stores use `StoreOperations` versions)
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [[`d5ed981`](https://github.com/mastra-ai/mastra/commit/d5ed981c8701c1b8a27a5f35a9a2f7d9244e695f), [`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`932d63d`](https://github.com/mastra-ai/mastra/commit/932d63dd51be9c8bf1e00e3671fe65606c6fb9cd), [`b760b73`](https://github.com/mastra-ai/mastra/commit/b760b731aca7c8a3f041f61d57a7f125ae9cb215), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`2b459f4`](https://github.com/mastra-ai/mastra/commit/2b459f466fd91688eeb2a44801dc23f7f8a887ab), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`24b76d8`](https://github.com/mastra-ai/mastra/commit/24b76d8e17656269c8ed09a0c038adb9cc2ae95a), [`243a823`](https://github.com/mastra-ai/mastra/commit/243a8239c5906f5c94e4f78b54676793f7510ae3), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`c61fac3`](https://github.com/mastra-ai/mastra/commit/c61fac3add96f0dcce0208c07415279e2537eb62), [`6f14f70`](https://github.com/mastra-ai/mastra/commit/6f14f706ccaaf81b69544b6c1b75ab66a41e5317), [`09e4bae`](https://github.com/mastra-ai/mastra/commit/09e4bae18dd5357d2ae078a4a95a2af32168ab08), [`4524734`](https://github.com/mastra-ai/mastra/commit/45247343e384717a7c8404296275c56201d6470f), [`2a53598`](https://github.com/mastra-ai/mastra/commit/2a53598c6d8cfeb904a7fc74e57e526d751c8fa6), [`c7cd3c7`](https://github.com/mastra-ai/mastra/commit/c7cd3c7a187d7aaf79e2ca139de328bf609a14b4), [`847c212`](https://github.com/mastra-ai/mastra/commit/847c212caba7df0d6f2fc756b494ac3c75c3720d), [`6f941c4`](https://github.com/mastra-ai/mastra/commit/6f941c438ca5f578619788acc7608fc2e23bd176)]:
|
|
45
|
+
- @mastra/core@1.0.0-beta.12
|
|
46
|
+
|
|
47
|
+
## 1.0.0-beta.5
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
await workflow.deleteWorkflowRunById(runId);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
|
|
58
|
+
- @mastra/core@1.0.0-beta.10
|
|
59
|
+
|
|
3
60
|
## 1.0.0-beta.4
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install @mastra/clickhouse
|
|
|
10
10
|
|
|
11
11
|
## Prerequisites
|
|
12
12
|
|
|
13
|
-
- Clickhouse server (version 21.
|
|
13
|
+
- Clickhouse server (version 21.12 or higher recommended)
|
|
14
14
|
- Node.js 16 or higher
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
@@ -141,6 +141,8 @@ The store supports the following data types:
|
|
|
141
141
|
- `jsonb`: String (JSON serialized)
|
|
142
142
|
- `integer`: Int64
|
|
143
143
|
- `bigint`: Int64
|
|
144
|
+
- `float`: Float64
|
|
145
|
+
- `boolean`: Bool
|
|
144
146
|
|
|
145
147
|
## Related Links
|
|
146
148
|
|
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,8 @@ var TABLE_ENGINES = {
|
|
|
15
15
|
[storage.TABLE_SCORERS]: `MergeTree()`,
|
|
16
16
|
[storage.TABLE_RESOURCES]: `ReplacingMergeTree()`,
|
|
17
17
|
// TODO: verify this is the correct engine for Spans when implementing clickhouse storage
|
|
18
|
-
[storage.TABLE_SPANS]: `ReplacingMergeTree()
|
|
18
|
+
[storage.TABLE_SPANS]: `ReplacingMergeTree()`,
|
|
19
|
+
mastra_agents: `ReplacingMergeTree()`
|
|
19
20
|
};
|
|
20
21
|
var COLUMN_TYPES = {
|
|
21
22
|
text: "String",
|
|
@@ -1215,14 +1216,18 @@ var StoreOperationsClickhouse = class extends storage.StoreOperations {
|
|
|
1215
1216
|
getSqlType(type) {
|
|
1216
1217
|
switch (type) {
|
|
1217
1218
|
case "text":
|
|
1219
|
+
case "uuid":
|
|
1220
|
+
case "jsonb":
|
|
1218
1221
|
return "String";
|
|
1219
1222
|
case "timestamp":
|
|
1220
1223
|
return "DateTime64(3)";
|
|
1221
1224
|
case "integer":
|
|
1222
1225
|
case "bigint":
|
|
1223
1226
|
return "Int64";
|
|
1224
|
-
case "
|
|
1225
|
-
return "
|
|
1227
|
+
case "float":
|
|
1228
|
+
return "Float64";
|
|
1229
|
+
case "boolean":
|
|
1230
|
+
return "Bool";
|
|
1226
1231
|
default:
|
|
1227
1232
|
return super.getSqlType(type);
|
|
1228
1233
|
}
|
|
@@ -1239,7 +1244,7 @@ var StoreOperationsClickhouse = class extends storage.StoreOperations {
|
|
|
1239
1244
|
constraints.push("DEFAULT '{}'");
|
|
1240
1245
|
}
|
|
1241
1246
|
const columnTtl = this.ttl?.[tableName]?.columns?.[name];
|
|
1242
|
-
return `"${name}" ${
|
|
1247
|
+
return `"${name}" ${this.getSqlType(def.type)} ${constraints.join(" ")} ${columnTtl ? `TTL toDateTime(${columnTtl.ttlKey ?? "createdAt"}) + INTERVAL ${columnTtl.interval} ${columnTtl.unit}` : ""}`;
|
|
1243
1248
|
}).join(",\n");
|
|
1244
1249
|
const rowTtl = this.ttl?.[tableName]?.row;
|
|
1245
1250
|
const sql = tableName === storage.TABLE_WORKFLOW_SNAPSHOT ? `
|
|
@@ -1423,7 +1428,7 @@ var StoreOperationsClickhouse = class extends storage.StoreOperations {
|
|
|
1423
1428
|
const engine = TABLE_ENGINES[tableName] ?? "MergeTree()";
|
|
1424
1429
|
const keyEntries = Object.entries(keys);
|
|
1425
1430
|
const conditions = keyEntries.map(
|
|
1426
|
-
([key]) => `"${key}" = {var_${key}:${
|
|
1431
|
+
([key]) => `"${key}" = {var_${key}:${this.getSqlType(storage.TABLE_SCHEMAS[tableName]?.[key]?.type ?? "text")}}`
|
|
1427
1432
|
).join(" AND ");
|
|
1428
1433
|
const values = keyEntries.reduce((acc, [key, value]) => {
|
|
1429
1434
|
return { ...acc, [`var_${key}`]: value };
|
|
@@ -2156,6 +2161,28 @@ var WorkflowsStorageClickhouse = class extends storage.WorkflowsStorage {
|
|
|
2156
2161
|
);
|
|
2157
2162
|
}
|
|
2158
2163
|
}
|
|
2164
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2165
|
+
try {
|
|
2166
|
+
const values = {
|
|
2167
|
+
var_runId: runId,
|
|
2168
|
+
var_workflow_name: workflowName
|
|
2169
|
+
};
|
|
2170
|
+
await this.client.command({
|
|
2171
|
+
query: `DELETE FROM ${storage.TABLE_WORKFLOW_SNAPSHOT} WHERE run_id = {var_runId:String} AND workflow_name = {var_workflow_name:String}`,
|
|
2172
|
+
query_params: values
|
|
2173
|
+
});
|
|
2174
|
+
} catch (error$1) {
|
|
2175
|
+
throw new error.MastraError(
|
|
2176
|
+
{
|
|
2177
|
+
id: storage.createStorageErrorId("CLICKHOUSE", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
2178
|
+
domain: error.ErrorDomain.STORAGE,
|
|
2179
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
2180
|
+
details: { runId, workflowName }
|
|
2181
|
+
},
|
|
2182
|
+
error$1
|
|
2183
|
+
);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2159
2186
|
};
|
|
2160
2187
|
|
|
2161
2188
|
// src/storage/index.ts
|
|
@@ -2300,6 +2327,9 @@ var ClickhouseStore = class extends storage.MastraStorage {
|
|
|
2300
2327
|
}) {
|
|
2301
2328
|
return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
|
|
2302
2329
|
}
|
|
2330
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2331
|
+
return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
|
|
2332
|
+
}
|
|
2303
2333
|
async getThreadById({ threadId }) {
|
|
2304
2334
|
return this.stores.memory.getThreadById({ threadId });
|
|
2305
2335
|
}
|