@mastra/dynamodb 1.0.0-beta.6 → 1.0.0-beta.8

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,239 @@
1
1
  # @mastra/dynamodb
2
2
 
3
+ ## 1.0.0-beta.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Add storage composition to MastraStorage ([#11401](https://github.com/mastra-ai/mastra/pull/11401))
8
+
9
+ `MastraStorage` can now compose storage domains from different adapters. Use it when you need different databases for different purposes - for example, PostgreSQL for memory and workflows, but a different database for observability.
10
+
11
+ ```typescript
12
+ import { MastraStorage } from '@mastra/core/storage';
13
+ import { MemoryPG, WorkflowsPG, ScoresPG } from '@mastra/pg';
14
+ import { MemoryLibSQL } from '@mastra/libsql';
15
+
16
+ // Compose domains from different stores
17
+ const storage = new MastraStorage({
18
+ id: 'composite',
19
+ domains: {
20
+ memory: new MemoryLibSQL({ url: 'file:./local.db' }),
21
+ workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
22
+ scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
23
+ },
24
+ });
25
+ ```
26
+
27
+ **Breaking changes:**
28
+ - `storage.supports` property no longer exists
29
+ - `StorageSupports` type is no longer exported from `@mastra/core/storage`
30
+
31
+ All stores now support the same features. For domain availability, use `getStore()`:
32
+
33
+ ```typescript
34
+ const store = await storage.getStore('memory');
35
+ if (store) {
36
+ // domain is available
37
+ }
38
+ ```
39
+
40
+ - Updated dependencies [[`3d93a15`](https://github.com/mastra-ai/mastra/commit/3d93a15796b158c617461c8b98bede476ebb43e2), [`efe406a`](https://github.com/mastra-ai/mastra/commit/efe406a1353c24993280ebc2ed61dd9f65b84b26), [`119e5c6`](https://github.com/mastra-ai/mastra/commit/119e5c65008f3e5cfca954eefc2eb85e3bf40da4), [`74e504a`](https://github.com/mastra-ai/mastra/commit/74e504a3b584eafd2f198001c6a113bbec589fd3), [`e33fdbd`](https://github.com/mastra-ai/mastra/commit/e33fdbd07b33920d81e823122331b0c0bee0bb59), [`929f69c`](https://github.com/mastra-ai/mastra/commit/929f69c3436fa20dd0f0e2f7ebe8270bd82a1529), [`8a73529`](https://github.com/mastra-ai/mastra/commit/8a73529ca01187f604b1f3019d0a725ac63ae55f)]:
41
+ - @mastra/core@1.0.0-beta.16
42
+
43
+ ## 1.0.0-beta.7
44
+
45
+ ### Minor Changes
46
+
47
+ - Introduce StorageDomain base class for composite storage support ([#11249](https://github.com/mastra-ai/mastra/pull/11249))
48
+
49
+ Storage adapters now use a domain-based architecture where each domain (memory, workflows, scores, observability, agents) extends a `StorageDomain` base class with `init()` and `dangerouslyClearAll()` methods.
50
+
51
+ **Key changes:**
52
+ - Add `StorageDomain` abstract base class that all domain storage classes extend
53
+ - Add `InMemoryDB` class for shared state across in-memory domain implementations
54
+ - All storage domains now implement `dangerouslyClearAll()` for test cleanup
55
+ - Remove `operations` from public `StorageDomains` type (now internal to each adapter)
56
+ - Add flexible client/config patterns - domains accept either an existing database client or config to create one internally
57
+
58
+ **Why this matters:**
59
+
60
+ This enables composite storage where you can use different database adapters per domain:
61
+
62
+ ```typescript
63
+ import { Mastra } from '@mastra/core';
64
+ import { PostgresStore } from '@mastra/pg';
65
+ import { ClickhouseStore } from '@mastra/clickhouse';
66
+
67
+ // Use Postgres for most domains but Clickhouse for observability
68
+ const mastra = new Mastra({
69
+ storage: new PostgresStore({
70
+ connectionString: 'postgres://...',
71
+ }),
72
+ // Future: override specific domains
73
+ // observability: new ClickhouseStore({ ... }).getStore('observability'),
74
+ });
75
+ ```
76
+
77
+ **Standalone domain usage:**
78
+
79
+ Domains can now be used independently with flexible configuration:
80
+
81
+ ```typescript
82
+ import { MemoryLibSQL } from '@mastra/libsql/memory';
83
+
84
+ // Option 1: Pass config to create client internally
85
+ const memory = new MemoryLibSQL({
86
+ url: 'file:./local.db',
87
+ });
88
+
89
+ // Option 2: Pass existing client for shared connections
90
+ import { createClient } from '@libsql/client';
91
+ const client = createClient({ url: 'file:./local.db' });
92
+ const memory = new MemoryLibSQL({ client });
93
+ ```
94
+
95
+ **Breaking changes:**
96
+ - `StorageDomains` type no longer includes `operations` - access via `getStore()` instead
97
+ - Domain base classes now require implementing `dangerouslyClearAll()` method
98
+
99
+ - Refactor storage architecture to use domain-specific stores via `getStore()` pattern ([#11361](https://github.com/mastra-ai/mastra/pull/11361))
100
+
101
+ ### Summary
102
+
103
+ This release introduces a new storage architecture that replaces passthrough methods on `MastraStorage` with domain-specific storage interfaces accessed via `getStore()`. This change reduces code duplication across storage adapters and provides a cleaner, more modular API.
104
+
105
+ ### Migration Guide
106
+
107
+ All direct method calls on storage instances should be updated to use `getStore()`:
108
+
109
+ ```typescript
110
+ // Before
111
+ const thread = await storage.getThreadById({ threadId });
112
+ await storage.persistWorkflowSnapshot({ workflowName, runId, snapshot });
113
+ await storage.createSpan(span);
114
+
115
+ // After
116
+ const memory = await storage.getStore('memory');
117
+ const thread = await memory?.getThreadById({ threadId });
118
+
119
+ const workflows = await storage.getStore('workflows');
120
+ await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
121
+
122
+ const observability = await storage.getStore('observability');
123
+ await observability?.createSpan(span);
124
+ ```
125
+
126
+ ### Available Domains
127
+ - **`memory`**: Thread and message operations (`getThreadById`, `saveThread`, `saveMessages`, etc.)
128
+ - **`workflows`**: Workflow state persistence (`persistWorkflowSnapshot`, `loadWorkflowSnapshot`, `getWorkflowRunById`, etc.)
129
+ - **`scores`**: Evaluation scores (`saveScore`, `listScoresByScorerId`, etc.)
130
+ - **`observability`**: Tracing and spans (`createSpan`, `updateSpan`, `getTrace`, etc.)
131
+ - **`agents`**: Stored agent configurations (`createAgent`, `getAgentById`, `listAgents`, etc.)
132
+
133
+ ### Breaking Changes
134
+ - Passthrough methods have been removed from `MastraStorage` base class
135
+ - All storage adapters now require accessing domains via `getStore()`
136
+ - The `stores` property on storage instances is now the canonical way to access domain storage
137
+
138
+ ### Internal Changes
139
+ - Each storage adapter now initializes domain-specific stores in its constructor
140
+ - Domain stores share database connections and handle their own table initialization
141
+
142
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
143
+
144
+ ## What changed
145
+
146
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
147
+
148
+ **Before:**
149
+
150
+ ```typescript
151
+ // Old span structure
152
+ span.agentId; // 'my-agent'
153
+ span.toolId; // undefined
154
+ span.workflowId; // undefined
155
+ ```
156
+
157
+ **After:**
158
+
159
+ ```typescript
160
+ // New span structure
161
+ span.entityType; // EntityType.AGENT
162
+ span.entityId; // 'my-agent'
163
+ span.entityName; // 'My Agent'
164
+ ```
165
+
166
+ ## New `listTraces()` API
167
+
168
+ Query traces with filtering, pagination, and sorting:
169
+
170
+ ```typescript
171
+ const { spans, pagination } = await storage.listTraces({
172
+ filters: {
173
+ entityType: EntityType.AGENT,
174
+ entityId: 'my-agent',
175
+ userId: 'user-123',
176
+ environment: 'production',
177
+ status: TraceStatus.SUCCESS,
178
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
179
+ },
180
+ pagination: { page: 0, perPage: 50 },
181
+ orderBy: { field: 'startedAt', direction: 'DESC' },
182
+ });
183
+ ```
184
+
185
+ **Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
186
+
187
+ ## New retrieval methods
188
+ - `getSpan({ traceId, spanId })` - Get a single span
189
+ - `getRootSpan({ traceId })` - Get the root span of a trace
190
+ - `getTrace({ traceId })` - Get all spans for a trace
191
+
192
+ ## Backward compatibility
193
+
194
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
195
+
196
+ ## Migration
197
+
198
+ **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
199
+
200
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
201
+
202
+ ### Patch Changes
203
+
204
+ - Added pre-configured client support for all storage adapters. ([#11302](https://github.com/mastra-ai/mastra/pull/11302))
205
+
206
+ **What changed**
207
+
208
+ All storage adapters now accept pre-configured database clients in addition to connection credentials. This allows you to customize client settings (connection pools, timeouts, interceptors) before passing them to Mastra.
209
+
210
+ **Example**
211
+
212
+ ```typescript
213
+ import { createClient } from '@clickhouse/client';
214
+ import { ClickhouseStore } from '@mastra/clickhouse';
215
+
216
+ // Create and configure client with custom settings
217
+ const client = createClient({
218
+ url: 'http://localhost:8123',
219
+ username: 'default',
220
+ password: '',
221
+ request_timeout: 60000,
222
+ });
223
+
224
+ // Pass pre-configured client to store
225
+ const store = new ClickhouseStore({
226
+ id: 'my-store',
227
+ client,
228
+ });
229
+ ```
230
+
231
+ **Additional improvements**
232
+ - Added input validation for required connection parameters (URL, credentials) with clear error messages
233
+
234
+ - Updated dependencies [[`33a4d2e`](https://github.com/mastra-ai/mastra/commit/33a4d2e4ed8af51f69256232f00c34d6b6b51d48), [`4aaa844`](https://github.com/mastra-ai/mastra/commit/4aaa844a4f19d054490f43638a990cc57bda8d2f), [`4a1a6cb`](https://github.com/mastra-ai/mastra/commit/4a1a6cb3facad54b2bb6780b00ce91d6de1edc08), [`31d13d5`](https://github.com/mastra-ai/mastra/commit/31d13d5fdc2e2380e2e3ee3ec9fb29d2a00f265d), [`4c62166`](https://github.com/mastra-ai/mastra/commit/4c621669f4a29b1f443eca3ba70b814afa286266), [`7bcbf10`](https://github.com/mastra-ai/mastra/commit/7bcbf10133516e03df964b941f9a34e9e4ab4177), [`4353600`](https://github.com/mastra-ai/mastra/commit/43536005a65988a8eede236f69122e7f5a284ba2), [`6986fb0`](https://github.com/mastra-ai/mastra/commit/6986fb064f5db6ecc24aa655e1d26529087b43b3), [`053e979`](https://github.com/mastra-ai/mastra/commit/053e9793b28e970086b0507f7f3b76ea32c1e838), [`e26dc9c`](https://github.com/mastra-ai/mastra/commit/e26dc9c3ccfec54ae3dc3e2b2589f741f9ae60a6), [`55edf73`](https://github.com/mastra-ai/mastra/commit/55edf7302149d6c964fbb7908b43babfc2b52145), [`27c0009`](https://github.com/mastra-ai/mastra/commit/27c0009777a6073d7631b0eb7b481d94e165b5ca), [`dee388d`](https://github.com/mastra-ai/mastra/commit/dee388dde02f2e63c53385ae69252a47ab6825cc), [`3f3fc30`](https://github.com/mastra-ai/mastra/commit/3f3fc3096f24c4a26cffeecfe73085928f72aa63), [`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`10c2735`](https://github.com/mastra-ai/mastra/commit/10c27355edfdad1ee2b826b897df74125eb81fb8), [`1924cf0`](https://github.com/mastra-ai/mastra/commit/1924cf06816e5e4d4d5333065ec0f4bb02a97799), [`b339816`](https://github.com/mastra-ai/mastra/commit/b339816df0984d0243d944ac2655d6ba5f809cde)]:
235
+ - @mastra/core@1.0.0-beta.15
236
+
3
237
  ## 1.0.0-beta.6
4
238
 
5
239
  ### Patch Changes