@mastra/mongodb 0.13.6 → 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 +15 -0
- package/dist/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
|
|
3
18
|
## 0.13.6
|
|
4
19
|
|
|
5
20
|
### 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
|
);
|