@mastra/clickhouse 1.13.1 → 1.14.0-alpha.1

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 CHANGED
@@ -1,5 +1,67 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 1.14.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - Added batch trace ID filtering to observability metric queries. ([#20535](https://github.com/mastra-ai/mastra/pull/20535))
8
+
9
+ ```ts
10
+ const result = await observability.getMetricBreakdown({
11
+ name: ['mastra_model_total_input_tokens'],
12
+ aggregation: 'sum',
13
+ groupBy: ['traceId'],
14
+ filters: { traceIds: ['trace-1', 'trace-2'] },
15
+ });
16
+ ```
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [[`82201f7`](https://github.com/mastra-ai/mastra/commit/82201f75fae8e050a8de2df08b74875ee74c6b83), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`0a6598b`](https://github.com/mastra-ai/mastra/commit/0a6598bde80bde008986ad6616bed9632b9294cb), [`9e1dad8`](https://github.com/mastra-ai/mastra/commit/9e1dad8f7b1cab2bb7ade90e5b7561f24577b88a), [`2f43145`](https://github.com/mastra-ai/mastra/commit/2f4314504c03cbba280414ac81ba3197448ee6b0), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866)]:
21
+ - @mastra/core@1.56.0-alpha.6
22
+
23
+ ## 1.13.2-alpha.0
24
+
25
+ ### Patch Changes
26
+
27
+ - Stored workflow definitions now persist across restarts on every major database backend. ([#20471](https://github.com/mastra-ai/mastra/pull/20471))
28
+
29
+ Implement the `workflowDefinitions` storage domain for libsql, pg, mysql, mssql, mongodb, and spanner. Previously the stored-workflow persistence path (`POST /stored/workflows`, `Mastra.addStoredWorkflow`) only worked against `@mastra/core`'s in-memory store. Persistent adapters returned `undefined` from `storage.getStore('workflowDefinitions')` and threw when the HTTP handler tried to read/write a workflow.
30
+
31
+ ```ts
32
+ const workflowDefinitions = await storage.getStore('workflowDefinitions');
33
+ if (!workflowDefinitions) {
34
+ throw new Error('This storage adapter does not support the workflowDefinitions domain');
35
+ }
36
+
37
+ await workflowDefinitions.upsert({
38
+ id: 'greeting-workflow',
39
+ inputSchema: { type: 'object', properties: { name: { type: 'string' } }, required: ['name'] },
40
+ outputSchema: { type: 'object', properties: { text: { type: 'string' } }, required: ['text'] },
41
+ graph: [{ type: 'agent', id: 'greet', agentId: 'greeter-agent' }],
42
+ });
43
+
44
+ const { definitions, total } = await workflowDefinitions.list({ status: 'active' });
45
+ const definition = await workflowDefinitions.get('greeting-workflow');
46
+ await workflowDefinitions.delete('greeting-workflow');
47
+ ```
48
+
49
+ Each adapter now ships a `WorkflowDefinitions*` domain that:
50
+
51
+ - Creates the shared `mastra_workflow_definitions` table (or Mongo collection) from `WORKFLOW_DEFINITIONS_SCHEMA` during `init()`, plus a default index on `status`.
52
+ - Implements `upsert` / `get` / `list` / `delete` matching `WorkflowDefinitionsStorage` semantics (`list` supports `status` and `authorId` filters and orders by `updatedAt` desc). Partial upserts preserve unspecified fields, including `authorId` updates and `createdAt` / `updatedAt` semantics.
53
+ - Handles concurrent first-writes race-safely: if two callers upsert the same new id simultaneously, the losing insert detects the duplicate key, re-reads the row, and applies the partial-update path instead of failing.
54
+ - Round-trips the JSON columns (`inputSchema`, `outputSchema`, `stateSchema`, `requestContextSchema`, `metadata`, `graph`) through each adapter's JSON handling, so declarative workflow graphs rehydrate identically no matter which backend they were stored in. Malformed persisted JSON surfaces as an actionable error naming the row and column instead of hydrating raw strings.
55
+
56
+ Exported class names by adapter: `WorkflowDefinitionsLibSQL`, `WorkflowDefinitionsPG`, `WorkflowDefinitionsMySQL`, `WorkflowDefinitionsMSSQL`, `MongoDBWorkflowDefinitionsStore`, `WorkflowDefinitionsSpanner`. The composite stores (`LibSQLStore`, `PostgresStore`, `MySQLStore`, `MSSQLStore`, `MongoDBStore`, `SpannerStore`) auto-wire the new domain, so callers do not need to construct it manually — `storage.getStore('workflowDefinitions')` now returns a live handle.
57
+
58
+ The pg adapter reads `createdAt` / `updatedAt` from the auto-added `createdAtZ` / `updatedAtZ` `timestamptz` companion columns to avoid the naive-timestamp / local-TZ drift that a plain `TIMESTAMP` read exhibits under node-pg.
59
+
60
+ `@mastra/clickhouse` and `@mastra/cloudflare` register the new `mastra_workflow_definitions` table in their table/type maps so shared table constants stay exhaustive (no workflow-definitions domain implementation yet).
61
+
62
+ - Updated dependencies [[`4844167`](https://github.com/mastra-ai/mastra/commit/4844167cff2d5ec5004e94edd34970833040fa3f), [`5faf93f`](https://github.com/mastra-ai/mastra/commit/5faf93f03e19daea394b9e2a923f2e4f833407f2), [`80ad891`](https://github.com/mastra-ai/mastra/commit/80ad891f8cd10379aa5b5af7510c763783b2ab56), [`a1cb98d`](https://github.com/mastra-ai/mastra/commit/a1cb98d11990b560b98482292a1f34aa1a2d9092), [`598ad82`](https://github.com/mastra-ai/mastra/commit/598ad82d41c41389a686338a1d0e50b7400e1938), [`1fd6aad`](https://github.com/mastra-ai/mastra/commit/1fd6aad1ea4a9d32f65efa832307c35e981a4c0a)]:
63
+ - @mastra/core@1.56.0-alpha.4
64
+
3
65
  ## 1.13.1
4
66
 
5
67
  ### Patch Changes
@@ -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.13.1"
6
+ version: "1.14.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.13.1",
2
+ "version": "1.14.0-alpha.1",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -188,6 +188,8 @@ export const mastra = new Mastra({
188
188
 
189
189
  **default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in domains will use this storage's domains as fallbacks.
190
190
 
191
+ **editor** (`MastraCompositeStore`): Storage adapter for Editor-owned domains, including agents, prompt blocks, scorers, MCP clients and servers, workspaces, and skills. Takes precedence over default storage but not explicit domain overrides.
192
+
191
193
  **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
192
194
 
193
195
  **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage. Set a domain to false to disable it entirely; a disabled domain does not fall back to editor or default.
package/dist/index.cjs CHANGED
@@ -216,7 +216,8 @@ const TABLE_ENGINES = {
216
216
  [_mastra_core_storage.TABLE_HARNESS_SESSIONS]: `ReplacingMergeTree()`,
217
217
  mastra_channel_installations: `ReplacingMergeTree()`,
218
218
  mastra_channel_config: `ReplacingMergeTree()`,
219
- [_mastra_core_storage.TABLE_THREAD_STATE]: `ReplacingMergeTree()`
219
+ [_mastra_core_storage.TABLE_THREAD_STATE]: `ReplacingMergeTree()`,
220
+ [_mastra_core_storage.TABLE_WORKFLOW_DEFINITIONS]: `ReplacingMergeTree()`
220
221
  };
221
222
  const COLUMN_TYPES = {
222
223
  text: "String",
@@ -4458,6 +4459,7 @@ function buildMetricsFilterConditions(filters, tableAlias) {
4458
4459
  const col = (name) => tableAlias ? `${tableAlias}.${name}` : name;
4459
4460
  assertNoDeprecatedSourceFilter(filters.source, "executionSource", "metrics");
4460
4461
  addCommonFilterFields(filters, tableAlias, out);
4462
+ addIn(col("traceId"), filters.traceIds, "traceIds", out);
4461
4463
  addIn(col("name"), filters.name, "metricNames", out);
4462
4464
  addEq(col("provider"), filters.provider, "provider", "String", out);
4463
4465
  addEq(col("model"), filters.model, "model", "String", out);