@mastra/dynamodb 0.14.6 → 0.15.0-alpha.1

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,32 @@
1
1
  # @mastra/dynamodb
2
2
 
3
+ ## 0.15.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 376913a: Update peerdeps of @mastra/core
8
+
9
+ ### Patch Changes
10
+
11
+ - 376913a: Update peerdeps
12
+ - Updated dependencies [8fbf79e]
13
+ - @mastra/core@0.16.0-alpha.1
14
+
15
+ ## 0.14.7-alpha.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
20
+ - Updated dependencies [fd83526]
21
+ - Updated dependencies [d0b90ab]
22
+ - Updated dependencies [6f5eb7a]
23
+ - Updated dependencies [a01cf14]
24
+ - Updated dependencies [a9e50ee]
25
+ - Updated dependencies [5397eb4]
26
+ - Updated dependencies [c9f4e4a]
27
+ - Updated dependencies [0acbc80]
28
+ - @mastra/core@0.16.0-alpha.0
29
+
3
30
  ## 0.14.6
4
31
 
5
32
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1307,6 +1307,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
1307
1307
  }) {
1308
1308
  this.logger.debug("Getting messages", { threadId, selectBy });
1309
1309
  try {
1310
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1310
1311
  const messages = [];
1311
1312
  const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1312
1313
  if (selectBy?.include?.length) {
@@ -1355,7 +1356,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
1355
1356
  id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED",
1356
1357
  domain: error.ErrorDomain.STORAGE,
1357
1358
  category: error.ErrorCategory.THIRD_PARTY,
1358
- details: { threadId }
1359
+ details: { threadId, resourceId: resourceId ?? "" }
1359
1360
  },
1360
1361
  error$1
1361
1362
  );
@@ -1510,6 +1511,7 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
1510
1511
  const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1511
1512
  this.logger.debug("Getting messages with pagination", { threadId, page, perPage, fromDate, toDate, limit });
1512
1513
  try {
1514
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1513
1515
  let messages = [];
1514
1516
  if (selectBy?.include?.length) {
1515
1517
  const includeMessages = await this._getIncludedMessages(threadId, selectBy);
@@ -1565,19 +1567,23 @@ var MemoryStorageDynamoDB = class extends storage.MemoryStorage {
1565
1567
  hasMore
1566
1568
  };
1567
1569
  } catch (error$1) {
1568
- throw new error.MastraError(
1570
+ const mastraError = new error.MastraError(
1569
1571
  {
1570
1572
  id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
1571
1573
  domain: error.ErrorDomain.STORAGE,
1572
1574
  category: error.ErrorCategory.THIRD_PARTY,
1573
- details: { threadId }
1575
+ details: { threadId, resourceId: resourceId ?? "" }
1574
1576
  },
1575
1577
  error$1
1576
1578
  );
1579
+ this.logger?.trackException?.(mastraError);
1580
+ this.logger?.error?.(mastraError.toString());
1581
+ return { messages: [], total: 0, page, perPage, hasMore: false };
1577
1582
  }
1578
1583
  }
1579
1584
  // Helper method to get included messages with context
1580
1585
  async _getIncludedMessages(threadId, selectBy) {
1586
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1581
1587
  if (!selectBy?.include?.length) {
1582
1588
  return [];
1583
1589
  }