@mastra/libsql 1.23.0-alpha.2 → 1.23.0-alpha.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.
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.23.0-alpha.2"
6
+ version: "1.23.0-alpha.3"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.23.0-alpha.2",
2
+ "version": "1.23.0-alpha.3",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -9938,6 +9938,8 @@ var MemoryLibSQL = class MemoryLibSQL extends _mastra_core_storage.MemoryStorage
9938
9938
  };
9939
9939
  //#endregion
9940
9940
  //#region src/storage/domains/notifications/index.ts
9941
+ /** Ids per UPDATE statement — keeps bind parameters well under SQLite's per-statement limit. */
9942
+ const BULK_ID_BATCH_SIZE = 500;
9941
9943
  const statusTimestamp = (status, now) => {
9942
9944
  if (status === "delivered") return { deliveredAt: now };
9943
9945
  if (status === "seen") return { seenAt: now };
@@ -10238,6 +10240,31 @@ var NotificationsLibSQL = class NotificationsLibSQL extends _mastra_core_storage
10238
10240
  if (!updated) throw new Error(`Notification ${input.id} was not found for thread ${input.threadId}`);
10239
10241
  return updated;
10240
10242
  }
10243
+ async updateNotificationsStatus(input) {
10244
+ const ids = Array.from(new Set(input.ids));
10245
+ if (ids.length === 0) return [];
10246
+ const now = /* @__PURE__ */ new Date();
10247
+ const assignments = {
10248
+ status: input.status,
10249
+ updatedAt: now.toISOString()
10250
+ };
10251
+ for (const [column, value] of Object.entries(statusTimestamp(input.status, now))) assignments[column] = value.toISOString();
10252
+ const setClause = Object.keys(assignments).map((column) => `"${column}" = ?`).join(", ");
10253
+ const updated = [];
10254
+ for (let offset = 0; offset < ids.length; offset += BULK_ID_BATCH_SIZE) {
10255
+ const batch = ids.slice(offset, offset + BULK_ID_BATCH_SIZE);
10256
+ const result = await this.#db.executeWriteOperationWithRetry(() => withClientWriteLock(this.#client, () => this.#client.execute({
10257
+ sql: `UPDATE "${_mastra_core_storage.TABLE_NOTIFICATIONS}" SET ${setClause} WHERE "threadId" = ? AND "id" IN (${batch.map(() => "?").join(", ")}) RETURNING ${buildSelectColumns(_mastra_core_storage.TABLE_NOTIFICATIONS)}`,
10258
+ args: [
10259
+ ...Object.values(assignments),
10260
+ input.threadId,
10261
+ ...batch
10262
+ ]
10263
+ })), `bulk update notification status in table ${_mastra_core_storage.TABLE_NOTIFICATIONS}`);
10264
+ for (const row of result.rows ?? []) updated.push(rowToNotification(row));
10265
+ }
10266
+ return updated;
10267
+ }
10241
10268
  async findCoalescable(input) {
10242
10269
  if (!input.dedupeKey && !input.coalesceKey) return void 0;
10243
10270
  const agentId = input.agentId ?? null;