@mastra/dynamodb 0.11.1-alpha.0 → 0.11.1-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/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var clientDynamodb = require('@aws-sdk/client-dynamodb');
4
4
  var libDynamodb = require('@aws-sdk/lib-dynamodb');
5
5
  var agent = require('@mastra/core/agent');
6
+ var error = require('@mastra/core/error');
6
7
  var storage = require('@mastra/core/storage');
7
8
  var electrodb = require('electrodb');
8
9
 
@@ -566,22 +567,33 @@ var DynamoDBStore = class extends storage.MastraStorage {
566
567
  hasInitialized = null;
567
568
  constructor({ name, config }) {
568
569
  super({ name });
569
- if (!config.tableName || typeof config.tableName !== "string" || config.tableName.trim() === "") {
570
- throw new Error("DynamoDBStore: config.tableName must be provided and cannot be empty.");
571
- }
572
- if (!/^[a-zA-Z0-9_.-]{3,255}$/.test(config.tableName)) {
573
- throw new Error(
574
- `DynamoDBStore: config.tableName "${config.tableName}" contains invalid characters or is not between 3 and 255 characters long.`
570
+ try {
571
+ if (!config.tableName || typeof config.tableName !== "string" || config.tableName.trim() === "") {
572
+ throw new Error("DynamoDBStore: config.tableName must be provided and cannot be empty.");
573
+ }
574
+ if (!/^[a-zA-Z0-9_.-]{3,255}$/.test(config.tableName)) {
575
+ throw new Error(
576
+ `DynamoDBStore: config.tableName "${config.tableName}" contains invalid characters or is not between 3 and 255 characters long.`
577
+ );
578
+ }
579
+ const dynamoClient = new clientDynamodb.DynamoDBClient({
580
+ region: config.region || "us-east-1",
581
+ endpoint: config.endpoint,
582
+ credentials: config.credentials
583
+ });
584
+ this.tableName = config.tableName;
585
+ this.client = libDynamodb.DynamoDBDocumentClient.from(dynamoClient);
586
+ this.service = getElectroDbService(this.client, this.tableName);
587
+ } catch (error$1) {
588
+ throw new error.MastraError(
589
+ {
590
+ id: "STORAGE_DYNAMODB_STORE_CONSTRUCTOR_FAILED",
591
+ domain: error.ErrorDomain.STORAGE,
592
+ category: error.ErrorCategory.USER
593
+ },
594
+ error$1
575
595
  );
576
596
  }
577
- const dynamoClient = new clientDynamodb.DynamoDBClient({
578
- region: config.region || "us-east-1",
579
- endpoint: config.endpoint,
580
- credentials: config.credentials
581
- });
582
- this.tableName = config.tableName;
583
- this.client = libDynamodb.DynamoDBDocumentClient.from(dynamoClient);
584
- this.service = getElectroDbService(this.client, this.tableName);
585
597
  }
586
598
  /**
587
599
  * This method is modified for DynamoDB with ElectroDB single-table design.
@@ -603,9 +615,17 @@ var DynamoDBStore = class extends storage.MastraStorage {
603
615
  );
604
616
  }
605
617
  this.logger.debug(`Table ${this.tableName} exists and is accessible`);
606
- } catch (error) {
607
- this.logger.error("Error validating table access", { tableName: this.tableName, error });
608
- throw error;
618
+ } catch (error$1) {
619
+ this.logger.error("Error validating table access", { tableName: this.tableName, error: error$1 });
620
+ throw new error.MastraError(
621
+ {
622
+ id: "STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_ACCESS_FAILED",
623
+ domain: error.ErrorDomain.STORAGE,
624
+ category: error.ErrorCategory.THIRD_PARTY,
625
+ details: { tableName: this.tableName }
626
+ },
627
+ error$1
628
+ );
609
629
  }
610
630
  }
611
631
  /**
@@ -620,11 +640,19 @@ var DynamoDBStore = class extends storage.MastraStorage {
620
640
  });
621
641
  await this.client.send(command);
622
642
  return true;
623
- } catch (error) {
624
- if (error.name === "ResourceNotFoundException") {
643
+ } catch (error$1) {
644
+ if (error$1.name === "ResourceNotFoundException") {
625
645
  return false;
626
646
  }
627
- throw error;
647
+ throw new error.MastraError(
648
+ {
649
+ id: "STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_EXISTS_FAILED",
650
+ domain: error.ErrorDomain.STORAGE,
651
+ category: error.ErrorCategory.THIRD_PARTY,
652
+ details: { tableName: this.tableName }
653
+ },
654
+ error$1
655
+ );
628
656
  }
629
657
  }
630
658
  /**
@@ -638,8 +666,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
638
666
  }
639
667
  try {
640
668
  await this.hasInitialized;
641
- } catch (error) {
642
- throw error;
669
+ } catch (error$1) {
670
+ throw new error.MastraError(
671
+ {
672
+ id: "STORAGE_DYNAMODB_STORE_INIT_FAILED",
673
+ domain: error.ErrorDomain.STORAGE,
674
+ category: error.ErrorCategory.THIRD_PARTY,
675
+ details: { tableName: this.tableName }
676
+ },
677
+ error$1
678
+ );
643
679
  }
644
680
  }
645
681
  /**
@@ -685,7 +721,13 @@ var DynamoDBStore = class extends storage.MastraStorage {
685
721
  this.logger.debug("DynamoDB clearTable called", { tableName });
686
722
  const entityName = this.getEntityNameForTable(tableName);
687
723
  if (!entityName || !this.service.entities[entityName]) {
688
- throw new Error(`No entity defined for ${tableName}`);
724
+ throw new error.MastraError({
725
+ id: "STORAGE_DYNAMODB_STORE_CLEAR_TABLE_INVALID_ARGS",
726
+ domain: error.ErrorDomain.STORAGE,
727
+ category: error.ErrorCategory.USER,
728
+ text: "No entity defined for tableName",
729
+ details: { tableName }
730
+ });
689
731
  }
690
732
  try {
691
733
  const result = await this.service.entities[entityName].scan.go({ pages: "all" });
@@ -732,9 +774,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
732
774
  await this.service.entities[entityName].delete(batchKeys).go();
733
775
  }
734
776
  this.logger.debug(`Successfully cleared all records for ${tableName}`);
735
- } catch (error) {
736
- this.logger.error("Failed to clear table", { tableName, error });
737
- throw error;
777
+ } catch (error$1) {
778
+ throw new error.MastraError(
779
+ {
780
+ id: "STORAGE_DYNAMODB_STORE_CLEAR_TABLE_FAILED",
781
+ domain: error.ErrorDomain.STORAGE,
782
+ category: error.ErrorCategory.THIRD_PARTY,
783
+ details: { tableName }
784
+ },
785
+ error$1
786
+ );
738
787
  }
739
788
  }
740
789
  /**
@@ -744,14 +793,27 @@ var DynamoDBStore = class extends storage.MastraStorage {
744
793
  this.logger.debug("DynamoDB insert called", { tableName });
745
794
  const entityName = this.getEntityNameForTable(tableName);
746
795
  if (!entityName || !this.service.entities[entityName]) {
747
- throw new Error(`No entity defined for ${tableName}`);
796
+ throw new error.MastraError({
797
+ id: "STORAGE_DYNAMODB_STORE_INSERT_INVALID_ARGS",
798
+ domain: error.ErrorDomain.STORAGE,
799
+ category: error.ErrorCategory.USER,
800
+ text: "No entity defined for tableName",
801
+ details: { tableName }
802
+ });
748
803
  }
749
804
  try {
750
805
  const dataToSave = { entity: entityName, ...this.preprocessRecord(record) };
751
806
  await this.service.entities[entityName].create(dataToSave).go();
752
- } catch (error) {
753
- this.logger.error("Failed to insert record", { tableName, error });
754
- throw error;
807
+ } catch (error$1) {
808
+ throw new error.MastraError(
809
+ {
810
+ id: "STORAGE_DYNAMODB_STORE_INSERT_FAILED",
811
+ domain: error.ErrorDomain.STORAGE,
812
+ category: error.ErrorCategory.THIRD_PARTY,
813
+ details: { tableName }
814
+ },
815
+ error$1
816
+ );
755
817
  }
756
818
  }
757
819
  /**
@@ -761,7 +823,13 @@ var DynamoDBStore = class extends storage.MastraStorage {
761
823
  this.logger.debug("DynamoDB batchInsert called", { tableName, count: records.length });
762
824
  const entityName = this.getEntityNameForTable(tableName);
763
825
  if (!entityName || !this.service.entities[entityName]) {
764
- throw new Error(`No entity defined for ${tableName}`);
826
+ throw new error.MastraError({
827
+ id: "STORAGE_DYNAMODB_STORE_BATCH_INSERT_INVALID_ARGS",
828
+ domain: error.ErrorDomain.STORAGE,
829
+ category: error.ErrorCategory.USER,
830
+ text: "No entity defined for tableName",
831
+ details: { tableName }
832
+ });
765
833
  }
766
834
  const recordsToSave = records.map((rec) => ({ entity: entityName, ...this.preprocessRecord(rec) }));
767
835
  const batchSize = 25;
@@ -781,9 +849,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
781
849
  await this.service.entities[entityName].create(recordData).go();
782
850
  }
783
851
  }
784
- } catch (error) {
785
- this.logger.error("Failed to batch insert records", { tableName, error });
786
- throw error;
852
+ } catch (error$1) {
853
+ throw new error.MastraError(
854
+ {
855
+ id: "STORAGE_DYNAMODB_STORE_BATCH_INSERT_FAILED",
856
+ domain: error.ErrorDomain.STORAGE,
857
+ category: error.ErrorCategory.THIRD_PARTY,
858
+ details: { tableName }
859
+ },
860
+ error$1
861
+ );
787
862
  }
788
863
  }
789
864
  /**
@@ -793,7 +868,13 @@ var DynamoDBStore = class extends storage.MastraStorage {
793
868
  this.logger.debug("DynamoDB load called", { tableName, keys });
794
869
  const entityName = this.getEntityNameForTable(tableName);
795
870
  if (!entityName || !this.service.entities[entityName]) {
796
- throw new Error(`No entity defined for ${tableName}`);
871
+ throw new error.MastraError({
872
+ id: "STORAGE_DYNAMODB_STORE_LOAD_INVALID_ARGS",
873
+ domain: error.ErrorDomain.STORAGE,
874
+ category: error.ErrorCategory.USER,
875
+ text: "No entity defined for tableName",
876
+ details: { tableName }
877
+ });
797
878
  }
798
879
  try {
799
880
  const keyObject = { entity: entityName, ...keys };
@@ -803,9 +884,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
803
884
  }
804
885
  let data = result.data;
805
886
  return data;
806
- } catch (error) {
807
- this.logger.error("Failed to load record", { tableName, keys, error });
808
- throw error;
887
+ } catch (error$1) {
888
+ throw new error.MastraError(
889
+ {
890
+ id: "STORAGE_DYNAMODB_STORE_LOAD_FAILED",
891
+ domain: error.ErrorDomain.STORAGE,
892
+ category: error.ErrorCategory.THIRD_PARTY,
893
+ details: { tableName }
894
+ },
895
+ error$1
896
+ );
809
897
  }
810
898
  }
811
899
  // Thread operations
@@ -825,9 +913,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
825
913
  // metadata: data.metadata ? JSON.parse(data.metadata) : undefined, // REMOVED by AI
826
914
  // metadata is already transformed by the entity's getter
827
915
  };
828
- } catch (error) {
829
- this.logger.error("Failed to get thread by ID", { threadId, error });
830
- throw error;
916
+ } catch (error$1) {
917
+ throw new error.MastraError(
918
+ {
919
+ id: "STORAGE_DYNAMODB_STORE_GET_THREAD_BY_ID_FAILED",
920
+ domain: error.ErrorDomain.STORAGE,
921
+ category: error.ErrorCategory.THIRD_PARTY,
922
+ details: { threadId }
923
+ },
924
+ error$1
925
+ );
831
926
  }
832
927
  }
833
928
  async getThreadsByResourceId({ resourceId }) {
@@ -845,9 +940,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
845
940
  // metadata: data.metadata ? JSON.parse(data.metadata) : undefined, // REMOVED by AI
846
941
  // metadata is already transformed by the entity's getter
847
942
  }));
848
- } catch (error) {
849
- this.logger.error("Failed to get threads by resource ID", { resourceId, error });
850
- throw error;
943
+ } catch (error$1) {
944
+ throw new error.MastraError(
945
+ {
946
+ id: "STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_FAILED",
947
+ domain: error.ErrorDomain.STORAGE,
948
+ category: error.ErrorCategory.THIRD_PARTY,
949
+ details: { resourceId }
950
+ },
951
+ error$1
952
+ );
851
953
  }
852
954
  }
853
955
  async saveThread({ thread }) {
@@ -872,9 +974,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
872
974
  updatedAt: now,
873
975
  metadata: thread.metadata
874
976
  };
875
- } catch (error) {
876
- this.logger.error("Failed to save thread", { threadId: thread.id, error });
877
- throw error;
977
+ } catch (error$1) {
978
+ throw new error.MastraError(
979
+ {
980
+ id: "STORAGE_DYNAMODB_STORE_SAVE_THREAD_FAILED",
981
+ domain: error.ErrorDomain.STORAGE,
982
+ category: error.ErrorCategory.THIRD_PARTY,
983
+ details: { threadId: thread.id }
984
+ },
985
+ error$1
986
+ );
878
987
  }
879
988
  }
880
989
  async updateThread({
@@ -905,18 +1014,32 @@ var DynamoDBStore = class extends storage.MastraStorage {
905
1014
  metadata: metadata || existingThread.metadata,
906
1015
  updatedAt: now
907
1016
  };
908
- } catch (error) {
909
- this.logger.error("Failed to update thread", { threadId: id, error });
910
- throw error;
1017
+ } catch (error$1) {
1018
+ throw new error.MastraError(
1019
+ {
1020
+ id: "STORAGE_DYNAMODB_STORE_UPDATE_THREAD_FAILED",
1021
+ domain: error.ErrorDomain.STORAGE,
1022
+ category: error.ErrorCategory.THIRD_PARTY,
1023
+ details: { threadId: id }
1024
+ },
1025
+ error$1
1026
+ );
911
1027
  }
912
1028
  }
913
1029
  async deleteThread({ threadId }) {
914
1030
  this.logger.debug("Deleting thread", { threadId });
915
1031
  try {
916
1032
  await this.service.entities.thread.delete({ entity: "thread", id: threadId }).go();
917
- } catch (error) {
918
- this.logger.error("Failed to delete thread", { threadId, error });
919
- throw error;
1033
+ } catch (error$1) {
1034
+ throw new error.MastraError(
1035
+ {
1036
+ id: "STORAGE_DYNAMODB_STORE_DELETE_THREAD_FAILED",
1037
+ domain: error.ErrorDomain.STORAGE,
1038
+ category: error.ErrorCategory.THIRD_PARTY,
1039
+ details: { threadId }
1040
+ },
1041
+ error$1
1042
+ );
920
1043
  }
921
1044
  }
922
1045
  async getMessages({
@@ -928,8 +1051,9 @@ var DynamoDBStore = class extends storage.MastraStorage {
928
1051
  this.logger.debug("Getting messages", { threadId, selectBy });
929
1052
  try {
930
1053
  const query = this.service.entities.message.query.byThread({ entity: "message", threadId });
931
- if (selectBy?.last && typeof selectBy.last === "number") {
932
- const results2 = await query.go({ limit: selectBy.last, order: "desc" });
1054
+ const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1055
+ if (limit !== Number.MAX_SAFE_INTEGER) {
1056
+ const results2 = await query.go({ limit, order: "desc" });
933
1057
  const list2 = new agent.MessageList({ threadId, resourceId }).add(
934
1058
  results2.data.map((data) => this.parseMessageData(data)),
935
1059
  "memory"
@@ -944,9 +1068,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
944
1068
  );
945
1069
  if (format === `v2`) return list.get.all.v2();
946
1070
  return list.get.all.v1();
947
- } catch (error) {
948
- this.logger.error("Failed to get messages", { threadId, error });
949
- throw error;
1071
+ } catch (error$1) {
1072
+ throw new error.MastraError(
1073
+ {
1074
+ id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED",
1075
+ domain: error.ErrorDomain.STORAGE,
1076
+ category: error.ErrorCategory.THIRD_PARTY,
1077
+ details: { threadId }
1078
+ },
1079
+ error$1
1080
+ );
950
1081
  }
951
1082
  }
952
1083
  async saveMessages(args) {
@@ -1005,9 +1136,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1005
1136
  const list = new agent.MessageList().add(messages, "memory");
1006
1137
  if (format === `v1`) return list.get.all.v1();
1007
1138
  return list.get.all.v2();
1008
- } catch (error) {
1009
- this.logger.error("Failed to save messages", { error });
1010
- throw error;
1139
+ } catch (error$1) {
1140
+ throw new error.MastraError(
1141
+ {
1142
+ id: "STORAGE_DYNAMODB_STORE_SAVE_MESSAGES_FAILED",
1143
+ domain: error.ErrorDomain.STORAGE,
1144
+ category: error.ErrorCategory.THIRD_PARTY,
1145
+ details: { count: messages.length }
1146
+ },
1147
+ error$1
1148
+ );
1011
1149
  }
1012
1150
  }
1013
1151
  // Helper function to parse message data (handle JSON fields)
@@ -1052,9 +1190,15 @@ var DynamoDBStore = class extends storage.MastraStorage {
1052
1190
  }
1053
1191
  } while (cursor && pagesFetched < startPage);
1054
1192
  return items;
1055
- } catch (error) {
1056
- this.logger.error("Failed to get traces", { error });
1057
- throw error;
1193
+ } catch (error$1) {
1194
+ throw new error.MastraError(
1195
+ {
1196
+ id: "STORAGE_DYNAMODB_STORE_GET_TRACES_FAILED",
1197
+ domain: error.ErrorDomain.STORAGE,
1198
+ category: error.ErrorCategory.THIRD_PARTY
1199
+ },
1200
+ error$1
1201
+ );
1058
1202
  }
1059
1203
  }
1060
1204
  async batchTraceInsert({ records }) {
@@ -1069,9 +1213,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1069
1213
  records: recordsToSave
1070
1214
  // Pass records with 'entity' included
1071
1215
  });
1072
- } catch (error) {
1073
- this.logger.error("Failed to batch insert traces", { error });
1074
- throw error;
1216
+ } catch (error$1) {
1217
+ throw new error.MastraError(
1218
+ {
1219
+ id: "STORAGE_DYNAMODB_STORE_BATCH_TRACE_INSERT_FAILED",
1220
+ domain: error.ErrorDomain.STORAGE,
1221
+ category: error.ErrorCategory.THIRD_PARTY,
1222
+ details: { count: records.length }
1223
+ },
1224
+ error$1
1225
+ );
1075
1226
  }
1076
1227
  }
1077
1228
  // Workflow operations
@@ -1096,9 +1247,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1096
1247
  resourceId
1097
1248
  };
1098
1249
  await this.service.entities.workflowSnapshot.upsert(data).go();
1099
- } catch (error) {
1100
- this.logger.error("Failed to persist workflow snapshot", { workflowName, runId, error });
1101
- throw error;
1250
+ } catch (error$1) {
1251
+ throw new error.MastraError(
1252
+ {
1253
+ id: "STORAGE_DYNAMODB_STORE_PERSIST_WORKFLOW_SNAPSHOT_FAILED",
1254
+ domain: error.ErrorDomain.STORAGE,
1255
+ category: error.ErrorCategory.THIRD_PARTY,
1256
+ details: { workflowName, runId }
1257
+ },
1258
+ error$1
1259
+ );
1102
1260
  }
1103
1261
  }
1104
1262
  async loadWorkflowSnapshot({
@@ -1117,9 +1275,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1117
1275
  return null;
1118
1276
  }
1119
1277
  return result.data.snapshot;
1120
- } catch (error) {
1121
- this.logger.error("Failed to load workflow snapshot", { workflowName, runId, error });
1122
- throw error;
1278
+ } catch (error$1) {
1279
+ throw new error.MastraError(
1280
+ {
1281
+ id: "STORAGE_DYNAMODB_STORE_LOAD_WORKFLOW_SNAPSHOT_FAILED",
1282
+ domain: error.ErrorDomain.STORAGE,
1283
+ category: error.ErrorCategory.THIRD_PARTY,
1284
+ details: { workflowName, runId }
1285
+ },
1286
+ error$1
1287
+ );
1123
1288
  }
1124
1289
  }
1125
1290
  async getWorkflowRuns(args) {
@@ -1179,9 +1344,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1179
1344
  runs,
1180
1345
  total
1181
1346
  };
1182
- } catch (error) {
1183
- this.logger.error("Failed to get workflow runs", { error });
1184
- throw error;
1347
+ } catch (error$1) {
1348
+ throw new error.MastraError(
1349
+ {
1350
+ id: "STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUNS_FAILED",
1351
+ domain: error.ErrorDomain.STORAGE,
1352
+ category: error.ErrorCategory.THIRD_PARTY,
1353
+ details: { workflowName: args?.workflowName || "", resourceId: args?.resourceId || "" }
1354
+ },
1355
+ error$1
1356
+ );
1185
1357
  }
1186
1358
  }
1187
1359
  async getWorkflowRunById(args) {
@@ -1226,9 +1398,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1226
1398
  updatedAt: new Date(matchingRunDbItem.updatedAt),
1227
1399
  resourceId: matchingRunDbItem.resourceId
1228
1400
  };
1229
- } catch (error) {
1230
- this.logger.error("Failed to get workflow run by ID", { runId, workflowName, error });
1231
- throw error;
1401
+ } catch (error$1) {
1402
+ throw new error.MastraError(
1403
+ {
1404
+ id: "STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUN_BY_ID_FAILED",
1405
+ domain: error.ErrorDomain.STORAGE,
1406
+ category: error.ErrorCategory.THIRD_PARTY,
1407
+ details: { runId, workflowName: args?.workflowName || "" }
1408
+ },
1409
+ error$1
1410
+ );
1232
1411
  }
1233
1412
  }
1234
1413
  // Helper function to format workflow run
@@ -1305,19 +1484,47 @@ var DynamoDBStore = class extends storage.MastraStorage {
1305
1484
  };
1306
1485
  }
1307
1486
  });
1308
- } catch (error) {
1309
- this.logger.error("Failed to get evals by agent name", { agentName, type, error });
1310
- throw error;
1487
+ } catch (error$1) {
1488
+ throw new error.MastraError(
1489
+ {
1490
+ id: "STORAGE_DYNAMODB_STORE_GET_EVALS_BY_AGENT_NAME_FAILED",
1491
+ domain: error.ErrorDomain.STORAGE,
1492
+ category: error.ErrorCategory.THIRD_PARTY,
1493
+ details: { agentName }
1494
+ },
1495
+ error$1
1496
+ );
1311
1497
  }
1312
1498
  }
1313
1499
  async getTracesPaginated(_args) {
1314
- throw new Error("Method not implemented.");
1500
+ throw new error.MastraError(
1501
+ {
1502
+ id: "STORAGE_DYNAMODB_STORE_GET_TRACES_PAGINATED_FAILED",
1503
+ domain: error.ErrorDomain.STORAGE,
1504
+ category: error.ErrorCategory.THIRD_PARTY
1505
+ },
1506
+ new Error("Method not implemented.")
1507
+ );
1315
1508
  }
1316
1509
  async getThreadsByResourceIdPaginated(_args) {
1317
- throw new Error("Method not implemented.");
1510
+ throw new error.MastraError(
1511
+ {
1512
+ id: "STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_PAGINATED_FAILED",
1513
+ domain: error.ErrorDomain.STORAGE,
1514
+ category: error.ErrorCategory.THIRD_PARTY
1515
+ },
1516
+ new Error("Method not implemented.")
1517
+ );
1318
1518
  }
1319
1519
  async getMessagesPaginated(_args) {
1320
- throw new Error("Method not implemented.");
1520
+ throw new error.MastraError(
1521
+ {
1522
+ id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
1523
+ domain: error.ErrorDomain.STORAGE,
1524
+ category: error.ErrorCategory.THIRD_PARTY
1525
+ },
1526
+ new Error("Method not implemented.")
1527
+ );
1321
1528
  }
1322
1529
  /**
1323
1530
  * Closes the DynamoDB client connection and cleans up resources.
@@ -1328,9 +1535,15 @@ var DynamoDBStore = class extends storage.MastraStorage {
1328
1535
  try {
1329
1536
  this.client.destroy();
1330
1537
  this.logger.debug("DynamoDB client closed successfully for store:", { name: this.name });
1331
- } catch (error) {
1332
- this.logger.error("Error closing DynamoDB client for store:", { name: this.name, error });
1333
- throw error;
1538
+ } catch (error$1) {
1539
+ throw new error.MastraError(
1540
+ {
1541
+ id: "STORAGE_DYNAMODB_STORE_CLOSE_FAILED",
1542
+ domain: error.ErrorDomain.STORAGE,
1543
+ category: error.ErrorCategory.THIRD_PARTY
1544
+ },
1545
+ error$1
1546
+ );
1334
1547
  }
1335
1548
  }
1336
1549
  async updateMessages(_args) {