@mastra/lance 0.2.4 → 0.2.5

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,4 +1,4 @@
1
1
 
2
- > @mastra/lance@0.2.4-alpha.0 build /home/runner/work/mastra/mastra/stores/lance
2
+ > @mastra/lance@0.2.5-alpha.0 build /home/runner/work/mastra/mastra/stores/lance
3
3
  > tsup --silent --config tsup.config.ts
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @mastra/lance
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - cc9035c: dependencies updates:
8
+ - Updated dependency [`@lancedb/lancedb@^0.21.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.21.2) (from `^0.18.2`, in `dependencies`)
9
+ - b32c50d: Filter scores by source
10
+ - Updated dependencies [d5330bf]
11
+ - Updated dependencies [2e74797]
12
+ - Updated dependencies [8388649]
13
+ - Updated dependencies [a239d41]
14
+ - Updated dependencies [dd94a26]
15
+ - Updated dependencies [3ba6772]
16
+ - Updated dependencies [b5cf2a3]
17
+ - Updated dependencies [2fff911]
18
+ - Updated dependencies [b32c50d]
19
+ - Updated dependencies [63449d0]
20
+ - Updated dependencies [121a3f8]
21
+ - Updated dependencies [ec510e7]
22
+ - @mastra/core@0.13.2
23
+
24
+ ## 0.2.5-alpha.0
25
+
26
+ ### Patch Changes
27
+
28
+ - cc9035c: dependencies updates:
29
+ - Updated dependency [`@lancedb/lancedb@^0.21.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.21.2) (from `^0.18.2`, in `dependencies`)
30
+ - b32c50d: Filter scores by source
31
+ - Updated dependencies [d5330bf]
32
+ - Updated dependencies [a239d41]
33
+ - Updated dependencies [b32c50d]
34
+ - Updated dependencies [121a3f8]
35
+ - Updated dependencies [ec510e7]
36
+ - @mastra/core@0.13.2-alpha.2
37
+
3
38
  ## 0.2.4
4
39
 
5
40
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1361,6 +1361,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1361
1361
  }
1362
1362
  async saveScore(score) {
1363
1363
  try {
1364
+ const id = crypto.randomUUID();
1364
1365
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1365
1366
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1366
1367
  const allowedFields = new Set(schema.fields.map((f) => f.name));
@@ -1375,7 +1376,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1375
1376
  filteredScore[key] = JSON.stringify(filteredScore[key]);
1376
1377
  }
1377
1378
  }
1378
- console.log("Saving score to LanceStorage:", filteredScore);
1379
+ filteredScore.id = id;
1379
1380
  await table.add([filteredScore], { mode: "append" });
1380
1381
  return { score };
1381
1382
  } catch (error$1) {
@@ -1414,18 +1415,35 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1414
1415
  }
1415
1416
  async getScoresByScorerId({
1416
1417
  scorerId,
1417
- pagination
1418
+ pagination,
1419
+ entityId,
1420
+ entityType,
1421
+ source
1418
1422
  }) {
1419
1423
  try {
1420
1424
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1421
1425
  const { page = 0, perPage = 10 } = pagination || {};
1422
1426
  const offset = page * perPage;
1423
- const query = table.query().where(`\`scorerId\` = '${scorerId}'`).limit(perPage);
1427
+ let query = table.query().where(`\`scorerId\` = '${scorerId}'`);
1428
+ if (source) {
1429
+ query = query.where(`\`source\` = '${source}'`);
1430
+ }
1431
+ if (entityId) {
1432
+ query = query.where(`\`entityId\` = '${entityId}'`);
1433
+ }
1434
+ if (entityType) {
1435
+ query = query.where(`\`entityType\` = '${entityType}'`);
1436
+ }
1437
+ query = query.limit(perPage);
1424
1438
  if (offset > 0) query.offset(offset);
1425
1439
  const records = await query.toArray();
1426
1440
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1427
1441
  const scores = processResultWithTypeConversion(records, schema);
1428
- const allRecords = await table.query().where(`\`scorerId\` = '${scorerId}'`).toArray();
1442
+ let totalQuery = table.query().where(`\`scorerId\` = '${scorerId}'`);
1443
+ if (source) {
1444
+ totalQuery = totalQuery.where(`\`source\` = '${source}'`);
1445
+ }
1446
+ const allRecords = await totalQuery.toArray();
1429
1447
  const total = allRecords.length;
1430
1448
  return {
1431
1449
  pagination: {
@@ -2122,9 +2140,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2122
2140
  }
2123
2141
  async getScoresByScorerId({
2124
2142
  scorerId,
2143
+ source,
2144
+ entityId,
2145
+ entityType,
2125
2146
  pagination
2126
2147
  }) {
2127
- return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
2148
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
2128
2149
  }
2129
2150
  async saveScore(_score) {
2130
2151
  return this.stores.scores.saveScore(_score);