@mastra/dynamodb 0.0.0-sidebar-window-undefined-fix-20251029233656 → 0.0.0-span-scorring-test-20251124132129

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.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { DynamoDBClient, DescribeTableCommand } from '@aws-sdk/client-dynamodb';
2
2
  import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
3
3
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
4
- import { MastraStorage, StoreOperations, WorkflowsStorage, MemoryStorage, resolveMessageLimit, ScoresStorage, LegacyEvalsStorage, TABLE_AI_SPANS, TABLE_RESOURCES, TABLE_TRACES, TABLE_SCORERS, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
4
+ import { MastraStorage, StoreOperations, WorkflowsStorage, normalizePerPage, MemoryStorage, calculatePagination, ScoresStorage, TABLE_SPANS, TABLE_RESOURCES, TABLE_TRACES, TABLE_SCORERS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
5
5
  import { Entity, Service } from 'electrodb';
6
6
  import { MessageList } from '@mastra/core/agent';
7
- import { saveScorePayloadSchema } from '@mastra/core/scores';
7
+ import { saveScorePayloadSchema } from '@mastra/core/evals';
8
8
 
9
9
  // src/storage/index.ts
10
10
 
@@ -562,7 +562,7 @@ var scoreEntity = new Entity({
562
562
  return value;
563
563
  }
564
564
  },
565
- runtimeContext: {
565
+ requestContext: {
566
566
  type: "string",
567
567
  required: false,
568
568
  set: (value) => {
@@ -933,187 +933,6 @@ function getElectroDbService(client, tableName) {
933
933
  }
934
934
  );
935
935
  }
936
- var LegacyEvalsDynamoDB = class extends LegacyEvalsStorage {
937
- service;
938
- tableName;
939
- constructor({ service, tableName }) {
940
- super();
941
- this.service = service;
942
- this.tableName = tableName;
943
- }
944
- // Eval operations
945
- async getEvalsByAgentName(agentName, type) {
946
- this.logger.debug("Getting evals for agent", { agentName, type });
947
- try {
948
- const query = this.service.entities.eval.query.byAgent({ entity: "eval", agent_name: agentName });
949
- const results = await query.go({ order: "desc", limit: 100 });
950
- if (!results.data.length) {
951
- return [];
952
- }
953
- let filteredData = results.data;
954
- if (type) {
955
- filteredData = filteredData.filter((evalRecord) => {
956
- try {
957
- const testInfo = evalRecord.test_info && typeof evalRecord.test_info === "string" ? JSON.parse(evalRecord.test_info) : void 0;
958
- if (type === "test" && !testInfo) {
959
- return false;
960
- }
961
- if (type === "live" && testInfo) {
962
- return false;
963
- }
964
- } catch (e) {
965
- this.logger.warn("Failed to parse test_info during filtering", { record: evalRecord, error: e });
966
- }
967
- return true;
968
- });
969
- }
970
- return filteredData.map((evalRecord) => {
971
- try {
972
- return {
973
- input: evalRecord.input,
974
- output: evalRecord.output,
975
- // Safely parse result and test_info
976
- result: evalRecord.result && typeof evalRecord.result === "string" ? JSON.parse(evalRecord.result) : void 0,
977
- agentName: evalRecord.agent_name,
978
- createdAt: evalRecord.created_at,
979
- // Keep as string from DDB?
980
- metricName: evalRecord.metric_name,
981
- instructions: evalRecord.instructions,
982
- runId: evalRecord.run_id,
983
- globalRunId: evalRecord.global_run_id,
984
- testInfo: evalRecord.test_info && typeof evalRecord.test_info === "string" ? JSON.parse(evalRecord.test_info) : void 0
985
- };
986
- } catch (parseError) {
987
- this.logger.error("Failed to parse eval record", { record: evalRecord, error: parseError });
988
- return {
989
- agentName: evalRecord.agent_name,
990
- createdAt: evalRecord.created_at,
991
- runId: evalRecord.run_id,
992
- globalRunId: evalRecord.global_run_id
993
- };
994
- }
995
- });
996
- } catch (error) {
997
- throw new MastraError(
998
- {
999
- id: "STORAGE_DYNAMODB_STORE_GET_EVALS_BY_AGENT_NAME_FAILED",
1000
- domain: ErrorDomain.STORAGE,
1001
- category: ErrorCategory.THIRD_PARTY,
1002
- details: { agentName }
1003
- },
1004
- error
1005
- );
1006
- }
1007
- }
1008
- async getEvals(options = {}) {
1009
- const { agentName, type, page = 0, perPage = 100, dateRange } = options;
1010
- this.logger.debug("Getting evals with pagination", { agentName, type, page, perPage, dateRange });
1011
- try {
1012
- let query;
1013
- if (agentName) {
1014
- query = this.service.entities.eval.query.byAgent({ entity: "eval", agent_name: agentName });
1015
- } else {
1016
- query = this.service.entities.eval.query.byEntity({ entity: "eval" });
1017
- }
1018
- const results = await query.go({
1019
- order: "desc",
1020
- pages: "all"
1021
- // Get all pages to apply filtering and pagination
1022
- });
1023
- if (!results.data.length) {
1024
- return {
1025
- evals: [],
1026
- total: 0,
1027
- page,
1028
- perPage,
1029
- hasMore: false
1030
- };
1031
- }
1032
- let filteredData = results.data;
1033
- if (type) {
1034
- filteredData = filteredData.filter((evalRecord) => {
1035
- try {
1036
- const testInfo = evalRecord.test_info && typeof evalRecord.test_info === "string" ? JSON.parse(evalRecord.test_info) : void 0;
1037
- if (type === "test" && !testInfo) {
1038
- return false;
1039
- }
1040
- if (type === "live" && testInfo) {
1041
- return false;
1042
- }
1043
- } catch (e) {
1044
- this.logger.warn("Failed to parse test_info during filtering", { record: evalRecord, error: e });
1045
- }
1046
- return true;
1047
- });
1048
- }
1049
- if (dateRange) {
1050
- const fromDate = dateRange.start;
1051
- const toDate = dateRange.end;
1052
- filteredData = filteredData.filter((evalRecord) => {
1053
- const recordDate = new Date(evalRecord.created_at);
1054
- if (fromDate && recordDate < fromDate) {
1055
- return false;
1056
- }
1057
- if (toDate && recordDate > toDate) {
1058
- return false;
1059
- }
1060
- return true;
1061
- });
1062
- }
1063
- const total = filteredData.length;
1064
- const start = page * perPage;
1065
- const end = start + perPage;
1066
- const paginatedData = filteredData.slice(start, end);
1067
- const evals = paginatedData.map((evalRecord) => {
1068
- try {
1069
- return {
1070
- input: evalRecord.input,
1071
- output: evalRecord.output,
1072
- result: evalRecord.result && typeof evalRecord.result === "string" ? JSON.parse(evalRecord.result) : void 0,
1073
- agentName: evalRecord.agent_name,
1074
- createdAt: evalRecord.created_at,
1075
- metricName: evalRecord.metric_name,
1076
- instructions: evalRecord.instructions,
1077
- runId: evalRecord.run_id,
1078
- globalRunId: evalRecord.global_run_id,
1079
- testInfo: evalRecord.test_info && typeof evalRecord.test_info === "string" ? JSON.parse(evalRecord.test_info) : void 0
1080
- };
1081
- } catch (parseError) {
1082
- this.logger.error("Failed to parse eval record", { record: evalRecord, error: parseError });
1083
- return {
1084
- agentName: evalRecord.agent_name,
1085
- createdAt: evalRecord.created_at,
1086
- runId: evalRecord.run_id,
1087
- globalRunId: evalRecord.global_run_id
1088
- };
1089
- }
1090
- });
1091
- const hasMore = end < total;
1092
- return {
1093
- evals,
1094
- total,
1095
- page,
1096
- perPage,
1097
- hasMore
1098
- };
1099
- } catch (error) {
1100
- throw new MastraError(
1101
- {
1102
- id: "STORAGE_DYNAMODB_STORE_GET_EVALS_FAILED",
1103
- domain: ErrorDomain.STORAGE,
1104
- category: ErrorCategory.THIRD_PARTY,
1105
- details: {
1106
- agentName: agentName || "all",
1107
- type: type || "all",
1108
- page,
1109
- perPage
1110
- }
1111
- },
1112
- error
1113
- );
1114
- }
1115
- }
1116
- };
1117
936
  var MemoryStorageDynamoDB = class extends MemoryStorage {
1118
937
  service;
1119
938
  constructor({ service }) {
@@ -1132,17 +951,17 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1132
951
  };
1133
952
  }
1134
953
  // Helper function to transform and sort threads
1135
- transformAndSortThreads(rawThreads, orderBy, sortDirection) {
954
+ transformAndSortThreads(rawThreads, field, direction) {
1136
955
  return rawThreads.map((data) => ({
1137
956
  ...data,
1138
957
  // Convert date strings back to Date objects for consistency
1139
958
  createdAt: typeof data.createdAt === "string" ? new Date(data.createdAt) : data.createdAt,
1140
959
  updatedAt: typeof data.updatedAt === "string" ? new Date(data.updatedAt) : data.updatedAt
1141
960
  })).sort((a, b) => {
1142
- const fieldA = orderBy === "createdAt" ? a.createdAt : a.updatedAt;
1143
- const fieldB = orderBy === "createdAt" ? b.createdAt : b.updatedAt;
961
+ const fieldA = field === "createdAt" ? a.createdAt : a.updatedAt;
962
+ const fieldB = field === "createdAt" ? b.createdAt : b.updatedAt;
1144
963
  const comparison = fieldA.getTime() - fieldB.getTime();
1145
- return sortDirection === "DESC" ? -comparison : comparison;
964
+ return direction === "DESC" ? -comparison : comparison;
1146
965
  });
1147
966
  }
1148
967
  async getThreadById({ threadId }) {
@@ -1173,32 +992,6 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1173
992
  );
1174
993
  }
1175
994
  }
1176
- /**
1177
- * @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
1178
- */
1179
- async getThreadsByResourceId(args) {
1180
- const resourceId = args.resourceId;
1181
- const orderBy = this.castThreadOrderBy(args.orderBy);
1182
- const sortDirection = this.castThreadSortDirection(args.sortDirection);
1183
- this.logger.debug("Getting threads by resource ID", { resourceId, orderBy, sortDirection });
1184
- try {
1185
- const result = await this.service.entities.thread.query.byResource({ entity: "thread", resourceId }).go();
1186
- if (!result.data.length) {
1187
- return [];
1188
- }
1189
- return this.transformAndSortThreads(result.data, orderBy, sortDirection);
1190
- } catch (error) {
1191
- throw new MastraError(
1192
- {
1193
- id: "STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_FAILED",
1194
- domain: ErrorDomain.STORAGE,
1195
- category: ErrorCategory.THIRD_PARTY,
1196
- details: { resourceId }
1197
- },
1198
- error
1199
- );
1200
- }
1201
- }
1202
995
  async saveThread({ thread }) {
1203
996
  this.logger.debug("Saving thread", { threadId: thread.id });
1204
997
  const now = /* @__PURE__ */ new Date();
@@ -1218,7 +1011,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1218
1011
  resourceId: thread.resourceId,
1219
1012
  title: threadData.title,
1220
1013
  createdAt: thread.createdAt || now,
1221
- updatedAt: now,
1014
+ updatedAt: thread.updatedAt || now,
1222
1015
  metadata: thread.metadata
1223
1016
  };
1224
1017
  } catch (error) {
@@ -1278,7 +1071,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1278
1071
  async deleteThread({ threadId }) {
1279
1072
  this.logger.debug("Deleting thread", { threadId });
1280
1073
  try {
1281
- const messages = await this.getMessages({ threadId });
1074
+ const { messages } = await this.listMessages({ threadId, perPage: false });
1282
1075
  if (messages.length > 0) {
1283
1076
  const batchSize = 25;
1284
1077
  for (let i = 0; i < messages.length; i += batchSize) {
@@ -1307,104 +1100,175 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1307
1100
  );
1308
1101
  }
1309
1102
  }
1310
- async getMessages({
1311
- threadId,
1312
- resourceId,
1313
- selectBy,
1314
- format
1315
- }) {
1316
- this.logger.debug("Getting messages", { threadId, selectBy });
1103
+ async listMessagesById({ messageIds }) {
1104
+ this.logger.debug("Getting messages by ID", { messageIds });
1105
+ if (messageIds.length === 0) return { messages: [] };
1317
1106
  try {
1318
- if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1319
- const messages = [];
1320
- const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1321
- if (selectBy?.include?.length) {
1322
- const includeMessages = await this._getIncludedMessages(threadId, selectBy);
1323
- if (includeMessages) {
1324
- messages.push(...includeMessages);
1325
- }
1326
- }
1327
- if (limit !== 0) {
1328
- const query = this.service.entities.message.query.byThread({ entity: "message", threadId });
1329
- let results;
1330
- if (limit !== Number.MAX_SAFE_INTEGER && limit > 0) {
1331
- results = await query.go({ limit, order: "desc" });
1332
- results.data = results.data.reverse();
1333
- } else {
1334
- results = await query.go();
1335
- }
1336
- let allThreadMessages = results.data.map((data) => this.parseMessageData(data)).filter((msg) => "content" in msg);
1337
- allThreadMessages.sort((a, b) => {
1338
- const timeA = a.createdAt.getTime();
1339
- const timeB = b.createdAt.getTime();
1340
- if (timeA === timeB) {
1341
- return a.id.localeCompare(b.id);
1342
- }
1343
- return timeA - timeB;
1344
- });
1345
- messages.push(...allThreadMessages);
1346
- }
1347
- messages.sort((a, b) => {
1348
- const timeA = a.createdAt.getTime();
1349
- const timeB = b.createdAt.getTime();
1350
- if (timeA === timeB) {
1351
- return a.id.localeCompare(b.id);
1352
- }
1353
- return timeA - timeB;
1354
- });
1355
- const uniqueMessages = messages.filter(
1107
+ const results = await Promise.all(
1108
+ messageIds.map((id) => this.service.entities.message.query.primary({ entity: "message", id }).go())
1109
+ );
1110
+ const data = results.map((result) => result.data).flat(1);
1111
+ let parsedMessages = data.map((data2) => this.parseMessageData(data2)).filter((msg) => "content" in msg);
1112
+ const uniqueMessages = parsedMessages.filter(
1356
1113
  (message, index, self) => index === self.findIndex((m) => m.id === message.id)
1357
1114
  );
1358
- const list = new MessageList({ threadId, resourceId }).add(uniqueMessages, "memory");
1359
- if (format === `v2`) return list.get.all.v2();
1360
- return list.get.all.v1();
1115
+ const list = new MessageList().add(uniqueMessages, "memory");
1116
+ return { messages: list.get.all.db() };
1361
1117
  } catch (error) {
1362
1118
  throw new MastraError(
1363
1119
  {
1364
- id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED",
1120
+ id: "STORAGE_DYNAMODB_STORE_LIST_MESSAGES_BY_ID_FAILED",
1365
1121
  domain: ErrorDomain.STORAGE,
1366
1122
  category: ErrorCategory.THIRD_PARTY,
1367
- details: { threadId, resourceId: resourceId ?? "" }
1123
+ details: { messageIds: JSON.stringify(messageIds) }
1368
1124
  },
1369
1125
  error
1370
1126
  );
1371
1127
  }
1372
1128
  }
1373
- async getMessagesById({
1374
- messageIds,
1375
- format
1376
- }) {
1377
- this.logger.debug("Getting messages by ID", { messageIds });
1378
- if (messageIds.length === 0) return [];
1379
- try {
1380
- const results = await Promise.all(
1381
- messageIds.map((id) => this.service.entities.message.query.primary({ entity: "message", id }).go())
1382
- );
1383
- const data = results.map((result) => result.data).flat(1);
1384
- let parsedMessages = data.map((data2) => this.parseMessageData(data2)).filter((msg) => "content" in msg);
1385
- const uniqueMessages = parsedMessages.filter(
1386
- (message, index, self) => index === self.findIndex((m) => m.id === message.id)
1129
+ async listMessages(args) {
1130
+ const { threadId, resourceId, include, filter, perPage: perPageInput, page = 0, orderBy } = args;
1131
+ if (!threadId.trim()) {
1132
+ throw new MastraError(
1133
+ {
1134
+ id: "STORAGE_DYNAMODB_LIST_MESSAGES_INVALID_THREAD_ID",
1135
+ domain: ErrorDomain.STORAGE,
1136
+ category: ErrorCategory.THIRD_PARTY,
1137
+ details: { threadId }
1138
+ },
1139
+ new Error("threadId must be a non-empty string")
1387
1140
  );
1388
- const list = new MessageList().add(uniqueMessages, "memory");
1389
- if (format === `v1`) return list.get.all.v1();
1390
- return list.get.all.v2();
1141
+ }
1142
+ const perPage = normalizePerPage(perPageInput, 40);
1143
+ const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
1144
+ try {
1145
+ if (page < 0) {
1146
+ throw new MastraError(
1147
+ {
1148
+ id: "STORAGE_DYNAMODB_LIST_MESSAGES_INVALID_PAGE",
1149
+ domain: ErrorDomain.STORAGE,
1150
+ category: ErrorCategory.USER,
1151
+ details: { page }
1152
+ },
1153
+ new Error("page must be >= 0")
1154
+ );
1155
+ }
1156
+ const { field, direction } = this.parseOrderBy(orderBy, "ASC");
1157
+ this.logger.debug("Getting messages with listMessages", {
1158
+ threadId,
1159
+ resourceId,
1160
+ perPageInput,
1161
+ offset,
1162
+ perPage,
1163
+ page,
1164
+ field,
1165
+ direction
1166
+ });
1167
+ const query = this.service.entities.message.query.byThread({ entity: "message", threadId });
1168
+ const results = await query.go();
1169
+ let allThreadMessages = results.data.map((data) => this.parseMessageData(data)).filter((msg) => "content" in msg && typeof msg.content === "object");
1170
+ if (resourceId) {
1171
+ allThreadMessages = allThreadMessages.filter((msg) => msg.resourceId === resourceId);
1172
+ }
1173
+ if (filter?.dateRange) {
1174
+ const dateRange = filter.dateRange;
1175
+ allThreadMessages = allThreadMessages.filter((msg) => {
1176
+ const createdAt = new Date(msg.createdAt).getTime();
1177
+ if (dateRange.start) {
1178
+ const startTime = dateRange.start instanceof Date ? dateRange.start.getTime() : new Date(dateRange.start).getTime();
1179
+ if (createdAt < startTime) return false;
1180
+ }
1181
+ if (dateRange.end) {
1182
+ const endTime = dateRange.end instanceof Date ? dateRange.end.getTime() : new Date(dateRange.end).getTime();
1183
+ if (createdAt > endTime) return false;
1184
+ }
1185
+ return true;
1186
+ });
1187
+ }
1188
+ allThreadMessages.sort((a, b) => {
1189
+ const aValue = field === "createdAt" ? new Date(a.createdAt).getTime() : a[field];
1190
+ const bValue = field === "createdAt" ? new Date(b.createdAt).getTime() : b[field];
1191
+ if (aValue === bValue) {
1192
+ return a.id.localeCompare(b.id);
1193
+ }
1194
+ return direction === "ASC" ? aValue - bValue : bValue - aValue;
1195
+ });
1196
+ const total = allThreadMessages.length;
1197
+ const paginatedMessages = allThreadMessages.slice(offset, offset + perPage);
1198
+ const paginatedCount = paginatedMessages.length;
1199
+ if (total === 0 && paginatedCount === 0 && (!include || include.length === 0)) {
1200
+ return {
1201
+ messages: [],
1202
+ total: 0,
1203
+ page,
1204
+ perPage: perPageForResponse,
1205
+ hasMore: false
1206
+ };
1207
+ }
1208
+ const messageIds = new Set(paginatedMessages.map((m) => m.id));
1209
+ let includeMessages = [];
1210
+ if (include && include.length > 0) {
1211
+ const selectBy = { include };
1212
+ includeMessages = await this._getIncludedMessages(threadId, selectBy);
1213
+ for (const includeMsg of includeMessages) {
1214
+ if (!messageIds.has(includeMsg.id)) {
1215
+ paginatedMessages.push(includeMsg);
1216
+ messageIds.add(includeMsg.id);
1217
+ }
1218
+ }
1219
+ }
1220
+ const list = new MessageList().add(paginatedMessages, "memory");
1221
+ let finalMessages = list.get.all.db();
1222
+ finalMessages = finalMessages.sort((a, b) => {
1223
+ const aValue = field === "createdAt" ? new Date(a.createdAt).getTime() : a[field];
1224
+ const bValue = field === "createdAt" ? new Date(b.createdAt).getTime() : b[field];
1225
+ if (aValue === bValue) {
1226
+ return a.id.localeCompare(b.id);
1227
+ }
1228
+ return direction === "ASC" ? aValue - bValue : bValue - aValue;
1229
+ });
1230
+ const returnedThreadMessageIds = new Set(finalMessages.filter((m) => m.threadId === threadId).map((m) => m.id));
1231
+ const allThreadMessagesReturned = returnedThreadMessageIds.size >= total;
1232
+ let hasMore = false;
1233
+ if (perPageInput !== false && !allThreadMessagesReturned) {
1234
+ hasMore = offset + paginatedCount < total;
1235
+ }
1236
+ return {
1237
+ messages: finalMessages,
1238
+ total,
1239
+ page,
1240
+ perPage: perPageForResponse,
1241
+ hasMore
1242
+ };
1391
1243
  } catch (error) {
1392
- throw new MastraError(
1244
+ const mastraError = new MastraError(
1393
1245
  {
1394
- id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_BY_ID_FAILED",
1246
+ id: "STORAGE_DYNAMODB_STORE_LIST_MESSAGES_FAILED",
1395
1247
  domain: ErrorDomain.STORAGE,
1396
1248
  category: ErrorCategory.THIRD_PARTY,
1397
- details: { messageIds: JSON.stringify(messageIds) }
1249
+ details: {
1250
+ threadId,
1251
+ resourceId: resourceId ?? ""
1252
+ }
1398
1253
  },
1399
1254
  error
1400
1255
  );
1256
+ this.logger?.error?.(mastraError.toString());
1257
+ this.logger?.trackException?.(mastraError);
1258
+ return {
1259
+ messages: [],
1260
+ total: 0,
1261
+ page,
1262
+ perPage: perPageForResponse,
1263
+ hasMore: false
1264
+ };
1401
1265
  }
1402
1266
  }
1403
1267
  async saveMessages(args) {
1404
- const { messages, format = "v1" } = args;
1268
+ const { messages } = args;
1405
1269
  this.logger.debug("Saving messages", { count: messages.length });
1406
1270
  if (!messages.length) {
1407
- return [];
1271
+ return { messages: [] };
1408
1272
  }
1409
1273
  const threadId = messages[0]?.threadId;
1410
1274
  if (!threadId) {
@@ -1458,8 +1322,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1458
1322
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1459
1323
  }).go();
1460
1324
  const list = new MessageList().add(messages, "memory");
1461
- if (format === `v1`) return list.get.all.v1();
1462
- return list.get.all.v2();
1325
+ return { messages: list.get.all.db() };
1463
1326
  } catch (error) {
1464
1327
  throw new MastraError(
1465
1328
  {
@@ -1472,37 +1335,48 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1472
1335
  );
1473
1336
  }
1474
1337
  }
1475
- async getThreadsByResourceIdPaginated(args) {
1476
- const { resourceId, page = 0, perPage = 100 } = args;
1477
- const orderBy = this.castThreadOrderBy(args.orderBy);
1478
- const sortDirection = this.castThreadSortDirection(args.sortDirection);
1338
+ async listThreadsByResourceId(args) {
1339
+ const { resourceId, page = 0, perPage: perPageInput, orderBy } = args;
1340
+ const perPage = normalizePerPage(perPageInput, 100);
1341
+ if (page < 0) {
1342
+ throw new MastraError(
1343
+ {
1344
+ id: "STORAGE_DYNAMODB_LIST_THREADS_BY_RESOURCE_ID_INVALID_PAGE",
1345
+ domain: ErrorDomain.STORAGE,
1346
+ category: ErrorCategory.USER,
1347
+ details: { page }
1348
+ },
1349
+ new Error("page must be >= 0")
1350
+ );
1351
+ }
1352
+ const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
1353
+ const { field, direction } = this.parseOrderBy(orderBy);
1479
1354
  this.logger.debug("Getting threads by resource ID with pagination", {
1480
1355
  resourceId,
1481
1356
  page,
1482
1357
  perPage,
1483
- orderBy,
1484
- sortDirection
1358
+ field,
1359
+ direction
1485
1360
  });
1486
1361
  try {
1487
1362
  const query = this.service.entities.thread.query.byResource({ entity: "thread", resourceId });
1488
1363
  const results = await query.go();
1489
- const allThreads = this.transformAndSortThreads(results.data, orderBy, sortDirection);
1490
- const startIndex = page * perPage;
1491
- const endIndex = startIndex + perPage;
1492
- const paginatedThreads = allThreads.slice(startIndex, endIndex);
1364
+ const allThreads = this.transformAndSortThreads(results.data, field, direction);
1365
+ const endIndex = offset + perPage;
1366
+ const paginatedThreads = allThreads.slice(offset, endIndex);
1493
1367
  const total = allThreads.length;
1494
- const hasMore = endIndex < total;
1368
+ const hasMore = offset + perPage < total;
1495
1369
  return {
1496
1370
  threads: paginatedThreads,
1497
1371
  total,
1498
1372
  page,
1499
- perPage,
1373
+ perPage: perPageForResponse,
1500
1374
  hasMore
1501
1375
  };
1502
1376
  } catch (error) {
1503
1377
  throw new MastraError(
1504
1378
  {
1505
- id: "STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_PAGINATED_FAILED",
1379
+ id: "DYNAMODB_STORAGE_LIST_THREADS_BY_RESOURCE_ID_FAILED",
1506
1380
  domain: ErrorDomain.STORAGE,
1507
1381
  category: ErrorCategory.THIRD_PARTY,
1508
1382
  details: { resourceId, page, perPage }
@@ -1511,84 +1385,6 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1511
1385
  );
1512
1386
  }
1513
1387
  }
1514
- async getMessagesPaginated(args) {
1515
- const { threadId, resourceId, selectBy, format = "v1" } = args;
1516
- const { page = 0, perPage = 40, dateRange } = selectBy?.pagination || {};
1517
- const fromDate = dateRange?.start;
1518
- const toDate = dateRange?.end;
1519
- const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1520
- this.logger.debug("Getting messages with pagination", { threadId, page, perPage, fromDate, toDate, limit });
1521
- try {
1522
- if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1523
- let messages = [];
1524
- if (selectBy?.include?.length) {
1525
- const includeMessages = await this._getIncludedMessages(threadId, selectBy);
1526
- if (includeMessages) {
1527
- messages.push(...includeMessages);
1528
- }
1529
- }
1530
- if (limit !== 0) {
1531
- const query = this.service.entities.message.query.byThread({ entity: "message", threadId });
1532
- let results;
1533
- if (limit !== Number.MAX_SAFE_INTEGER && limit > 0) {
1534
- results = await query.go({ limit, order: "desc" });
1535
- results.data = results.data.reverse();
1536
- } else {
1537
- results = await query.go();
1538
- }
1539
- let allThreadMessages = results.data.map((data) => this.parseMessageData(data)).filter((msg) => "content" in msg);
1540
- allThreadMessages.sort((a, b) => {
1541
- const timeA = a.createdAt.getTime();
1542
- const timeB = b.createdAt.getTime();
1543
- if (timeA === timeB) {
1544
- return a.id.localeCompare(b.id);
1545
- }
1546
- return timeA - timeB;
1547
- });
1548
- const excludeIds = messages.map((m) => m.id);
1549
- if (excludeIds.length > 0) {
1550
- allThreadMessages = allThreadMessages.filter((msg) => !excludeIds.includes(msg.id));
1551
- }
1552
- messages.push(...allThreadMessages);
1553
- }
1554
- messages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
1555
- if (fromDate || toDate) {
1556
- messages = messages.filter((msg) => {
1557
- const createdAt = new Date(msg.createdAt).getTime();
1558
- if (fromDate && createdAt < new Date(fromDate).getTime()) return false;
1559
- if (toDate && createdAt > new Date(toDate).getTime()) return false;
1560
- return true;
1561
- });
1562
- }
1563
- const total = messages.length;
1564
- const start = page * perPage;
1565
- const end = start + perPage;
1566
- const paginatedMessages = messages.slice(start, end);
1567
- const hasMore = end < total;
1568
- const list = new MessageList({ threadId, resourceId }).add(paginatedMessages, "memory");
1569
- const finalMessages = format === "v2" ? list.get.all.v2() : list.get.all.v1();
1570
- return {
1571
- messages: finalMessages,
1572
- total,
1573
- page,
1574
- perPage,
1575
- hasMore
1576
- };
1577
- } catch (error) {
1578
- const mastraError = new MastraError(
1579
- {
1580
- id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
1581
- domain: ErrorDomain.STORAGE,
1582
- category: ErrorCategory.THIRD_PARTY,
1583
- details: { threadId, resourceId: resourceId ?? "" }
1584
- },
1585
- error
1586
- );
1587
- this.logger?.trackException?.(mastraError);
1588
- this.logger?.error?.(mastraError.toString());
1589
- return { messages: [], total: 0, page, perPage, hasMore: false };
1590
- }
1591
- }
1592
1388
  // Helper method to get included messages with context
1593
1389
  async _getIncludedMessages(threadId, selectBy) {
1594
1390
  if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
@@ -1855,11 +1651,10 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1855
1651
  [TABLE_THREADS]: "thread",
1856
1652
  [TABLE_MESSAGES]: "message",
1857
1653
  [TABLE_WORKFLOW_SNAPSHOT]: "workflow_snapshot",
1858
- [TABLE_EVALS]: "eval",
1859
1654
  [TABLE_SCORERS]: "score",
1860
1655
  [TABLE_TRACES]: "trace",
1861
1656
  [TABLE_RESOURCES]: "resource",
1862
- [TABLE_AI_SPANS]: "ai_span"
1657
+ [TABLE_SPANS]: "ai_span"
1863
1658
  };
1864
1659
  return mapping[tableName] || null;
1865
1660
  }
@@ -2224,7 +2019,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2224
2019
  input: typeof validatedScore.input === "string" ? validatedScore.input : JSON.stringify(validatedScore.input),
2225
2020
  output: typeof validatedScore.output === "string" ? validatedScore.output : JSON.stringify(validatedScore.output),
2226
2021
  additionalContext: typeof validatedScore.additionalContext === "string" ? validatedScore.additionalContext : JSON.stringify(validatedScore.additionalContext),
2227
- runtimeContext: typeof validatedScore.runtimeContext === "string" ? validatedScore.runtimeContext : JSON.stringify(validatedScore.runtimeContext),
2022
+ requestContext: typeof validatedScore.requestContext === "string" ? validatedScore.requestContext : JSON.stringify(validatedScore.requestContext),
2228
2023
  entityType: validatedScore.entityType,
2229
2024
  entityData: typeof validatedScore.entity === "string" ? validatedScore.entity : JSON.stringify(validatedScore.entity),
2230
2025
  entityId: validatedScore.entityId,
@@ -2255,7 +2050,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2255
2050
  );
2256
2051
  }
2257
2052
  }
2258
- async getScoresByScorerId({
2053
+ async listScoresByScorerId({
2259
2054
  scorerId,
2260
2055
  pagination,
2261
2056
  entityId,
@@ -2276,18 +2071,19 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2276
2071
  allScores = allScores.filter((score) => score.source === source);
2277
2072
  }
2278
2073
  allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2279
- const startIndex = pagination.page * pagination.perPage;
2280
- const endIndex = startIndex + pagination.perPage;
2281
- const paginatedScores = allScores.slice(startIndex, endIndex);
2074
+ const { page, perPage: perPageInput } = pagination;
2075
+ const perPage = normalizePerPage(perPageInput, Number.MAX_SAFE_INTEGER);
2076
+ const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
2282
2077
  const total = allScores.length;
2283
- const hasMore = endIndex < total;
2078
+ const end = perPageInput === false ? allScores.length : start + perPage;
2079
+ const paginatedScores = allScores.slice(start, end);
2284
2080
  return {
2285
2081
  scores: paginatedScores,
2286
2082
  pagination: {
2287
2083
  total,
2288
- page: pagination.page,
2289
- perPage: pagination.perPage,
2290
- hasMore
2084
+ page,
2085
+ perPage: perPageForResponse,
2086
+ hasMore: end < total
2291
2087
  }
2292
2088
  };
2293
2089
  } catch (error) {
@@ -2309,7 +2105,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2309
2105
  );
2310
2106
  }
2311
2107
  }
2312
- async getScoresByRunId({
2108
+ async listScoresByRunId({
2313
2109
  runId,
2314
2110
  pagination
2315
2111
  }) {
@@ -2319,18 +2115,19 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2319
2115
  const results = await query.go();
2320
2116
  const allScores = results.data.map((data) => this.parseScoreData(data));
2321
2117
  allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2322
- const startIndex = pagination.page * pagination.perPage;
2323
- const endIndex = startIndex + pagination.perPage;
2324
- const paginatedScores = allScores.slice(startIndex, endIndex);
2118
+ const { page, perPage: perPageInput } = pagination;
2119
+ const perPage = normalizePerPage(perPageInput, Number.MAX_SAFE_INTEGER);
2120
+ const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
2325
2121
  const total = allScores.length;
2326
- const hasMore = endIndex < total;
2122
+ const end = perPageInput === false ? allScores.length : start + perPage;
2123
+ const paginatedScores = allScores.slice(start, end);
2327
2124
  return {
2328
2125
  scores: paginatedScores,
2329
2126
  pagination: {
2330
2127
  total,
2331
- page: pagination.page,
2332
- perPage: pagination.perPage,
2333
- hasMore
2128
+ page,
2129
+ perPage: perPageForResponse,
2130
+ hasMore: end < total
2334
2131
  }
2335
2132
  };
2336
2133
  } catch (error) {
@@ -2345,7 +2142,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2345
2142
  );
2346
2143
  }
2347
2144
  }
2348
- async getScoresByEntityId({
2145
+ async listScoresByEntityId({
2349
2146
  entityId,
2350
2147
  entityType,
2351
2148
  pagination
@@ -2357,18 +2154,19 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2357
2154
  let allScores = results.data.map((data) => this.parseScoreData(data));
2358
2155
  allScores = allScores.filter((score) => score.entityType === entityType);
2359
2156
  allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2360
- const startIndex = pagination.page * pagination.perPage;
2361
- const endIndex = startIndex + pagination.perPage;
2362
- const paginatedScores = allScores.slice(startIndex, endIndex);
2157
+ const { page, perPage: perPageInput } = pagination;
2158
+ const perPage = normalizePerPage(perPageInput, Number.MAX_SAFE_INTEGER);
2159
+ const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
2363
2160
  const total = allScores.length;
2364
- const hasMore = endIndex < total;
2161
+ const end = perPageInput === false ? allScores.length : start + perPage;
2162
+ const paginatedScores = allScores.slice(start, end);
2365
2163
  return {
2366
2164
  scores: paginatedScores,
2367
2165
  pagination: {
2368
2166
  total,
2369
- page: pagination.page,
2370
- perPage: pagination.perPage,
2371
- hasMore
2167
+ page,
2168
+ perPage: perPageForResponse,
2169
+ hasMore: end < total
2372
2170
  }
2373
2171
  };
2374
2172
  } catch (error) {
@@ -2383,7 +2181,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2383
2181
  );
2384
2182
  }
2385
2183
  }
2386
- async getScoresBySpan({
2184
+ async listScoresBySpan({
2387
2185
  traceId,
2388
2186
  spanId,
2389
2187
  pagination
@@ -2394,18 +2192,19 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2394
2192
  const results = await query.go();
2395
2193
  const allScores = results.data.map((data) => this.parseScoreData(data));
2396
2194
  allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2397
- const startIndex = pagination.page * pagination.perPage;
2398
- const endIndex = startIndex + pagination.perPage;
2399
- const paginatedScores = allScores.slice(startIndex, endIndex);
2195
+ const { page, perPage: perPageInput } = pagination;
2196
+ const perPage = normalizePerPage(perPageInput, Number.MAX_SAFE_INTEGER);
2197
+ const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
2400
2198
  const total = allScores.length;
2401
- const hasMore = endIndex < total;
2199
+ const end = perPageInput === false ? allScores.length : start + perPage;
2200
+ const paginatedScores = allScores.slice(start, end);
2402
2201
  return {
2403
2202
  scores: paginatedScores,
2404
2203
  pagination: {
2405
2204
  total,
2406
- page: pagination.page,
2407
- perPage: pagination.perPage,
2408
- hasMore
2205
+ page,
2206
+ perPage: perPageForResponse,
2207
+ hasMore: end < total
2409
2208
  }
2410
2209
  };
2411
2210
  } catch (error) {
@@ -2442,7 +2241,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2442
2241
  // runId,
2443
2242
  // stepId,
2444
2243
  // result,
2445
- // runtimeContext,
2244
+ // requestContext,
2446
2245
  }) {
2447
2246
  throw new Error("Method not implemented.");
2448
2247
  }
@@ -2469,7 +2268,6 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2469
2268
  workflow_name: workflowName,
2470
2269
  run_id: runId,
2471
2270
  snapshot: JSON.stringify(snapshot),
2472
- // Stringify the snapshot object
2473
2271
  createdAt: now,
2474
2272
  updatedAt: now,
2475
2273
  resourceId
@@ -2515,11 +2313,24 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2515
2313
  );
2516
2314
  }
2517
2315
  }
2518
- async getWorkflowRuns(args) {
2316
+ async listWorkflowRuns(args) {
2519
2317
  this.logger.debug("Getting workflow runs", { args });
2520
2318
  try {
2521
- const limit = args?.limit || 10;
2522
- const offset = args?.offset || 0;
2319
+ const perPage = args?.perPage !== void 0 ? args.perPage : 10;
2320
+ const page = args?.page !== void 0 ? args.page : 0;
2321
+ if (page < 0) {
2322
+ throw new MastraError(
2323
+ {
2324
+ id: "DYNAMODB_STORE_INVALID_PAGE",
2325
+ domain: ErrorDomain.STORAGE,
2326
+ category: ErrorCategory.USER,
2327
+ details: { page }
2328
+ },
2329
+ new Error("page must be >= 0")
2330
+ );
2331
+ }
2332
+ const normalizedPerPage = normalizePerPage(perPage, 10);
2333
+ const offset = page * normalizedPerPage;
2523
2334
  let query;
2524
2335
  if (args?.workflowName) {
2525
2336
  query = this.service.entities.workflow_snapshot.query.primary({
@@ -2541,6 +2352,11 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2541
2352
  });
2542
2353
  if (pageResults.data && pageResults.data.length > 0) {
2543
2354
  let pageFilteredData = pageResults.data;
2355
+ if (args?.status) {
2356
+ pageFilteredData = pageFilteredData.filter((snapshot) => {
2357
+ return snapshot.snapshot.status === args.status;
2358
+ });
2359
+ }
2544
2360
  if (args?.fromDate || args?.toDate) {
2545
2361
  pageFilteredData = pageFilteredData.filter((snapshot) => {
2546
2362
  const createdAt = new Date(snapshot.createdAt);
@@ -2566,7 +2382,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2566
2382
  return { runs: [], total: 0 };
2567
2383
  }
2568
2384
  const total = allMatchingSnapshots.length;
2569
- const paginatedData = allMatchingSnapshots.slice(offset, offset + limit);
2385
+ const paginatedData = allMatchingSnapshots.slice(offset, offset + normalizedPerPage);
2570
2386
  const runs = paginatedData.map((snapshot) => formatWorkflowRun(snapshot));
2571
2387
  return {
2572
2388
  runs,
@@ -2575,7 +2391,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2575
2391
  } catch (error) {
2576
2392
  throw new MastraError(
2577
2393
  {
2578
- id: "STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUNS_FAILED",
2394
+ id: "STORAGE_DYNAMODB_STORE_LIST_WORKFLOW_RUNS_FAILED",
2579
2395
  domain: ErrorDomain.STORAGE,
2580
2396
  category: ErrorCategory.THIRD_PARTY,
2581
2397
  details: { workflowName: args?.workflowName || "", resourceId: args?.resourceId || "" }
@@ -2648,7 +2464,7 @@ var DynamoDBStore = class extends MastraStorage {
2648
2464
  hasInitialized = null;
2649
2465
  stores;
2650
2466
  constructor({ name, config }) {
2651
- super({ name });
2467
+ super({ id: config.id, name });
2652
2468
  try {
2653
2469
  if (!config.tableName || typeof config.tableName !== "string" || config.tableName.trim() === "") {
2654
2470
  throw new Error("DynamoDBStore: config.tableName must be provided and cannot be empty.");
@@ -2676,7 +2492,6 @@ var DynamoDBStore = class extends MastraStorage {
2676
2492
  const scores = new ScoresStorageDynamoDB({ service: this.service });
2677
2493
  this.stores = {
2678
2494
  operations,
2679
- legacyEvals: new LegacyEvalsDynamoDB({ service: this.service, tableName: this.tableName }),
2680
2495
  workflows,
2681
2496
  memory,
2682
2497
  scores
@@ -2699,7 +2514,7 @@ var DynamoDBStore = class extends MastraStorage {
2699
2514
  hasColumn: false,
2700
2515
  createTable: false,
2701
2516
  deleteMessages: false,
2702
- getScoresBySpan: true
2517
+ listScoresBySpan: true
2703
2518
  };
2704
2519
  }
2705
2520
  /**
@@ -2794,9 +2609,6 @@ var DynamoDBStore = class extends MastraStorage {
2794
2609
  async getThreadById({ threadId }) {
2795
2610
  return this.stores.memory.getThreadById({ threadId });
2796
2611
  }
2797
- async getThreadsByResourceId(args) {
2798
- return this.stores.memory.getThreadsByResourceId(args);
2799
- }
2800
2612
  async saveThread({ thread }) {
2801
2613
  return this.stores.memory.saveThread({ thread });
2802
2614
  }
@@ -2810,29 +2622,12 @@ var DynamoDBStore = class extends MastraStorage {
2810
2622
  async deleteThread({ threadId }) {
2811
2623
  return this.stores.memory.deleteThread({ threadId });
2812
2624
  }
2813
- async getMessages({
2814
- threadId,
2815
- resourceId,
2816
- selectBy,
2817
- format
2818
- }) {
2819
- return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format });
2820
- }
2821
- async getMessagesById({
2822
- messageIds,
2823
- format
2824
- }) {
2825
- return this.stores.memory.getMessagesById({ messageIds, format });
2625
+ async listMessagesById(args) {
2626
+ return this.stores.memory.listMessagesById(args);
2826
2627
  }
2827
2628
  async saveMessages(args) {
2828
2629
  return this.stores.memory.saveMessages(args);
2829
2630
  }
2830
- async getThreadsByResourceIdPaginated(args) {
2831
- return this.stores.memory.getThreadsByResourceIdPaginated(args);
2832
- }
2833
- async getMessagesPaginated(args) {
2834
- return this.stores.memory.getMessagesPaginated(args);
2835
- }
2836
2631
  async updateMessages(_args) {
2837
2632
  return this.stores.memory.updateMessages(_args);
2838
2633
  }
@@ -2842,9 +2637,9 @@ var DynamoDBStore = class extends MastraStorage {
2842
2637
  runId,
2843
2638
  stepId,
2844
2639
  result,
2845
- runtimeContext
2640
+ requestContext
2846
2641
  }) {
2847
- return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
2642
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, requestContext });
2848
2643
  }
2849
2644
  async updateWorkflowState({
2850
2645
  workflowName,
@@ -2867,8 +2662,8 @@ var DynamoDBStore = class extends MastraStorage {
2867
2662
  }) {
2868
2663
  return this.stores.workflows.loadWorkflowSnapshot({ workflowName, runId });
2869
2664
  }
2870
- async getWorkflowRuns(args) {
2871
- return this.stores.workflows.getWorkflowRuns(args);
2665
+ async listWorkflowRuns(args) {
2666
+ return this.stores.workflows.listWorkflowRuns(args);
2872
2667
  }
2873
2668
  async getWorkflowRunById(args) {
2874
2669
  return this.stores.workflows.getWorkflowRunById(args);
@@ -2886,13 +2681,6 @@ var DynamoDBStore = class extends MastraStorage {
2886
2681
  }) {
2887
2682
  return this.stores.memory.updateResource({ resourceId, workingMemory, metadata });
2888
2683
  }
2889
- // Eval operations
2890
- async getEvalsByAgentName(agentName, type) {
2891
- return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
2892
- }
2893
- async getEvals(options) {
2894
- return this.stores.legacyEvals.getEvals(options);
2895
- }
2896
2684
  /**
2897
2685
  * Closes the DynamoDB client connection and cleans up resources.
2898
2686
  * Should be called when the store is no longer needed, e.g., at the end of tests or application shutdown.
@@ -2922,38 +2710,38 @@ var DynamoDBStore = class extends MastraStorage {
2922
2710
  async saveScore(_score) {
2923
2711
  return this.stores.scores.saveScore(_score);
2924
2712
  }
2925
- async getScoresByRunId({
2713
+ async listScoresByRunId({
2926
2714
  runId: _runId,
2927
2715
  pagination: _pagination
2928
2716
  }) {
2929
- return this.stores.scores.getScoresByRunId({ runId: _runId, pagination: _pagination });
2717
+ return this.stores.scores.listScoresByRunId({ runId: _runId, pagination: _pagination });
2930
2718
  }
2931
- async getScoresByEntityId({
2719
+ async listScoresByEntityId({
2932
2720
  entityId: _entityId,
2933
2721
  entityType: _entityType,
2934
2722
  pagination: _pagination
2935
2723
  }) {
2936
- return this.stores.scores.getScoresByEntityId({
2724
+ return this.stores.scores.listScoresByEntityId({
2937
2725
  entityId: _entityId,
2938
2726
  entityType: _entityType,
2939
2727
  pagination: _pagination
2940
2728
  });
2941
2729
  }
2942
- async getScoresByScorerId({
2730
+ async listScoresByScorerId({
2943
2731
  scorerId,
2944
2732
  source,
2945
2733
  entityId,
2946
2734
  entityType,
2947
2735
  pagination
2948
2736
  }) {
2949
- return this.stores.scores.getScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
2737
+ return this.stores.scores.listScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
2950
2738
  }
2951
- async getScoresBySpan({
2739
+ async listScoresBySpan({
2952
2740
  traceId,
2953
2741
  spanId,
2954
2742
  pagination
2955
2743
  }) {
2956
- return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
2744
+ return this.stores.scores.listScoresBySpan({ traceId, spanId, pagination });
2957
2745
  }
2958
2746
  };
2959
2747