@mastra/dynamodb 0.0.0-tsconfig-compile-20250703214351 → 0.0.0-workflow-deno-20250616115451

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.
@@ -1,8 +1,6 @@
1
1
  import { DynamoDBClient, DescribeTableCommand } from '@aws-sdk/client-dynamodb';
2
2
  import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
3
- import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
3
  import { MessageList } from '@mastra/core/agent';
5
- import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
6
4
  import type { StorageThreadType, MastraMessageV2, MastraMessageV1 } from '@mastra/core/memory';
7
5
 
8
6
  import {
@@ -22,7 +20,6 @@ import type {
22
20
  StorageGetTracesArg,
23
21
  PaginationInfo,
24
22
  StorageColumn,
25
- TABLE_RESOURCES,
26
23
  } from '@mastra/core/storage';
27
24
  import type { Trace } from '@mastra/core/telemetry';
28
25
  import type { WorkflowRunState } from '@mastra/core/workflows';
@@ -39,8 +36,6 @@ export interface DynamoDBStoreConfig {
39
36
  };
40
37
  }
41
38
 
42
- type SUPPORTED_TABLE_NAMES = Exclude<TABLE_NAMES, typeof TABLE_RESOURCES>;
43
-
44
39
  // Define a type for our service that allows string indexing
45
40
  type MastraService = Service<Record<string, any>> & {
46
41
  [key: string]: any;
@@ -67,37 +62,26 @@ export class DynamoDBStore extends MastraStorage {
67
62
  super({ name });
68
63
 
69
64
  // Validate required config
70
- try {
71
- if (!config.tableName || typeof config.tableName !== 'string' || config.tableName.trim() === '') {
72
- throw new Error('DynamoDBStore: config.tableName must be provided and cannot be empty.');
73
- }
74
- // Validate tableName characters (basic check)
75
- if (!/^[a-zA-Z0-9_.-]{3,255}$/.test(config.tableName)) {
76
- throw new Error(
77
- `DynamoDBStore: config.tableName "${config.tableName}" contains invalid characters or is not between 3 and 255 characters long.`,
78
- );
79
- }
80
-
81
- const dynamoClient = new DynamoDBClient({
82
- region: config.region || 'us-east-1',
83
- endpoint: config.endpoint,
84
- credentials: config.credentials,
85
- });
86
-
87
- this.tableName = config.tableName;
88
- this.client = DynamoDBDocumentClient.from(dynamoClient);
89
- this.service = getElectroDbService(this.client, this.tableName) as MastraService;
90
- } catch (error) {
91
- throw new MastraError(
92
- {
93
- id: 'STORAGE_DYNAMODB_STORE_CONSTRUCTOR_FAILED',
94
- domain: ErrorDomain.STORAGE,
95
- category: ErrorCategory.USER,
96
- },
97
- error,
65
+ if (!config.tableName || typeof config.tableName !== 'string' || config.tableName.trim() === '') {
66
+ throw new Error('DynamoDBStore: config.tableName must be provided and cannot be empty.');
67
+ }
68
+ // Validate tableName characters (basic check)
69
+ if (!/^[a-zA-Z0-9_.-]{3,255}$/.test(config.tableName)) {
70
+ throw new Error(
71
+ `DynamoDBStore: config.tableName "${config.tableName}" contains invalid characters or is not between 3 and 255 characters long.`,
98
72
  );
99
73
  }
100
74
 
75
+ const dynamoClient = new DynamoDBClient({
76
+ region: config.region || 'us-east-1',
77
+ endpoint: config.endpoint,
78
+ credentials: config.credentials,
79
+ });
80
+
81
+ this.tableName = config.tableName;
82
+ this.client = DynamoDBDocumentClient.from(dynamoClient);
83
+ this.service = getElectroDbService(this.client, this.tableName) as MastraService;
84
+
101
85
  // We're using a single table design with ElectroDB,
102
86
  // so we don't need to create multiple tables
103
87
  }
@@ -128,15 +112,7 @@ export class DynamoDBStore extends MastraStorage {
128
112
  this.logger.debug(`Table ${this.tableName} exists and is accessible`);
129
113
  } catch (error) {
130
114
  this.logger.error('Error validating table access', { tableName: this.tableName, error });
131
- throw new MastraError(
132
- {
133
- id: 'STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_ACCESS_FAILED',
134
- domain: ErrorDomain.STORAGE,
135
- category: ErrorCategory.THIRD_PARTY,
136
- details: { tableName: this.tableName },
137
- },
138
- error,
139
- );
115
+ throw error;
140
116
  }
141
117
  }
142
118
 
@@ -162,15 +138,7 @@ export class DynamoDBStore extends MastraStorage {
162
138
  }
163
139
 
164
140
  // For other errors (like permissions issues), we should throw
165
- throw new MastraError(
166
- {
167
- id: 'STORAGE_DYNAMODB_STORE_VALIDATE_TABLE_EXISTS_FAILED',
168
- domain: ErrorDomain.STORAGE,
169
- category: ErrorCategory.THIRD_PARTY,
170
- details: { tableName: this.tableName },
171
- },
172
- error,
173
- );
141
+ throw error;
174
142
  }
175
143
  }
176
144
 
@@ -197,15 +165,7 @@ export class DynamoDBStore extends MastraStorage {
197
165
  // The error has already been handled by _performInitializationAndStore
198
166
  // (i.e., this.hasInitialized was reset). Re-throwing here ensures
199
167
  // the caller of init() is aware of the failure.
200
- throw new MastraError(
201
- {
202
- id: 'STORAGE_DYNAMODB_STORE_INIT_FAILED',
203
- domain: ErrorDomain.STORAGE,
204
- category: ErrorCategory.THIRD_PARTY,
205
- details: { tableName: this.tableName },
206
- },
207
- error,
208
- );
168
+ throw error;
209
169
  }
210
170
  }
211
171
 
@@ -266,18 +226,12 @@ export class DynamoDBStore extends MastraStorage {
266
226
  /**
267
227
  * Clear all items from a logical "table" (entity type)
268
228
  */
269
- async clearTable({ tableName }: { tableName: SUPPORTED_TABLE_NAMES }): Promise<void> {
229
+ async clearTable({ tableName }: { tableName: TABLE_NAMES }): Promise<void> {
270
230
  this.logger.debug('DynamoDB clearTable called', { tableName });
271
231
 
272
232
  const entityName = this.getEntityNameForTable(tableName);
273
233
  if (!entityName || !this.service.entities[entityName]) {
274
- throw new MastraError({
275
- id: 'STORAGE_DYNAMODB_STORE_CLEAR_TABLE_INVALID_ARGS',
276
- domain: ErrorDomain.STORAGE,
277
- category: ErrorCategory.USER,
278
- text: 'No entity defined for tableName',
279
- details: { tableName },
280
- });
234
+ throw new Error(`No entity defined for ${tableName}`);
281
235
  }
282
236
 
283
237
  try {
@@ -347,39 +301,20 @@ export class DynamoDBStore extends MastraStorage {
347
301
 
348
302
  this.logger.debug(`Successfully cleared all records for ${tableName}`);
349
303
  } catch (error) {
350
- throw new MastraError(
351
- {
352
- id: 'STORAGE_DYNAMODB_STORE_CLEAR_TABLE_FAILED',
353
- domain: ErrorDomain.STORAGE,
354
- category: ErrorCategory.THIRD_PARTY,
355
- details: { tableName },
356
- },
357
- error,
358
- );
304
+ this.logger.error('Failed to clear table', { tableName, error });
305
+ throw error;
359
306
  }
360
307
  }
361
308
 
362
309
  /**
363
310
  * Insert a record into the specified "table" (entity)
364
311
  */
365
- async insert({
366
- tableName,
367
- record,
368
- }: {
369
- tableName: SUPPORTED_TABLE_NAMES;
370
- record: Record<string, any>;
371
- }): Promise<void> {
312
+ async insert({ tableName, record }: { tableName: TABLE_NAMES; record: Record<string, any> }): Promise<void> {
372
313
  this.logger.debug('DynamoDB insert called', { tableName });
373
314
 
374
315
  const entityName = this.getEntityNameForTable(tableName);
375
316
  if (!entityName || !this.service.entities[entityName]) {
376
- throw new MastraError({
377
- id: 'STORAGE_DYNAMODB_STORE_INSERT_INVALID_ARGS',
378
- domain: ErrorDomain.STORAGE,
379
- category: ErrorCategory.USER,
380
- text: 'No entity defined for tableName',
381
- details: { tableName },
382
- });
317
+ throw new Error(`No entity defined for ${tableName}`);
383
318
  }
384
319
 
385
320
  try {
@@ -387,39 +322,20 @@ export class DynamoDBStore extends MastraStorage {
387
322
  const dataToSave = { entity: entityName, ...this.preprocessRecord(record) };
388
323
  await this.service.entities[entityName].create(dataToSave).go();
389
324
  } catch (error) {
390
- throw new MastraError(
391
- {
392
- id: 'STORAGE_DYNAMODB_STORE_INSERT_FAILED',
393
- domain: ErrorDomain.STORAGE,
394
- category: ErrorCategory.THIRD_PARTY,
395
- details: { tableName },
396
- },
397
- error,
398
- );
325
+ this.logger.error('Failed to insert record', { tableName, error });
326
+ throw error;
399
327
  }
400
328
  }
401
329
 
402
330
  /**
403
331
  * Insert multiple records as a batch
404
332
  */
405
- async batchInsert({
406
- tableName,
407
- records,
408
- }: {
409
- tableName: SUPPORTED_TABLE_NAMES;
410
- records: Record<string, any>[];
411
- }): Promise<void> {
333
+ async batchInsert({ tableName, records }: { tableName: TABLE_NAMES; records: Record<string, any>[] }): Promise<void> {
412
334
  this.logger.debug('DynamoDB batchInsert called', { tableName, count: records.length });
413
335
 
414
336
  const entityName = this.getEntityNameForTable(tableName);
415
337
  if (!entityName || !this.service.entities[entityName]) {
416
- throw new MastraError({
417
- id: 'STORAGE_DYNAMODB_STORE_BATCH_INSERT_INVALID_ARGS',
418
- domain: ErrorDomain.STORAGE,
419
- category: ErrorCategory.USER,
420
- text: 'No entity defined for tableName',
421
- details: { tableName },
422
- });
338
+ throw new Error(`No entity defined for ${tableName}`);
423
339
  }
424
340
 
425
341
  // Add entity type and preprocess each record
@@ -449,39 +365,20 @@ export class DynamoDBStore extends MastraStorage {
449
365
  // Original batch call: await this.service.entities[entityName].create(batch).go();
450
366
  }
451
367
  } catch (error) {
452
- throw new MastraError(
453
- {
454
- id: 'STORAGE_DYNAMODB_STORE_BATCH_INSERT_FAILED',
455
- domain: ErrorDomain.STORAGE,
456
- category: ErrorCategory.THIRD_PARTY,
457
- details: { tableName },
458
- },
459
- error,
460
- );
368
+ this.logger.error('Failed to batch insert records', { tableName, error });
369
+ throw error;
461
370
  }
462
371
  }
463
372
 
464
373
  /**
465
374
  * Load a record by its keys
466
375
  */
467
- async load<R>({
468
- tableName,
469
- keys,
470
- }: {
471
- tableName: SUPPORTED_TABLE_NAMES;
472
- keys: Record<string, string>;
473
- }): Promise<R | null> {
376
+ async load<R>({ tableName, keys }: { tableName: TABLE_NAMES; keys: Record<string, string> }): Promise<R | null> {
474
377
  this.logger.debug('DynamoDB load called', { tableName, keys });
475
378
 
476
379
  const entityName = this.getEntityNameForTable(tableName);
477
380
  if (!entityName || !this.service.entities[entityName]) {
478
- throw new MastraError({
479
- id: 'STORAGE_DYNAMODB_STORE_LOAD_INVALID_ARGS',
480
- domain: ErrorDomain.STORAGE,
481
- category: ErrorCategory.USER,
482
- text: 'No entity defined for tableName',
483
- details: { tableName },
484
- });
381
+ throw new Error(`No entity defined for ${tableName}`);
485
382
  }
486
383
 
487
384
  try {
@@ -506,15 +403,8 @@ export class DynamoDBStore extends MastraStorage {
506
403
 
507
404
  return data as R;
508
405
  } catch (error) {
509
- throw new MastraError(
510
- {
511
- id: 'STORAGE_DYNAMODB_STORE_LOAD_FAILED',
512
- domain: ErrorDomain.STORAGE,
513
- category: ErrorCategory.THIRD_PARTY,
514
- details: { tableName },
515
- },
516
- error,
517
- );
406
+ this.logger.error('Failed to load record', { tableName, keys, error });
407
+ throw error;
518
408
  }
519
409
  }
520
410
 
@@ -539,15 +429,8 @@ export class DynamoDBStore extends MastraStorage {
539
429
  // metadata is already transformed by the entity's getter
540
430
  } as StorageThreadType;
541
431
  } catch (error) {
542
- throw new MastraError(
543
- {
544
- id: 'STORAGE_DYNAMODB_STORE_GET_THREAD_BY_ID_FAILED',
545
- domain: ErrorDomain.STORAGE,
546
- category: ErrorCategory.THIRD_PARTY,
547
- details: { threadId },
548
- },
549
- error,
550
- );
432
+ this.logger.error('Failed to get thread by ID', { threadId, error });
433
+ throw error;
551
434
  }
552
435
  }
553
436
 
@@ -570,15 +453,8 @@ export class DynamoDBStore extends MastraStorage {
570
453
  // metadata is already transformed by the entity's getter
571
454
  })) as StorageThreadType[];
572
455
  } catch (error) {
573
- throw new MastraError(
574
- {
575
- id: 'STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_FAILED',
576
- domain: ErrorDomain.STORAGE,
577
- category: ErrorCategory.THIRD_PARTY,
578
- details: { resourceId },
579
- },
580
- error,
581
- );
456
+ this.logger.error('Failed to get threads by resource ID', { resourceId, error });
457
+ throw error;
582
458
  }
583
459
  }
584
460
 
@@ -609,15 +485,8 @@ export class DynamoDBStore extends MastraStorage {
609
485
  metadata: thread.metadata,
610
486
  };
611
487
  } catch (error) {
612
- throw new MastraError(
613
- {
614
- id: 'STORAGE_DYNAMODB_STORE_SAVE_THREAD_FAILED',
615
- domain: ErrorDomain.STORAGE,
616
- category: ErrorCategory.THIRD_PARTY,
617
- details: { threadId: thread.id },
618
- },
619
- error,
620
- );
488
+ this.logger.error('Failed to save thread', { threadId: thread.id, error });
489
+ throw error;
621
490
  }
622
491
  }
623
492
 
@@ -672,15 +541,8 @@ export class DynamoDBStore extends MastraStorage {
672
541
  updatedAt: now,
673
542
  };
674
543
  } catch (error) {
675
- throw new MastraError(
676
- {
677
- id: 'STORAGE_DYNAMODB_STORE_UPDATE_THREAD_FAILED',
678
- domain: ErrorDomain.STORAGE,
679
- category: ErrorCategory.THIRD_PARTY,
680
- details: { threadId: id },
681
- },
682
- error,
683
- );
544
+ this.logger.error('Failed to update thread', { threadId: id, error });
545
+ throw error;
684
546
  }
685
547
  }
686
548
 
@@ -696,15 +558,8 @@ export class DynamoDBStore extends MastraStorage {
696
558
  // 2. Delete any vector embeddings related to this thread
697
559
  // These would be additional operations
698
560
  } catch (error) {
699
- throw new MastraError(
700
- {
701
- id: 'STORAGE_DYNAMODB_STORE_DELETE_THREAD_FAILED',
702
- domain: ErrorDomain.STORAGE,
703
- category: ErrorCategory.THIRD_PARTY,
704
- details: { threadId },
705
- },
706
- error,
707
- );
561
+ this.logger.error('Failed to delete thread', { threadId, error });
562
+ throw error;
708
563
  }
709
564
  }
710
565
 
@@ -724,13 +579,12 @@ export class DynamoDBStore extends MastraStorage {
724
579
  // Provide *all* composite key components for the 'byThread' index ('entity', 'threadId')
725
580
  const query = this.service.entities.message.query.byThread({ entity: 'message', threadId });
726
581
 
727
- const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
728
582
  // Apply the 'last' limit if provided
729
- if (limit !== Number.MAX_SAFE_INTEGER) {
583
+ if (selectBy?.last && typeof selectBy.last === 'number') {
730
584
  // Use ElectroDB's limit parameter
731
585
  // DDB GSIs are sorted in ascending order
732
586
  // Use ElectroDB's order parameter to sort in descending order to retrieve 'latest' messages
733
- const results = await query.go({ limit, order: 'desc' });
587
+ const results = await query.go({ limit: selectBy.last, order: 'desc' });
734
588
  // Use arrow function in map to preserve 'this' context for parseMessageData
735
589
  const list = new MessageList({ threadId, resourceId }).add(
736
590
  results.data.map((data: any) => this.parseMessageData(data)),
@@ -750,15 +604,8 @@ export class DynamoDBStore extends MastraStorage {
750
604
  if (format === `v2`) return list.get.all.v2();
751
605
  return list.get.all.v1();
752
606
  } catch (error) {
753
- throw new MastraError(
754
- {
755
- id: 'STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED',
756
- domain: ErrorDomain.STORAGE,
757
- category: ErrorCategory.THIRD_PARTY,
758
- details: { threadId },
759
- },
760
- error,
761
- );
607
+ this.logger.error('Failed to get messages', { threadId, error });
608
+ throw error;
762
609
  }
763
610
  }
764
611
  async saveMessages(args: { messages: MastraMessageV1[]; format?: undefined | 'v1' }): Promise<MastraMessageV1[]>;
@@ -818,7 +665,7 @@ export class DynamoDBStore extends MastraStorage {
818
665
  this.logger.error('Missing entity property in message data for create', { messageData });
819
666
  throw new Error('Internal error: Missing entity property during saveMessages');
820
667
  }
821
- await this.service.entities.message.put(messageData).go();
668
+ await this.service.entities.message.create(messageData).go();
822
669
  }
823
670
  }),
824
671
  // Update thread's updatedAt timestamp
@@ -834,15 +681,8 @@ export class DynamoDBStore extends MastraStorage {
834
681
  if (format === `v1`) return list.get.all.v1();
835
682
  return list.get.all.v2();
836
683
  } catch (error) {
837
- throw new MastraError(
838
- {
839
- id: 'STORAGE_DYNAMODB_STORE_SAVE_MESSAGES_FAILED',
840
- domain: ErrorDomain.STORAGE,
841
- category: ErrorCategory.THIRD_PARTY,
842
- details: { count: messages.length },
843
- },
844
- error,
845
- );
684
+ this.logger.error('Failed to save messages', { error });
685
+ throw error;
846
686
  }
847
687
  }
848
688
 
@@ -906,14 +746,8 @@ export class DynamoDBStore extends MastraStorage {
906
746
 
907
747
  return items;
908
748
  } catch (error) {
909
- throw new MastraError(
910
- {
911
- id: 'STORAGE_DYNAMODB_STORE_GET_TRACES_FAILED',
912
- domain: ErrorDomain.STORAGE,
913
- category: ErrorCategory.THIRD_PARTY,
914
- },
915
- error,
916
- );
749
+ this.logger.error('Failed to get traces', { error });
750
+ throw error;
917
751
  }
918
752
  }
919
753
 
@@ -932,15 +766,8 @@ export class DynamoDBStore extends MastraStorage {
932
766
  records: recordsToSave, // Pass records with 'entity' included
933
767
  });
934
768
  } catch (error) {
935
- throw new MastraError(
936
- {
937
- id: 'STORAGE_DYNAMODB_STORE_BATCH_TRACE_INSERT_FAILED',
938
- domain: ErrorDomain.STORAGE,
939
- category: ErrorCategory.THIRD_PARTY,
940
- details: { count: records.length },
941
- },
942
- error,
943
- );
769
+ this.logger.error('Failed to batch insert traces', { error });
770
+ throw error;
944
771
  }
945
772
  }
946
773
 
@@ -972,15 +799,8 @@ export class DynamoDBStore extends MastraStorage {
972
799
  // Use upsert instead of create to handle both create and update cases
973
800
  await this.service.entities.workflowSnapshot.upsert(data).go();
974
801
  } catch (error) {
975
- throw new MastraError(
976
- {
977
- id: 'STORAGE_DYNAMODB_STORE_PERSIST_WORKFLOW_SNAPSHOT_FAILED',
978
- domain: ErrorDomain.STORAGE,
979
- category: ErrorCategory.THIRD_PARTY,
980
- details: { workflowName, runId },
981
- },
982
- error,
983
- );
802
+ this.logger.error('Failed to persist workflow snapshot', { workflowName, runId, error });
803
+ throw error;
984
804
  }
985
805
  }
986
806
 
@@ -1011,15 +831,8 @@ export class DynamoDBStore extends MastraStorage {
1011
831
  // Parse the snapshot string
1012
832
  return result.data.snapshot as WorkflowRunState;
1013
833
  } catch (error) {
1014
- throw new MastraError(
1015
- {
1016
- id: 'STORAGE_DYNAMODB_STORE_LOAD_WORKFLOW_SNAPSHOT_FAILED',
1017
- domain: ErrorDomain.STORAGE,
1018
- category: ErrorCategory.THIRD_PARTY,
1019
- details: { workflowName, runId },
1020
- },
1021
- error,
1022
- );
834
+ this.logger.error('Failed to load workflow snapshot', { workflowName, runId, error });
835
+ throw error;
1023
836
  }
1024
837
  }
1025
838
 
@@ -1109,15 +922,8 @@ export class DynamoDBStore extends MastraStorage {
1109
922
  total,
1110
923
  };
1111
924
  } catch (error) {
1112
- throw new MastraError(
1113
- {
1114
- id: 'STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUNS_FAILED',
1115
- domain: ErrorDomain.STORAGE,
1116
- category: ErrorCategory.THIRD_PARTY,
1117
- details: { workflowName: args?.workflowName || '', resourceId: args?.resourceId || '' },
1118
- },
1119
- error,
1120
- );
925
+ this.logger.error('Failed to get workflow runs', { error });
926
+ throw error;
1121
927
  }
1122
928
  }
1123
929
 
@@ -1188,15 +994,8 @@ export class DynamoDBStore extends MastraStorage {
1188
994
  resourceId: matchingRunDbItem.resourceId,
1189
995
  };
1190
996
  } catch (error) {
1191
- throw new MastraError(
1192
- {
1193
- id: 'STORAGE_DYNAMODB_STORE_GET_WORKFLOW_RUN_BY_ID_FAILED',
1194
- domain: ErrorDomain.STORAGE,
1195
- category: ErrorCategory.THIRD_PARTY,
1196
- details: { runId, workflowName: args?.workflowName || '' },
1197
- },
1198
- error,
1199
- );
997
+ this.logger.error('Failed to get workflow run by ID', { runId, workflowName, error });
998
+ throw error;
1200
999
  }
1201
1000
  }
1202
1001
 
@@ -1213,8 +1012,8 @@ export class DynamoDBStore extends MastraStorage {
1213
1012
  }
1214
1013
 
1215
1014
  // Helper methods for entity/table mapping
1216
- private getEntityNameForTable(tableName: SUPPORTED_TABLE_NAMES): string | null {
1217
- const mapping: Record<SUPPORTED_TABLE_NAMES, string> = {
1015
+ private getEntityNameForTable(tableName: TABLE_NAMES): string | null {
1016
+ const mapping: Record<TABLE_NAMES, string> = {
1218
1017
  [TABLE_THREADS]: 'thread',
1219
1018
  [TABLE_MESSAGES]: 'message',
1220
1019
  [TABLE_WORKFLOW_SNAPSHOT]: 'workflowSnapshot',
@@ -1298,27 +1097,13 @@ export class DynamoDBStore extends MastraStorage {
1298
1097
  }
1299
1098
  });
1300
1099
  } catch (error) {
1301
- throw new MastraError(
1302
- {
1303
- id: 'STORAGE_DYNAMODB_STORE_GET_EVALS_BY_AGENT_NAME_FAILED',
1304
- domain: ErrorDomain.STORAGE,
1305
- category: ErrorCategory.THIRD_PARTY,
1306
- details: { agentName },
1307
- },
1308
- error,
1309
- );
1100
+ this.logger.error('Failed to get evals by agent name', { agentName, type, error });
1101
+ throw error;
1310
1102
  }
1311
1103
  }
1312
1104
 
1313
1105
  async getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & { traces: Trace[] }> {
1314
- throw new MastraError(
1315
- {
1316
- id: 'STORAGE_DYNAMODB_STORE_GET_TRACES_PAGINATED_FAILED',
1317
- domain: ErrorDomain.STORAGE,
1318
- category: ErrorCategory.THIRD_PARTY,
1319
- },
1320
- new Error('Method not implemented.'),
1321
- );
1106
+ throw new Error('Method not implemented.');
1322
1107
  }
1323
1108
 
1324
1109
  async getThreadsByResourceIdPaginated(_args: {
@@ -1326,27 +1111,13 @@ export class DynamoDBStore extends MastraStorage {
1326
1111
  page?: number;
1327
1112
  perPage?: number;
1328
1113
  }): Promise<PaginationInfo & { threads: StorageThreadType[] }> {
1329
- throw new MastraError(
1330
- {
1331
- id: 'STORAGE_DYNAMODB_STORE_GET_THREADS_BY_RESOURCE_ID_PAGINATED_FAILED',
1332
- domain: ErrorDomain.STORAGE,
1333
- category: ErrorCategory.THIRD_PARTY,
1334
- },
1335
- new Error('Method not implemented.'),
1336
- );
1114
+ throw new Error('Method not implemented.');
1337
1115
  }
1338
1116
 
1339
1117
  async getMessagesPaginated(
1340
1118
  _args: StorageGetMessagesArg,
1341
1119
  ): Promise<PaginationInfo & { messages: MastraMessageV1[] | MastraMessageV2[] }> {
1342
- throw new MastraError(
1343
- {
1344
- id: 'STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED',
1345
- domain: ErrorDomain.STORAGE,
1346
- category: ErrorCategory.THIRD_PARTY,
1347
- },
1348
- new Error('Method not implemented.'),
1349
- );
1120
+ throw new Error('Method not implemented.');
1350
1121
  }
1351
1122
 
1352
1123
  /**
@@ -1359,25 +1130,9 @@ export class DynamoDBStore extends MastraStorage {
1359
1130
  this.client.destroy();
1360
1131
  this.logger.debug('DynamoDB client closed successfully for store:', { name: this.name });
1361
1132
  } catch (error) {
1362
- throw new MastraError(
1363
- {
1364
- id: 'STORAGE_DYNAMODB_STORE_CLOSE_FAILED',
1365
- domain: ErrorDomain.STORAGE,
1366
- category: ErrorCategory.THIRD_PARTY,
1367
- },
1368
- error,
1369
- );
1133
+ this.logger.error('Error closing DynamoDB client for store:', { name: this.name, error });
1134
+ // Optionally re-throw or handle as appropriate for your application's error handling strategy
1135
+ throw error;
1370
1136
  }
1371
1137
  }
1372
-
1373
- async updateMessages(_args: {
1374
- messages: Partial<Omit<MastraMessageV2, 'createdAt'>> &
1375
- {
1376
- id: string;
1377
- content?: { metadata?: MastraMessageContentV2['metadata']; content?: MastraMessageContentV2['content'] };
1378
- }[];
1379
- }): Promise<MastraMessageV2[]> {
1380
- this.logger.error('updateMessages is not yet implemented in DynamoDBStore');
1381
- throw new Error('Method not implemented');
1382
- }
1383
1138
  }