@mastra/libsql 1.14.1 → 1.14.2-alpha.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 1.14.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed `persistWorkflowSnapshot` resetting a workflow run's `createdAt` on every re-persist. The default execution engine re-persists a run's snapshot on every step, so `createdAt` drifted to the last activity time and jumped forward on suspend/resume. Re-persisting now preserves the original `createdAt` and only advances `updatedAt`, so `listWorkflowRuns` ordering, fromDate/toDate filters, and the creation time shown in Studio stay correct. ([#18004](https://github.com/mastra-ai/mastra/pull/18004))
8
+
9
+ - Updated dependencies [[`bf3fe49`](https://github.com/mastra-ai/mastra/commit/bf3fe49f9467dbbdb8f9eaf74e0f7971ffb19559), [`24ceaea`](https://github.com/mastra-ai/mastra/commit/24ceaea0bdd8609cabbab764380608ca6621a194), [`6ccf67b`](https://github.com/mastra-ai/mastra/commit/6ccf67bf075753754927a57bc2e1734ba2c820c5), [`825d8de`](https://github.com/mastra-ai/mastra/commit/825d8def9fa64c2bcc3d8dd6b49e09342c3ac5c7), [`ffa09e7`](https://github.com/mastra-ai/mastra/commit/ffa09e772a5c92270eabe2090fc42d45bd8ec4b7), [`461a7c5`](https://github.com/mastra-ai/mastra/commit/461a7c501449295287f4f0ee4b0b42344f39fcf8), [`4211472`](https://github.com/mastra-ai/mastra/commit/4211472a5a2bd319c60cd2e42d9109c3eef7ac1c), [`9e45902`](https://github.com/mastra-ai/mastra/commit/9e4590208e745055cecca202e2db0e5c65e17d3c), [`5c0df77`](https://github.com/mastra-ai/mastra/commit/5c0df776c40efa420f8c07a2f3ee66010296618e)]:
10
+ - @mastra/core@1.47.0-alpha.3
11
+
3
12
  ## 1.14.1
4
13
 
5
14
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.14.1"
6
+ version: "1.14.2-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.14.1",
2
+ "version": "1.14.2-alpha.0",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -12043,19 +12043,22 @@ var WorkflowsLibSQL = class extends storage.WorkflowsStorage {
12043
12043
  updatedAt
12044
12044
  }) {
12045
12045
  const now = /* @__PURE__ */ new Date();
12046
- const data = {
12047
- workflow_name: workflowName,
12048
- run_id: runId,
12049
- resourceId,
12050
- snapshot,
12051
- createdAt: createdAt ?? now,
12052
- updatedAt: updatedAt ?? now
12053
- };
12054
- this.logger.debug("Persisting workflow snapshot", { workflowName, runId, data });
12055
- await this.#db.insert({
12056
- tableName: storage.TABLE_WORKFLOW_SNAPSHOT,
12057
- record: data
12058
- });
12046
+ const createdAtValue = (createdAt ?? now).toISOString();
12047
+ const updatedAtValue = (updatedAt ?? now).toISOString();
12048
+ this.logger.debug("Persisting workflow snapshot", { workflowName, runId });
12049
+ await this.executeWithRetry(
12050
+ () => withClientWriteLock(
12051
+ this.#client,
12052
+ () => this.#client.execute({
12053
+ sql: `INSERT INTO ${storage.TABLE_WORKFLOW_SNAPSHOT} (workflow_name, run_id, resourceId, snapshot, createdAt, updatedAt)
12054
+ VALUES (?, ?, ?, jsonb(?), ?, ?)
12055
+ ON CONFLICT(workflow_name, run_id)
12056
+ DO UPDATE SET resourceId = excluded.resourceId, snapshot = excluded.snapshot, updatedAt = excluded.updatedAt`,
12057
+ args: [workflowName, runId, resourceId ?? null, safeStringify(snapshot), createdAtValue, updatedAtValue]
12058
+ })
12059
+ ),
12060
+ "persistWorkflowSnapshot"
12061
+ );
12059
12062
  }
12060
12063
  async loadWorkflowSnapshot({
12061
12064
  workflowName,