@mastra/clickhouse 1.25.0-alpha.0 → 1.25.1-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.
@@ -3,7 +3,7 @@ name: mastra-clickhouse
3
3
  description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/clickhouse"
6
- version: "1.25.0-alpha.0"
6
+ version: "1.25.1-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.25.0-alpha.0",
2
+ "version": "1.25.1-alpha.0",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -965,12 +965,23 @@ var MemoryStorageClickhouse = class extends _mastra_core_storage.MemoryStorage {
965
965
  query_params: { messageIds }
966
966
  });
967
967
  if (threadIds.length > 0) {
968
- const now = (/* @__PURE__ */ new Date()).toISOString().replace("Z", "");
969
- await this.client.command({
970
- query: `ALTER TABLE ${_mastra_core_storage.TABLE_THREADS} UPDATE updatedAt = {now:DateTime64(3)} WHERE id IN {threadIds:Array(String)}`,
971
- query_params: {
972
- now,
973
- threadIds
968
+ const now = Date.now();
969
+ const existingThreads = await this.getLatestThreads(threadIds);
970
+ if (existingThreads.size > 0) await this.client.insert({
971
+ table: _mastra_core_storage.TABLE_THREADS,
972
+ format: "JSONEachRow",
973
+ values: Array.from(existingThreads.values()).map((existingThread) => ({
974
+ id: existingThread.id,
975
+ resourceId: existingThread.resourceId,
976
+ title: existingThread.title,
977
+ metadata: serializeMetadata(existingThread.metadata),
978
+ createdAt: existingThread.createdAt,
979
+ updatedAt: new Date(Math.max(now, new Date(existingThread.updatedAt).getTime() + 1)).toISOString().replace("Z", "")
980
+ })),
981
+ clickhouse_settings: {
982
+ date_time_input_format: "best_effort",
983
+ use_client_time_zone: 1,
984
+ output_format_json_quote_64bit_integers: 0
974
985
  }
975
986
  });
976
987
  }