@mastra/lance 1.0.0-beta.4 → 1.0.0-beta.6

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,5 +1,34 @@
1
1
  # @mastra/lance
2
2
 
3
+ ## 1.0.0-beta.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
8
+
9
+ ```typescript
10
+ await workflow.deleteWorkflowRunById(runId);
11
+ ```
12
+
13
+ - Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
14
+ - @mastra/core@1.0.0-beta.10
15
+
16
+ ## 1.0.0-beta.5
17
+
18
+ ### Patch Changes
19
+
20
+ - Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
21
+
22
+ **What Changed**
23
+ - saveScore now correctly returns scores that can be retrieved with getScoreById
24
+ - Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
25
+
26
+ **Impact**
27
+ 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.
28
+
29
+ - 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)]:
30
+ - @mastra/core@1.0.0-beta.8
31
+
3
32
  ## 1.0.0-beta.4
4
33
 
5
34
  ### 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", "INVALID_PAYLOAD"),
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.THIRD_PARTY
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).forEach((key) => {
1270
+ for (const key of Object.keys(validatedScore)) {
1263
1271
  if (allowedFields.has(key)) {
1264
- filteredScore[key] = score[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
  {
@@ -1637,6 +1645,23 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
1637
1645
  );
1638
1646
  }
1639
1647
  }
1648
+ async deleteWorkflowRunById({ runId, workflowName }) {
1649
+ try {
1650
+ const table = await this.client.openTable(storage.TABLE_WORKFLOW_SNAPSHOT);
1651
+ const whereClause = `run_id = '${runId.replace(/'/g, "''")}' AND workflow_name = '${workflowName.replace(/'/g, "''")}'`;
1652
+ await table.delete(whereClause);
1653
+ } catch (error$1) {
1654
+ throw new error.MastraError(
1655
+ {
1656
+ id: storage.createStorageErrorId("LANCE", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
1657
+ domain: error.ErrorDomain.STORAGE,
1658
+ category: error.ErrorCategory.THIRD_PARTY,
1659
+ details: { runId, workflowName }
1660
+ },
1661
+ error$1
1662
+ );
1663
+ }
1664
+ }
1640
1665
  async listWorkflowRuns(args) {
1641
1666
  try {
1642
1667
  const table = await this.client.openTable(storage.TABLE_WORKFLOW_SNAPSHOT);
@@ -1909,6 +1934,9 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
1909
1934
  async getWorkflowRunById(args) {
1910
1935
  return this.stores.workflows.getWorkflowRunById(args);
1911
1936
  }
1937
+ async deleteWorkflowRunById({ runId, workflowName }) {
1938
+ return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
1939
+ }
1912
1940
  async updateWorkflowResults({
1913
1941
  workflowName,
1914
1942
  runId,
@@ -1951,8 +1979,8 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
1951
1979
  }) {
1952
1980
  return this.stores.scores.listScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
1953
1981
  }
1954
- async saveScore(_score) {
1955
- return this.stores.scores.saveScore(_score);
1982
+ async saveScore(score) {
1983
+ return this.stores.scores.saveScore(score);
1956
1984
  }
1957
1985
  async listScoresByRunId({
1958
1986
  runId,