@mastra/cloudflare 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/cloudflare
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
@@ -1557,13 +1557,19 @@ var ScoresStorageCloudflare = class extends storage.ScoresStorage {
1557
1557
  id: storage.createStorageErrorId("CLOUDFLARE", "SAVE_SCORE", "VALIDATION_FAILED"),
1558
1558
  domain: error.ErrorDomain.STORAGE,
1559
1559
  category: error.ErrorCategory.USER,
1560
- details: { scoreId: score.id }
1560
+ details: {
1561
+ scorer: score.scorer?.id ?? "unknown",
1562
+ entityId: score.entityId ?? "unknown",
1563
+ entityType: score.entityType ?? "unknown",
1564
+ traceId: score.traceId ?? "",
1565
+ spanId: score.spanId ?? ""
1566
+ }
1561
1567
  },
1562
1568
  error$1
1563
1569
  );
1564
1570
  }
1571
+ const id = crypto.randomUUID();
1565
1572
  try {
1566
- const id = crypto.randomUUID();
1567
1573
  const serializedRecord = {};
1568
1574
  for (const [key, value] of Object.entries(parsedScore)) {
1569
1575
  if (value !== null && value !== void 0) {
@@ -1576,23 +1582,23 @@ var ScoresStorageCloudflare = class extends storage.ScoresStorage {
1576
1582
  serializedRecord[key] = null;
1577
1583
  }
1578
1584
  }
1585
+ const now = /* @__PURE__ */ new Date();
1579
1586
  serializedRecord.id = id;
1580
- serializedRecord.createdAt = (/* @__PURE__ */ new Date()).toISOString();
1581
- serializedRecord.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
1587
+ serializedRecord.createdAt = now.toISOString();
1588
+ serializedRecord.updatedAt = now.toISOString();
1582
1589
  await this.operations.putKV({
1583
1590
  tableName: storage.TABLE_SCORERS,
1584
1591
  key: id,
1585
1592
  value: serializedRecord
1586
1593
  });
1587
- const scoreFromDb = await this.getScoreById({ id: score.id });
1588
- return { score: scoreFromDb };
1594
+ return { score: { ...parsedScore, id, createdAt: now, updatedAt: now } };
1589
1595
  } catch (error$1) {
1590
1596
  const mastraError = new error.MastraError(
1591
1597
  {
1592
1598
  id: storage.createStorageErrorId("CLOUDFLARE", "SAVE_SCORE", "FAILED"),
1593
1599
  domain: error.ErrorDomain.STORAGE,
1594
1600
  category: error.ErrorCategory.THIRD_PARTY,
1595
- text: `Failed to save score: ${score.id}`
1601
+ details: { id }
1596
1602
  },
1597
1603
  error$1
1598
1604
  );
@@ -2046,6 +2052,28 @@ var WorkflowsStorageCloudflare = class extends storage.WorkflowsStorage {
2046
2052
  return null;
2047
2053
  }
2048
2054
  }
2055
+ async deleteWorkflowRunById({ runId, workflowName }) {
2056
+ try {
2057
+ if (!runId || !workflowName) {
2058
+ throw new Error("runId and workflowName are required");
2059
+ }
2060
+ const key = this.operations.getKey(storage.TABLE_WORKFLOW_SNAPSHOT, { workflow_name: workflowName, run_id: runId });
2061
+ await this.operations.deleteKV(storage.TABLE_WORKFLOW_SNAPSHOT, key);
2062
+ } catch (error$1) {
2063
+ throw new error.MastraError(
2064
+ {
2065
+ id: storage.createStorageErrorId("CLOUDFLARE", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
2066
+ domain: error.ErrorDomain.STORAGE,
2067
+ category: error.ErrorCategory.THIRD_PARTY,
2068
+ details: {
2069
+ workflowName,
2070
+ runId
2071
+ }
2072
+ },
2073
+ error$1
2074
+ );
2075
+ }
2076
+ }
2049
2077
  };
2050
2078
 
2051
2079
  // src/storage/types.ts
@@ -2237,6 +2265,9 @@ var CloudflareStore = class extends storage.MastraStorage {
2237
2265
  }) {
2238
2266
  return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
2239
2267
  }
2268
+ async deleteWorkflowRunById({ runId, workflowName }) {
2269
+ return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
2270
+ }
2240
2271
  async updateMessages(args) {
2241
2272
  return this.stores.memory.updateMessages(args);
2242
2273
  }