@mastra/mongodb 1.20.1-alpha.1 → 1.21.0
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 +24 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
9
9
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
10
10
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.
|
|
12
|
+
var version = "1.21.0";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/vector/filter.ts
|
|
15
15
|
/**
|
|
@@ -6465,6 +6465,7 @@ const OM_TABLE = "mastra_observational_memory";
|
|
|
6465
6465
|
var MemoryStorageMongoDB = class MemoryStorageMongoDB extends _mastra_core_storage.MemoryStorage {
|
|
6466
6466
|
supportsPartialThreadUpdate = true;
|
|
6467
6467
|
supportsObservationalMemory = true;
|
|
6468
|
+
supportsObservationalMemoryHistorySearch = true;
|
|
6468
6469
|
#connector;
|
|
6469
6470
|
#skipDefaultIndexes;
|
|
6470
6471
|
#indexes;
|
|
@@ -7505,13 +7506,34 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends _mastra_core_stora
|
|
|
7505
7506
|
const lookupKey = this.getOMKey(threadId, resourceId);
|
|
7506
7507
|
const collection = await this.getCollection(OM_TABLE);
|
|
7507
7508
|
const filter = { lookupKey };
|
|
7509
|
+
if (options?.recordId !== void 0) filter["id"] = options.recordId;
|
|
7508
7510
|
if (options?.from || options?.to) {
|
|
7509
7511
|
const createdAtFilter = {};
|
|
7510
7512
|
if (options.from) createdAtFilter["$gte"] = options.from;
|
|
7511
7513
|
if (options.to) createdAtFilter["$lte"] = options.to;
|
|
7512
7514
|
filter["createdAt"] = createdAtFilter;
|
|
7513
7515
|
}
|
|
7514
|
-
|
|
7516
|
+
if (options?.groupId !== void 0) {
|
|
7517
|
+
const prefix = { $literal: `<observation-group id="${options.groupId}"` };
|
|
7518
|
+
filter["$expr"] = { $or: [{ $gte: [{ $indexOfCP: [{ $ifNull: ["$activeObservations", ""] }, prefix] }, 0] }, { $anyElementTrue: [{ $map: {
|
|
7519
|
+
input: { $cond: [
|
|
7520
|
+
{ $isArray: "$bufferedObservationChunks" },
|
|
7521
|
+
"$bufferedObservationChunks",
|
|
7522
|
+
[]
|
|
7523
|
+
] },
|
|
7524
|
+
as: "chunk",
|
|
7525
|
+
in: { $gte: [{ $indexOfCP: [{ $ifNull: ["$$chunk.observations", ""] }, prefix] }, 0] }
|
|
7526
|
+
} }] }] };
|
|
7527
|
+
}
|
|
7528
|
+
if (options?.beforeGeneration !== void 0 || options?.afterGeneration !== void 0) filter["generationCount"] = {
|
|
7529
|
+
...options.beforeGeneration !== void 0 ? { $lt: options.beforeGeneration } : {},
|
|
7530
|
+
...options.afterGeneration !== void 0 ? { $gt: options.afterGeneration } : {}
|
|
7531
|
+
};
|
|
7532
|
+
let cursor = collection.find(filter).sort({
|
|
7533
|
+
generationCount: options?.sortDirection === "ASC" ? 1 : -1,
|
|
7534
|
+
createdAt: 1,
|
|
7535
|
+
id: 1
|
|
7536
|
+
});
|
|
7515
7537
|
if (options?.offset != null) cursor = cursor.skip(options.offset);
|
|
7516
7538
|
return (await cursor.limit(limit).toArray()).map((doc) => this.parseOMDocument(doc));
|
|
7517
7539
|
} catch (error) {
|