@mastra/lance 0.0.0-zod-v4-compat-part-2-20250820135355 → 0.0.0-zod-v4-stuff-20250825154219

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 CHANGED
@@ -1,14 +1,129 @@
1
1
  # @mastra/lance
2
2
 
3
- ## 0.0.0-zod-v4-compat-part-2-20250820135355
3
+ ## 0.0.0-zod-v4-stuff-20250825154219
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Updated dependencies [[`0778757`](https://github.com/mastra-ai/mastra/commit/07787570e4addbd501522037bd2542c3d9e26822), [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b), [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1), [`d51eac2`](https://github.com/mastra-ai/mastra/commit/d51eac24ba0fbb33d3e22dcc310f9c0e7167598d), [`9613558`](https://github.com/mastra-ai/mastra/commit/9613558e6475f4710e05d1be7553a32ee7bddc20)]:
8
+ - @mastra/core@0.0.0-zod-v4-stuff-20250825154219
9
+
10
+ ## 0.2.7
11
+
12
+ ### Patch Changes
13
+
14
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
15
+
16
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`0f00e17`](https://github.com/mastra-ai/mastra/commit/0f00e172953ccdccadb35ed3d70f5e4d89115869), [`217cd7a`](https://github.com/mastra-ai/mastra/commit/217cd7a4ce171e9a575c41bb8c83300f4db03236), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
17
+ - @mastra/core@0.14.1
18
+
19
+ ## 0.2.7-alpha.0
20
+
21
+ ### Patch Changes
22
+
23
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
24
+
25
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
26
+ - @mastra/core@0.14.1-alpha.0
27
+
28
+ ## 0.2.6
29
+
30
+ ### Patch Changes
31
+
32
+ - 03997ae: Update peerdeps
33
+ - Updated dependencies [227c7e6]
34
+ - Updated dependencies [12cae67]
35
+ - Updated dependencies [fd3a3eb]
36
+ - Updated dependencies [6faaee5]
37
+ - Updated dependencies [4232b14]
38
+ - Updated dependencies [a89de7e]
39
+ - Updated dependencies [5a37d0c]
40
+ - Updated dependencies [4bde0cb]
41
+ - Updated dependencies [cf4f357]
42
+ - Updated dependencies [ad888a2]
43
+ - Updated dependencies [481751d]
44
+ - Updated dependencies [2454423]
45
+ - Updated dependencies [194e395]
46
+ - Updated dependencies [a722c0b]
47
+ - Updated dependencies [c30bca8]
48
+ - Updated dependencies [3b5fec7]
49
+ - Updated dependencies [a8f129d]
50
+ - @mastra/core@0.14.0
51
+
52
+ ## 0.2.6-alpha.0
53
+
54
+ ### Patch Changes
55
+
56
+ - 03997ae: Update peerdeps
57
+ - @mastra/core@0.14.0-alpha.7
58
+
59
+ ## 0.2.5
60
+
61
+ ### Patch Changes
62
+
63
+ - cc9035c: dependencies updates:
64
+ - Updated dependency [`@lancedb/lancedb@^0.21.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.21.2) (from `^0.18.2`, in `dependencies`)
65
+ - b32c50d: Filter scores by source
66
+ - Updated dependencies [d5330bf]
67
+ - Updated dependencies [2e74797]
68
+ - Updated dependencies [8388649]
69
+ - Updated dependencies [a239d41]
70
+ - Updated dependencies [dd94a26]
71
+ - Updated dependencies [3ba6772]
72
+ - Updated dependencies [b5cf2a3]
73
+ - Updated dependencies [2fff911]
74
+ - Updated dependencies [b32c50d]
75
+ - Updated dependencies [63449d0]
76
+ - Updated dependencies [121a3f8]
77
+ - Updated dependencies [ec510e7]
78
+ - @mastra/core@0.13.2
79
+
80
+ ## 0.2.5-alpha.0
81
+
82
+ ### Patch Changes
83
+
84
+ - cc9035c: dependencies updates:
85
+ - Updated dependency [`@lancedb/lancedb@^0.21.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.21.2) (from `^0.18.2`, in `dependencies`)
86
+ - b32c50d: Filter scores by source
87
+ - Updated dependencies [d5330bf]
88
+ - Updated dependencies [a239d41]
89
+ - Updated dependencies [b32c50d]
90
+ - Updated dependencies [121a3f8]
91
+ - Updated dependencies [ec510e7]
92
+ - @mastra/core@0.13.2-alpha.2
93
+
94
+ ## 0.2.4
95
+
96
+ ### Patch Changes
97
+
98
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
99
+ - Updated dependencies [cb36de0]
100
+ - Updated dependencies [d0496e6]
101
+ - Updated dependencies [a82b851]
102
+ - Updated dependencies [ea0c5f2]
103
+ - Updated dependencies [41a0a0e]
104
+ - Updated dependencies [2871020]
7
105
  - Updated dependencies [94f4812]
8
106
  - Updated dependencies [e202b82]
9
107
  - Updated dependencies [e00f6a0]
108
+ - Updated dependencies [4a406ec]
109
+ - Updated dependencies [b0e43c1]
110
+ - Updated dependencies [5d377e5]
111
+ - Updated dependencies [1fb812e]
10
112
  - Updated dependencies [35c5798]
11
- - @mastra/core@0.0.0-zod-v4-compat-part-2-20250820135355
113
+ - @mastra/core@0.13.0
114
+
115
+ ## 0.2.4-alpha.0
116
+
117
+ ### Patch Changes
118
+
119
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
120
+ - Updated dependencies [cb36de0]
121
+ - Updated dependencies [a82b851]
122
+ - Updated dependencies [41a0a0e]
123
+ - Updated dependencies [2871020]
124
+ - Updated dependencies [4a406ec]
125
+ - Updated dependencies [5d377e5]
126
+ - @mastra/core@0.13.0-alpha.2
12
127
 
13
128
  ## 0.2.3
14
129
 
package/dist/index.cjs CHANGED
@@ -381,6 +381,20 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
381
381
  );
382
382
  }
383
383
  }
384
+ normalizeMessage(message) {
385
+ const { thread_id, ...rest } = message;
386
+ return {
387
+ ...rest,
388
+ threadId: thread_id,
389
+ content: typeof message.content === "string" ? (() => {
390
+ try {
391
+ return JSON.parse(message.content);
392
+ } catch {
393
+ return message.content;
394
+ }
395
+ })() : message.content
396
+ };
397
+ }
384
398
  async getMessages({
385
399
  threadId,
386
400
  resourceId,
@@ -421,21 +435,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
421
435
  allRecords,
422
436
  await getTableSchema({ tableName: storage.TABLE_MESSAGES, client: this.client })
423
437
  );
424
- const normalized = messages.map((msg) => {
425
- const { thread_id, ...rest } = msg;
426
- return {
427
- ...rest,
428
- threadId: thread_id,
429
- content: typeof msg.content === "string" ? (() => {
430
- try {
431
- return JSON.parse(msg.content);
432
- } catch {
433
- return msg.content;
434
- }
435
- })() : msg.content
436
- };
437
- });
438
- const list = new agent.MessageList({ threadId, resourceId }).add(normalized, "memory");
438
+ const list = new agent.MessageList({ threadId, resourceId }).add(messages.map(this.normalizeMessage), "memory");
439
439
  if (format === "v2") return list.get.all.v2();
440
440
  return list.get.all.v1();
441
441
  } catch (error$1) {
@@ -449,6 +449,36 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
449
449
  );
450
450
  }
451
451
  }
452
+ async getMessagesById({
453
+ messageIds,
454
+ format
455
+ }) {
456
+ if (messageIds.length === 0) return [];
457
+ try {
458
+ const table = await this.client.openTable(storage.TABLE_MESSAGES);
459
+ const quotedIds = messageIds.map((id) => `'${id}'`).join(", ");
460
+ const allRecords = await table.query().where(`id IN (${quotedIds})`).toArray();
461
+ const messages = processResultWithTypeConversion(
462
+ allRecords,
463
+ await getTableSchema({ tableName: storage.TABLE_MESSAGES, client: this.client })
464
+ );
465
+ const list = new agent.MessageList().add(messages.map(this.normalizeMessage), "memory");
466
+ if (format === `v1`) return list.get.all.v1();
467
+ return list.get.all.v2();
468
+ } catch (error$1) {
469
+ throw new error.MastraError(
470
+ {
471
+ id: "LANCE_STORE_GET_MESSAGES_BY_ID_FAILED",
472
+ domain: error.ErrorDomain.STORAGE,
473
+ category: error.ErrorCategory.THIRD_PARTY,
474
+ details: {
475
+ messageIds: JSON.stringify(messageIds)
476
+ }
477
+ },
478
+ error$1
479
+ );
480
+ }
481
+ }
452
482
  async saveMessages(args) {
453
483
  try {
454
484
  const { messages, format = "v1" } = args;
@@ -1361,6 +1391,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1361
1391
  }
1362
1392
  async saveScore(score) {
1363
1393
  try {
1394
+ const id = crypto.randomUUID();
1364
1395
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1365
1396
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1366
1397
  const allowedFields = new Set(schema.fields.map((f) => f.name));
@@ -1375,7 +1406,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1375
1406
  filteredScore[key] = JSON.stringify(filteredScore[key]);
1376
1407
  }
1377
1408
  }
1378
- console.log("Saving score to LanceStorage:", filteredScore);
1409
+ filteredScore.id = id;
1379
1410
  await table.add([filteredScore], { mode: "append" });
1380
1411
  return { score };
1381
1412
  } catch (error$1) {
@@ -1414,18 +1445,35 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1414
1445
  }
1415
1446
  async getScoresByScorerId({
1416
1447
  scorerId,
1417
- pagination
1448
+ pagination,
1449
+ entityId,
1450
+ entityType,
1451
+ source
1418
1452
  }) {
1419
1453
  try {
1420
1454
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1421
1455
  const { page = 0, perPage = 10 } = pagination || {};
1422
1456
  const offset = page * perPage;
1423
- const query = table.query().where(`\`scorerId\` = '${scorerId}'`).limit(perPage);
1457
+ let query = table.query().where(`\`scorerId\` = '${scorerId}'`);
1458
+ if (source) {
1459
+ query = query.where(`\`source\` = '${source}'`);
1460
+ }
1461
+ if (entityId) {
1462
+ query = query.where(`\`entityId\` = '${entityId}'`);
1463
+ }
1464
+ if (entityType) {
1465
+ query = query.where(`\`entityType\` = '${entityType}'`);
1466
+ }
1467
+ query = query.limit(perPage);
1424
1468
  if (offset > 0) query.offset(offset);
1425
1469
  const records = await query.toArray();
1426
1470
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1427
1471
  const scores = processResultWithTypeConversion(records, schema);
1428
- const allRecords = await table.query().where(`\`scorerId\` = '${scorerId}'`).toArray();
1472
+ let totalQuery = table.query().where(`\`scorerId\` = '${scorerId}'`);
1473
+ if (source) {
1474
+ totalQuery = totalQuery.where(`\`source\` = '${source}'`);
1475
+ }
1476
+ const allRecords = await totalQuery.toArray();
1429
1477
  const total = allRecords.length;
1430
1478
  return {
1431
1479
  pagination: {
@@ -2071,6 +2119,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2071
2119
  }) {
2072
2120
  return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format, threadConfig });
2073
2121
  }
2122
+ async getMessagesById({
2123
+ messageIds,
2124
+ format
2125
+ }) {
2126
+ return this.stores.memory.getMessagesById({ messageIds, format });
2127
+ }
2074
2128
  async saveMessages(args) {
2075
2129
  return this.stores.memory.saveMessages(args);
2076
2130
  }
@@ -2122,9 +2176,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2122
2176
  }
2123
2177
  async getScoresByScorerId({
2124
2178
  scorerId,
2179
+ source,
2180
+ entityId,
2181
+ entityType,
2125
2182
  pagination
2126
2183
  }) {
2127
- return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
2184
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
2128
2185
  }
2129
2186
  async saveScore(_score) {
2130
2187
  return this.stores.scores.saveScore(_score);