@mastra/lance 1.0.0-beta.4 → 1.0.0-beta.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.
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +19 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +2 -2
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @mastra/lance
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
|
|
8
|
+
|
|
9
|
+
**What Changed**
|
|
10
|
+
- saveScore now correctly returns scores that can be retrieved with getScoreById
|
|
11
|
+
- Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
|
|
12
|
+
|
|
13
|
+
**Impact**
|
|
14
|
+
Previously, calling getScoreById after saveScore would return null because the generated ID wasn't persisted to the database. This is now fixed across all store implementations, ensuring consistent behavior and data integrity.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`0d41fe2`](https://github.com/mastra-ai/mastra/commit/0d41fe245355dfc66d61a0d9c85d9400aac351ff), [`6b3ba91`](https://github.com/mastra-ai/mastra/commit/6b3ba91494cc10394df96782f349a4f7b1e152cc), [`7907fd1`](https://github.com/mastra-ai/mastra/commit/7907fd1c5059813b7b870b81ca71041dc807331b)]:
|
|
17
|
+
- @mastra/core@1.0.0-beta.8
|
|
18
|
+
|
|
3
19
|
## 1.0.0-beta.4
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1245,35 +1245,43 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1245
1245
|
} catch (error$1) {
|
|
1246
1246
|
throw new error.MastraError(
|
|
1247
1247
|
{
|
|
1248
|
-
id: storage.createStorageErrorId("LANCE", "SAVE_SCORE", "
|
|
1248
|
+
id: storage.createStorageErrorId("LANCE", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1249
1249
|
text: "Failed to save score in LanceStorage",
|
|
1250
1250
|
domain: error.ErrorDomain.STORAGE,
|
|
1251
|
-
category: error.ErrorCategory.
|
|
1251
|
+
category: error.ErrorCategory.USER,
|
|
1252
|
+
details: {
|
|
1253
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1254
|
+
entityId: score.entityId ?? "unknown",
|
|
1255
|
+
entityType: score.entityType ?? "unknown",
|
|
1256
|
+
traceId: score.traceId ?? "",
|
|
1257
|
+
spanId: score.spanId ?? ""
|
|
1258
|
+
}
|
|
1252
1259
|
},
|
|
1253
1260
|
error$1
|
|
1254
1261
|
);
|
|
1255
1262
|
}
|
|
1263
|
+
const id = crypto.randomUUID();
|
|
1264
|
+
const now = /* @__PURE__ */ new Date();
|
|
1256
1265
|
try {
|
|
1257
|
-
const id = crypto.randomUUID();
|
|
1258
1266
|
const table = await this.client.openTable(storage.TABLE_SCORERS);
|
|
1259
1267
|
const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
|
|
1260
1268
|
const allowedFields = new Set(schema.fields.map((f) => f.name));
|
|
1261
1269
|
const filteredScore = {};
|
|
1262
|
-
Object.keys(validatedScore)
|
|
1270
|
+
for (const key of Object.keys(validatedScore)) {
|
|
1263
1271
|
if (allowedFields.has(key)) {
|
|
1264
|
-
filteredScore[key] =
|
|
1272
|
+
filteredScore[key] = validatedScore[key];
|
|
1265
1273
|
}
|
|
1266
|
-
}
|
|
1274
|
+
}
|
|
1267
1275
|
for (const key in filteredScore) {
|
|
1268
1276
|
if (filteredScore[key] !== null && typeof filteredScore[key] === "object" && !(filteredScore[key] instanceof Date)) {
|
|
1269
1277
|
filteredScore[key] = JSON.stringify(filteredScore[key]);
|
|
1270
1278
|
}
|
|
1271
1279
|
}
|
|
1272
|
-
filteredScore.createdAt = /* @__PURE__ */ new Date();
|
|
1273
|
-
filteredScore.updatedAt = /* @__PURE__ */ new Date();
|
|
1274
1280
|
filteredScore.id = id;
|
|
1281
|
+
filteredScore.createdAt = now;
|
|
1282
|
+
filteredScore.updatedAt = now;
|
|
1275
1283
|
await table.add([filteredScore], { mode: "append" });
|
|
1276
|
-
return { score };
|
|
1284
|
+
return { score: { ...validatedScore, id, createdAt: now, updatedAt: now } };
|
|
1277
1285
|
} catch (error$1) {
|
|
1278
1286
|
throw new error.MastraError(
|
|
1279
1287
|
{
|
|
@@ -1951,8 +1959,8 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1951
1959
|
}) {
|
|
1952
1960
|
return this.stores.scores.listScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
|
|
1953
1961
|
}
|
|
1954
|
-
async saveScore(
|
|
1955
|
-
return this.stores.scores.saveScore(
|
|
1962
|
+
async saveScore(score) {
|
|
1963
|
+
return this.stores.scores.saveScore(score);
|
|
1956
1964
|
}
|
|
1957
1965
|
async listScoresByRunId({
|
|
1958
1966
|
runId,
|