@mastra/dsql 1.3.3 → 1.3.4-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
@@ -1822,6 +1822,13 @@ var AgentsDSQL = class AgentsDSQL extends AgentsStorage {
1822
1822
  function inPlaceholders(count, startIndex = 1) {
1823
1823
  return Array.from({ length: count }, (_, i) => `$${i + startIndex}`).join(", ");
1824
1824
  }
1825
+ /**
1826
+ * Bind dates as UTC strings because node-postgres serializes Date parameters
1827
+ * for TIMESTAMP columns using the process's local timezone.
1828
+ */
1829
+ function toUtcISOString(date) {
1830
+ return date.toISOString();
1831
+ }
1825
1832
  var MemoryDSQL = class MemoryDSQL extends MemoryStorage {
1826
1833
  supportsPartialThreadUpdate = true;
1827
1834
  #db;
@@ -2050,6 +2057,8 @@ var MemoryDSQL = class MemoryDSQL extends MemoryStorage {
2050
2057
  indexName: TABLE_THREADS,
2051
2058
  schemaName: getSchemaName(this.#schema)
2052
2059
  });
2060
+ const createdAt = toUtcISOString(thread.createdAt);
2061
+ const updatedAt = toUtcISOString(thread.updatedAt);
2053
2062
  await withRetry(async () => {
2054
2063
  await this.#db.client.none(`INSERT INTO ${tableName} (
2055
2064
  id,
@@ -2073,10 +2082,10 @@ var MemoryDSQL = class MemoryDSQL extends MemoryStorage {
2073
2082
  thread.resourceId,
2074
2083
  thread.title,
2075
2084
  thread.metadata ? JSON.stringify(thread.metadata) : null,
2076
- thread.createdAt,
2077
- thread.createdAt,
2078
- thread.updatedAt,
2079
- thread.updatedAt
2085
+ createdAt,
2086
+ createdAt,
2087
+ updatedAt,
2088
+ updatedAt
2080
2089
  ]);
2081
2090
  }, { onRetry: (error, attempt, delay) => {
2082
2091
  this.logger?.warn?.(`saveThread retry ${attempt} for ${thread.id} after ${delay}ms: ${error.message}`);
@@ -2641,7 +2650,9 @@ var MemoryDSQL = class MemoryDSQL extends MemoryStorage {
2641
2650
  tableName: TABLE_RESOURCES,
2642
2651
  record: {
2643
2652
  ...resource,
2644
- metadata: JSON.stringify(resource.metadata)
2653
+ metadata: JSON.stringify(resource.metadata),
2654
+ createdAt: toUtcISOString(resource.createdAt),
2655
+ updatedAt: toUtcISOString(resource.updatedAt)
2645
2656
  }
2646
2657
  });
2647
2658
  return resource;