@mastra/mongodb 0.13.1 → 0.13.3-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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @mastra/mongodb@0.13.1-alpha.0 build /home/runner/work/mastra/mastra/stores/mongodb
2
+ > @mastra/mongodb@0.13.3-alpha.0 build /home/runner/work/mastra/mastra/stores/mongodb
3
3
  > tsup --silent --config tsup.config.ts
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @mastra/mongodb
2
2
 
3
+ ## 0.13.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
8
+
9
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
10
+ - @mastra/core@0.14.1-alpha.0
11
+
12
+ ## 0.13.2
13
+
14
+ ### Patch Changes
15
+
16
+ - 03997ae: Update peerdeps
17
+ - Updated dependencies [227c7e6]
18
+ - Updated dependencies [12cae67]
19
+ - Updated dependencies [fd3a3eb]
20
+ - Updated dependencies [6faaee5]
21
+ - Updated dependencies [4232b14]
22
+ - Updated dependencies [a89de7e]
23
+ - Updated dependencies [5a37d0c]
24
+ - Updated dependencies [4bde0cb]
25
+ - Updated dependencies [cf4f357]
26
+ - Updated dependencies [ad888a2]
27
+ - Updated dependencies [481751d]
28
+ - Updated dependencies [2454423]
29
+ - Updated dependencies [194e395]
30
+ - Updated dependencies [a722c0b]
31
+ - Updated dependencies [c30bca8]
32
+ - Updated dependencies [3b5fec7]
33
+ - Updated dependencies [a8f129d]
34
+ - @mastra/core@0.14.0
35
+
36
+ ## 0.13.2-alpha.0
37
+
38
+ ### Patch Changes
39
+
40
+ - 03997ae: Update peerdeps
41
+ - @mastra/core@0.14.0-alpha.7
42
+
3
43
  ## 0.13.1
4
44
 
5
45
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -925,6 +925,29 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
925
925
  );
926
926
  }
927
927
  }
928
+ async getMessagesById({
929
+ messageIds,
930
+ format
931
+ }) {
932
+ if (messageIds.length === 0) return [];
933
+ try {
934
+ const collection = await this.operations.getCollection(storage.TABLE_MESSAGES);
935
+ const rawMessages = await collection.find({ id: { $in: messageIds } }).sort({ createdAt: -1 }).toArray();
936
+ const list = new agent.MessageList().add(rawMessages.map(this.parseRow), "memory");
937
+ if (format === `v1`) return list.get.all.v1();
938
+ return list.get.all.v2();
939
+ } catch (error$1) {
940
+ throw new error.MastraError(
941
+ {
942
+ id: "MONGODB_STORE_GET_MESSAGES_BY_ID_FAILED",
943
+ domain: error.ErrorDomain.STORAGE,
944
+ category: error.ErrorCategory.THIRD_PARTY,
945
+ details: { messageIds: JSON.stringify(messageIds) }
946
+ },
947
+ error$1
948
+ );
949
+ }
950
+ }
928
951
  async getMessagesPaginated(args) {
929
952
  const { threadId, format, selectBy } = args;
930
953
  const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
@@ -2235,6 +2258,12 @@ var MongoDBStore = class extends storage.MastraStorage {
2235
2258
  }) {
2236
2259
  return this.stores.memory.getMessages({ threadId, selectBy, format });
2237
2260
  }
2261
+ async getMessagesById({
2262
+ messageIds,
2263
+ format
2264
+ }) {
2265
+ return this.stores.memory.getMessagesById({ messageIds, format });
2266
+ }
2238
2267
  async saveMessages(args) {
2239
2268
  return this.stores.memory.saveMessages(args);
2240
2269
  }