@mastra/libsql 1.10.0-alpha.0 → 1.10.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,41 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Extend the schedules storage schema to support owned schedules and richer trigger audit. This is a breaking schema change to `mastra_schedules` and `mastra_schedule_triggers`; scheduled workflows are still in alpha so no compat shim is provided. ([#16166](https://github.com/mastra-ai/mastra/pull/16166))
8
+ - `Schedule` gains optional `ownerType` / `ownerId` so a schedule row can be attributed to an owning subsystem (e.g. an agent that owns a heartbeat schedule). Workflow schedules leave both fields unset.
9
+ - `ScheduleTrigger.status` is renamed to `outcome` and the type is widened to `ScheduleTriggerOutcome` so future outcome values can be added without another rename.
10
+ - `ScheduleTrigger` gains a stable `id` primary key and new `triggerKind`, `parentTriggerId`, and `metadata` fields. `triggerKind` distinguishes `schedule-fire` rows from later `queue-drain` rows (used by upcoming heartbeat work); `parentTriggerId` links related rows; `metadata` carries outcome-specific context.
11
+ - The libsql, pg, and mongodb adapters all add the new columns/indexes. Their `@mastra/core` peer dependency is tightened to `>=1.32.0-0 <2.0.0-0` so installing a new storage adapter against an older core (or vice-versa) surfaces a peer-dependency warning at install time instead of silently writing/reading the wrong field.
12
+ - Scheduler producer, server schemas/handler, and client SDK types are updated to use the new fields. The `triggers` response on `GET /api/schedules/:id/triggers` now returns `outcome` instead of `status`.
13
+ - The bundled Studio (Mastra CLI) is updated to read `outcome` so the schedule detail page keeps polling and rendering publish-failure rows correctly.
14
+
15
+ - Added the `schedules` storage domain so LibSQL-backed Mastra apps can use scheduled workflows. Creates `mastra_schedules` and `mastra_schedule_triggers` tables on init. ([#15830](https://github.com/mastra-ai/mastra/pull/15830))
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`6dcd65f`](https://github.com/mastra-ai/mastra/commit/6dcd65f2a34069e6dc43ba35f1d11119b9b40bef), [`86c0298`](https://github.com/mastra-ai/mastra/commit/86c0298e647306423c842f9d5ac827bd616bd13d), [`c05c9a1`](https://github.com/mastra-ai/mastra/commit/c05c9a13230988cef6d438a62f37760f31927bc7), [`ca28c23`](https://github.com/mastra-ai/mastra/commit/ca28c232a2f18801a6cf20fe053479237b4d4fb0), [`e24aacb`](https://github.com/mastra-ai/mastra/commit/e24aacba07bd66f5d95b636dc24016fca26b52cf), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`7fce309`](https://github.com/mastra-ai/mastra/commit/7fce30912b14170bfc41f0ac736cca0f39fe0cd4), [`1d64a76`](https://github.com/mastra-ai/mastra/commit/1d64a765861a0772ea187bab76e5ed37bf82d042), [`1c2dda8`](https://github.com/mastra-ai/mastra/commit/1c2dda805fbfccc0abf55d4cb20cc34402dc3f0c), [`c721164`](https://github.com/mastra-ai/mastra/commit/c7211643f7ac861f83b19a3757cc921487fc9d75), [`1b55954`](https://github.com/mastra-ai/mastra/commit/1b559541c1e08a10e49d01ffc51a634dfc37a286), [`7997c2e`](https://github.com/mastra-ai/mastra/commit/7997c2e55ddd121562a4098cd8d2b89c68433bf1), [`5adc55e`](https://github.com/mastra-ai/mastra/commit/5adc55e63407be8ee977914957d68bcc2a075ceb), [`7679a63`](https://github.com/mastra-ai/mastra/commit/7679a634eae8e8ca459fd87538fdf72b4389b07f), [`a0d9b6d`](https://github.com/mastra-ai/mastra/commit/a0d9b6d6b810aeaa9e177a0dcc99a4402e609634), [`e97ccb9`](https://github.com/mastra-ai/mastra/commit/e97ccb900f8b7a390ce82c9f8eb8d6eb2c5e3777), [`c5daf48`](https://github.com/mastra-ai/mastra/commit/c5daf48556e98c46ae06caf00f92c249912007e9), [`70017d7`](https://github.com/mastra-ai/mastra/commit/70017d72ab741b5d7040e2a15c251a317782e39e), [`cd96779`](https://github.com/mastra-ai/mastra/commit/cd9677937f113b2856dc8b9f3d4bdabcee58bb2e), [`b0c7022`](https://github.com/mastra-ai/mastra/commit/b0c70224f80dad7c0cdbfb22cbff22e0f75c064f), [`e4942bc`](https://github.com/mastra-ai/mastra/commit/e4942bc7fdc903572f7d84f26d5e15f9d39c763d)]:
20
+ - @mastra/core@1.32.0
21
+
22
+ ## 1.10.0-alpha.1
23
+
24
+ ### Minor Changes
25
+
26
+ - Extend the schedules storage schema to support owned schedules and richer trigger audit. This is a breaking schema change to `mastra_schedules` and `mastra_schedule_triggers`; scheduled workflows are still in alpha so no compat shim is provided. ([#16166](https://github.com/mastra-ai/mastra/pull/16166))
27
+ - `Schedule` gains optional `ownerType` / `ownerId` so a schedule row can be attributed to an owning subsystem (e.g. an agent that owns a heartbeat schedule). Workflow schedules leave both fields unset.
28
+ - `ScheduleTrigger.status` is renamed to `outcome` and the type is widened to `ScheduleTriggerOutcome` so future outcome values can be added without another rename.
29
+ - `ScheduleTrigger` gains a stable `id` primary key and new `triggerKind`, `parentTriggerId`, and `metadata` fields. `triggerKind` distinguishes `schedule-fire` rows from later `queue-drain` rows (used by upcoming heartbeat work); `parentTriggerId` links related rows; `metadata` carries outcome-specific context.
30
+ - The libsql, pg, and mongodb adapters all add the new columns/indexes. Their `@mastra/core` peer dependency is tightened to `>=1.32.0-0 <2.0.0-0` so installing a new storage adapter against an older core (or vice-versa) surfaces a peer-dependency warning at install time instead of silently writing/reading the wrong field.
31
+ - Scheduler producer, server schemas/handler, and client SDK types are updated to use the new fields. The `triggers` response on `GET /api/schedules/:id/triggers` now returns `outcome` instead of `status`.
32
+ - The bundled Studio (Mastra CLI) is updated to read `outcome` so the schedule detail page keeps polling and rendering publish-failure rows correctly.
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [[`ca28c23`](https://github.com/mastra-ai/mastra/commit/ca28c232a2f18801a6cf20fe053479237b4d4fb0)]:
37
+ - @mastra/core@1.32.0-alpha.3
38
+
3
39
  ## 1.10.0-alpha.0
4
40
 
5
41
  ### Minor 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.10.0-alpha.0"
6
+ version: "1.10.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.0-alpha.0",
2
+ "version": "1.10.0",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -8930,17 +8930,24 @@ function rowToSchedule(row) {
8930
8930
  if (row.last_run_id != null) schedule.lastRunId = String(row.last_run_id);
8931
8931
  const metadata = parseJson2(row.metadata);
8932
8932
  if (metadata !== void 0) schedule.metadata = metadata;
8933
+ if (row.owner_type != null) schedule.ownerType = String(row.owner_type);
8934
+ if (row.owner_id != null) schedule.ownerId = String(row.owner_id);
8933
8935
  return schedule;
8934
8936
  }
8935
8937
  function rowToTrigger(row) {
8936
8938
  const trigger = {
8939
+ id: row.id != null ? String(row.id) : void 0,
8937
8940
  scheduleId: String(row.schedule_id),
8938
- runId: String(row.run_id),
8941
+ runId: row.run_id != null ? String(row.run_id) : null,
8939
8942
  scheduledFireAt: toNumber(row.scheduled_fire_at),
8940
8943
  actualFireAt: toNumber(row.actual_fire_at),
8941
- status: String(row.status)
8944
+ outcome: String(row.outcome),
8945
+ triggerKind: row.trigger_kind != null ? String(row.trigger_kind) : "schedule-fire"
8942
8946
  };
8943
8947
  if (row.error != null) trigger.error = String(row.error);
8948
+ if (row.parent_trigger_id != null) trigger.parentTriggerId = String(row.parent_trigger_id);
8949
+ const metadata = parseJson2(row.metadata);
8950
+ if (metadata !== void 0) trigger.metadata = metadata;
8944
8951
  return trigger;
8945
8952
  }
8946
8953
  var SchedulesLibSQL = class extends storage.SchedulesStorage {
@@ -8984,7 +8991,9 @@ var SchedulesLibSQL = class extends storage.SchedulesStorage {
8984
8991
  last_run_id: schedule.lastRunId ?? null,
8985
8992
  created_at: schedule.createdAt,
8986
8993
  updated_at: schedule.updatedAt,
8987
- metadata: schedule.metadata ?? null
8994
+ metadata: schedule.metadata ?? null,
8995
+ owner_type: schedule.ownerType ?? null,
8996
+ owner_id: schedule.ownerId ?? null
8988
8997
  }
8989
8998
  });
8990
8999
  return schedule;
@@ -9008,6 +9017,22 @@ var SchedulesLibSQL = class extends storage.SchedulesStorage {
9008
9017
  conditions.push("json_extract(target, '$.workflowId') = ?");
9009
9018
  params.push(filter.workflowId);
9010
9019
  }
9020
+ if (filter?.ownerType !== void 0) {
9021
+ if (filter.ownerType === null) {
9022
+ conditions.push("owner_type IS NULL");
9023
+ } else {
9024
+ conditions.push("owner_type = ?");
9025
+ params.push(filter.ownerType);
9026
+ }
9027
+ }
9028
+ if (filter?.ownerId !== void 0) {
9029
+ if (filter.ownerId === null) {
9030
+ conditions.push("owner_id IS NULL");
9031
+ } else {
9032
+ conditions.push("owner_id = ?");
9033
+ params.push(filter.ownerId);
9034
+ }
9035
+ }
9011
9036
  const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
9012
9037
  const result = await this.#client.execute({
9013
9038
  sql: `SELECT ${buildSelectColumns(storage.TABLE_SCHEDULES)} FROM ${storage.TABLE_SCHEDULES} ${where} ORDER BY created_at ASC`,
@@ -9053,6 +9078,14 @@ var SchedulesLibSQL = class extends storage.SchedulesStorage {
9053
9078
  setClauses.push("metadata = jsonb(?)");
9054
9079
  params.push(patch.metadata != null ? JSON.stringify(patch.metadata) : null);
9055
9080
  }
9081
+ if ("ownerType" in patch) {
9082
+ setClauses.push("owner_type = ?");
9083
+ params.push(patch.ownerType ?? null);
9084
+ }
9085
+ if ("ownerId" in patch) {
9086
+ setClauses.push("owner_id = ?");
9087
+ params.push(patch.ownerId ?? null);
9088
+ }
9056
9089
  setClauses.push("updated_at = ?");
9057
9090
  params.push(Date.now());
9058
9091
  params.push(id);
@@ -9089,15 +9122,20 @@ var SchedulesLibSQL = class extends storage.SchedulesStorage {
9089
9122
  });
9090
9123
  }
9091
9124
  async recordTrigger(trigger) {
9125
+ const id = trigger.id ?? crypto.randomUUID();
9092
9126
  await this.#db.insert({
9093
9127
  tableName: storage.TABLE_SCHEDULE_TRIGGERS,
9094
9128
  record: {
9129
+ id,
9095
9130
  schedule_id: trigger.scheduleId,
9096
9131
  run_id: trigger.runId,
9097
9132
  scheduled_fire_at: trigger.scheduledFireAt,
9098
9133
  actual_fire_at: trigger.actualFireAt,
9099
- status: trigger.status,
9100
- error: trigger.error ?? null
9134
+ outcome: trigger.outcome,
9135
+ error: trigger.error ?? null,
9136
+ trigger_kind: trigger.triggerKind ?? "schedule-fire",
9137
+ parent_trigger_id: trigger.parentTriggerId ?? null,
9138
+ metadata: trigger.metadata ?? null
9101
9139
  }
9102
9140
  });
9103
9141
  }