@mastra/libsql 1.23.4-alpha.0 → 1.24.0-alpha.1
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 +30 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +2 -4
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2953,7 +2953,9 @@ function rowToTask(row) {
|
|
|
2953
2953
|
createdAt: new Date(String(row.createdAt)),
|
|
2954
2954
|
startedAt: row.startedAt ? new Date(String(row.startedAt)) : void 0,
|
|
2955
2955
|
suspendedAt: row.suspendedAt ? new Date(String(row.suspendedAt)) : void 0,
|
|
2956
|
-
completedAt: row.completedAt ? new Date(String(row.completedAt)) : void 0
|
|
2956
|
+
completedAt: row.completedAt ? new Date(String(row.completedAt)) : void 0,
|
|
2957
|
+
ownerId: row.ownerId != null ? String(row.ownerId) : void 0,
|
|
2958
|
+
leaseExpiresAt: row.leaseExpiresAt ? new Date(String(row.leaseExpiresAt)) : void 0
|
|
2957
2959
|
};
|
|
2958
2960
|
}
|
|
2959
2961
|
var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksStorage {
|
|
@@ -2987,7 +2989,12 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
2987
2989
|
await this.#db.alterTable({
|
|
2988
2990
|
tableName: TABLE_BACKGROUND_TASKS,
|
|
2989
2991
|
schema: TABLE_SCHEMAS[TABLE_BACKGROUND_TASKS],
|
|
2990
|
-
ifNotExists: [
|
|
2992
|
+
ifNotExists: [
|
|
2993
|
+
"suspend_payload",
|
|
2994
|
+
"suspendedAt",
|
|
2995
|
+
"ownerId",
|
|
2996
|
+
"leaseExpiresAt"
|
|
2997
|
+
]
|
|
2991
2998
|
});
|
|
2992
2999
|
}
|
|
2993
3000
|
async dangerouslyClearAll() {
|
|
@@ -3030,7 +3037,9 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3030
3037
|
createdAt: task.createdAt.toISOString(),
|
|
3031
3038
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
3032
3039
|
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
3033
|
-
completedAt: task.completedAt?.toISOString() ?? null
|
|
3040
|
+
completedAt: task.completedAt?.toISOString() ?? null,
|
|
3041
|
+
ownerId: task.ownerId ?? null,
|
|
3042
|
+
leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null
|
|
3034
3043
|
}
|
|
3035
3044
|
});
|
|
3036
3045
|
}
|
|
@@ -3069,6 +3078,14 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3069
3078
|
setClauses.push("completedAt = ?");
|
|
3070
3079
|
params.push(update.completedAt?.toISOString() ?? null);
|
|
3071
3080
|
}
|
|
3081
|
+
if ("ownerId" in update) {
|
|
3082
|
+
setClauses.push("ownerId = ?");
|
|
3083
|
+
params.push(update.ownerId ?? null);
|
|
3084
|
+
}
|
|
3085
|
+
if ("leaseExpiresAt" in update) {
|
|
3086
|
+
setClauses.push("leaseExpiresAt = ?");
|
|
3087
|
+
params.push(update.leaseExpiresAt?.toISOString() ?? null);
|
|
3088
|
+
}
|
|
3072
3089
|
if (setClauses.length === 0) return false;
|
|
3073
3090
|
params.push(taskId);
|
|
3074
3091
|
let where = "id = ?";
|
|
@@ -3076,6 +3093,16 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3076
3093
|
where += " AND status = ?";
|
|
3077
3094
|
params.push(options.expectedStatus);
|
|
3078
3095
|
}
|
|
3096
|
+
if (options?.expectedOwnerId !== void 0) if (options.expectedOwnerId === null) where += " AND ownerId IS NULL";
|
|
3097
|
+
else {
|
|
3098
|
+
where += " AND ownerId = ?";
|
|
3099
|
+
params.push(options.expectedOwnerId);
|
|
3100
|
+
}
|
|
3101
|
+
if (options?.expectedLeaseExpiresAt !== void 0) if (options.expectedLeaseExpiresAt === null) where += " AND leaseExpiresAt IS NULL";
|
|
3102
|
+
else {
|
|
3103
|
+
where += " AND leaseExpiresAt = ?";
|
|
3104
|
+
params.push(options.expectedLeaseExpiresAt.toISOString());
|
|
3105
|
+
}
|
|
3079
3106
|
return (await this.#client.execute({
|
|
3080
3107
|
sql: `UPDATE ${TABLE_BACKGROUND_TASKS} SET ${setClauses.join(", ")} WHERE ${where}`,
|
|
3081
3108
|
args: params
|