@mastra/pg 1.14.2-alpha.0 → 1.14.2

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
@@ -160,7 +160,7 @@ var createNumericOperator = (symbol) => {
160
160
  const isNumeric = typeof value === "number" || typeof value === "string" && !isNaN(Number(value)) && value.trim() !== "";
161
161
  if (isNumeric) {
162
162
  return {
163
- sql: `(CASE WHEN jsonb_typeof(metadata#>'{${jsonPathKey}}') = 'number' THEN (metadata#>>'{${jsonPathKey}}')::numeric ${symbol} $${paramIndex}::numeric ELSE FALSE END)`,
163
+ sql: `(CASE WHEN jsonb_typeof(metadata#>'{${jsonPathKey}}') = 'number' THEN (metadata#>>'{${jsonPathKey}}')::numeric ${symbol} $${paramIndex}::numeric ELSE NULL END)`,
164
164
  needsValue: true
165
165
  };
166
166
  } else {
@@ -18275,11 +18275,12 @@ var WorkflowsPG = class _WorkflowsPG extends WorkflowsStorage {
18275
18275
  const now = /* @__PURE__ */ new Date();
18276
18276
  const sanitizedSnapshot = sanitizeJsonForPg(JSON.stringify(snapshot));
18277
18277
  await t.none(
18278
- `INSERT INTO ${tableName} (workflow_name, run_id, snapshot, "createdAt", "updatedAt")
18279
- VALUES ($1, $2, $3, $4, $5)
18278
+ `INSERT INTO ${tableName}
18279
+ (workflow_name, run_id, snapshot, "createdAt", "updatedAt", "createdAtZ", "updatedAtZ")
18280
+ VALUES ($1, $2, $3, $4, $5, $6, $7)
18280
18281
  ON CONFLICT (workflow_name, run_id) DO UPDATE
18281
- SET snapshot = $3, "updatedAt" = $5`,
18282
- [workflowName, runId, sanitizedSnapshot, now, now]
18282
+ SET snapshot = $3, "updatedAt" = $5, "updatedAtZ" = $7`,
18283
+ [workflowName, runId, sanitizedSnapshot, now, now, now, now]
18283
18284
  );
18284
18285
  return snapshot.context;
18285
18286
  });
@@ -18321,9 +18322,12 @@ var WorkflowsPG = class _WorkflowsPG extends WorkflowsStorage {
18321
18322
  }
18322
18323
  const updatedSnapshot = { ...snapshot, ...opts };
18323
18324
  const sanitizedSnapshot = sanitizeJsonForPg(JSON.stringify(updatedSnapshot));
18325
+ const now = /* @__PURE__ */ new Date();
18324
18326
  await t.none(
18325
- `UPDATE ${tableName} SET snapshot = $1, "updatedAt" = $2 WHERE workflow_name = $3 AND run_id = $4`,
18326
- [sanitizedSnapshot, /* @__PURE__ */ new Date(), workflowName, runId]
18327
+ `UPDATE ${tableName}
18328
+ SET snapshot = $1, "updatedAt" = $2, "updatedAtZ" = $3
18329
+ WHERE workflow_name = $4 AND run_id = $5`,
18330
+ [sanitizedSnapshot, now, now, workflowName, runId]
18327
18331
  );
18328
18332
  return updatedSnapshot;
18329
18333
  });
@@ -18356,11 +18360,21 @@ var WorkflowsPG = class _WorkflowsPG extends WorkflowsStorage {
18356
18360
  const updatedAtValue = updatedAt ? updatedAt : now;
18357
18361
  const sanitizedSnapshot = sanitizeJsonForPg(JSON.stringify(snapshot));
18358
18362
  await this.#db.client.none(
18359
- `INSERT INTO ${getTableName7({ indexName: TABLE_WORKFLOW_SNAPSHOT, schemaName: getSchemaName7(this.#schema) })} (workflow_name, run_id, "resourceId", snapshot, "createdAt", "updatedAt")
18360
- VALUES ($1, $2, $3, $4, $5, $6)
18363
+ `INSERT INTO ${getTableName7({ indexName: TABLE_WORKFLOW_SNAPSHOT, schemaName: getSchemaName7(this.#schema) })}
18364
+ (workflow_name, run_id, "resourceId", snapshot, "createdAt", "updatedAt", "createdAtZ", "updatedAtZ")
18365
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
18361
18366
  ON CONFLICT (workflow_name, run_id) DO UPDATE
18362
- SET "resourceId" = $3, snapshot = $4, "updatedAt" = $6`,
18363
- [workflowName, runId, resourceId, sanitizedSnapshot, createdAtValue, updatedAtValue]
18367
+ SET "resourceId" = $3, snapshot = $4, "updatedAt" = $6, "updatedAtZ" = $8`,
18368
+ [
18369
+ workflowName,
18370
+ runId,
18371
+ resourceId,
18372
+ sanitizedSnapshot,
18373
+ createdAtValue,
18374
+ updatedAtValue,
18375
+ createdAtValue,
18376
+ updatedAtValue
18377
+ ]
18364
18378
  );
18365
18379
  } catch (error) {
18366
18380
  throw new MastraError(