@mastra/mssql 0.0.0-fix-9244-clickhouse-metadata-20251105010900 → 0.0.0-fix-thread-list-20251105222841
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 +101 -3
- package/README.md +3 -4
- package/dist/index.cjs +19 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -97
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -7
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +13 -13
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +11 -17
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mastra/mssql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-thread-list-20251105222841
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
@@ -43,6 +43,74 @@
|
|
|
43
43
|
+ thread.listMessages({ page: 0, perPage: 20 })
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
- # Major Changes ([#9695](https://github.com/mastra-ai/mastra/pull/9695))
|
|
47
|
+
|
|
48
|
+
## Storage Layer
|
|
49
|
+
|
|
50
|
+
### BREAKING: Removed `storage.getMessages()`
|
|
51
|
+
|
|
52
|
+
The `getMessages()` method has been removed from all storage implementations. Use `listMessages()` instead, which provides pagination support.
|
|
53
|
+
|
|
54
|
+
**Migration:**
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Before
|
|
58
|
+
const messages = await storage.getMessages({ threadId: 'thread-1' });
|
|
59
|
+
|
|
60
|
+
// After
|
|
61
|
+
const result = await storage.listMessages({
|
|
62
|
+
threadId: 'thread-1',
|
|
63
|
+
page: 0,
|
|
64
|
+
perPage: 50,
|
|
65
|
+
});
|
|
66
|
+
const messages = result.messages; // Access messages array
|
|
67
|
+
console.log(result.total); // Total count
|
|
68
|
+
console.log(result.hasMore); // Whether more pages exist
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Message ordering default
|
|
72
|
+
|
|
73
|
+
`listMessages()` defaults to ASC (oldest first) ordering by `createdAt`, matching the previous `getMessages()` behavior.
|
|
74
|
+
|
|
75
|
+
**To use DESC ordering (newest first):**
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const result = await storage.listMessages({
|
|
79
|
+
threadId: 'thread-1',
|
|
80
|
+
orderBy: { field: 'createdAt', direction: 'DESC' },
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Client SDK
|
|
85
|
+
|
|
86
|
+
### BREAKING: Renamed `client.getThreadMessages()` → `client.listThreadMessages()`
|
|
87
|
+
|
|
88
|
+
**Migration:**
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Before
|
|
92
|
+
const response = await client.getThreadMessages(threadId, { agentId });
|
|
93
|
+
|
|
94
|
+
// After
|
|
95
|
+
const response = await client.listThreadMessages(threadId, { agentId });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The response format remains the same.
|
|
99
|
+
|
|
100
|
+
## Type Changes
|
|
101
|
+
|
|
102
|
+
### BREAKING: Removed `StorageGetMessagesArg` type
|
|
103
|
+
|
|
104
|
+
Use `StorageListMessagesInput` instead:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// Before
|
|
108
|
+
import type { StorageGetMessagesArg } from '@mastra/core';
|
|
109
|
+
|
|
110
|
+
// After
|
|
111
|
+
import type { StorageListMessagesInput } from '@mastra/core';
|
|
112
|
+
```
|
|
113
|
+
|
|
46
114
|
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
47
115
|
|
|
48
116
|
- Add new list methods to storage API: `listMessages`, `listMessagesById`, `listThreadsByResourceId`, and `listWorkflowRuns`. Most methods are currently wrappers around existing methods. Full implementations will be added when migrating away from legacy methods. ([#9489](https://github.com/mastra-ai/mastra/pull/9489))
|
|
@@ -115,6 +183,36 @@
|
|
|
115
183
|
- Improved `perPage` validation to handle edge cases (negative values, `0`, `false`)
|
|
116
184
|
- Added reusable query parser utilities for consistent validation in handlers
|
|
117
185
|
|
|
186
|
+
- ```([#9709](https://github.com/mastra-ai/mastra/pull/9709))
|
|
187
|
+
import { Mastra } from '@mastra/core';
|
|
188
|
+
import { Observability } from '@mastra/observability'; // Explicit import
|
|
189
|
+
|
|
190
|
+
const mastra = new Mastra({
|
|
191
|
+
...other_config,
|
|
192
|
+
observability: new Observability({
|
|
193
|
+
default: { enabled: true }
|
|
194
|
+
}) // Instance
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Instead of:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
import { Mastra } from '@mastra/core';
|
|
202
|
+
import '@mastra/observability/init'; // Explicit import
|
|
203
|
+
|
|
204
|
+
const mastra = new Mastra({
|
|
205
|
+
...other_config,
|
|
206
|
+
observability: {
|
|
207
|
+
default: { enabled: true }
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Also renamed a bunch of:
|
|
213
|
+
- `Tracing` things to `Observability` things.
|
|
214
|
+
- `AI-` things to just things.
|
|
215
|
+
|
|
118
216
|
- Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
119
217
|
|
|
120
218
|
- Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
|
|
@@ -153,8 +251,8 @@
|
|
|
153
251
|
|
|
154
252
|
### Patch Changes
|
|
155
253
|
|
|
156
|
-
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`ca8041c`](https://github.com/mastra-ai/mastra/commit/ca8041cce0379fda22ed293a565bcb5b6ddca68a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
|
|
157
|
-
- @mastra/core@0.0.0-fix-
|
|
254
|
+
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`0491e7c`](https://github.com/mastra-ai/mastra/commit/0491e7c9b714cb0ba22187ee062147ec2dd7c712), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`aaa40e7`](https://github.com/mastra-ai/mastra/commit/aaa40e788628b319baa8e889407d11ad626547fa), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`ca8041c`](https://github.com/mastra-ai/mastra/commit/ca8041cce0379fda22ed293a565bcb5b6ddca68a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`354ad0b`](https://github.com/mastra-ai/mastra/commit/354ad0b7b1b8183ac567f236a884fc7ede6d7138), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`e59e0d3`](https://github.com/mastra-ai/mastra/commit/e59e0d32afb5fcf2c9f3c00c8f81f6c21d3a63fa), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
|
|
255
|
+
- @mastra/core@0.0.0-fix-thread-list-20251105222841
|
|
158
256
|
|
|
159
257
|
## 0.4.6
|
|
160
258
|
|
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ await store.saveMessages({
|
|
|
98
98
|
|
|
99
99
|
// Query threads and messages
|
|
100
100
|
const savedThread = await store.getThreadById({ threadId: 'thread-123' });
|
|
101
|
-
const messages = await store.
|
|
101
|
+
const messages = await store.listMessages({ threadId: 'thread-123' });
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
## Configuration
|
|
@@ -213,9 +213,8 @@ MSSQLStore supports multiple connection methods:
|
|
|
213
213
|
|
|
214
214
|
### Messages
|
|
215
215
|
|
|
216
|
-
- `saveMessages({ messages
|
|
217
|
-
- `
|
|
218
|
-
- `listMessagesById({ messageIds, format? })`: Get messages by their IDs
|
|
216
|
+
- `saveMessages({ messages })`: Save multiple messages with atomic transaction
|
|
217
|
+
- `listMessagesById({ messageIds })`: Get messages by their IDs
|
|
219
218
|
- `listMessages({ threadId, resourceId?, page?, perPage?, orderBy?, filter? })`: Get paginated messages for a thread with filtering and sorting
|
|
220
219
|
- `updateMessages({ messages })`: Update existing messages with atomic transaction
|
|
221
220
|
- `deleteMessages(messageIds)`: Delete specific messages with atomic transaction
|
package/dist/index.cjs
CHANGED
|
@@ -377,10 +377,9 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
377
377
|
}
|
|
378
378
|
async _getIncludedMessages({
|
|
379
379
|
threadId,
|
|
380
|
-
|
|
380
|
+
include
|
|
381
381
|
}) {
|
|
382
382
|
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
383
|
-
const include = selectBy?.include;
|
|
384
383
|
if (!include) return null;
|
|
385
384
|
const unionQueries = [];
|
|
386
385
|
const paramValues = [];
|
|
@@ -452,75 +451,6 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
452
451
|
});
|
|
453
452
|
return dedupedRows;
|
|
454
453
|
}
|
|
455
|
-
/**
|
|
456
|
-
* @deprecated use listMessages instead
|
|
457
|
-
*/
|
|
458
|
-
async getMessages(args) {
|
|
459
|
-
const { threadId, resourceId, selectBy } = args;
|
|
460
|
-
const selectStatement = `SELECT seq_id, id, content, role, type, [createdAt], thread_id AS threadId, resourceId`;
|
|
461
|
-
const orderByStatement = `ORDER BY [seq_id] DESC`;
|
|
462
|
-
const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
|
|
463
|
-
try {
|
|
464
|
-
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
465
|
-
let rows = [];
|
|
466
|
-
const include = selectBy?.include || [];
|
|
467
|
-
if (include?.length) {
|
|
468
|
-
const includeMessages = await this._getIncludedMessages({ threadId, selectBy });
|
|
469
|
-
if (includeMessages) {
|
|
470
|
-
rows.push(...includeMessages);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
const excludeIds = rows.map((m) => m.id).filter(Boolean);
|
|
474
|
-
let query = `${selectStatement} FROM ${getTableName({ indexName: storage.TABLE_MESSAGES, schemaName: getSchemaName(this.schema) })} WHERE [thread_id] = @threadId`;
|
|
475
|
-
const request = this.pool.request();
|
|
476
|
-
request.input("threadId", threadId);
|
|
477
|
-
if (excludeIds.length > 0) {
|
|
478
|
-
const excludeParams = excludeIds.map((_, idx) => `@id${idx}`);
|
|
479
|
-
query += ` AND id NOT IN (${excludeParams.join(", ")})`;
|
|
480
|
-
excludeIds.forEach((id, idx) => {
|
|
481
|
-
request.input(`id${idx}`, id);
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
query += ` ${orderByStatement} OFFSET 0 ROWS FETCH NEXT @limit ROWS ONLY`;
|
|
485
|
-
request.input("limit", limit);
|
|
486
|
-
const result = await request.query(query);
|
|
487
|
-
const remainingRows = result.recordset || [];
|
|
488
|
-
rows.push(...remainingRows);
|
|
489
|
-
rows.sort((a, b) => {
|
|
490
|
-
const timeDiff = a.seq_id - b.seq_id;
|
|
491
|
-
return timeDiff;
|
|
492
|
-
});
|
|
493
|
-
const messagesWithParsedContent = rows.map((row) => {
|
|
494
|
-
if (typeof row.content === "string") {
|
|
495
|
-
try {
|
|
496
|
-
return { ...row, content: JSON.parse(row.content) };
|
|
497
|
-
} catch {
|
|
498
|
-
return row;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return row;
|
|
502
|
-
});
|
|
503
|
-
const cleanMessages = messagesWithParsedContent.map(({ seq_id, ...rest }) => rest);
|
|
504
|
-
const list = new agent.MessageList().add(cleanMessages, "memory");
|
|
505
|
-
return { messages: list.get.all.db() };
|
|
506
|
-
} catch (error$1) {
|
|
507
|
-
const mastraError = new error.MastraError(
|
|
508
|
-
{
|
|
509
|
-
id: "MASTRA_STORAGE_MSSQL_STORE_GET_MESSAGES_FAILED",
|
|
510
|
-
domain: error.ErrorDomain.STORAGE,
|
|
511
|
-
category: error.ErrorCategory.THIRD_PARTY,
|
|
512
|
-
details: {
|
|
513
|
-
threadId,
|
|
514
|
-
resourceId: resourceId ?? ""
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
error$1
|
|
518
|
-
);
|
|
519
|
-
this.logger?.error?.(mastraError.toString());
|
|
520
|
-
this.logger?.trackException?.(mastraError);
|
|
521
|
-
return { messages: [] };
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
454
|
async listMessagesById({ messageIds }) {
|
|
525
455
|
if (messageIds.length === 0) return { messages: [] };
|
|
526
456
|
const selectStatement = `SELECT seq_id, id, content, role, type, [createdAt], thread_id AS threadId, resourceId`;
|
|
@@ -584,7 +514,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
584
514
|
const perPage = storage.normalizePerPage(perPageInput, 40);
|
|
585
515
|
const { offset, perPage: perPageForResponse } = storage.calculatePagination(page, perPageInput, perPage);
|
|
586
516
|
try {
|
|
587
|
-
const { field, direction } = this.parseOrderBy(orderBy);
|
|
517
|
+
const { field, direction } = this.parseOrderBy(orderBy, "ASC");
|
|
588
518
|
const orderByStatement = `ORDER BY [${field}] ${direction}`;
|
|
589
519
|
const selectStatement = `SELECT seq_id, id, content, role, type, [createdAt], thread_id AS threadId, resourceId`;
|
|
590
520
|
const tableName = getTableName({ indexName: storage.TABLE_MESSAGES, schemaName: getSchemaName(this.schema) });
|
|
@@ -629,8 +559,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
629
559
|
}
|
|
630
560
|
const messageIds = new Set(messages.map((m) => m.id));
|
|
631
561
|
if (include && include.length > 0) {
|
|
632
|
-
const
|
|
633
|
-
const includeMessages = await this._getIncludedMessages({ threadId, selectBy });
|
|
562
|
+
const includeMessages = await this._getIncludedMessages({ threadId, include });
|
|
634
563
|
if (includeMessages) {
|
|
635
564
|
for (const includeMsg of includeMessages) {
|
|
636
565
|
if (!messageIds.has(includeMsg.id)) {
|
|
@@ -1043,13 +972,13 @@ var ObservabilityMSSQL = class extends storage.ObservabilityStorage {
|
|
|
1043
972
|
this.operations = operations;
|
|
1044
973
|
this.schema = schema;
|
|
1045
974
|
}
|
|
1046
|
-
get
|
|
975
|
+
get tracingStrategy() {
|
|
1047
976
|
return {
|
|
1048
977
|
preferred: "batch-with-updates",
|
|
1049
978
|
supported: ["batch-with-updates", "insert-only"]
|
|
1050
979
|
};
|
|
1051
980
|
}
|
|
1052
|
-
async
|
|
981
|
+
async createSpan(span) {
|
|
1053
982
|
try {
|
|
1054
983
|
const startedAt = span.startedAt instanceof Date ? span.startedAt.toISOString() : span.startedAt;
|
|
1055
984
|
const endedAt = span.endedAt instanceof Date ? span.endedAt.toISOString() : span.endedAt;
|
|
@@ -1120,7 +1049,7 @@ var ObservabilityMSSQL = class extends storage.ObservabilityStorage {
|
|
|
1120
1049
|
);
|
|
1121
1050
|
}
|
|
1122
1051
|
}
|
|
1123
|
-
async
|
|
1052
|
+
async updateSpan({
|
|
1124
1053
|
spanId,
|
|
1125
1054
|
traceId,
|
|
1126
1055
|
updates
|
|
@@ -1255,7 +1184,7 @@ var ObservabilityMSSQL = class extends storage.ObservabilityStorage {
|
|
|
1255
1184
|
);
|
|
1256
1185
|
}
|
|
1257
1186
|
}
|
|
1258
|
-
async
|
|
1187
|
+
async batchCreateSpans(args) {
|
|
1259
1188
|
if (!args.records || args.records.length === 0) {
|
|
1260
1189
|
return;
|
|
1261
1190
|
}
|
|
@@ -1282,7 +1211,7 @@ var ObservabilityMSSQL = class extends storage.ObservabilityStorage {
|
|
|
1282
1211
|
);
|
|
1283
1212
|
}
|
|
1284
1213
|
}
|
|
1285
|
-
async
|
|
1214
|
+
async batchUpdateSpans(args) {
|
|
1286
1215
|
if (!args.records || args.records.length === 0) {
|
|
1287
1216
|
return;
|
|
1288
1217
|
}
|
|
@@ -2235,7 +2164,7 @@ ${columns}
|
|
|
2235
2164
|
table: storage.TABLE_SCORERS,
|
|
2236
2165
|
columns: ["traceId", "spanId", "seq_id DESC"]
|
|
2237
2166
|
},
|
|
2238
|
-
//
|
|
2167
|
+
// Spans indexes for optimal trace querying
|
|
2239
2168
|
{
|
|
2240
2169
|
name: `${schemaPrefix}mastra_ai_spans_traceid_startedat_idx`,
|
|
2241
2170
|
table: storage.TABLE_AI_SPANS,
|
|
@@ -3100,7 +3029,7 @@ var MSSQLStore = class extends storage.MastraStorage {
|
|
|
3100
3029
|
createTable: true,
|
|
3101
3030
|
deleteMessages: true,
|
|
3102
3031
|
listScoresBySpan: true,
|
|
3103
|
-
|
|
3032
|
+
observabilityInstance: true,
|
|
3104
3033
|
indexManagement: true
|
|
3105
3034
|
};
|
|
3106
3035
|
}
|
|
@@ -3151,12 +3080,6 @@ var MSSQLStore = class extends storage.MastraStorage {
|
|
|
3151
3080
|
async deleteThread({ threadId }) {
|
|
3152
3081
|
return this.stores.memory.deleteThread({ threadId });
|
|
3153
3082
|
}
|
|
3154
|
-
/**
|
|
3155
|
-
* @deprecated use listMessages instead
|
|
3156
|
-
*/
|
|
3157
|
-
async getMessages(args) {
|
|
3158
|
-
return this.stores.memory.getMessages(args);
|
|
3159
|
-
}
|
|
3160
3083
|
async listMessagesById({ messageIds }) {
|
|
3161
3084
|
return this.stores.memory.listMessagesById({ messageIds });
|
|
3162
3085
|
}
|
|
@@ -3252,7 +3175,7 @@ var MSSQLStore = class extends storage.MastraStorage {
|
|
|
3252
3175
|
return this.stores.operations.dropIndex(indexName);
|
|
3253
3176
|
}
|
|
3254
3177
|
/**
|
|
3255
|
-
*
|
|
3178
|
+
* Tracing / Observability
|
|
3256
3179
|
*/
|
|
3257
3180
|
getObservabilityStore() {
|
|
3258
3181
|
if (!this.stores.observability) {
|
|
@@ -3265,15 +3188,15 @@ var MSSQLStore = class extends storage.MastraStorage {
|
|
|
3265
3188
|
}
|
|
3266
3189
|
return this.stores.observability;
|
|
3267
3190
|
}
|
|
3268
|
-
async
|
|
3269
|
-
return this.getObservabilityStore().
|
|
3191
|
+
async createSpan(span) {
|
|
3192
|
+
return this.getObservabilityStore().createSpan(span);
|
|
3270
3193
|
}
|
|
3271
|
-
async
|
|
3194
|
+
async updateSpan({
|
|
3272
3195
|
spanId,
|
|
3273
3196
|
traceId,
|
|
3274
3197
|
updates
|
|
3275
3198
|
}) {
|
|
3276
|
-
return this.getObservabilityStore().
|
|
3199
|
+
return this.getObservabilityStore().updateSpan({ spanId, traceId, updates });
|
|
3277
3200
|
}
|
|
3278
3201
|
async getAITrace(traceId) {
|
|
3279
3202
|
return this.getObservabilityStore().getAITrace(traceId);
|
|
@@ -3281,11 +3204,11 @@ var MSSQLStore = class extends storage.MastraStorage {
|
|
|
3281
3204
|
async getAITracesPaginated(args) {
|
|
3282
3205
|
return this.getObservabilityStore().getAITracesPaginated(args);
|
|
3283
3206
|
}
|
|
3284
|
-
async
|
|
3285
|
-
return this.getObservabilityStore().
|
|
3207
|
+
async batchCreateSpans(args) {
|
|
3208
|
+
return this.getObservabilityStore().batchCreateSpans(args);
|
|
3286
3209
|
}
|
|
3287
|
-
async
|
|
3288
|
-
return this.getObservabilityStore().
|
|
3210
|
+
async batchUpdateSpans(args) {
|
|
3211
|
+
return this.getObservabilityStore().batchUpdateSpans(args);
|
|
3289
3212
|
}
|
|
3290
3213
|
async batchDeleteAITraces(args) {
|
|
3291
3214
|
return this.getObservabilityStore().batchDeleteAITraces(args);
|