@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 +26 -0
- package/dist/index.cjs +15 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -255,6 +255,7 @@ var MemoryStorageClickhouse = class extends MemoryStorage {
|
|
|
255
255
|
format
|
|
256
256
|
}) {
|
|
257
257
|
try {
|
|
258
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
258
259
|
const messages = [];
|
|
259
260
|
const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
|
|
260
261
|
const include = selectBy?.include || [];
|
|
@@ -847,11 +848,12 @@ var MemoryStorageClickhouse = class extends MemoryStorage {
|
|
|
847
848
|
}
|
|
848
849
|
}
|
|
849
850
|
async getMessagesPaginated(args) {
|
|
851
|
+
const { threadId, resourceId, selectBy, format = "v1" } = args;
|
|
852
|
+
const page = selectBy?.pagination?.page || 0;
|
|
853
|
+
const perPageInput = selectBy?.pagination?.perPage;
|
|
854
|
+
const perPage = perPageInput !== void 0 ? perPageInput : resolveMessageLimit({ last: selectBy?.last, defaultLimit: 20 });
|
|
850
855
|
try {
|
|
851
|
-
|
|
852
|
-
const page = selectBy?.pagination?.page || 0;
|
|
853
|
-
const perPageInput = selectBy?.pagination?.perPage;
|
|
854
|
-
const perPage = perPageInput !== void 0 ? perPageInput : resolveMessageLimit({ last: selectBy?.last, defaultLimit: 20 });
|
|
856
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
855
857
|
const offset = page * perPage;
|
|
856
858
|
const dateRange = selectBy?.pagination?.dateRange;
|
|
857
859
|
const fromDate = dateRange?.start;
|
|
@@ -1010,14 +1012,21 @@ var MemoryStorageClickhouse = class extends MemoryStorage {
|
|
|
1010
1012
|
hasMore: offset + perPage < total
|
|
1011
1013
|
};
|
|
1012
1014
|
} catch (error) {
|
|
1013
|
-
|
|
1015
|
+
const mastraError = new MastraError(
|
|
1014
1016
|
{
|
|
1015
1017
|
id: "CLICKHOUSE_STORAGE_GET_MESSAGES_PAGINATED_FAILED",
|
|
1016
1018
|
domain: ErrorDomain.STORAGE,
|
|
1017
|
-
category: ErrorCategory.THIRD_PARTY
|
|
1019
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
1020
|
+
details: {
|
|
1021
|
+
threadId,
|
|
1022
|
+
resourceId: resourceId ?? ""
|
|
1023
|
+
}
|
|
1018
1024
|
},
|
|
1019
1025
|
error
|
|
1020
1026
|
);
|
|
1027
|
+
this.logger?.trackException?.(mastraError);
|
|
1028
|
+
this.logger?.error?.(mastraError.toString());
|
|
1029
|
+
return { messages: [], total: 0, page, perPage: perPageInput || 40, hasMore: false };
|
|
1021
1030
|
}
|
|
1022
1031
|
}
|
|
1023
1032
|
async updateMessages(args) {
|