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