@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.
@@ -11,7 +11,6 @@ import {
11
11
  waitUntilTableExists,
12
12
  waitUntilTableNotExists,
13
13
  } from '@aws-sdk/client-dynamodb';
14
- import { createSampleMessageV2, createSampleThread } from '@internal/storage-test-utils';
15
14
  import type { MastraMessageV1, StorageThreadType, WorkflowRun, WorkflowRunState } from '@mastra/core';
16
15
  import type { MastraMessageV2 } from '@mastra/core/agent';
17
16
  import { TABLE_EVALS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
@@ -556,82 +555,6 @@ describe('DynamoDBStore Integration Tests', () => {
556
555
  expect(retrieved[0]?.content).toBe('Large Message 0');
557
556
  expect(retrieved[29]?.content).toBe('Large Message 29');
558
557
  });
559
-
560
- test('should upsert messages: duplicate id+threadId results in update, not duplicate row', async () => {
561
- const thread = await createSampleThread();
562
- await store.saveThread({ thread });
563
- const baseMessage = createSampleMessageV2({
564
- threadId: thread.id,
565
- createdAt: new Date(),
566
- content: { content: 'Original' },
567
- resourceId: thread.resourceId,
568
- });
569
-
570
- // Insert the message for the first time
571
- await store.saveMessages({ messages: [baseMessage], format: 'v2' });
572
-
573
- // // Insert again with the same id and threadId but different content
574
- const updatedMessage = {
575
- ...createSampleMessageV2({
576
- threadId: thread.id,
577
- createdAt: new Date(),
578
- content: { content: 'Updated' },
579
- resourceId: thread.resourceId,
580
- }),
581
- id: baseMessage.id,
582
- };
583
-
584
- await store.saveMessages({ messages: [updatedMessage], format: 'v2' });
585
-
586
- // Retrieve messages for the thread
587
- const retrievedMessages = await store.getMessages({ threadId: thread.id, format: 'v2' });
588
-
589
- // Only one message should exist for that id+threadId
590
- expect(retrievedMessages.filter(m => m.id === baseMessage.id)).toHaveLength(1);
591
-
592
- // The content should be the updated one
593
- expect(retrievedMessages.find(m => m.id === baseMessage.id)?.content.content).toBe('Updated');
594
- });
595
-
596
- test('should upsert messages: duplicate id and different threadid', async () => {
597
- const thread1 = await createSampleThread();
598
- const thread2 = await createSampleThread();
599
- await store.saveThread({ thread: thread1 });
600
- await store.saveThread({ thread: thread2 });
601
-
602
- const message = createSampleMessageV2({
603
- threadId: thread1.id,
604
- createdAt: new Date(),
605
- content: { content: 'Thread1 Content' },
606
- resourceId: thread1.resourceId,
607
- });
608
-
609
- // Insert message into thread1
610
- await store.saveMessages({ messages: [message], format: 'v2' });
611
-
612
- // Attempt to insert a message with the same id but different threadId
613
- const conflictingMessage = {
614
- ...createSampleMessageV2({
615
- threadId: thread2.id, // different thread
616
- content: { content: 'Thread2 Content' },
617
- resourceId: thread2.resourceId,
618
- }),
619
- id: message.id,
620
- };
621
-
622
- // Save should save the message to the new thread
623
- await store.saveMessages({ messages: [conflictingMessage], format: 'v2' });
624
-
625
- // Retrieve messages for both threads
626
- const thread1Messages = await store.getMessages({ threadId: thread1.id, format: 'v2' });
627
- const thread2Messages = await store.getMessages({ threadId: thread2.id, format: 'v2' });
628
-
629
- // Thread 1 should NOT have the message with that id
630
- expect(thread1Messages.find(m => m.id === message.id)).toBeUndefined();
631
-
632
- // Thread 2 should have the message with that id
633
- expect(thread2Messages.find(m => m.id === message.id)?.content.content).toBe('Thread2 Content');
634
- });
635
558
  });
636
559
 
637
560
  describe('Single-Table Design', () => {
@@ -1363,4 +1286,4 @@ describe('DynamoDBStore Integration Tests', () => {
1363
1286
  ).toBeNull();
1364
1287
  });
1365
1288
  }); // End Generic Storage Methods describe
1366
- });
1289
+ }); // End Main Describe