@mastra/mssql 1.10.6 → 1.11.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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +29 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +1 -0
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1778,10 +1778,13 @@ function rowToTask(row) {
|
|
|
1778
1778
|
suspendedAt: row.suspendedAt ? row.suspendedAt instanceof Date ? row.suspendedAt : new Date(row.suspendedAt) : void 0,
|
|
1779
1779
|
completedAt: row.completedAt ? row.completedAt instanceof Date ? row.completedAt : new Date(row.completedAt) : void 0,
|
|
1780
1780
|
ownerId: row.ownerId ?? void 0,
|
|
1781
|
-
leaseExpiresAt: row.leaseExpiresAt ? row.leaseExpiresAt instanceof Date ? row.leaseExpiresAt : new Date(row.leaseExpiresAt) : void 0
|
|
1781
|
+
leaseExpiresAt: row.leaseExpiresAt ? row.leaseExpiresAt instanceof Date ? row.leaseExpiresAt : new Date(row.leaseExpiresAt) : void 0,
|
|
1782
|
+
expiresAt: row.expiresAt ? row.expiresAt instanceof Date ? row.expiresAt : new Date(row.expiresAt) : void 0,
|
|
1783
|
+
metadata: parseJson(row.metadata)
|
|
1782
1784
|
};
|
|
1783
1785
|
}
|
|
1784
1786
|
var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksStorage {
|
|
1787
|
+
supportsTaskExpiry = true;
|
|
1785
1788
|
pool;
|
|
1786
1789
|
db;
|
|
1787
1790
|
schema;
|
|
@@ -1819,7 +1822,9 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
1819
1822
|
"suspend_payload",
|
|
1820
1823
|
"suspendedAt",
|
|
1821
1824
|
"ownerId",
|
|
1822
|
-
"leaseExpiresAt"
|
|
1825
|
+
"leaseExpiresAt",
|
|
1826
|
+
"expiresAt",
|
|
1827
|
+
"metadata"
|
|
1823
1828
|
]
|
|
1824
1829
|
});
|
|
1825
1830
|
await this.createDefaultIndexes();
|
|
@@ -1899,7 +1904,9 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
1899
1904
|
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
1900
1905
|
completedAt: task.completedAt?.toISOString() ?? null,
|
|
1901
1906
|
ownerId: task.ownerId ?? null,
|
|
1902
|
-
leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null
|
|
1907
|
+
leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null,
|
|
1908
|
+
expiresAt: task.expiresAt?.toISOString() ?? null,
|
|
1909
|
+
metadata: serializeJson(task.metadata)
|
|
1903
1910
|
}
|
|
1904
1911
|
});
|
|
1905
1912
|
}
|
|
@@ -1947,6 +1954,14 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
1947
1954
|
setClauses.push(`[leaseExpiresAt] = @p${idx}`);
|
|
1948
1955
|
params[`p${idx++}`] = update.leaseExpiresAt?.toISOString() ?? null;
|
|
1949
1956
|
}
|
|
1957
|
+
if ("expiresAt" in update) {
|
|
1958
|
+
setClauses.push(`[expiresAt] = @p${idx}`);
|
|
1959
|
+
params[`p${idx++}`] = update.expiresAt?.toISOString() ?? null;
|
|
1960
|
+
}
|
|
1961
|
+
if ("metadata" in update) {
|
|
1962
|
+
setClauses.push(`[metadata] = @p${idx}`);
|
|
1963
|
+
params[`p${idx++}`] = serializeJson(update.metadata);
|
|
1964
|
+
}
|
|
1950
1965
|
if (setClauses.length === 0) return false;
|
|
1951
1966
|
setClauses.push(`[id] = [id]`);
|
|
1952
1967
|
params[`p${idx}`] = taskId;
|
|
@@ -1970,6 +1985,13 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
1970
1985
|
predicates.push(`[leaseExpiresAt] = @p${idx++}`);
|
|
1971
1986
|
}
|
|
1972
1987
|
}
|
|
1988
|
+
if (options?.expectedSuspendedAt !== void 0) {
|
|
1989
|
+
if (options.expectedSuspendedAt === null) predicates.push(`[suspendedAt] IS NULL`);
|
|
1990
|
+
else {
|
|
1991
|
+
params[`p${idx}`] = options.expectedSuspendedAt.toISOString();
|
|
1992
|
+
predicates.push(`[suspendedAt] = @p${idx++}`);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1973
1995
|
const predicateSql = predicates.length > 0 ? ` AND ${predicates.join(" AND ")}` : "";
|
|
1974
1996
|
const request = this.pool.request();
|
|
1975
1997
|
for (const [name, value] of Object.entries(params)) request.input(name, value);
|
|
@@ -2020,7 +2042,8 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
2020
2042
|
params[`p${idx}`] = filter.toolCallId;
|
|
2021
2043
|
conditions.push(`[tool_call_id] = @p${idx++}`);
|
|
2022
2044
|
}
|
|
2023
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
2045
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : filter.dateFilterBy === "expiresAt" ? "[expiresAt]" : "[createdAt]";
|
|
2046
|
+
if (filter.hasExpiresAt !== void 0) conditions.push(filter.hasExpiresAt ? "[expiresAt] IS NOT NULL" : "[expiresAt] IS NULL");
|
|
2024
2047
|
if (filter.fromDate) {
|
|
2025
2048
|
params[`p${idx}`] = filter.fromDate.toISOString();
|
|
2026
2049
|
conditions.push(`${dateCol} >= @p${idx++}`);
|
|
@@ -2070,7 +2093,8 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
2070
2093
|
});
|
|
2071
2094
|
conditions.push(`[status] IN (${placeholders.join(", ")})`);
|
|
2072
2095
|
}
|
|
2073
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : "[createdAt]";
|
|
2096
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "[startedAt]" : filter.dateFilterBy === "suspendedAt" ? "[suspendedAt]" : filter.dateFilterBy === "completedAt" ? "[completedAt]" : filter.dateFilterBy === "expiresAt" ? "[expiresAt]" : "[createdAt]";
|
|
2097
|
+
if (filter.hasExpiresAt !== void 0) conditions.push(filter.hasExpiresAt ? "[expiresAt] IS NOT NULL" : "[expiresAt] IS NULL");
|
|
2074
2098
|
if (filter.fromDate) {
|
|
2075
2099
|
params[`p${idx}`] = filter.fromDate.toISOString();
|
|
2076
2100
|
conditions.push(`${dateCol} >= @p${idx++}`);
|