@mastra/mssql 1.2.1-alpha.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 +20 -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/dist/index.js
CHANGED
|
@@ -1379,11 +1379,13 @@ function rowToTask(row) {
|
|
|
1379
1379
|
runId: row.run_id ?? "",
|
|
1380
1380
|
result: parseJson(row.result),
|
|
1381
1381
|
error: parseJson(row.error),
|
|
1382
|
+
suspendPayload: parseJson(row.suspend_payload),
|
|
1382
1383
|
retryCount: Number(row.retry_count),
|
|
1383
1384
|
maxRetries: Number(row.max_retries),
|
|
1384
1385
|
timeoutMs: Number(row.timeout_ms),
|
|
1385
1386
|
createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
|
|
1386
1387
|
startedAt: row.startedAt ? row.startedAt instanceof Date ? row.startedAt : new Date(row.startedAt) : void 0,
|
|
1388
|
+
suspendedAt: row.suspendedAt ? row.suspendedAt instanceof Date ? row.suspendedAt : new Date(row.suspendedAt) : void 0,
|
|
1387
1389
|
completedAt: row.completedAt ? row.completedAt instanceof Date ? row.completedAt : new Date(row.completedAt) : void 0
|
|
1388
1390
|
};
|
|
1389
1391
|
}
|
|
@@ -1416,6 +1418,11 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1416
1418
|
tableName: TABLE_BACKGROUND_TASKS,
|
|
1417
1419
|
schema: TABLE_SCHEMAS[TABLE_BACKGROUND_TASKS]
|
|
1418
1420
|
});
|
|
1421
|
+
await this.db.alterTable({
|
|
1422
|
+
tableName: TABLE_BACKGROUND_TASKS,
|
|
1423
|
+
schema: TABLE_SCHEMAS[TABLE_BACKGROUND_TASKS],
|
|
1424
|
+
ifNotExists: ["suspend_payload", "suspendedAt"]
|
|
1425
|
+
});
|
|
1419
1426
|
await this.createDefaultIndexes();
|
|
1420
1427
|
await this.createCustomIndexes();
|
|
1421
1428
|
}
|
|
@@ -1485,11 +1492,13 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1485
1492
|
args: serializeJson(task.args),
|
|
1486
1493
|
result: serializeJson(task.result),
|
|
1487
1494
|
error: serializeJson(task.error),
|
|
1495
|
+
suspend_payload: serializeJson(task.suspendPayload),
|
|
1488
1496
|
retry_count: task.retryCount,
|
|
1489
1497
|
max_retries: task.maxRetries,
|
|
1490
1498
|
timeout_ms: task.timeoutMs,
|
|
1491
1499
|
createdAt: task.createdAt.toISOString(),
|
|
1492
1500
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
1501
|
+
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
1493
1502
|
completedAt: task.completedAt?.toISOString() ?? null
|
|
1494
1503
|
}
|
|
1495
1504
|
});
|
|
@@ -1510,6 +1519,10 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1510
1519
|
setClauses.push(`[error] = @p${idx}`);
|
|
1511
1520
|
params[`p${idx++}`] = serializeJson(update.error);
|
|
1512
1521
|
}
|
|
1522
|
+
if ("suspendPayload" in update) {
|
|
1523
|
+
setClauses.push(`[suspend_payload] = @p${idx}`);
|
|
1524
|
+
params[`p${idx++}`] = serializeJson(update.suspendPayload);
|
|
1525
|
+
}
|
|
1513
1526
|
if ("retryCount" in update) {
|
|
1514
1527
|
setClauses.push(`[retry_count] = @p${idx}`);
|
|
1515
1528
|
params[`p${idx++}`] = update.retryCount;
|
|
@@ -1518,6 +1531,10 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1518
1531
|
setClauses.push(`[startedAt] = @p${idx}`);
|
|
1519
1532
|
params[`p${idx++}`] = update.startedAt?.toISOString() ?? null;
|
|
1520
1533
|
}
|
|
1534
|
+
if ("suspendedAt" in update) {
|
|
1535
|
+
setClauses.push(`[suspendedAt] = @p${idx}`);
|
|
1536
|
+
params[`p${idx++}`] = update.suspendedAt?.toISOString() ?? null;
|
|
1537
|
+
}
|
|
1521
1538
|
if ("completedAt" in update) {
|
|
1522
1539
|
setClauses.push(`[completedAt] = @p${idx}`);
|
|
1523
1540
|
params[`p${idx++}`] = update.completedAt?.toISOString() ?? null;
|
|
@@ -1573,7 +1590,11 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1573
1590
|
params[`p${idx}`] = filter.toolName;
|
|
1574
1591
|
conditions.push(`[tool_name] = @p${idx++}`);
|
|
1575
1592
|
}
|
|
1576
|
-
|
|
1593
|
+
if (filter.toolCallId) {
|
|
1594
|
+
params[`p${idx}`] = filter.toolCallId;
|
|
1595
|
+
conditions.push(`[tool_call_id] = @p${idx++}`);
|
|
1596
|
+
}
|
|
1597
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1577
1598
|
if (filter.fromDate) {
|
|
1578
1599
|
params[`p${idx}`] = filter.fromDate.toISOString();
|
|
1579
1600
|
conditions.push(`${dateCol} >= @p${idx++}`);
|
|
@@ -1589,7 +1610,7 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1589
1610
|
}
|
|
1590
1611
|
const countResult = await countRequest.query(`SELECT COUNT(*) as count FROM ${this.tableName()} ${where}`);
|
|
1591
1612
|
const total = Number(countResult.recordset[0]?.count ?? 0);
|
|
1592
|
-
const orderCol = filter.orderBy === "startedAt" ? "[startedAt]" : filter.orderBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1613
|
+
const orderCol = filter.orderBy === "startedAt" ? "[startedAt]" : filter.orderBy === "suspendedAt" ? "[suspendedAt]" : filter.orderBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1593
1614
|
const direction = filter.orderDirection === "desc" ? "DESC" : "ASC";
|
|
1594
1615
|
let sql5 = `SELECT * FROM ${this.tableName()} ${where} ORDER BY ${orderCol} ${direction}`;
|
|
1595
1616
|
if (filter.perPage != null) {
|
|
@@ -1626,7 +1647,7 @@ var BackgroundTasksMSSQL = class _BackgroundTasksMSSQL extends BackgroundTasksSt
|
|
|
1626
1647
|
});
|
|
1627
1648
|
conditions.push(`[status] IN (${placeholders.join(", ")})`);
|
|
1628
1649
|
}
|
|
1629
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1650
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
1630
1651
|
if (filter.fromDate) {
|
|
1631
1652
|
params[`p${idx}`] = filter.fromDate.toISOString();
|
|
1632
1653
|
conditions.push(`${dateCol} >= @p${idx++}`);
|