@mastra/cloudflare-d1 1.0.0-beta.4 → 1.0.0-beta.5

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
@@ -1900,6 +1900,25 @@ var WorkflowsStorageD1 = class extends WorkflowsStorage {
1900
1900
  );
1901
1901
  }
1902
1902
  }
1903
+ async deleteWorkflowRunById({ runId, workflowName }) {
1904
+ const fullTableName = this.operations.getTableName(TABLE_WORKFLOW_SNAPSHOT);
1905
+ try {
1906
+ const sql = `DELETE FROM ${fullTableName} WHERE workflow_name = ? AND run_id = ?`;
1907
+ const params = [workflowName, runId];
1908
+ await this.operations.executeQuery({ sql, params });
1909
+ } catch (error) {
1910
+ throw new MastraError(
1911
+ {
1912
+ id: createStorageErrorId("CLOUDFLARE_D1", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
1913
+ domain: ErrorDomain.STORAGE,
1914
+ category: ErrorCategory.THIRD_PARTY,
1915
+ text: `Failed to delete workflow run by ID: ${error instanceof Error ? error.message : String(error)}`,
1916
+ details: { runId, workflowName }
1917
+ },
1918
+ error
1919
+ );
1920
+ }
1921
+ }
1903
1922
  };
1904
1923
 
1905
1924
  // src/storage/index.ts
@@ -2081,6 +2100,9 @@ var D1Store = class extends MastraStorage {
2081
2100
  }) {
2082
2101
  return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
2083
2102
  }
2103
+ async deleteWorkflowRunById({ runId, workflowName }) {
2104
+ return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
2105
+ }
2084
2106
  /**
2085
2107
  * Insert multiple records in a batch operation
2086
2108
  * @param tableName The table to insert into