@mastra/mssql 1.2.1 → 1.2.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 +9 -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 +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/mssql
|
|
2
2
|
|
|
3
|
+
## 1.2.2-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
|
+
|
|
3
12
|
## 1.2.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1385,11 +1385,13 @@ function rowToTask(row) {
|
|
|
1385
1385
|
runId: row.run_id ?? "",
|
|
1386
1386
|
result: parseJson(row.result),
|
|
1387
1387
|
error: parseJson(row.error),
|
|
1388
|
+
suspendPayload: parseJson(row.suspend_payload),
|
|
1388
1389
|
retryCount: Number(row.retry_count),
|
|
1389
1390
|
maxRetries: Number(row.max_retries),
|
|
1390
1391
|
timeoutMs: Number(row.timeout_ms),
|
|
1391
1392
|
createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
|
|
1392
1393
|
startedAt: row.startedAt ? row.startedAt instanceof Date ? row.startedAt : new Date(row.startedAt) : void 0,
|
|
1394
|
+
suspendedAt: row.suspendedAt ? row.suspendedAt instanceof Date ? row.suspendedAt : new Date(row.suspendedAt) : void 0,
|
|
1393
1395
|
completedAt: row.completedAt ? row.completedAt instanceof Date ? row.completedAt : new Date(row.completedAt) : void 0
|
|
1394
1396
|
};
|
|
1395
1397
|
}
|
|
@@ -1422,6 +1424,11 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1422
1424
|
tableName: storage.TABLE_BACKGROUND_TASKS,
|
|
1423
1425
|
schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS]
|
|
1424
1426
|
});
|
|
1427
|
+
await this.db.alterTable({
|
|
1428
|
+
tableName: storage.TABLE_BACKGROUND_TASKS,
|
|
1429
|
+
schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS],
|
|
1430
|
+
ifNotExists: ["suspend_payload", "suspendedAt"]
|
|
1431
|
+
});
|
|
1425
1432
|
await this.createDefaultIndexes();
|
|
1426
1433
|
await this.createCustomIndexes();
|
|
1427
1434
|
}
|
|
@@ -1491,11 +1498,13 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1491
1498
|
args: serializeJson(task.args),
|
|
1492
1499
|
result: serializeJson(task.result),
|
|
1493
1500
|
error: serializeJson(task.error),
|
|
1501
|
+
suspend_payload: serializeJson(task.suspendPayload),
|
|
1494
1502
|
retry_count: task.retryCount,
|
|
1495
1503
|
max_retries: task.maxRetries,
|
|
1496
1504
|
timeout_ms: task.timeoutMs,
|
|
1497
1505
|
createdAt: task.createdAt.toISOString(),
|
|
1498
1506
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
1507
|
+
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
1499
1508
|
completedAt: task.completedAt?.toISOString() ?? null
|
|
1500
1509
|
}
|
|
1501
1510
|
});
|
|
@@ -1516,6 +1525,10 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1516
1525
|
setClauses.push(`[error] = @p${idx}`);
|
|
1517
1526
|
params[`p${idx++}`] = serializeJson(update.error);
|
|
1518
1527
|
}
|
|
1528
|
+
if ("suspendPayload" in update) {
|
|
1529
|
+
setClauses.push(`[suspend_payload] = @p${idx}`);
|
|
1530
|
+
params[`p${idx++}`] = serializeJson(update.suspendPayload);
|
|
1531
|
+
}
|
|
1519
1532
|
if ("retryCount" in update) {
|
|
1520
1533
|
setClauses.push(`[retry_count] = @p${idx}`);
|
|
1521
1534
|
params[`p${idx++}`] = update.retryCount;
|
|
@@ -1524,6 +1537,10 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1524
1537
|
setClauses.push(`[startedAt] = @p${idx}`);
|
|
1525
1538
|
params[`p${idx++}`] = update.startedAt?.toISOString() ?? null;
|
|
1526
1539
|
}
|
|
1540
|
+
if ("suspendedAt" in update) {
|
|
1541
|
+
setClauses.push(`[suspendedAt] = @p${idx}`);
|
|
1542
|
+
params[`p${idx++}`] = update.suspendedAt?.toISOString() ?? null;
|
|
1543
|
+
}
|
|
1527
1544
|
if ("completedAt" in update) {
|
|
1528
1545
|
setClauses.push(`[completedAt] = @p${idx}`);
|
|
1529
1546
|
params[`p${idx++}`] = update.completedAt?.toISOString() ?? null;
|
|
@@ -1579,7 +1596,11 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1579
1596
|
params[`p${idx}`] = filter.toolName;
|
|
1580
1597
|
conditions.push(`[tool_name] = @p${idx++}`);
|
|
1581
1598
|
}
|
|
1582
|
-
|
|
1599
|
+
if (filter.toolCallId) {
|
|
1600
|
+
params[`p${idx}`] = filter.toolCallId;
|
|
1601
|
+
conditions.push(`[tool_call_id] = @p${idx++}`);
|
|
1602
|
+
}
|
|
1603
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1583
1604
|
if (filter.fromDate) {
|
|
1584
1605
|
params[`p${idx}`] = filter.fromDate.toISOString();
|
|
1585
1606
|
conditions.push(`${dateCol} >= @p${idx++}`);
|
|
@@ -1595,7 +1616,7 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1595
1616
|
}
|
|
1596
1617
|
const countResult = await countRequest.query(`SELECT COUNT(*) as count FROM ${this.tableName()} ${where}`);
|
|
1597
1618
|
const total = Number(countResult.recordset[0]?.count ?? 0);
|
|
1598
|
-
const orderCol = filter.orderBy === "startedAt" ? "[startedAt]" : filter.orderBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1619
|
+
const orderCol = filter.orderBy === "startedAt" ? "[startedAt]" : filter.orderBy === "suspendedAt" ? "[suspendedAt]" : filter.orderBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1599
1620
|
const direction = filter.orderDirection === "desc" ? "DESC" : "ASC";
|
|
1600
1621
|
let sql5 = `SELECT * FROM ${this.tableName()} ${where} ORDER BY ${orderCol} ${direction}`;
|
|
1601
1622
|
if (filter.perPage != null) {
|
|
@@ -1632,7 +1653,7 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends storage.Backgroun
|
|
|
1632
1653
|
});
|
|
1633
1654
|
conditions.push(`[status] IN (${placeholders.join(", ")})`);
|
|
1634
1655
|
}
|
|
1635
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1656
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1636
1657
|
if (filter.fromDate) {
|
|
1637
1658
|
params[`p${idx}`] = filter.fromDate.toISOString();
|
|
1638
1659
|
conditions.push(`${dateCol} >= @p${idx++}`);
|