@mastra/pg 1.10.0-alpha.1 → 1.10.1-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 +28 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 1.10.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Track `suspendedAt` and `suspendPayload` on background tasks. SQL adapters auto-migrate the new columns via `alterTable`. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
|
|
10
|
+
- @mastra/core@1.33.0-alpha.4
|
|
11
|
+
|
|
12
|
+
## 1.10.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- 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))
|
|
17
|
+
- `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.
|
|
18
|
+
- `ScheduleTrigger.status` is renamed to `outcome` and the type is widened to `ScheduleTriggerOutcome` so future outcome values can be added without another rename.
|
|
19
|
+
- `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.
|
|
20
|
+
- 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.
|
|
21
|
+
- 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`.
|
|
22
|
+
- The bundled Studio (Mastra CLI) is updated to read `outcome` so the schedule detail page keeps polling and rendering publish-failure rows correctly.
|
|
23
|
+
|
|
24
|
+
- Added the `schedules` storage domain so Postgres-backed Mastra apps can use scheduled workflows. Creates `mastra_schedules` and `mastra_schedule_triggers` tables on init, with default indexes on `(status, next_fire_at)` for due-schedule polling and `(schedule_id, actual_fire_at)` for trigger-history queries. ([#15830](https://github.com/mastra-ai/mastra/pull/15830))
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 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)]:
|
|
29
|
+
- @mastra/core@1.32.0
|
|
30
|
+
|
|
3
31
|
## 1.10.0-alpha.1
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -4314,11 +4314,13 @@ function rowToTask(row) {
|
|
|
4314
4314
|
runId: row.run_id,
|
|
4315
4315
|
result: parseJson(row.result),
|
|
4316
4316
|
error: parseJson(row.error),
|
|
4317
|
+
suspendPayload: parseJson(row.suspend_payload),
|
|
4317
4318
|
retryCount: Number(row.retry_count),
|
|
4318
4319
|
maxRetries: Number(row.max_retries),
|
|
4319
4320
|
timeoutMs: Number(row.timeout_ms),
|
|
4320
4321
|
createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
|
|
4321
4322
|
startedAt: row.startedAt ? row.startedAt instanceof Date ? row.startedAt : new Date(row.startedAt) : void 0,
|
|
4323
|
+
suspendedAt: row.suspendedAt ? row.suspendedAt instanceof Date ? row.suspendedAt : new Date(row.suspendedAt) : void 0,
|
|
4322
4324
|
completedAt: row.completedAt ? row.completedAt instanceof Date ? row.completedAt : new Date(row.completedAt) : void 0
|
|
4323
4325
|
};
|
|
4324
4326
|
}
|
|
@@ -4341,6 +4343,11 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4341
4343
|
tableName: storage.TABLE_BACKGROUND_TASKS,
|
|
4342
4344
|
schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS]
|
|
4343
4345
|
});
|
|
4346
|
+
await this.#db.alterTable({
|
|
4347
|
+
tableName: storage.TABLE_BACKGROUND_TASKS,
|
|
4348
|
+
schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS],
|
|
4349
|
+
ifNotExists: ["suspend_payload", "suspendedAt"]
|
|
4350
|
+
});
|
|
4344
4351
|
await this.createDefaultIndexes();
|
|
4345
4352
|
await this.createCustomIndexes();
|
|
4346
4353
|
}
|
|
@@ -4427,11 +4434,13 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4427
4434
|
args: serializeJson(task.args),
|
|
4428
4435
|
result: serializeJson(task.result),
|
|
4429
4436
|
error: serializeJson(task.error),
|
|
4437
|
+
suspend_payload: serializeJson(task.suspendPayload),
|
|
4430
4438
|
retry_count: task.retryCount,
|
|
4431
4439
|
max_retries: task.maxRetries,
|
|
4432
4440
|
timeout_ms: task.timeoutMs,
|
|
4433
4441
|
createdAt: task.createdAt.toISOString(),
|
|
4434
4442
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
4443
|
+
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
4435
4444
|
completedAt: task.completedAt?.toISOString() ?? null
|
|
4436
4445
|
}
|
|
4437
4446
|
});
|
|
@@ -4452,6 +4461,10 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4452
4461
|
setClauses.push(`"error" = $${paramIdx++}`);
|
|
4453
4462
|
params.push(serializeJson(update.error));
|
|
4454
4463
|
}
|
|
4464
|
+
if ("suspendPayload" in update) {
|
|
4465
|
+
setClauses.push(`"suspend_payload" = $${paramIdx++}`);
|
|
4466
|
+
params.push(serializeJson(update.suspendPayload));
|
|
4467
|
+
}
|
|
4455
4468
|
if ("retryCount" in update) {
|
|
4456
4469
|
setClauses.push(`"retry_count" = $${paramIdx++}`);
|
|
4457
4470
|
params.push(update.retryCount);
|
|
@@ -4460,6 +4473,10 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4460
4473
|
setClauses.push(`"startedAt" = $${paramIdx++}`);
|
|
4461
4474
|
params.push(update.startedAt?.toISOString() ?? null);
|
|
4462
4475
|
}
|
|
4476
|
+
if ("suspendedAt" in update) {
|
|
4477
|
+
setClauses.push(`"suspendedAt" = $${paramIdx++}`);
|
|
4478
|
+
params.push(update.suspendedAt?.toISOString() ?? null);
|
|
4479
|
+
}
|
|
4463
4480
|
if ("completedAt" in update) {
|
|
4464
4481
|
setClauses.push(`"completedAt" = $${paramIdx++}`);
|
|
4465
4482
|
params.push(update.completedAt?.toISOString() ?? null);
|
|
@@ -4505,7 +4522,11 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4505
4522
|
conditions.push(`"tool_name" = $${paramIdx++}`);
|
|
4506
4523
|
params.push(filter.toolName);
|
|
4507
4524
|
}
|
|
4508
|
-
|
|
4525
|
+
if (filter.toolCallId) {
|
|
4526
|
+
conditions.push(`"tool_call_id" = $${paramIdx++}`);
|
|
4527
|
+
params.push(filter.toolCallId);
|
|
4528
|
+
}
|
|
4529
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? '"startedAt"' : filter.dateFilterBy === "suspendedAt" ? '"suspendedAt"' : filter.dateFilterBy === "completedAt" ? '"completedAt"' : '"createdAt"';
|
|
4509
4530
|
if (filter.fromDate) {
|
|
4510
4531
|
conditions.push(`${dateCol} >= $${paramIdx++}`);
|
|
4511
4532
|
params.push(filter.fromDate.toISOString());
|
|
@@ -4520,7 +4541,7 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4520
4541
|
params.slice(0, paramIdx - 1)
|
|
4521
4542
|
);
|
|
4522
4543
|
const total = Number(countResult?.count ?? 0);
|
|
4523
|
-
const orderCol = filter.orderBy === "startedAt" ? '"startedAt"' : filter.orderBy === "completedAt" ? '"completedAt"' : '"createdAt"';
|
|
4544
|
+
const orderCol = filter.orderBy === "startedAt" ? '"startedAt"' : filter.orderBy === "suspendedAt" ? '"suspendedAt"' : filter.orderBy === "completedAt" ? '"completedAt"' : '"createdAt"';
|
|
4524
4545
|
const direction = filter.orderDirection === "desc" ? "DESC" : "ASC";
|
|
4525
4546
|
let sql = `SELECT * FROM ${table} ${where} ORDER BY ${orderCol} ${direction}`;
|
|
4526
4547
|
if (filter.perPage != null) {
|
|
@@ -4549,7 +4570,7 @@ var BackgroundTasksPG = class _BackgroundTasksPG extends storage.BackgroundTasks
|
|
|
4549
4570
|
conditions.push(`"status" IN (${placeholders.join(", ")})`);
|
|
4550
4571
|
params.push(...statuses);
|
|
4551
4572
|
}
|
|
4552
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? '"startedAt"' : filter.dateFilterBy === "completedAt" ? '"completedAt"' : '"createdAt"';
|
|
4573
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? '"startedAt"' : filter.dateFilterBy === "suspendedAt" ? '"suspendedAt"' : filter.dateFilterBy === "completedAt" ? '"completedAt"' : '"createdAt"';
|
|
4553
4574
|
if (filter.fromDate) {
|
|
4554
4575
|
conditions.push(`${dateCol} >= $${paramIdx++}`);
|
|
4555
4576
|
params.push(filter.fromDate.toISOString());
|