@mastra/libsql 1.0.0-beta.6 → 1.0.0-beta.8

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
@@ -2532,9 +2532,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
2532
2532
  const parsedTableName = parseSqlIdentifier(tableName, "table name");
2533
2533
  const columns = Object.entries(schema).map(([name, col]) => {
2534
2534
  const parsedColumnName = parseSqlIdentifier(name, "column name");
2535
- let type = col.type.toUpperCase();
2536
- if (type === "TEXT") type = "TEXT";
2537
- if (type === "TIMESTAMP") type = "TEXT";
2535
+ const type = this.getSqlType(col.type);
2538
2536
  const nullable = col.nullable ? "" : "NOT NULL";
2539
2537
  const primaryKey = col.primaryKey ? "PRIMARY KEY" : "";
2540
2538
  return `${parsedColumnName} ${type} ${nullable} ${primaryKey}`.trim();
@@ -2582,9 +2580,11 @@ var StoreOperationsLibSQL = class extends StoreOperations {
2582
2580
  case "bigint":
2583
2581
  return "INTEGER";
2584
2582
  // SQLite uses INTEGER for all integer sizes
2585
- case "jsonb":
2583
+ case "timestamp":
2586
2584
  return "TEXT";
2587
- // Store JSON as TEXT in SQLite
2585
+ // Store timestamps as ISO strings in SQLite
2586
+ // jsonb falls through to base class which returns 'JSONB'
2587
+ // SQLite's flexible type system treats JSONB as TEXT affinity
2588
2588
  default:
2589
2589
  return super.getSqlType(type);
2590
2590
  }
@@ -3422,6 +3422,24 @@ var WorkflowsLibSQL = class extends WorkflowsStorage {
3422
3422
  );
3423
3423
  }
3424
3424
  }
3425
+ async deleteWorkflowRunById({ runId, workflowName }) {
3426
+ try {
3427
+ await this.client.execute({
3428
+ sql: `DELETE FROM ${TABLE_WORKFLOW_SNAPSHOT} WHERE workflow_name = ? AND run_id = ?`,
3429
+ args: [workflowName, runId]
3430
+ });
3431
+ } catch (error) {
3432
+ throw new MastraError(
3433
+ {
3434
+ id: createStorageErrorId("LIBSQL", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
3435
+ domain: ErrorDomain.STORAGE,
3436
+ category: ErrorCategory.THIRD_PARTY,
3437
+ details: { runId, workflowName }
3438
+ },
3439
+ error
3440
+ );
3441
+ }
3442
+ }
3425
3443
  async listWorkflowRuns({
3426
3444
  workflowName,
3427
3445
  fromDate,
@@ -3684,6 +3702,9 @@ var LibSQLStore = class extends MastraStorage {
3684
3702
  }) {
3685
3703
  return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
3686
3704
  }
3705
+ async deleteWorkflowRunById({ runId, workflowName }) {
3706
+ return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
3707
+ }
3687
3708
  async getResourceById({ resourceId }) {
3688
3709
  return this.stores.memory.getResourceById({ resourceId });
3689
3710
  }