@mastra/cloudflare 1.3.2 → 1.3.3-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @mastra/cloudflare
2
2
 
3
+ ## 1.3.3-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Respect optional `resourceId` in `getThreadById` so scoped thread lookups return `null` when the thread belongs to a different resource. ([#14237](https://github.com/mastra-ai/mastra/pull/14237))
8
+
9
+ Example:
10
+
11
+ ```typescript
12
+ const thread = await memory.getThreadById({
13
+ threadId: 'my-thread-id',
14
+ resourceId: 'my-user-id',
15
+ });
16
+ // Returns null if the thread does not belong to 'my-user-id'.
17
+ ```
18
+
19
+ - Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4)]:
20
+ - @mastra/core@1.33.0-alpha.8
21
+
22
+ ## 1.3.3-alpha.0
23
+
24
+ ### Patch Changes
25
+
26
+ - Track `suspendedAt` and `suspendPayload` on background tasks. SQL adapters auto-migrate the new columns via `alterTable`. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
27
+
28
+ - Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
29
+ - @mastra/core@1.33.0-alpha.4
30
+
3
31
  ## 1.3.2
4
32
 
5
33
  ### Patch Changes
@@ -689,11 +689,13 @@ function rowToTask(row) {
689
689
  runId: String(row.run_id),
690
690
  result: parseJson(row.result),
691
691
  error: parseJson(row.error),
692
+ suspendPayload: parseJson(row.suspend_payload),
692
693
  retryCount: Number(row.retry_count ?? 0),
693
694
  maxRetries: Number(row.max_retries ?? 0),
694
695
  timeoutMs: Number(row.timeout_ms ?? 3e5),
695
696
  createdAt: asDate(row.createdAt) ?? /* @__PURE__ */ new Date(),
696
697
  startedAt: asDate(row.startedAt),
698
+ suspendedAt: asDate(row.suspendedAt),
697
699
  completedAt: asDate(row.completedAt)
698
700
  };
699
701
  }
@@ -711,6 +713,11 @@ var BackgroundTasksStorageDO = class extends storage.BackgroundTasksStorage {
711
713
  tableName: storage.TABLE_BACKGROUND_TASKS,
712
714
  schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS]
713
715
  });
716
+ await this.#db.alterTable({
717
+ tableName: storage.TABLE_BACKGROUND_TASKS,
718
+ schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS],
719
+ ifNotExists: ["suspend_payload", "suspendedAt"]
720
+ });
714
721
  }
715
722
  async dangerouslyClearAll() {
716
723
  await this.#db.clearTable({ tableName: storage.TABLE_BACKGROUND_TASKS });
@@ -731,11 +738,13 @@ var BackgroundTasksStorageDO = class extends storage.BackgroundTasksStorage {
731
738
  args: serializeJson(task.args),
732
739
  result: serializeJson(task.result),
733
740
  error: serializeJson(task.error),
741
+ suspend_payload: serializeJson(task.suspendPayload),
734
742
  retry_count: task.retryCount,
735
743
  max_retries: task.maxRetries,
736
744
  timeout_ms: task.timeoutMs,
737
745
  createdAt: task.createdAt.toISOString(),
738
746
  startedAt: task.startedAt?.toISOString() ?? null,
747
+ suspendedAt: task.suspendedAt?.toISOString() ?? null,
739
748
  completedAt: task.completedAt?.toISOString() ?? null
740
749
  }
741
750
  });
@@ -765,6 +774,10 @@ var BackgroundTasksStorageDO = class extends storage.BackgroundTasksStorage {
765
774
  columns.push("error");
766
775
  values.push(serializeJson(update.error));
767
776
  }
777
+ if ("suspendPayload" in update) {
778
+ columns.push("suspend_payload");
779
+ values.push(serializeJson(update.suspendPayload));
780
+ }
768
781
  if ("retryCount" in update) {
769
782
  columns.push("retry_count");
770
783
  values.push(update.retryCount);
@@ -773,6 +786,10 @@ var BackgroundTasksStorageDO = class extends storage.BackgroundTasksStorage {
773
786
  columns.push("startedAt");
774
787
  values.push(update.startedAt?.toISOString() ?? null);
775
788
  }
789
+ if ("suspendedAt" in update) {
790
+ columns.push("suspendedAt");
791
+ values.push(update.suspendedAt?.toISOString() ?? null);
792
+ }
776
793
  if ("completedAt" in update) {
777
794
  columns.push("completedAt");
778
795
  values.push(update.completedAt?.toISOString() ?? null);
@@ -830,6 +847,7 @@ var BackgroundTasksStorageDO = class extends storage.BackgroundTasksStorage {
830
847
  if (filter.threadId) builder.whereAnd("thread_id = ?", filter.threadId);
831
848
  if (filter.resourceId) builder.whereAnd("resource_id = ?", filter.resourceId);
832
849
  if (filter.toolName) builder.whereAnd("tool_name = ?", filter.toolName);
850
+ if (filter.toolCallId) builder.whereAnd("tool_call_id = ?", filter.toolCallId);
833
851
  if (filter.runId) builder.whereAnd("run_id = ?", filter.runId);
834
852
  const dateCol = dateColumnName(filter.dateFilterBy ?? "createdAt");
835
853
  if (filter.fromDate) builder.whereAnd(`${dateCol} >= ?`, filter.fromDate.toISOString());
@@ -902,6 +920,7 @@ var BackgroundTasksStorageDO = class extends storage.BackgroundTasksStorage {
902
920
  if (filter.threadId) query.whereAnd("thread_id = ?", filter.threadId);
903
921
  if (filter.resourceId) query.whereAnd("resource_id = ?", filter.resourceId);
904
922
  if (filter.toolName) query.whereAnd("tool_name = ?", filter.toolName);
923
+ if (filter.toolCallId) query.whereAnd("tool_call_id = ?", filter.toolCallId);
905
924
  if (filter.runId) query.whereAnd("run_id = ?", filter.runId);
906
925
  const dateCol = dateColumnName(filter.dateFilterBy ?? "createdAt");
907
926
  if (filter.fromDate) query.whereAnd(`${dateCol} >= ?`, filter.fromDate.toISOString());
@@ -1067,12 +1086,15 @@ var MemoryStorageDO = class extends storage.MemoryStorage {
1067
1086
  );
1068
1087
  }
1069
1088
  }
1070
- async getThreadById({ threadId }) {
1089
+ async getThreadById({
1090
+ threadId,
1091
+ resourceId
1092
+ }) {
1071
1093
  const thread = await this.#db.load({
1072
1094
  tableName: storage.TABLE_THREADS,
1073
1095
  keys: { id: threadId }
1074
1096
  });
1075
- if (!thread) return null;
1097
+ if (!thread || resourceId !== void 0 && thread.resourceId !== resourceId) return null;
1076
1098
  try {
1077
1099
  return {
1078
1100
  ...thread,
@@ -2401,5 +2423,5 @@ exports.DOStore = DOStore;
2401
2423
  exports.MemoryStorageDO = MemoryStorageDO;
2402
2424
  exports.ScoresStorageDO = ScoresStorageDO;
2403
2425
  exports.WorkflowsStorageDO = WorkflowsStorageDO;
2404
- //# sourceMappingURL=chunk-T2WSIEXQ.cjs.map
2405
- //# sourceMappingURL=chunk-T2WSIEXQ.cjs.map
2426
+ //# sourceMappingURL=chunk-63YHZAI7.cjs.map
2427
+ //# sourceMappingURL=chunk-63YHZAI7.cjs.map