@mastra/lance 0.0.0-tsconfig-compile-20250703214351 → 0.0.0-workflow-deno-20250616130925
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/CHANGELOG.md +3 -99
- package/dist/_tsup-dts-rollup.d.cts +4 -28
- package/dist/_tsup-dts-rollup.d.ts +4 -28
- package/dist/index.cjs +160 -806
- package/dist/index.js +127 -773
- package/package.json +7 -7
- package/src/storage/index.test.ts +2 -72
- package/src/storage/index.ts +68 -498
- package/src/vector/filter.test.ts +3 -3
- package/src/vector/filter.ts +4 -24
- package/src/vector/index.test.ts +3 -3
- package/src/vector/index.ts +79 -320
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/lance",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-workflow-deno-20250616130925",
|
|
4
4
|
"description": "Lance provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@microsoft/api-extractor": "^7.52.8",
|
|
27
27
|
"@types/node": "^20.19.0",
|
|
28
|
-
"eslint": "^9.
|
|
28
|
+
"eslint": "^9.28.0",
|
|
29
29
|
"tsup": "^8.5.0",
|
|
30
30
|
"typescript": "^5.8.3",
|
|
31
|
-
"vitest": "^3.2.
|
|
32
|
-
"@internal/
|
|
33
|
-
"@internal/
|
|
34
|
-
"@mastra/core": "0.0.0-
|
|
31
|
+
"vitest": "^3.2.3",
|
|
32
|
+
"@internal/lint": "0.0.0-workflow-deno-20250616130925",
|
|
33
|
+
"@internal/storage-test-utils": "0.0.0-workflow-deno-20250616130925",
|
|
34
|
+
"@mastra/core": "0.0.0-workflow-deno-20250616130925"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@mastra/core": "0.0.0
|
|
37
|
+
"@mastra/core": ">=0.10.4-0 <0.11.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
|
@@ -54,7 +54,6 @@ function generateMessageRecords(count: number, threadId?: string): MastraMessage
|
|
|
54
54
|
toolCallIds: [],
|
|
55
55
|
toolCallArgs: [],
|
|
56
56
|
toolNames: [],
|
|
57
|
-
type: 'v2',
|
|
58
57
|
}));
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -233,7 +232,7 @@ describe('LanceStorage tests', async () => {
|
|
|
233
232
|
|
|
234
233
|
it('should throw error when invalid key type is provided', async () => {
|
|
235
234
|
await expect(storage.load({ tableName: TABLE_MESSAGES, keys: { id: '1' } })).rejects.toThrowError(
|
|
236
|
-
|
|
235
|
+
"Failed to load record: Error: Expected numeric value for field 'id', got string",
|
|
237
236
|
);
|
|
238
237
|
});
|
|
239
238
|
|
|
@@ -564,6 +563,7 @@ describe('LanceStorage tests', async () => {
|
|
|
564
563
|
expect(message.threadId).toEqual(threadId);
|
|
565
564
|
expect(message.id.toString()).toEqual(messages[index].id);
|
|
566
565
|
expect(message.content).toEqual(messages[index].content);
|
|
566
|
+
expect(new Date(message.createdAt)).toEqual(new Date(messages[index].createdAt));
|
|
567
567
|
expect(message.role).toEqual(messages[index].role);
|
|
568
568
|
expect(message.resourceId).toEqual(messages[index].resourceId);
|
|
569
569
|
expect(message.type).toEqual(messages[index].type);
|
|
@@ -708,76 +708,6 @@ describe('LanceStorage tests', async () => {
|
|
|
708
708
|
expect(currentDate).toBeLessThanOrEqual(nextDate);
|
|
709
709
|
}
|
|
710
710
|
});
|
|
711
|
-
|
|
712
|
-
it('should upsert messages: duplicate id+threadId results in update, not duplicate row', async () => {
|
|
713
|
-
const thread = 'thread-1';
|
|
714
|
-
const baseMessage = generateMessageRecords(1, thread)[0];
|
|
715
|
-
|
|
716
|
-
// Insert the message for the first time
|
|
717
|
-
await storage.saveMessages({ messages: [baseMessage], format: 'v2' });
|
|
718
|
-
|
|
719
|
-
// Insert again with the same id and threadId but different content
|
|
720
|
-
const updatedMessage: MastraMessageV2 = {
|
|
721
|
-
...generateMessageRecords(1, thread)[0],
|
|
722
|
-
id: baseMessage.id,
|
|
723
|
-
content: { format: 2, parts: [{ type: 'text', text: 'Updated' }] },
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
await storage.saveMessages({ messages: [updatedMessage], format: 'v2' });
|
|
727
|
-
|
|
728
|
-
// Retrieve messages for the thread
|
|
729
|
-
const retrievedMessages = await storage.getMessages({ threadId: thread, format: 'v2' });
|
|
730
|
-
// Only one message should exist for that id+threadId
|
|
731
|
-
expect(retrievedMessages.filter(m => m.id.toString() === baseMessage.id)).toHaveLength(1);
|
|
732
|
-
|
|
733
|
-
// The content should be the updated one
|
|
734
|
-
expect(retrievedMessages.find(m => m.id.toString() === baseMessage.id)?.content.parts[0].text).toBe('Updated');
|
|
735
|
-
});
|
|
736
|
-
|
|
737
|
-
it('should upsert messages: duplicate id and different threadid', async () => {
|
|
738
|
-
const thread1 = 'thread-1';
|
|
739
|
-
const thread2 = 'thread-2';
|
|
740
|
-
const thread3 = 'thread-3';
|
|
741
|
-
|
|
742
|
-
const message = generateMessageRecords(1, thread1)[0];
|
|
743
|
-
|
|
744
|
-
// Insert message into thread1
|
|
745
|
-
await storage.saveMessages({ messages: [message], format: 'v2' });
|
|
746
|
-
|
|
747
|
-
// Attempt to insert a message with the same id but different threadId
|
|
748
|
-
const conflictingMessage: MastraMessageV2 = {
|
|
749
|
-
...generateMessageRecords(1, thread2)[0],
|
|
750
|
-
id: message.id,
|
|
751
|
-
content: { format: 2, parts: [{ type: 'text', text: 'Thread2 Content' }] },
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
const differentMessage: MastraMessageV2 = {
|
|
755
|
-
...generateMessageRecords(1, thread3)[0],
|
|
756
|
-
id: '2',
|
|
757
|
-
content: { format: 2, parts: [{ type: 'text', text: 'Another Message Content' }] },
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
// Save should move the message to the new thread
|
|
761
|
-
await storage.saveMessages({ messages: [conflictingMessage], format: 'v2' });
|
|
762
|
-
|
|
763
|
-
await storage.saveMessages({ messages: [differentMessage], format: 'v2' });
|
|
764
|
-
|
|
765
|
-
// Retrieve messages for both threads
|
|
766
|
-
const thread1Messages = await storage.getMessages({ threadId: thread1, format: 'v2' });
|
|
767
|
-
const thread2Messages = await storage.getMessages({ threadId: thread2, format: 'v2' });
|
|
768
|
-
const thread3Messages = await storage.getMessages({ threadId: thread3, format: 'v2' });
|
|
769
|
-
|
|
770
|
-
// Thread 1 should NOT have the message with that id
|
|
771
|
-
expect(thread1Messages.find(m => m.id.toString() === message.id)).toBeUndefined();
|
|
772
|
-
|
|
773
|
-
// Thread 2 should have the message with that id
|
|
774
|
-
expect(thread2Messages.find(m => m.id.toString() === message.id)?.content.parts[0].text).toBe('Thread2 Content');
|
|
775
|
-
|
|
776
|
-
// Thread 2 should have the other message
|
|
777
|
-
expect(thread3Messages.find(m => m.id.toString() === differentMessage.id)?.content.parts[0].text).toBe(
|
|
778
|
-
'Another Message Content',
|
|
779
|
-
);
|
|
780
|
-
});
|
|
781
711
|
});
|
|
782
712
|
|
|
783
713
|
describe('Trace operations', () => {
|