@mastra/mssql 1.7.2 → 1.7.3
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 +18 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +3 -1
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1890,7 +1890,7 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
1890
1890
|
}
|
|
1891
1891
|
});
|
|
1892
1892
|
}
|
|
1893
|
-
async updateTask(taskId, update) {
|
|
1893
|
+
async updateTask(taskId, update, options) {
|
|
1894
1894
|
const setClauses = [];
|
|
1895
1895
|
const params = {};
|
|
1896
1896
|
let idx = 1;
|
|
@@ -1926,12 +1926,18 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
|
|
|
1926
1926
|
setClauses.push(`[completedAt] = @p${idx}`);
|
|
1927
1927
|
params[`p${idx++}`] = update.completedAt?.toISOString() ?? null;
|
|
1928
1928
|
}
|
|
1929
|
-
if (setClauses.length === 0) return;
|
|
1929
|
+
if (setClauses.length === 0) return false;
|
|
1930
1930
|
setClauses.push(`[id] = [id]`);
|
|
1931
1931
|
params[`p${idx}`] = taskId;
|
|
1932
|
+
const taskIdParam = `p${idx++}`;
|
|
1933
|
+
let statusPredicate = "";
|
|
1934
|
+
if (options?.expectedStatus) {
|
|
1935
|
+
params[`p${idx}`] = options.expectedStatus;
|
|
1936
|
+
statusPredicate = ` AND [status] = @p${idx}`;
|
|
1937
|
+
}
|
|
1932
1938
|
const request = this.pool.request();
|
|
1933
1939
|
for (const [name, value] of Object.entries(params)) request.input(name, value);
|
|
1934
|
-
await request.query(`UPDATE ${this.tableName()} SET ${setClauses.join(", ")} WHERE [id] =
|
|
1940
|
+
return ((await request.query(`UPDATE ${this.tableName()} SET ${setClauses.join(", ")} WHERE [id] = @${taskIdParam}${statusPredicate}`)).rowsAffected[0] ?? 0) > 0;
|
|
1935
1941
|
}
|
|
1936
1942
|
async getTask(taskId) {
|
|
1937
1943
|
const request = this.pool.request();
|