@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/dist/index.js
CHANGED
|
@@ -1243,35 +1243,43 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1243
1243
|
} catch (error) {
|
|
1244
1244
|
throw new MastraError(
|
|
1245
1245
|
{
|
|
1246
|
-
id: createStorageErrorId("LANCE", "SAVE_SCORE", "
|
|
1246
|
+
id: createStorageErrorId("LANCE", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1247
1247
|
text: "Failed to save score in LanceStorage",
|
|
1248
1248
|
domain: ErrorDomain.STORAGE,
|
|
1249
|
-
category: ErrorCategory.
|
|
1249
|
+
category: ErrorCategory.USER,
|
|
1250
|
+
details: {
|
|
1251
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1252
|
+
entityId: score.entityId ?? "unknown",
|
|
1253
|
+
entityType: score.entityType ?? "unknown",
|
|
1254
|
+
traceId: score.traceId ?? "",
|
|
1255
|
+
spanId: score.spanId ?? ""
|
|
1256
|
+
}
|
|
1250
1257
|
},
|
|
1251
1258
|
error
|
|
1252
1259
|
);
|
|
1253
1260
|
}
|
|
1261
|
+
const id = crypto.randomUUID();
|
|
1262
|
+
const now = /* @__PURE__ */ new Date();
|
|
1254
1263
|
try {
|
|
1255
|
-
const id = crypto.randomUUID();
|
|
1256
1264
|
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1257
1265
|
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1258
1266
|
const allowedFields = new Set(schema.fields.map((f) => f.name));
|
|
1259
1267
|
const filteredScore = {};
|
|
1260
|
-
Object.keys(validatedScore)
|
|
1268
|
+
for (const key of Object.keys(validatedScore)) {
|
|
1261
1269
|
if (allowedFields.has(key)) {
|
|
1262
|
-
filteredScore[key] =
|
|
1270
|
+
filteredScore[key] = validatedScore[key];
|
|
1263
1271
|
}
|
|
1264
|
-
}
|
|
1272
|
+
}
|
|
1265
1273
|
for (const key in filteredScore) {
|
|
1266
1274
|
if (filteredScore[key] !== null && typeof filteredScore[key] === "object" && !(filteredScore[key] instanceof Date)) {
|
|
1267
1275
|
filteredScore[key] = JSON.stringify(filteredScore[key]);
|
|
1268
1276
|
}
|
|
1269
1277
|
}
|
|
1270
|
-
filteredScore.createdAt = /* @__PURE__ */ new Date();
|
|
1271
|
-
filteredScore.updatedAt = /* @__PURE__ */ new Date();
|
|
1272
1278
|
filteredScore.id = id;
|
|
1279
|
+
filteredScore.createdAt = now;
|
|
1280
|
+
filteredScore.updatedAt = now;
|
|
1273
1281
|
await table.add([filteredScore], { mode: "append" });
|
|
1274
|
-
return { score };
|
|
1282
|
+
return { score: { ...validatedScore, id, createdAt: now, updatedAt: now } };
|
|
1275
1283
|
} catch (error) {
|
|
1276
1284
|
throw new MastraError(
|
|
1277
1285
|
{
|
|
@@ -1949,8 +1957,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1949
1957
|
}) {
|
|
1950
1958
|
return this.stores.scores.listScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
|
|
1951
1959
|
}
|
|
1952
|
-
async saveScore(
|
|
1953
|
-
return this.stores.scores.saveScore(
|
|
1960
|
+
async saveScore(score) {
|
|
1961
|
+
return this.stores.scores.saveScore(score);
|
|
1954
1962
|
}
|
|
1955
1963
|
async listScoresByRunId({
|
|
1956
1964
|
runId,
|