@mastra/libsql 1.23.3 → 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/docs/references/docs-memory-overview.md +2 -2
- package/dist/index.cjs +32 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -5
- 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/dist/storage/domains/workflows/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +2 -2
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
|
|
@@ -13527,7 +13554,7 @@ var WorkflowsLibSQL = class WorkflowsLibSQL extends WorkflowsStorage {
|
|
|
13527
13554
|
}
|
|
13528
13555
|
}, "deleteWorkflowRunById");
|
|
13529
13556
|
}
|
|
13530
|
-
async listWorkflowRuns({ workflowName, fromDate, toDate, page, perPage, resourceId, threadId, status } = {}) {
|
|
13557
|
+
async listWorkflowRuns({ workflowName, fromDate, toDate, page, perPage, resourceId, threadId, status, summary } = {}) {
|
|
13531
13558
|
try {
|
|
13532
13559
|
const conditions = [];
|
|
13533
13560
|
const args = [];
|
|
@@ -13568,7 +13595,7 @@ var WorkflowsLibSQL = class WorkflowsLibSQL extends WorkflowsStorage {
|
|
|
13568
13595
|
const normalizedPerPage = usePagination ? normalizePerPage(perPage, Number.MAX_SAFE_INTEGER) : 0;
|
|
13569
13596
|
const offset = usePagination ? page * normalizedPerPage : 0;
|
|
13570
13597
|
const runs = ((await this.#client.execute({
|
|
13571
|
-
sql: `SELECT workflow_name, run_id, resourceId, json(snapshot) as snapshot, createdAt, updatedAt FROM ${TABLE_WORKFLOW_SNAPSHOT} ${whereClause} ORDER BY createdAt DESC${usePagination ? ` LIMIT ? OFFSET ?` : ""}`,
|
|
13598
|
+
sql: `SELECT workflow_name, run_id, resourceId, ${summary ? `json_object('status', json_extract(snapshot, '$.status'), 'timestamp', json_extract(snapshot, '$.timestamp'))` : "json(snapshot)"} as snapshot, createdAt, updatedAt FROM ${TABLE_WORKFLOW_SNAPSHOT} ${whereClause} ORDER BY createdAt DESC${usePagination ? ` LIMIT ? OFFSET ?` : ""}`,
|
|
13572
13599
|
args: usePagination ? [
|
|
13573
13600
|
...args,
|
|
13574
13601
|
normalizedPerPage,
|