@mastra/cloudflare-d1 1.4.0 → 1.4.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
@@ -2254,8 +2254,8 @@ var WorkflowsStorageD1 = class extends WorkflowsStorage {
2254
2254
  const countBuilder = createSqlBuilder().count().from(fullTableName);
2255
2255
  if (workflowName) builder.whereAnd("workflow_name = ?", workflowName);
2256
2256
  if (status) {
2257
- builder.whereAnd("json_extract(snapshot, '$.status') = ?", status);
2258
- countBuilder.whereAnd("json_extract(snapshot, '$.status') = ?", status);
2257
+ builder.whereAnd("CASE WHEN json_valid(snapshot) THEN json_extract(snapshot, '$.status') END = ?", status);
2258
+ countBuilder.whereAnd("CASE WHEN json_valid(snapshot) THEN json_extract(snapshot, '$.status') END = ?", status);
2259
2259
  }
2260
2260
  if (resourceId) if (await this.#db.hasColumn(fullTableName, "resourceId")) {
2261
2261
  builder.whereAnd("resourceId = ?", resourceId);