@mastra/clickhouse 0.14.3 → 0.15.0-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,31 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 0.15.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 376913a: Update peerdeps of @mastra/core
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8fbf79e]
12
+ - @mastra/core@0.16.0-alpha.1
13
+
14
+ ## 0.14.4-alpha.0
15
+
16
+ ### Patch Changes
17
+
18
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
19
+ - Updated dependencies [fd83526]
20
+ - Updated dependencies [d0b90ab]
21
+ - Updated dependencies [6f5eb7a]
22
+ - Updated dependencies [a01cf14]
23
+ - Updated dependencies [a9e50ee]
24
+ - Updated dependencies [5397eb4]
25
+ - Updated dependencies [c9f4e4a]
26
+ - Updated dependencies [0acbc80]
27
+ - @mastra/core@0.16.0-alpha.0
28
+
3
29
  ## 0.14.3
4
30
 
5
31
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -257,6 +257,7 @@ var MemoryStorageClickhouse = class extends storage.MemoryStorage {
257
257
  format
258
258
  }) {
259
259
  try {
260
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
260
261
  const messages = [];
261
262
  const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
262
263
  const include = selectBy?.include || [];
@@ -849,11 +850,12 @@ var MemoryStorageClickhouse = class extends storage.MemoryStorage {
849
850
  }
850
851
  }
851
852
  async getMessagesPaginated(args) {
853
+ const { threadId, resourceId, selectBy, format = "v1" } = args;
854
+ const page = selectBy?.pagination?.page || 0;
855
+ const perPageInput = selectBy?.pagination?.perPage;
856
+ const perPage = perPageInput !== void 0 ? perPageInput : storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 20 });
852
857
  try {
853
- const { threadId, selectBy, format = "v1" } = args;
854
- const page = selectBy?.pagination?.page || 0;
855
- const perPageInput = selectBy?.pagination?.perPage;
856
- const perPage = perPageInput !== void 0 ? perPageInput : storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 20 });
858
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
857
859
  const offset = page * perPage;
858
860
  const dateRange = selectBy?.pagination?.dateRange;
859
861
  const fromDate = dateRange?.start;
@@ -1012,14 +1014,21 @@ var MemoryStorageClickhouse = class extends storage.MemoryStorage {
1012
1014
  hasMore: offset + perPage < total
1013
1015
  };
1014
1016
  } catch (error$1) {
1015
- throw new error.MastraError(
1017
+ const mastraError = new error.MastraError(
1016
1018
  {
1017
1019
  id: "CLICKHOUSE_STORAGE_GET_MESSAGES_PAGINATED_FAILED",
1018
1020
  domain: error.ErrorDomain.STORAGE,
1019
- category: error.ErrorCategory.THIRD_PARTY
1021
+ category: error.ErrorCategory.THIRD_PARTY,
1022
+ details: {
1023
+ threadId,
1024
+ resourceId: resourceId ?? ""
1025
+ }
1020
1026
  },
1021
1027
  error$1
1022
1028
  );
1029
+ this.logger?.trackException?.(mastraError);
1030
+ this.logger?.error?.(mastraError.toString());
1031
+ return { messages: [], total: 0, page, perPage: perPageInput || 40, hasMore: false };
1023
1032
  }
1024
1033
  }
1025
1034
  async updateMessages(args) {