@mastra/mongodb 0.13.6-alpha.1 → 0.13.7-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # @mastra/mongodb
2
2
 
3
+ ## 0.13.7-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
8
+ - Updated dependencies [fd83526]
9
+ - Updated dependencies [d0b90ab]
10
+ - Updated dependencies [6f5eb7a]
11
+ - Updated dependencies [a01cf14]
12
+ - Updated dependencies [a9e50ee]
13
+ - Updated dependencies [5397eb4]
14
+ - Updated dependencies [c9f4e4a]
15
+ - Updated dependencies [0acbc80]
16
+ - @mastra/core@0.16.0-alpha.0
17
+
18
+ ## 0.13.6
19
+
20
+ ### Patch Changes
21
+
22
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
23
+ - f0dfcac: updated core peerdep
24
+ - Updated dependencies [ab48c97]
25
+ - Updated dependencies [85ef90b]
26
+ - Updated dependencies [aedbbfa]
27
+ - Updated dependencies [ff89505]
28
+ - Updated dependencies [637f323]
29
+ - Updated dependencies [de3cbc6]
30
+ - Updated dependencies [c19bcf7]
31
+ - Updated dependencies [4474d04]
32
+ - Updated dependencies [183dc95]
33
+ - Updated dependencies [a1111e2]
34
+ - Updated dependencies [b42a961]
35
+ - Updated dependencies [61debef]
36
+ - Updated dependencies [9beaeff]
37
+ - Updated dependencies [29de0e1]
38
+ - Updated dependencies [f643c65]
39
+ - Updated dependencies [00c74e7]
40
+ - Updated dependencies [fef7375]
41
+ - Updated dependencies [e3d8fea]
42
+ - Updated dependencies [45e4d39]
43
+ - Updated dependencies [9eee594]
44
+ - Updated dependencies [7149d8d]
45
+ - Updated dependencies [822c2e8]
46
+ - Updated dependencies [979912c]
47
+ - Updated dependencies [7dcf4c0]
48
+ - Updated dependencies [4106a58]
49
+ - Updated dependencies [ad78bfc]
50
+ - Updated dependencies [0302f50]
51
+ - Updated dependencies [6ac697e]
52
+ - Updated dependencies [74db265]
53
+ - Updated dependencies [0ce418a]
54
+ - Updated dependencies [af90672]
55
+ - Updated dependencies [8387952]
56
+ - Updated dependencies [7f3b8da]
57
+ - Updated dependencies [905352b]
58
+ - Updated dependencies [599d04c]
59
+ - Updated dependencies [56041d0]
60
+ - Updated dependencies [3412597]
61
+ - Updated dependencies [5eca5d2]
62
+ - Updated dependencies [f2cda47]
63
+ - Updated dependencies [5de1555]
64
+ - Updated dependencies [cfd377a]
65
+ - Updated dependencies [1ed5a3e]
66
+ - @mastra/core@0.15.3
67
+
3
68
  ## 0.13.6-alpha.1
4
69
 
5
70
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -861,6 +861,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
861
861
  threadId,
862
862
  selectBy
863
863
  }) {
864
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
864
865
  const include = selectBy?.include;
865
866
  if (!include) return null;
866
867
  const collection = await this.operations.getCollection(storage.TABLE_MESSAGES);
@@ -887,10 +888,12 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
887
888
  }
888
889
  async getMessages({
889
890
  threadId,
891
+ resourceId,
890
892
  selectBy,
891
893
  format
892
894
  }) {
893
895
  try {
896
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
894
897
  const messages = [];
895
898
  const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
896
899
  if (selectBy?.include?.length) {
@@ -919,7 +922,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
919
922
  id: "MONGODB_STORE_GET_MESSAGES_FAILED",
920
923
  domain: error.ErrorDomain.STORAGE,
921
924
  category: error.ErrorCategory.THIRD_PARTY,
922
- details: { threadId }
925
+ details: { threadId, resourceId: resourceId ?? "" }
923
926
  },
924
927
  error$1
925
928
  );
@@ -949,7 +952,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
949
952
  }
950
953
  }
951
954
  async getMessagesPaginated(args) {
952
- const { threadId, format, selectBy } = args;
955
+ const { threadId, resourceId, format, selectBy } = args;
953
956
  const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
954
957
  const perPage = perPageInput !== void 0 ? perPageInput : storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
955
958
  const fromDate = dateRange?.start;
@@ -967,13 +970,14 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
967
970
  id: "MONGODB_STORE_GET_MESSAGES_PAGINATED_GET_INCLUDE_MESSAGES_FAILED",
968
971
  domain: error.ErrorDomain.STORAGE,
969
972
  category: error.ErrorCategory.THIRD_PARTY,
970
- details: { threadId }
973
+ details: { threadId, resourceId: resourceId ?? "" }
971
974
  },
972
975
  error$1
973
976
  );
974
977
  }
975
978
  }
976
979
  try {
980
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
977
981
  const currentOffset = page * perPage;
978
982
  const collection = await this.operations.getCollection(storage.TABLE_MESSAGES);
979
983
  const query = { thread_id: threadId };
@@ -1013,7 +1017,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1013
1017
  id: "MONGODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
1014
1018
  domain: error.ErrorDomain.STORAGE,
1015
1019
  category: error.ErrorCategory.THIRD_PARTY,
1016
- details: { threadId }
1020
+ details: { threadId, resourceId: resourceId ?? "" }
1017
1021
  },
1018
1022
  error$1
1019
1023
  );