@mastra/mongodb 1.18.8-alpha.0 → 1.18.8
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 +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/notifications/index.d.ts +6 -1
- package/dist/storage/domains/notifications/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
10
10
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
11
11
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.18.8
|
|
13
|
+
var version = "1.18.8";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/vector/filter.ts
|
|
16
16
|
/**
|
|
@@ -7976,6 +7976,8 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends _mastra_core_stora
|
|
|
7976
7976
|
};
|
|
7977
7977
|
//#endregion
|
|
7978
7978
|
//#region src/storage/domains/notifications/index.ts
|
|
7979
|
+
/** Ids per updateMany/find command — keeps the `$in` filter far below MongoDB's 16 MiB BSON limit. */
|
|
7980
|
+
const BULK_ID_BATCH_SIZE = 500;
|
|
7979
7981
|
const statusTimestamp = (status, now) => {
|
|
7980
7982
|
if (status === "delivered") return { deliveredAt: now };
|
|
7981
7983
|
if (status === "seen") return { seenAt: now };
|
|
@@ -8306,6 +8308,31 @@ var NotificationsMongoDB = class NotificationsMongoDB extends _mastra_core_stora
|
|
|
8306
8308
|
if (!updated) throw new Error(`Notification ${input.id} was not found for thread ${input.threadId}`);
|
|
8307
8309
|
return updated;
|
|
8308
8310
|
}
|
|
8311
|
+
async updateNotificationsStatus(input) {
|
|
8312
|
+
const ids = Array.from(new Set(input.ids));
|
|
8313
|
+
if (ids.length === 0) return [];
|
|
8314
|
+
const now = /* @__PURE__ */ new Date();
|
|
8315
|
+
const update = { $set: {
|
|
8316
|
+
status: input.status,
|
|
8317
|
+
...statusTimestamp(input.status, now),
|
|
8318
|
+
updatedAt: now
|
|
8319
|
+
} };
|
|
8320
|
+
const collection = await this.getCollection();
|
|
8321
|
+
const updated = [];
|
|
8322
|
+
for (let offset = 0; offset < ids.length; offset += BULK_ID_BATCH_SIZE) {
|
|
8323
|
+
const filter = {
|
|
8324
|
+
threadId: input.threadId,
|
|
8325
|
+
id: { $in: ids.slice(offset, offset + BULK_ID_BATCH_SIZE) }
|
|
8326
|
+
};
|
|
8327
|
+
await collection.updateMany(filter, update);
|
|
8328
|
+
const rows = await collection.find({
|
|
8329
|
+
...filter,
|
|
8330
|
+
status: input.status
|
|
8331
|
+
}).toArray();
|
|
8332
|
+
for (const row of rows) updated.push(rowToNotification(row));
|
|
8333
|
+
}
|
|
8334
|
+
return updated;
|
|
8335
|
+
}
|
|
8309
8336
|
async findCoalescable(input) {
|
|
8310
8337
|
if (!input.dedupeKey && !input.coalesceKey) return void 0;
|
|
8311
8338
|
const row = await (await this.getCollection()).findOne({
|