@mastra/clickhouse 1.28.0-alpha.0 → 1.28.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/dist/index.js CHANGED
@@ -759,6 +759,7 @@ var ClickhouseDB = class extends MastraBase {
759
759
  const rawUpdatedAt = filteredRecord.updatedAt || /* @__PURE__ */ new Date();
760
760
  if ("createdAt" in filteredRecord || (await this.getTableColumns(tableName)).has("createdAt")) filteredRecord.createdAt = rawCreatedAt instanceof Date ? rawCreatedAt.toISOString() : rawCreatedAt;
761
761
  if ("updatedAt" in filteredRecord || (await this.getTableColumns(tableName)).has("updatedAt")) filteredRecord.updatedAt = rawUpdatedAt instanceof Date ? rawUpdatedAt.toISOString() : rawUpdatedAt;
762
+ for (const [key, value] of Object.entries(filteredRecord)) if (TABLE_SCHEMAS[tableName]?.[key]?.type === "timestamp" && typeof value === "number") filteredRecord[key] = new Date(value).toISOString();
762
763
  await this.client.insert({
763
764
  table: tableName,
764
765
  values: [filteredRecord],
@@ -2271,12 +2272,12 @@ var ObservabilityStorageClickhouse = class extends ObservabilityStorage {
2271
2272
  }
2272
2273
  });
2273
2274
  const data = { ...updates };
2274
- if (data.endedAt instanceof Date) data.endedAt = data.endedAt.getTime();
2275
- if (data.startedAt instanceof Date) data.startedAt = data.startedAt.getTime();
2275
+ if (data.endedAt instanceof Date) data.endedAt = data.endedAt.toISOString();
2276
+ if (data.startedAt instanceof Date) data.startedAt = data.startedAt.toISOString();
2276
2277
  const updated = {
2277
2278
  ...existing,
2278
2279
  ...data,
2279
- updatedAt: Date.now()
2280
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2280
2281
  };
2281
2282
  await this.client.insert({
2282
2283
  table: TABLE_SPANS,
@@ -2514,7 +2515,7 @@ var ObservabilityStorageClickhouse = class extends ObservabilityStorage {
2514
2515
  }
2515
2516
  async batchUpdateSpans(args) {
2516
2517
  try {
2517
- const now = Date.now();
2518
+ const now = (/* @__PURE__ */ new Date()).toISOString();
2518
2519
  if (args.records.length === 0) return;
2519
2520
  const keyParams = {};
2520
2521
  const keyTuples = args.records.map((record, i) => {
@@ -2547,8 +2548,8 @@ var ObservabilityStorageClickhouse = class extends ObservabilityStorage {
2547
2548
  const existing = current.get(key);
2548
2549
  if (!existing) continue;
2549
2550
  const updates = { ...record.updates };
2550
- if (updates.startedAt instanceof Date) updates.startedAt = updates.startedAt.getTime();
2551
- if (updates.endedAt instanceof Date) updates.endedAt = updates.endedAt.getTime();
2551
+ if (updates.startedAt instanceof Date) updates.startedAt = updates.startedAt.toISOString();
2552
+ if (updates.endedAt instanceof Date) updates.endedAt = updates.endedAt.toISOString();
2552
2553
  current.set(key, {
2553
2554
  ...existing,
2554
2555
  ...updates,