@mastra/clickhouse 0.0.0-vector-query-tool-provider-options-20250828222356 → 0.0.0-vector-extension-schema-20250922130418

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/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
- const { threadId, 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 });
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
- throw new MastraError(
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) {
@@ -1100,7 +1109,7 @@ var MemoryStorageClickhouse = class extends MemoryStorage {
1100
1109
  UPDATE ${setClauses.join(", ")}
1101
1110
  WHERE id = {var_id_${paramIdx}:String}
1102
1111
  `;
1103
- console.log("Updating message:", id, "with query:", updateQuery, "values:", values);
1112
+ console.info("Updating message:", id, "with query:", updateQuery, "values:", values);
1104
1113
  updatePromises.push(
1105
1114
  this.client.command({
1106
1115
  query: updateQuery,
@@ -1159,7 +1168,7 @@ var MemoryStorageClickhouse = class extends MemoryStorage {
1159
1168
  }
1160
1169
  }
1161
1170
  if (needsRetry) {
1162
- console.log("Update not applied correctly, retrying with DELETE + INSERT for message:", id);
1171
+ console.info("Update not applied correctly, retrying with DELETE + INSERT for message:", id);
1163
1172
  await this.client.command({
1164
1173
  query: `DELETE FROM ${TABLE_MESSAGES} WHERE id = {messageId:String}`,
1165
1174
  query_params: { messageId: id },
@@ -1611,7 +1620,7 @@ var StoreOperationsClickhouse = class extends StoreOperations {
1611
1620
  use_client_time_zone: 1
1612
1621
  }
1613
1622
  });
1614
- console.log("INSERT RESULT", result);
1623
+ console.info("INSERT RESULT", result);
1615
1624
  } catch (error) {
1616
1625
  throw new MastraError(
1617
1626
  {
@@ -2293,6 +2302,7 @@ var WorkflowsStorageClickhouse = class extends WorkflowsStorage {
2293
2302
  async persistWorkflowSnapshot({
2294
2303
  workflowName,
2295
2304
  runId,
2305
+ resourceId,
2296
2306
  snapshot
2297
2307
  }) {
2298
2308
  try {
@@ -2303,11 +2313,13 @@ var WorkflowsStorageClickhouse = class extends WorkflowsStorage {
2303
2313
  const now = /* @__PURE__ */ new Date();
2304
2314
  const persisting = currentSnapshot ? {
2305
2315
  ...currentSnapshot,
2316
+ resourceId,
2306
2317
  snapshot: JSON.stringify(snapshot),
2307
2318
  updatedAt: now.toISOString()
2308
2319
  } : {
2309
2320
  workflow_name: workflowName,
2310
2321
  run_id: runId,
2322
+ resourceId,
2311
2323
  snapshot: JSON.stringify(snapshot),
2312
2324
  createdAt: now.toISOString(),
2313
2325
  updatedAt: now.toISOString()
@@ -2644,9 +2656,10 @@ var ClickhouseStore = class extends MastraStorage {
2644
2656
  async persistWorkflowSnapshot({
2645
2657
  workflowName,
2646
2658
  runId,
2659
+ resourceId,
2647
2660
  snapshot
2648
2661
  }) {
2649
- return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
2662
+ return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
2650
2663
  }
2651
2664
  async loadWorkflowSnapshot({
2652
2665
  workflowName,