@mastra/dynamodb 0.11.1-alpha.0 → 0.11.1-alpha.2

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,36 +774,68 @@ 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
  /**
741
790
  * Insert a record into the specified "table" (entity)
742
791
  */
743
- async insert({ tableName, record }) {
792
+ async insert({
793
+ tableName,
794
+ record
795
+ }) {
744
796
  this.logger.debug("DynamoDB insert called", { tableName });
745
797
  const entityName = this.getEntityNameForTable(tableName);
746
798
  if (!entityName || !this.service.entities[entityName]) {
747
- throw new Error(`No entity defined for ${tableName}`);
799
+ throw new error.MastraError({
800
+ id: "STORAGE_DYNAMODB_STORE_INSERT_INVALID_ARGS",
801
+ domain: error.ErrorDomain.STORAGE,
802
+ category: error.ErrorCategory.USER,
803
+ text: "No entity defined for tableName",
804
+ details: { tableName }
805
+ });
748
806
  }
749
807
  try {
750
808
  const dataToSave = { entity: entityName, ...this.preprocessRecord(record) };
751
809
  await this.service.entities[entityName].create(dataToSave).go();
752
- } catch (error) {
753
- this.logger.error("Failed to insert record", { tableName, error });
754
- throw error;
810
+ } catch (error$1) {
811
+ throw new error.MastraError(
812
+ {
813
+ id: "STORAGE_DYNAMODB_STORE_INSERT_FAILED",
814
+ domain: error.ErrorDomain.STORAGE,
815
+ category: error.ErrorCategory.THIRD_PARTY,
816
+ details: { tableName }
817
+ },
818
+ error$1
819
+ );
755
820
  }
756
821
  }
757
822
  /**
758
823
  * Insert multiple records as a batch
759
824
  */
760
- async batchInsert({ tableName, records }) {
825
+ async batchInsert({
826
+ tableName,
827
+ records
828
+ }) {
761
829
  this.logger.debug("DynamoDB batchInsert called", { tableName, count: records.length });
762
830
  const entityName = this.getEntityNameForTable(tableName);
763
831
  if (!entityName || !this.service.entities[entityName]) {
764
- throw new Error(`No entity defined for ${tableName}`);
832
+ throw new error.MastraError({
833
+ id: "STORAGE_DYNAMODB_STORE_BATCH_INSERT_INVALID_ARGS",
834
+ domain: error.ErrorDomain.STORAGE,
835
+ category: error.ErrorCategory.USER,
836
+ text: "No entity defined for tableName",
837
+ details: { tableName }
838
+ });
765
839
  }
766
840
  const recordsToSave = records.map((rec) => ({ entity: entityName, ...this.preprocessRecord(rec) }));
767
841
  const batchSize = 25;
@@ -781,19 +855,35 @@ var DynamoDBStore = class extends storage.MastraStorage {
781
855
  await this.service.entities[entityName].create(recordData).go();
782
856
  }
783
857
  }
784
- } catch (error) {
785
- this.logger.error("Failed to batch insert records", { tableName, error });
786
- throw error;
858
+ } catch (error$1) {
859
+ throw new error.MastraError(
860
+ {
861
+ id: "STORAGE_DYNAMODB_STORE_BATCH_INSERT_FAILED",
862
+ domain: error.ErrorDomain.STORAGE,
863
+ category: error.ErrorCategory.THIRD_PARTY,
864
+ details: { tableName }
865
+ },
866
+ error$1
867
+ );
787
868
  }
788
869
  }
789
870
  /**
790
871
  * Load a record by its keys
791
872
  */
792
- async load({ tableName, keys }) {
873
+ async load({
874
+ tableName,
875
+ keys
876
+ }) {
793
877
  this.logger.debug("DynamoDB load called", { tableName, keys });
794
878
  const entityName = this.getEntityNameForTable(tableName);
795
879
  if (!entityName || !this.service.entities[entityName]) {
796
- throw new Error(`No entity defined for ${tableName}`);
880
+ throw new error.MastraError({
881
+ id: "STORAGE_DYNAMODB_STORE_LOAD_INVALID_ARGS",
882
+ domain: error.ErrorDomain.STORAGE,
883
+ category: error.ErrorCategory.USER,
884
+ text: "No entity defined for tableName",
885
+ details: { tableName }
886
+ });
797
887
  }
798
888
  try {
799
889
  const keyObject = { entity: entityName, ...keys };
@@ -803,9 +893,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
803
893
  }
804
894
  let data = result.data;
805
895
  return data;
806
- } catch (error) {
807
- this.logger.error("Failed to load record", { tableName, keys, error });
808
- throw error;
896
+ } catch (error$1) {
897
+ throw new error.MastraError(
898
+ {
899
+ id: "STORAGE_DYNAMODB_STORE_LOAD_FAILED",
900
+ domain: error.ErrorDomain.STORAGE,
901
+ category: error.ErrorCategory.THIRD_PARTY,
902
+ details: { tableName }
903
+ },
904
+ error$1
905
+ );
809
906
  }
810
907
  }
811
908
  // Thread operations
@@ -825,9 +922,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
825
922
  // metadata: data.metadata ? JSON.parse(data.metadata) : undefined, // REMOVED by AI
826
923
  // metadata is already transformed by the entity's getter
827
924
  };
828
- } catch (error) {
829
- this.logger.error("Failed to get thread by ID", { threadId, error });
830
- throw error;
925
+ } catch (error$1) {
926
+ throw new error.MastraError(
927
+ {
928
+ id: "STORAGE_DYNAMODB_STORE_GET_THREAD_BY_ID_FAILED",
929
+ domain: error.ErrorDomain.STORAGE,
930
+ category: error.ErrorCategory.THIRD_PARTY,
931
+ details: { threadId }
932
+ },
933
+ error$1
934
+ );
831
935
  }
832
936
  }
833
937
  async getThreadsByResourceId({ resourceId }) {
@@ -845,9 +949,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
845
949
  // metadata: data.metadata ? JSON.parse(data.metadata) : undefined, // REMOVED by AI
846
950
  // metadata is already transformed by the entity's getter
847
951
  }));
848
- } catch (error) {
849
- this.logger.error("Failed to get threads by resource ID", { resourceId, error });
850
- throw error;
952
+ } catch (error$1) {
953
+ throw new error.MastraError(
954
+ {
955
+ id: "STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_FAILED",
956
+ domain: error.ErrorDomain.STORAGE,
957
+ category: error.ErrorCategory.THIRD_PARTY,
958
+ details: { resourceId }
959
+ },
960
+ error$1
961
+ );
851
962
  }
852
963
  }
853
964
  async saveThread({ thread }) {
@@ -872,9 +983,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
872
983
  updatedAt: now,
873
984
  metadata: thread.metadata
874
985
  };
875
- } catch (error) {
876
- this.logger.error("Failed to save thread", { threadId: thread.id, error });
877
- throw error;
986
+ } catch (error$1) {
987
+ throw new error.MastraError(
988
+ {
989
+ id: "STORAGE_DYNAMODB_STORE_SAVE_THREAD_FAILED",
990
+ domain: error.ErrorDomain.STORAGE,
991
+ category: error.ErrorCategory.THIRD_PARTY,
992
+ details: { threadId: thread.id }
993
+ },
994
+ error$1
995
+ );
878
996
  }
879
997
  }
880
998
  async updateThread({
@@ -905,18 +1023,32 @@ var DynamoDBStore = class extends storage.MastraStorage {
905
1023
  metadata: metadata || existingThread.metadata,
906
1024
  updatedAt: now
907
1025
  };
908
- } catch (error) {
909
- this.logger.error("Failed to update thread", { threadId: id, error });
910
- throw error;
1026
+ } catch (error$1) {
1027
+ throw new error.MastraError(
1028
+ {
1029
+ id: "STORAGE_DYNAMODB_STORE_UPDATE_THREAD_FAILED",
1030
+ domain: error.ErrorDomain.STORAGE,
1031
+ category: error.ErrorCategory.THIRD_PARTY,
1032
+ details: { threadId: id }
1033
+ },
1034
+ error$1
1035
+ );
911
1036
  }
912
1037
  }
913
1038
  async deleteThread({ threadId }) {
914
1039
  this.logger.debug("Deleting thread", { threadId });
915
1040
  try {
916
1041
  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;
1042
+ } catch (error$1) {
1043
+ throw new error.MastraError(
1044
+ {
1045
+ id: "STORAGE_DYNAMODB_STORE_DELETE_THREAD_FAILED",
1046
+ domain: error.ErrorDomain.STORAGE,
1047
+ category: error.ErrorCategory.THIRD_PARTY,
1048
+ details: { threadId }
1049
+ },
1050
+ error$1
1051
+ );
920
1052
  }
921
1053
  }
922
1054
  async getMessages({
@@ -928,8 +1060,9 @@ var DynamoDBStore = class extends storage.MastraStorage {
928
1060
  this.logger.debug("Getting messages", { threadId, selectBy });
929
1061
  try {
930
1062
  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" });
1063
+ const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1064
+ if (limit !== Number.MAX_SAFE_INTEGER) {
1065
+ const results2 = await query.go({ limit, order: "desc" });
933
1066
  const list2 = new agent.MessageList({ threadId, resourceId }).add(
934
1067
  results2.data.map((data) => this.parseMessageData(data)),
935
1068
  "memory"
@@ -944,9 +1077,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
944
1077
  );
945
1078
  if (format === `v2`) return list.get.all.v2();
946
1079
  return list.get.all.v1();
947
- } catch (error) {
948
- this.logger.error("Failed to get messages", { threadId, error });
949
- throw error;
1080
+ } catch (error$1) {
1081
+ throw new error.MastraError(
1082
+ {
1083
+ id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED",
1084
+ domain: error.ErrorDomain.STORAGE,
1085
+ category: error.ErrorCategory.THIRD_PARTY,
1086
+ details: { threadId }
1087
+ },
1088
+ error$1
1089
+ );
950
1090
  }
951
1091
  }
952
1092
  async saveMessages(args) {
@@ -994,7 +1134,7 @@ var DynamoDBStore = class extends storage.MastraStorage {
994
1134
  this.logger.error("Missing entity property in message data for create", { messageData });
995
1135
  throw new Error("Internal error: Missing entity property during saveMessages");
996
1136
  }
997
- await this.service.entities.message.create(messageData).go();
1137
+ await this.service.entities.message.put(messageData).go();
998
1138
  }
999
1139
  }),
1000
1140
  // Update thread's updatedAt timestamp
@@ -1005,9 +1145,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1005
1145
  const list = new agent.MessageList().add(messages, "memory");
1006
1146
  if (format === `v1`) return list.get.all.v1();
1007
1147
  return list.get.all.v2();
1008
- } catch (error) {
1009
- this.logger.error("Failed to save messages", { error });
1010
- throw error;
1148
+ } catch (error$1) {
1149
+ throw new error.MastraError(
1150
+ {
1151
+ id: "STORAGE_DYNAMODB_STORE_SAVE_MESSAGES_FAILED",
1152
+ domain: error.ErrorDomain.STORAGE,
1153
+ category: error.ErrorCategory.THIRD_PARTY,
1154
+ details: { count: messages.length }
1155
+ },
1156
+ error$1
1157
+ );
1011
1158
  }
1012
1159
  }
1013
1160
  // Helper function to parse message data (handle JSON fields)
@@ -1052,9 +1199,15 @@ var DynamoDBStore = class extends storage.MastraStorage {
1052
1199
  }
1053
1200
  } while (cursor && pagesFetched < startPage);
1054
1201
  return items;
1055
- } catch (error) {
1056
- this.logger.error("Failed to get traces", { error });
1057
- throw error;
1202
+ } catch (error$1) {
1203
+ throw new error.MastraError(
1204
+ {
1205
+ id: "STORAGE_DYNAMODB_STORE_GET_TRACES_FAILED",
1206
+ domain: error.ErrorDomain.STORAGE,
1207
+ category: error.ErrorCategory.THIRD_PARTY
1208
+ },
1209
+ error$1
1210
+ );
1058
1211
  }
1059
1212
  }
1060
1213
  async batchTraceInsert({ records }) {
@@ -1069,9 +1222,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1069
1222
  records: recordsToSave
1070
1223
  // Pass records with 'entity' included
1071
1224
  });
1072
- } catch (error) {
1073
- this.logger.error("Failed to batch insert traces", { error });
1074
- throw error;
1225
+ } catch (error$1) {
1226
+ throw new error.MastraError(
1227
+ {
1228
+ id: "STORAGE_DYNAMODB_STORE_BATCH_TRACE_INSERT_FAILED",
1229
+ domain: error.ErrorDomain.STORAGE,
1230
+ category: error.ErrorCategory.THIRD_PARTY,
1231
+ details: { count: records.length }
1232
+ },
1233
+ error$1
1234
+ );
1075
1235
  }
1076
1236
  }
1077
1237
  // Workflow operations
@@ -1096,9 +1256,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1096
1256
  resourceId
1097
1257
  };
1098
1258
  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;
1259
+ } catch (error$1) {
1260
+ throw new error.MastraError(
1261
+ {
1262
+ id: "STORAGE_DYNAMODB_STORE_PERSIST_WORKFLOW_SNAPSHOT_FAILED",
1263
+ domain: error.ErrorDomain.STORAGE,
1264
+ category: error.ErrorCategory.THIRD_PARTY,
1265
+ details: { workflowName, runId }
1266
+ },
1267
+ error$1
1268
+ );
1102
1269
  }
1103
1270
  }
1104
1271
  async loadWorkflowSnapshot({
@@ -1117,9 +1284,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1117
1284
  return null;
1118
1285
  }
1119
1286
  return result.data.snapshot;
1120
- } catch (error) {
1121
- this.logger.error("Failed to load workflow snapshot", { workflowName, runId, error });
1122
- throw error;
1287
+ } catch (error$1) {
1288
+ throw new error.MastraError(
1289
+ {
1290
+ id: "STORAGE_DYNAMODB_STORE_LOAD_WORKFLOW_SNAPSHOT_FAILED",
1291
+ domain: error.ErrorDomain.STORAGE,
1292
+ category: error.ErrorCategory.THIRD_PARTY,
1293
+ details: { workflowName, runId }
1294
+ },
1295
+ error$1
1296
+ );
1123
1297
  }
1124
1298
  }
1125
1299
  async getWorkflowRuns(args) {
@@ -1179,9 +1353,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1179
1353
  runs,
1180
1354
  total
1181
1355
  };
1182
- } catch (error) {
1183
- this.logger.error("Failed to get workflow runs", { error });
1184
- throw error;
1356
+ } catch (error$1) {
1357
+ throw new error.MastraError(
1358
+ {
1359
+ id: "STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUNS_FAILED",
1360
+ domain: error.ErrorDomain.STORAGE,
1361
+ category: error.ErrorCategory.THIRD_PARTY,
1362
+ details: { workflowName: args?.workflowName || "", resourceId: args?.resourceId || "" }
1363
+ },
1364
+ error$1
1365
+ );
1185
1366
  }
1186
1367
  }
1187
1368
  async getWorkflowRunById(args) {
@@ -1226,9 +1407,16 @@ var DynamoDBStore = class extends storage.MastraStorage {
1226
1407
  updatedAt: new Date(matchingRunDbItem.updatedAt),
1227
1408
  resourceId: matchingRunDbItem.resourceId
1228
1409
  };
1229
- } catch (error) {
1230
- this.logger.error("Failed to get workflow run by ID", { runId, workflowName, error });
1231
- throw error;
1410
+ } catch (error$1) {
1411
+ throw new error.MastraError(
1412
+ {
1413
+ id: "STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUN_BY_ID_FAILED",
1414
+ domain: error.ErrorDomain.STORAGE,
1415
+ category: error.ErrorCategory.THIRD_PARTY,
1416
+ details: { runId, workflowName: args?.workflowName || "" }
1417
+ },
1418
+ error$1
1419
+ );
1232
1420
  }
1233
1421
  }
1234
1422
  // Helper function to format workflow run
@@ -1305,19 +1493,47 @@ var DynamoDBStore = class extends storage.MastraStorage {
1305
1493
  };
1306
1494
  }
1307
1495
  });
1308
- } catch (error) {
1309
- this.logger.error("Failed to get evals by agent name", { agentName, type, error });
1310
- throw error;
1496
+ } catch (error$1) {
1497
+ throw new error.MastraError(
1498
+ {
1499
+ id: "STORAGE_DYNAMODB_STORE_GET_EVALS_BY_AGENT_NAME_FAILED",
1500
+ domain: error.ErrorDomain.STORAGE,
1501
+ category: error.ErrorCategory.THIRD_PARTY,
1502
+ details: { agentName }
1503
+ },
1504
+ error$1
1505
+ );
1311
1506
  }
1312
1507
  }
1313
1508
  async getTracesPaginated(_args) {
1314
- throw new Error("Method not implemented.");
1509
+ throw new error.MastraError(
1510
+ {
1511
+ id: "STORAGE_DYNAMODB_STORE_GET_TRACES_PAGINATED_FAILED",
1512
+ domain: error.ErrorDomain.STORAGE,
1513
+ category: error.ErrorCategory.THIRD_PARTY
1514
+ },
1515
+ new Error("Method not implemented.")
1516
+ );
1315
1517
  }
1316
1518
  async getThreadsByResourceIdPaginated(_args) {
1317
- throw new Error("Method not implemented.");
1519
+ throw new error.MastraError(
1520
+ {
1521
+ id: "STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_PAGINATED_FAILED",
1522
+ domain: error.ErrorDomain.STORAGE,
1523
+ category: error.ErrorCategory.THIRD_PARTY
1524
+ },
1525
+ new Error("Method not implemented.")
1526
+ );
1318
1527
  }
1319
1528
  async getMessagesPaginated(_args) {
1320
- throw new Error("Method not implemented.");
1529
+ throw new error.MastraError(
1530
+ {
1531
+ id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
1532
+ domain: error.ErrorDomain.STORAGE,
1533
+ category: error.ErrorCategory.THIRD_PARTY
1534
+ },
1535
+ new Error("Method not implemented.")
1536
+ );
1321
1537
  }
1322
1538
  /**
1323
1539
  * Closes the DynamoDB client connection and cleans up resources.
@@ -1328,9 +1544,15 @@ var DynamoDBStore = class extends storage.MastraStorage {
1328
1544
  try {
1329
1545
  this.client.destroy();
1330
1546
  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;
1547
+ } catch (error$1) {
1548
+ throw new error.MastraError(
1549
+ {
1550
+ id: "STORAGE_DYNAMODB_STORE_CLOSE_FAILED",
1551
+ domain: error.ErrorDomain.STORAGE,
1552
+ category: error.ErrorCategory.THIRD_PARTY
1553
+ },
1554
+ error$1
1555
+ );
1334
1556
  }
1335
1557
  }
1336
1558
  async updateMessages(_args) {