@mastra/mongodb 1.8.0-alpha.1 → 1.8.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 +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -4
- 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/mongodb
|
|
2
2
|
|
|
3
|
+
## 1.8.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.8.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 MongoDB-backed Mastra apps can use scheduled workflows. Creates `mastra_schedules` and `mastra_schedule_triggers` collections 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.8.0-alpha.1
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-mongodb
|
|
|
3
3
|
description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/mongodb"
|
|
6
|
-
version: "1.8.
|
|
6
|
+
version: "1.8.1-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var evals = require('@mastra/core/evals');
|
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
16
|
var package_default = {
|
|
17
|
-
version: "1.8.
|
|
17
|
+
version: "1.8.1-alpha.0"};
|
|
18
18
|
var MongoDBFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
19
19
|
getSupportedOperators() {
|
|
20
20
|
return {
|
|
@@ -1518,11 +1518,13 @@ function toDoc(task) {
|
|
|
1518
1518
|
args: task.args,
|
|
1519
1519
|
result: task.result ?? null,
|
|
1520
1520
|
error: task.error ?? null,
|
|
1521
|
+
suspend_payload: task.suspendPayload ?? null,
|
|
1521
1522
|
retry_count: task.retryCount,
|
|
1522
1523
|
max_retries: task.maxRetries,
|
|
1523
1524
|
timeout_ms: task.timeoutMs,
|
|
1524
1525
|
createdAt: task.createdAt.toISOString(),
|
|
1525
1526
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
1527
|
+
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
1526
1528
|
completedAt: task.completedAt?.toISOString() ?? null
|
|
1527
1529
|
};
|
|
1528
1530
|
}
|
|
@@ -1539,11 +1541,13 @@ function fromDoc(doc) {
|
|
|
1539
1541
|
runId: doc.run_id ?? "",
|
|
1540
1542
|
result: doc.result ?? void 0,
|
|
1541
1543
|
error: doc.error ?? void 0,
|
|
1544
|
+
suspendPayload: doc.suspend_payload ?? void 0,
|
|
1542
1545
|
retryCount: Number(doc.retry_count ?? 0),
|
|
1543
1546
|
maxRetries: Number(doc.max_retries ?? 0),
|
|
1544
1547
|
timeoutMs: Number(doc.timeout_ms ?? 3e5),
|
|
1545
1548
|
createdAt: new Date(doc.createdAt),
|
|
1546
1549
|
startedAt: doc.startedAt ? new Date(doc.startedAt) : void 0,
|
|
1550
|
+
suspendedAt: doc.suspendedAt ? new Date(doc.suspendedAt) : void 0,
|
|
1547
1551
|
completedAt: doc.completedAt ? new Date(doc.completedAt) : void 0
|
|
1548
1552
|
};
|
|
1549
1553
|
}
|
|
@@ -1611,8 +1615,10 @@ var BackgroundTasksStorageMongoDB = class _BackgroundTasksStorageMongoDB extends
|
|
|
1611
1615
|
if ("status" in update) $set.status = update.status;
|
|
1612
1616
|
if ("result" in update) $set.result = update.result ?? null;
|
|
1613
1617
|
if ("error" in update) $set.error = update.error ?? null;
|
|
1618
|
+
if ("suspendPayload" in update) $set.suspend_payload = update.suspendPayload ?? null;
|
|
1614
1619
|
if ("retryCount" in update) $set.retry_count = update.retryCount;
|
|
1615
1620
|
if ("startedAt" in update) $set.startedAt = update.startedAt?.toISOString() ?? null;
|
|
1621
|
+
if ("suspendedAt" in update) $set.suspendedAt = update.suspendedAt?.toISOString() ?? null;
|
|
1616
1622
|
if ("completedAt" in update) $set.completedAt = update.completedAt?.toISOString() ?? null;
|
|
1617
1623
|
if (Object.keys($set).length === 0) return;
|
|
1618
1624
|
const collection = await this.getCollection();
|
|
@@ -1634,14 +1640,15 @@ var BackgroundTasksStorageMongoDB = class _BackgroundTasksStorageMongoDB extends
|
|
|
1634
1640
|
if (filter.resourceId) query.resource_id = filter.resourceId;
|
|
1635
1641
|
if (filter.runId) query.run_id = filter.runId;
|
|
1636
1642
|
if (filter.toolName) query.tool_name = filter.toolName;
|
|
1637
|
-
|
|
1643
|
+
if (filter.toolCallId) query.tool_call_id = filter.toolCallId;
|
|
1644
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
|
|
1638
1645
|
if (filter.fromDate) {
|
|
1639
1646
|
query[dateCol] = { ...query[dateCol] || {}, $gte: filter.fromDate.toISOString() };
|
|
1640
1647
|
}
|
|
1641
1648
|
if (filter.toDate) {
|
|
1642
1649
|
query[dateCol] = { ...query[dateCol] || {}, $lt: filter.toDate.toISOString() };
|
|
1643
1650
|
}
|
|
1644
|
-
const orderCol = filter.orderBy === "startedAt" ? "startedAt" : filter.orderBy === "completedAt" ? "completedAt" : "createdAt";
|
|
1651
|
+
const orderCol = filter.orderBy === "startedAt" ? "startedAt" : filter.orderBy === "suspendedAt" ? "suspendedAt" : filter.orderBy === "completedAt" ? "completedAt" : "createdAt";
|
|
1645
1652
|
const direction = filter.orderDirection === "desc" ? -1 : 1;
|
|
1646
1653
|
const collection = await this.getCollection();
|
|
1647
1654
|
const total = await collection.countDocuments(query);
|
|
@@ -1665,7 +1672,7 @@ var BackgroundTasksStorageMongoDB = class _BackgroundTasksStorageMongoDB extends
|
|
|
1665
1672
|
const statuses = Array.isArray(filter.status) ? filter.status : [filter.status];
|
|
1666
1673
|
query.status = statuses.length === 1 ? statuses[0] : { $in: statuses };
|
|
1667
1674
|
}
|
|
1668
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
|
|
1675
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
|
|
1669
1676
|
if (filter.fromDate) {
|
|
1670
1677
|
query[dateCol] = { ...query[dateCol] || {}, $gte: filter.fromDate.toISOString() };
|
|
1671
1678
|
}
|
|
@@ -1677,6 +1684,7 @@ var BackgroundTasksStorageMongoDB = class _BackgroundTasksStorageMongoDB extends
|
|
|
1677
1684
|
if (filter.resourceId) query.resource_id = filter.resourceId;
|
|
1678
1685
|
if (filter.runId) query.run_id = filter.runId;
|
|
1679
1686
|
if (filter.toolName) query.tool_name = filter.toolName;
|
|
1687
|
+
if (filter.toolCallId) query.tool_call_id = filter.toolCallId;
|
|
1680
1688
|
if (Object.keys(query).length === 0) return;
|
|
1681
1689
|
const collection = await this.getCollection();
|
|
1682
1690
|
await collection.deleteMany(query);
|