@mastra/dynamodb 0.14.6 → 0.14.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 +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1305,6 +1305,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
|
|
|
1305
1305
|
}) {
|
|
1306
1306
|
this.logger.debug("Getting messages", { threadId, selectBy });
|
|
1307
1307
|
try {
|
|
1308
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
1308
1309
|
const messages = [];
|
|
1309
1310
|
const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
|
|
1310
1311
|
if (selectBy?.include?.length) {
|
|
@@ -1353,7 +1354,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
|
|
|
1353
1354
|
id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED",
|
|
1354
1355
|
domain: ErrorDomain.STORAGE,
|
|
1355
1356
|
category: ErrorCategory.THIRD_PARTY,
|
|
1356
|
-
details: { threadId }
|
|
1357
|
+
details: { threadId, resourceId: resourceId ?? "" }
|
|
1357
1358
|
},
|
|
1358
1359
|
error
|
|
1359
1360
|
);
|
|
@@ -1508,6 +1509,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
|
|
|
1508
1509
|
const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
|
|
1509
1510
|
this.logger.debug("Getting messages with pagination", { threadId, page, perPage, fromDate, toDate, limit });
|
|
1510
1511
|
try {
|
|
1512
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
1511
1513
|
let messages = [];
|
|
1512
1514
|
if (selectBy?.include?.length) {
|
|
1513
1515
|
const includeMessages = await this._getIncludedMessages(threadId, selectBy);
|
|
@@ -1563,19 +1565,23 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
|
|
|
1563
1565
|
hasMore
|
|
1564
1566
|
};
|
|
1565
1567
|
} catch (error) {
|
|
1566
|
-
|
|
1568
|
+
const mastraError = new MastraError(
|
|
1567
1569
|
{
|
|
1568
1570
|
id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
|
|
1569
1571
|
domain: ErrorDomain.STORAGE,
|
|
1570
1572
|
category: ErrorCategory.THIRD_PARTY,
|
|
1571
|
-
details: { threadId }
|
|
1573
|
+
details: { threadId, resourceId: resourceId ?? "" }
|
|
1572
1574
|
},
|
|
1573
1575
|
error
|
|
1574
1576
|
);
|
|
1577
|
+
this.logger?.trackException?.(mastraError);
|
|
1578
|
+
this.logger?.error?.(mastraError.toString());
|
|
1579
|
+
return { messages: [], total: 0, page, perPage, hasMore: false };
|
|
1575
1580
|
}
|
|
1576
1581
|
}
|
|
1577
1582
|
// Helper method to get included messages with context
|
|
1578
1583
|
async _getIncludedMessages(threadId, selectBy) {
|
|
1584
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
1579
1585
|
if (!selectBy?.include?.length) {
|
|
1580
1586
|
return [];
|
|
1581
1587
|
}
|