@mastra/upstash 0.14.0 → 0.14.1

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/dist/index.js CHANGED
@@ -251,6 +251,8 @@ function processRecord(tableName, record) {
251
251
  });
252
252
  } else if (tableName === TABLE_EVALS) {
253
253
  key = getKey(tableName, { id: record.run_id });
254
+ } else if (tableName === TABLE_SCORERS) {
255
+ key = getKey(tableName, { runId: record.runId });
254
256
  } else {
255
257
  key = getKey(tableName, { id: record.id });
256
258
  }
@@ -1199,6 +1201,9 @@ var ScoresUpstash = class extends ScoresStorage {
1199
1201
  }
1200
1202
  async getScoresByScorerId({
1201
1203
  scorerId,
1204
+ entityId,
1205
+ entityType,
1206
+ source,
1202
1207
  pagination = { page: 0, perPage: 20 }
1203
1208
  }) {
1204
1209
  const pattern = `${TABLE_SCORERS}:*`;
@@ -1212,7 +1217,14 @@ var ScoresUpstash = class extends ScoresStorage {
1212
1217
  const pipeline = this.client.pipeline();
1213
1218
  keys.forEach((key) => pipeline.get(key));
1214
1219
  const results = await pipeline.exec();
1215
- const filtered = results.map((row) => row).filter((row) => !!row && typeof row === "object" && row.scorerId === scorerId);
1220
+ const filtered = results.map((row) => row).filter((row) => {
1221
+ if (!row || typeof row !== "object") return false;
1222
+ if (row.scorerId !== scorerId) return false;
1223
+ if (entityId && row.entityId !== entityId) return false;
1224
+ if (entityType && row.entityType !== entityType) return false;
1225
+ if (source && row.source !== source) return false;
1226
+ return true;
1227
+ });
1216
1228
  const total = filtered.length;
1217
1229
  const { page, perPage } = pagination;
1218
1230
  const start = page * perPage;
@@ -1836,9 +1848,12 @@ var UpstashStore = class extends MastraStorage {
1836
1848
  }
1837
1849
  async getScoresByScorerId({
1838
1850
  scorerId,
1839
- pagination
1851
+ pagination,
1852
+ entityId,
1853
+ entityType,
1854
+ source
1840
1855
  }) {
1841
- return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
1856
+ return this.stores.scores.getScoresByScorerId({ scorerId, pagination, entityId, entityType, source });
1842
1857
  }
1843
1858
  };
1844
1859
  var UpstashFilterTranslator = class extends BaseFilterTranslator {