@mastra/cloudflare 0.11.11-alpha.1 → 0.11.12-alpha.0

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,70 @@
1
1
  # @mastra/cloudflare
2
2
 
3
+ ## 0.11.12-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
8
+ - Updated dependencies [fd83526]
9
+ - Updated dependencies [d0b90ab]
10
+ - Updated dependencies [6f5eb7a]
11
+ - Updated dependencies [a01cf14]
12
+ - Updated dependencies [a9e50ee]
13
+ - Updated dependencies [5397eb4]
14
+ - Updated dependencies [c9f4e4a]
15
+ - Updated dependencies [0acbc80]
16
+ - @mastra/core@0.16.0-alpha.0
17
+
18
+ ## 0.11.11
19
+
20
+ ### Patch Changes
21
+
22
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
23
+ - f0dfcac: updated core peerdep
24
+ - Updated dependencies [ab48c97]
25
+ - Updated dependencies [85ef90b]
26
+ - Updated dependencies [aedbbfa]
27
+ - Updated dependencies [ff89505]
28
+ - Updated dependencies [637f323]
29
+ - Updated dependencies [de3cbc6]
30
+ - Updated dependencies [c19bcf7]
31
+ - Updated dependencies [4474d04]
32
+ - Updated dependencies [183dc95]
33
+ - Updated dependencies [a1111e2]
34
+ - Updated dependencies [b42a961]
35
+ - Updated dependencies [61debef]
36
+ - Updated dependencies [9beaeff]
37
+ - Updated dependencies [29de0e1]
38
+ - Updated dependencies [f643c65]
39
+ - Updated dependencies [00c74e7]
40
+ - Updated dependencies [fef7375]
41
+ - Updated dependencies [e3d8fea]
42
+ - Updated dependencies [45e4d39]
43
+ - Updated dependencies [9eee594]
44
+ - Updated dependencies [7149d8d]
45
+ - Updated dependencies [822c2e8]
46
+ - Updated dependencies [979912c]
47
+ - Updated dependencies [7dcf4c0]
48
+ - Updated dependencies [4106a58]
49
+ - Updated dependencies [ad78bfc]
50
+ - Updated dependencies [0302f50]
51
+ - Updated dependencies [6ac697e]
52
+ - Updated dependencies [74db265]
53
+ - Updated dependencies [0ce418a]
54
+ - Updated dependencies [af90672]
55
+ - Updated dependencies [8387952]
56
+ - Updated dependencies [7f3b8da]
57
+ - Updated dependencies [905352b]
58
+ - Updated dependencies [599d04c]
59
+ - Updated dependencies [56041d0]
60
+ - Updated dependencies [3412597]
61
+ - Updated dependencies [5eca5d2]
62
+ - Updated dependencies [f2cda47]
63
+ - Updated dependencies [5de1555]
64
+ - Updated dependencies [cfd377a]
65
+ - Updated dependencies [1ed5a3e]
66
+ - @mastra/core@0.15.3
67
+
3
68
  ## 0.11.11-alpha.1
4
69
 
5
70
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -596,6 +596,7 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
596
596
  );
597
597
  }
598
598
  async getRecentMessages(threadId, limit, messageIds) {
599
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
599
600
  if (limit <= 0) return;
600
601
  try {
601
602
  const threadMessagesKey = this.getThreadMessagesKey(threadId);
@@ -655,14 +656,13 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
655
656
  format
656
657
  }) {
657
658
  console.log(`getMessages called with format: ${format}, threadId: ${threadId}`);
658
- if (!threadId) throw new Error("threadId is required");
659
659
  const actualFormat = format || "v1";
660
660
  console.log(`Using format: ${actualFormat}`);
661
- if (!threadId) throw new Error("threadId is required");
662
661
  const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
663
662
  const messageIds = /* @__PURE__ */ new Set();
664
663
  if (limit === 0 && !selectBy?.include?.length) return [];
665
664
  try {
665
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
666
666
  await Promise.all([
667
667
  selectBy?.include?.length ? this.getIncludedMessagesWithContext(threadId, selectBy.include, messageIds) : Promise.resolve(),
668
668
  limit > 0 ? this.getRecentMessages(threadId, limit, messageIds) : Promise.resolve()
@@ -723,7 +723,8 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
723
723
  category: error.ErrorCategory.THIRD_PARTY,
724
724
  text: `Error retrieving messages for thread ${threadId}`,
725
725
  details: {
726
- threadId
726
+ threadId,
727
+ resourceId: resourceId ?? ""
727
728
  }
728
729
  },
729
730
  error$1
@@ -769,9 +770,10 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
769
770
  }
770
771
  }
771
772
  async getMessagesPaginated(args) {
773
+ const { threadId, resourceId, selectBy, format = "v1" } = args;
774
+ const { page = 0, perPage = 100 } = selectBy?.pagination || {};
772
775
  try {
773
- const { threadId, selectBy, format = "v1" } = args;
774
- const { page = 0, perPage = 100 } = selectBy?.pagination || {};
776
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
775
777
  const messages = format === "v2" ? await this.getMessages({ threadId, selectBy, format: "v2" }) : await this.getMessages({ threadId, selectBy, format: "v1" });
776
778
  let filteredMessages = messages;
777
779
  if (selectBy?.pagination?.dateRange) {
@@ -794,15 +796,22 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
794
796
  messages: paginatedMessages
795
797
  };
796
798
  } catch (error$1) {
797
- throw new error.MastraError(
799
+ const mastraError = new error.MastraError(
798
800
  {
799
801
  id: "CLOUDFLARE_STORAGE_GET_MESSAGES_PAGINATED_FAILED",
800
802
  domain: error.ErrorDomain.STORAGE,
801
803
  category: error.ErrorCategory.THIRD_PARTY,
802
- text: "Failed to get messages with pagination"
804
+ text: "Failed to get messages with pagination",
805
+ details: {
806
+ threadId,
807
+ resourceId: resourceId ?? ""
808
+ }
803
809
  },
804
810
  error$1
805
811
  );
812
+ this.logger?.trackException?.(mastraError);
813
+ this.logger?.error?.(mastraError.toString());
814
+ return { messages: [], total: 0, page, perPage: perPage || 40, hasMore: false };
806
815
  }
807
816
  }
808
817
  async updateMessages(args) {