@mastra/dynamodb 1.0.0-beta.2 → 1.0.0-beta.4

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,7 +1,7 @@
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, normalizePerPage, MemoryStorage, calculatePagination, ScoresStorage, SCORERS_SCHEMA, TABLE_SPANS, TABLE_RESOURCES, TABLE_TRACES, TABLE_SCORERS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
4
+ import { MastraStorage, createStorageErrorId, StoreOperations, WorkflowsStorage, normalizePerPage, MemoryStorage, calculatePagination, ScoresStorage, SCORERS_SCHEMA, 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
7
  import { saveScorePayloadSchema } from '@mastra/core/evals';
@@ -987,7 +987,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
987
987
  } catch (error) {
988
988
  throw new MastraError(
989
989
  {
990
- id: "STORAGE_DYNAMODB_STORE_GET_THREAD_BY_ID_FAILED",
990
+ id: createStorageErrorId("DYNAMODB", "GET_THREAD_BY_ID", "FAILED"),
991
991
  domain: ErrorDomain.STORAGE,
992
992
  category: ErrorCategory.THIRD_PARTY,
993
993
  details: { threadId }
@@ -1021,7 +1021,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1021
1021
  } catch (error) {
1022
1022
  throw new MastraError(
1023
1023
  {
1024
- id: "STORAGE_DYNAMODB_STORE_SAVE_THREAD_FAILED",
1024
+ id: createStorageErrorId("DYNAMODB", "SAVE_THREAD", "FAILED"),
1025
1025
  domain: ErrorDomain.STORAGE,
1026
1026
  category: ErrorCategory.THIRD_PARTY,
1027
1027
  details: { threadId: thread.id }
@@ -1063,7 +1063,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1063
1063
  } catch (error) {
1064
1064
  throw new MastraError(
1065
1065
  {
1066
- id: "STORAGE_DYNAMODB_STORE_UPDATE_THREAD_FAILED",
1066
+ id: createStorageErrorId("DYNAMODB", "UPDATE_THREAD", "FAILED"),
1067
1067
  domain: ErrorDomain.STORAGE,
1068
1068
  category: ErrorCategory.THIRD_PARTY,
1069
1069
  details: { threadId: id }
@@ -1095,7 +1095,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1095
1095
  } catch (error) {
1096
1096
  throw new MastraError(
1097
1097
  {
1098
- id: "STORAGE_DYNAMODB_STORE_DELETE_THREAD_FAILED",
1098
+ id: createStorageErrorId("DYNAMODB", "DELETE_THREAD", "FAILED"),
1099
1099
  domain: ErrorDomain.STORAGE,
1100
1100
  category: ErrorCategory.THIRD_PARTY,
1101
1101
  details: { threadId }
@@ -1121,7 +1121,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1121
1121
  } catch (error) {
1122
1122
  throw new MastraError(
1123
1123
  {
1124
- id: "STORAGE_DYNAMODB_STORE_LIST_MESSAGES_BY_ID_FAILED",
1124
+ id: createStorageErrorId("DYNAMODB", "LIST_MESSAGES_BY_ID", "FAILED"),
1125
1125
  domain: ErrorDomain.STORAGE,
1126
1126
  category: ErrorCategory.THIRD_PARTY,
1127
1127
  details: { messageIds: JSON.stringify(messageIds) }
@@ -1136,7 +1136,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1136
1136
  if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
1137
1137
  throw new MastraError(
1138
1138
  {
1139
- id: "STORAGE_DYNAMODB_LIST_MESSAGES_INVALID_THREAD_ID",
1139
+ id: createStorageErrorId("DYNAMODB", "LIST_MESSAGES", "INVALID_THREAD_ID"),
1140
1140
  domain: ErrorDomain.STORAGE,
1141
1141
  category: ErrorCategory.THIRD_PARTY,
1142
1142
  details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
@@ -1150,7 +1150,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1150
1150
  if (page < 0) {
1151
1151
  throw new MastraError(
1152
1152
  {
1153
- id: "STORAGE_DYNAMODB_LIST_MESSAGES_INVALID_PAGE",
1153
+ id: createStorageErrorId("DYNAMODB", "LIST_MESSAGES", "INVALID_PAGE"),
1154
1154
  domain: ErrorDomain.STORAGE,
1155
1155
  category: ErrorCategory.USER,
1156
1156
  details: { page }
@@ -1248,7 +1248,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1248
1248
  } catch (error) {
1249
1249
  const mastraError = new MastraError(
1250
1250
  {
1251
- id: "STORAGE_DYNAMODB_STORE_LIST_MESSAGES_FAILED",
1251
+ id: createStorageErrorId("DYNAMODB", "LIST_MESSAGES", "FAILED"),
1252
1252
  domain: ErrorDomain.STORAGE,
1253
1253
  category: ErrorCategory.THIRD_PARTY,
1254
1254
  details: {
@@ -1331,7 +1331,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1331
1331
  } catch (error) {
1332
1332
  throw new MastraError(
1333
1333
  {
1334
- id: "STORAGE_DYNAMODB_STORE_SAVE_MESSAGES_FAILED",
1334
+ id: createStorageErrorId("DYNAMODB", "SAVE_MESSAGES", "FAILED"),
1335
1335
  domain: ErrorDomain.STORAGE,
1336
1336
  category: ErrorCategory.THIRD_PARTY,
1337
1337
  details: { count: messages.length }
@@ -1346,7 +1346,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1346
1346
  if (page < 0) {
1347
1347
  throw new MastraError(
1348
1348
  {
1349
- id: "STORAGE_DYNAMODB_LIST_THREADS_BY_RESOURCE_ID_INVALID_PAGE",
1349
+ id: createStorageErrorId("DYNAMODB", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
1350
1350
  domain: ErrorDomain.STORAGE,
1351
1351
  category: ErrorCategory.USER,
1352
1352
  details: { page }
@@ -1381,7 +1381,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1381
1381
  } catch (error) {
1382
1382
  throw new MastraError(
1383
1383
  {
1384
- id: "DYNAMODB_STORAGE_LIST_THREADS_BY_RESOURCE_ID_FAILED",
1384
+ id: createStorageErrorId("DYNAMODB", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
1385
1385
  domain: ErrorDomain.STORAGE,
1386
1386
  category: ErrorCategory.THIRD_PARTY,
1387
1387
  details: { resourceId, page, perPage }
@@ -1515,7 +1515,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1515
1515
  } catch (error) {
1516
1516
  throw new MastraError(
1517
1517
  {
1518
- id: "STORAGE_DYNAMODB_STORE_UPDATE_MESSAGES_FAILED",
1518
+ id: createStorageErrorId("DYNAMODB", "UPDATE_MESSAGES", "FAILED"),
1519
1519
  domain: ErrorDomain.STORAGE,
1520
1520
  category: ErrorCategory.THIRD_PARTY,
1521
1521
  details: { count: messages.length }
@@ -1544,7 +1544,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1544
1544
  } catch (error) {
1545
1545
  throw new MastraError(
1546
1546
  {
1547
- id: "STORAGE_DYNAMODB_STORE_GET_RESOURCE_BY_ID_FAILED",
1547
+ id: createStorageErrorId("DYNAMODB", "GET_RESOURCE_BY_ID", "FAILED"),
1548
1548
  domain: ErrorDomain.STORAGE,
1549
1549
  category: ErrorCategory.THIRD_PARTY,
1550
1550
  details: { resourceId }
@@ -1576,7 +1576,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1576
1576
  } catch (error) {
1577
1577
  throw new MastraError(
1578
1578
  {
1579
- id: "STORAGE_DYNAMODB_STORE_SAVE_RESOURCE_FAILED",
1579
+ id: createStorageErrorId("DYNAMODB", "SAVE_RESOURCE", "FAILED"),
1580
1580
  domain: ErrorDomain.STORAGE,
1581
1581
  category: ErrorCategory.THIRD_PARTY,
1582
1582
  details: { resourceId: resource.id }
@@ -1625,7 +1625,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1625
1625
  } catch (error) {
1626
1626
  throw new MastraError(
1627
1627
  {
1628
- id: "STORAGE_DYNAMODB_STORE_UPDATE_RESOURCE_FAILED",
1628
+ id: createStorageErrorId("DYNAMODB", "UPDATE_RESOURCE", "FAILED"),
1629
1629
  domain: ErrorDomain.STORAGE,
1630
1630
  category: ErrorCategory.THIRD_PARTY,
1631
1631
  details: { resourceId }
@@ -1725,7 +1725,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1725
1725
  }
1726
1726
  throw new MastraError(
1727
1727
  {
1728
- id: "STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_EXISTS_FAILED",
1728
+ id: createStorageErrorId("DYNAMODB", "VALIDATE_TABLE_EXISTS", "FAILED"),
1729
1729
  domain: ErrorDomain.STORAGE,
1730
1730
  category: ErrorCategory.THIRD_PARTY,
1731
1731
  details: { tableName: this.tableName }
@@ -1758,7 +1758,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1758
1758
  this.logger.error("Error validating table access", { tableName: this.tableName, error });
1759
1759
  throw new MastraError(
1760
1760
  {
1761
- id: "STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_ACCESS_FAILED",
1761
+ id: createStorageErrorId("DYNAMODB", "VALIDATE_TABLE_ACCESS", "FAILED"),
1762
1762
  domain: ErrorDomain.STORAGE,
1763
1763
  category: ErrorCategory.THIRD_PARTY,
1764
1764
  details: { tableName: this.tableName }
@@ -1772,7 +1772,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1772
1772
  const entityName = this.getEntityNameForTable(tableName);
1773
1773
  if (!entityName || !this.service.entities[entityName]) {
1774
1774
  throw new MastraError({
1775
- id: "STORAGE_DYNAMODB_STORE_INSERT_INVALID_ARGS",
1775
+ id: createStorageErrorId("DYNAMODB", "INSERT", "INVALID_ARGS"),
1776
1776
  domain: ErrorDomain.STORAGE,
1777
1777
  category: ErrorCategory.USER,
1778
1778
  text: "No entity defined for tableName",
@@ -1785,7 +1785,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1785
1785
  } catch (error) {
1786
1786
  throw new MastraError(
1787
1787
  {
1788
- id: "STORAGE_DYNAMODB_STORE_INSERT_FAILED",
1788
+ id: createStorageErrorId("DYNAMODB", "INSERT", "FAILED"),
1789
1789
  domain: ErrorDomain.STORAGE,
1790
1790
  category: ErrorCategory.THIRD_PARTY,
1791
1791
  details: { tableName }
@@ -1804,7 +1804,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1804
1804
  const entityName = this.getEntityNameForTable(tableName);
1805
1805
  if (!entityName || !this.service.entities[entityName]) {
1806
1806
  throw new MastraError({
1807
- id: "STORAGE_DYNAMODB_STORE_CLEAR_TABLE_INVALID_ARGS",
1807
+ id: createStorageErrorId("DYNAMODB", "CLEAR_TABLE", "INVALID_ARGS"),
1808
1808
  domain: ErrorDomain.STORAGE,
1809
1809
  category: ErrorCategory.USER,
1810
1810
  text: "No entity defined for tableName",
@@ -1867,7 +1867,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1867
1867
  } catch (error) {
1868
1868
  throw new MastraError(
1869
1869
  {
1870
- id: "STORAGE_DYNAMODB_STORE_CLEAR_TABLE_FAILED",
1870
+ id: createStorageErrorId("DYNAMODB", "CLEAR_TABLE", "FAILED"),
1871
1871
  domain: ErrorDomain.STORAGE,
1872
1872
  category: ErrorCategory.THIRD_PARTY,
1873
1873
  details: { tableName }
@@ -1884,7 +1884,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1884
1884
  const entityName = this.getEntityNameForTable(tableName);
1885
1885
  if (!entityName || !this.service.entities[entityName]) {
1886
1886
  throw new MastraError({
1887
- id: "STORAGE_DYNAMODB_STORE_BATCH_INSERT_INVALID_ARGS",
1887
+ id: createStorageErrorId("DYNAMODB", "BATCH_INSERT", "INVALID_ARGS"),
1888
1888
  domain: ErrorDomain.STORAGE,
1889
1889
  category: ErrorCategory.USER,
1890
1890
  text: "No entity defined for tableName",
@@ -1912,7 +1912,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1912
1912
  } catch (error) {
1913
1913
  throw new MastraError(
1914
1914
  {
1915
- id: "STORAGE_DYNAMODB_STORE_BATCH_INSERT_FAILED",
1915
+ id: createStorageErrorId("DYNAMODB", "BATCH_INSERT", "FAILED"),
1916
1916
  domain: ErrorDomain.STORAGE,
1917
1917
  category: ErrorCategory.THIRD_PARTY,
1918
1918
  details: { tableName }
@@ -1929,7 +1929,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1929
1929
  const entityName = this.getEntityNameForTable(tableName);
1930
1930
  if (!entityName || !this.service.entities[entityName]) {
1931
1931
  throw new MastraError({
1932
- id: "STORAGE_DYNAMODB_STORE_LOAD_INVALID_ARGS",
1932
+ id: createStorageErrorId("DYNAMODB", "LOAD", "INVALID_ARGS"),
1933
1933
  domain: ErrorDomain.STORAGE,
1934
1934
  category: ErrorCategory.USER,
1935
1935
  text: "No entity defined for tableName",
@@ -1947,7 +1947,7 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1947
1947
  } catch (error) {
1948
1948
  throw new MastraError(
1949
1949
  {
1950
- id: "STORAGE_DYNAMODB_STORE_LOAD_FAILED",
1950
+ id: createStorageErrorId("DYNAMODB", "LOAD", "FAILED"),
1951
1951
  domain: ErrorDomain.STORAGE,
1952
1952
  category: ErrorCategory.THIRD_PARTY,
1953
1953
  details: { tableName }
@@ -1998,7 +1998,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
1998
1998
  } catch (error) {
1999
1999
  throw new MastraError(
2000
2000
  {
2001
- id: "STORAGE_DYNAMODB_STORE_GET_SCORE_BY_ID_FAILED",
2001
+ id: createStorageErrorId("DYNAMODB", "GET_SCORE_BY_ID", "FAILED"),
2002
2002
  domain: ErrorDomain.STORAGE,
2003
2003
  category: ErrorCategory.THIRD_PARTY,
2004
2004
  details: { id }
@@ -2014,15 +2014,22 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2014
2014
  } catch (error) {
2015
2015
  throw new MastraError(
2016
2016
  {
2017
- id: "STORAGE_DYNAMODB_STORE_SAVE_SCORE_FAILED",
2017
+ id: createStorageErrorId("DYNAMODB", "SAVE_SCORE", "VALIDATION_FAILED"),
2018
2018
  domain: ErrorDomain.STORAGE,
2019
- category: ErrorCategory.THIRD_PARTY
2019
+ category: ErrorCategory.USER,
2020
+ details: {
2021
+ scorer: score.scorer?.id ?? "unknown",
2022
+ entityId: score.entityId ?? "unknown",
2023
+ entityType: score.entityType ?? "unknown",
2024
+ traceId: score.traceId ?? "",
2025
+ spanId: score.spanId ?? ""
2026
+ }
2020
2027
  },
2021
2028
  error
2022
2029
  );
2023
2030
  }
2024
2031
  const now = /* @__PURE__ */ new Date();
2025
- const scoreId = `score-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
2032
+ const scoreId = crypto.randomUUID();
2026
2033
  const scorer = typeof validatedScore.scorer === "string" ? validatedScore.scorer : JSON.stringify(validatedScore.scorer);
2027
2034
  const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? validatedScore.preprocessStepResult : JSON.stringify(validatedScore.preprocessStepResult);
2028
2035
  const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? validatedScore.analyzeStepResult : JSON.stringify(validatedScore.analyzeStepResult);
@@ -2052,17 +2059,18 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2052
2059
  );
2053
2060
  try {
2054
2061
  await this.service.entities.score.upsert(scoreData).go();
2055
- const savedScore = {
2056
- ...score,
2057
- id: scoreId,
2058
- createdAt: now,
2059
- updatedAt: now
2062
+ return {
2063
+ score: {
2064
+ ...validatedScore,
2065
+ id: scoreId,
2066
+ createdAt: now,
2067
+ updatedAt: now
2068
+ }
2060
2069
  };
2061
- return { score: savedScore };
2062
2070
  } catch (error) {
2063
2071
  throw new MastraError(
2064
2072
  {
2065
- id: "STORAGE_DYNAMODB_STORE_SAVE_SCORE_FAILED",
2073
+ id: createStorageErrorId("DYNAMODB", "SAVE_SCORE", "FAILED"),
2066
2074
  domain: ErrorDomain.STORAGE,
2067
2075
  category: ErrorCategory.THIRD_PARTY,
2068
2076
  details: { scorerId: score.scorerId, runId: score.runId }
@@ -2110,7 +2118,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2110
2118
  } catch (error) {
2111
2119
  throw new MastraError(
2112
2120
  {
2113
- id: "STORAGE_DYNAMODB_STORE_GET_SCORES_BY_SCORER_ID_FAILED",
2121
+ id: createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
2114
2122
  domain: ErrorDomain.STORAGE,
2115
2123
  category: ErrorCategory.THIRD_PARTY,
2116
2124
  details: {
@@ -2154,7 +2162,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2154
2162
  } catch (error) {
2155
2163
  throw new MastraError(
2156
2164
  {
2157
- id: "STORAGE_DYNAMODB_STORE_GET_SCORES_BY_RUN_ID_FAILED",
2165
+ id: createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_RUN_ID", "FAILED"),
2158
2166
  domain: ErrorDomain.STORAGE,
2159
2167
  category: ErrorCategory.THIRD_PARTY,
2160
2168
  details: { runId, page: pagination.page, perPage: pagination.perPage }
@@ -2193,7 +2201,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2193
2201
  } catch (error) {
2194
2202
  throw new MastraError(
2195
2203
  {
2196
- id: "STORAGE_DYNAMODB_STORE_GET_SCORES_BY_ENTITY_ID_FAILED",
2204
+ id: createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
2197
2205
  domain: ErrorDomain.STORAGE,
2198
2206
  category: ErrorCategory.THIRD_PARTY,
2199
2207
  details: { entityId, entityType, page: pagination.page, perPage: pagination.perPage }
@@ -2231,7 +2239,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2231
2239
  } catch (error) {
2232
2240
  throw new MastraError(
2233
2241
  {
2234
- id: "STORAGE_DYNAMODB_STORE_GET_SCORES_BY_SPAN_FAILED",
2242
+ id: createStorageErrorId("DYNAMODB", "LIST_SCORES_BY_SPAN", "FAILED"),
2235
2243
  domain: ErrorDomain.STORAGE,
2236
2244
  category: ErrorCategory.THIRD_PARTY,
2237
2245
  details: { traceId, spanId, page: pagination.page, perPage: pagination.perPage }
@@ -2297,7 +2305,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2297
2305
  } catch (error) {
2298
2306
  throw new MastraError(
2299
2307
  {
2300
- id: "STORAGE_DYNAMODB_STORE_PERSIST_WORKFLOW_SNAPSHOT_FAILED",
2308
+ id: createStorageErrorId("DYNAMODB", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
2301
2309
  domain: ErrorDomain.STORAGE,
2302
2310
  category: ErrorCategory.THIRD_PARTY,
2303
2311
  details: { workflowName, runId }
@@ -2325,7 +2333,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2325
2333
  } catch (error) {
2326
2334
  throw new MastraError(
2327
2335
  {
2328
- id: "STORAGE_DYNAMODB_STORE_LOAD_WORKFLOW_SNAPSHOT_FAILED",
2336
+ id: createStorageErrorId("DYNAMODB", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
2329
2337
  domain: ErrorDomain.STORAGE,
2330
2338
  category: ErrorCategory.THIRD_PARTY,
2331
2339
  details: { workflowName, runId }
@@ -2342,7 +2350,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2342
2350
  if (page < 0) {
2343
2351
  throw new MastraError(
2344
2352
  {
2345
- id: "DYNAMODB_STORE_INVALID_PAGE",
2353
+ id: createStorageErrorId("DYNAMODB", "LIST_WORKFLOW_RUNS", "INVALID_PAGE"),
2346
2354
  domain: ErrorDomain.STORAGE,
2347
2355
  category: ErrorCategory.USER,
2348
2356
  details: { page }
@@ -2412,7 +2420,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2412
2420
  } catch (error) {
2413
2421
  throw new MastraError(
2414
2422
  {
2415
- id: "STORAGE_DYNAMODB_STORE_LIST_WORKFLOW_RUNS_FAILED",
2423
+ id: createStorageErrorId("DYNAMODB", "LIST_WORKFLOW_RUNS", "FAILED"),
2416
2424
  domain: ErrorDomain.STORAGE,
2417
2425
  category: ErrorCategory.THIRD_PARTY,
2418
2426
  details: { workflowName: args?.workflowName || "", resourceId: args?.resourceId || "" }
@@ -2466,7 +2474,7 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2466
2474
  } catch (error) {
2467
2475
  throw new MastraError(
2468
2476
  {
2469
- id: "STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUN_BY_ID_FAILED",
2477
+ id: createStorageErrorId("DYNAMODB", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
2470
2478
  domain: ErrorDomain.STORAGE,
2471
2479
  category: ErrorCategory.THIRD_PARTY,
2472
2480
  details: { runId, workflowName: args?.workflowName || "" }
@@ -2485,7 +2493,7 @@ var DynamoDBStore = class extends MastraStorage {
2485
2493
  hasInitialized = null;
2486
2494
  stores;
2487
2495
  constructor({ name, config }) {
2488
- super({ id: config.id, name });
2496
+ super({ id: config.id, name, disableInit: config.disableInit });
2489
2497
  try {
2490
2498
  if (!config.tableName || typeof config.tableName !== "string" || config.tableName.trim() === "") {
2491
2499
  throw new Error("DynamoDBStore: config.tableName must be provided and cannot be empty.");
@@ -2520,7 +2528,7 @@ var DynamoDBStore = class extends MastraStorage {
2520
2528
  } catch (error) {
2521
2529
  throw new MastraError(
2522
2530
  {
2523
- id: "STORAGE_DYNAMODB_STORE_CONSTRUCTOR_FAILED",
2531
+ id: createStorageErrorId("DYNAMODB", "CONSTRUCTOR", "FAILED"),
2524
2532
  domain: ErrorDomain.STORAGE,
2525
2533
  category: ErrorCategory.USER
2526
2534
  },
@@ -2556,7 +2564,7 @@ var DynamoDBStore = class extends MastraStorage {
2556
2564
  }
2557
2565
  throw new MastraError(
2558
2566
  {
2559
- id: "STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_EXISTS_FAILED",
2567
+ id: createStorageErrorId("DYNAMODB", "VALIDATE_TABLE_EXISTS", "FAILED"),
2560
2568
  domain: ErrorDomain.STORAGE,
2561
2569
  category: ErrorCategory.THIRD_PARTY,
2562
2570
  details: { tableName: this.tableName }
@@ -2579,7 +2587,7 @@ var DynamoDBStore = class extends MastraStorage {
2579
2587
  } catch (error) {
2580
2588
  throw new MastraError(
2581
2589
  {
2582
- id: "STORAGE_DYNAMODB_STORE_INIT_FAILED",
2590
+ id: createStorageErrorId("DYNAMODB", "INIT", "FAILED"),
2583
2591
  domain: ErrorDomain.STORAGE,
2584
2592
  category: ErrorCategory.THIRD_PARTY,
2585
2593
  details: { tableName: this.tableName }
@@ -2714,7 +2722,7 @@ var DynamoDBStore = class extends MastraStorage {
2714
2722
  } catch (error) {
2715
2723
  throw new MastraError(
2716
2724
  {
2717
- id: "STORAGE_DYNAMODB_STORE_CLOSE_FAILED",
2725
+ id: createStorageErrorId("DYNAMODB", "CLOSE", "FAILED"),
2718
2726
  domain: ErrorDomain.STORAGE,
2719
2727
  category: ErrorCategory.THIRD_PARTY
2720
2728
  },
@@ -2728,8 +2736,8 @@ var DynamoDBStore = class extends MastraStorage {
2728
2736
  async getScoreById({ id: _id }) {
2729
2737
  return this.stores.scores.getScoreById({ id: _id });
2730
2738
  }
2731
- async saveScore(_score) {
2732
- return this.stores.scores.saveScore(_score);
2739
+ async saveScore(score) {
2740
+ return this.stores.scores.saveScore(score);
2733
2741
  }
2734
2742
  async listScoresByRunId({
2735
2743
  runId: _runId,