@mastra/mongodb 1.6.2-alpha.0 → 1.7.0-alpha.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/CHANGELOG.md +20 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +45 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +3 -2
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @mastra/mongodb
|
|
2
2
|
|
|
3
|
+
## 1.7.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Implemented `updateObservationalMemoryConfig()` in Postgres, LibSQL, and MongoDB storage adapters. This enables per-record config overrides for observational memory thresholds, supporting the new `memory.updateObservationalMemoryConfig()` API in `@mastra/memory`. ([#15115](https://github.com/mastra-ai/mastra/pull/15115))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`a50d220`](https://github.com/mastra-ai/mastra/commit/a50d220b01ecbc5644d489a3d446c3bd4ab30245)]:
|
|
12
|
+
- @mastra/core@1.23.0-alpha.9
|
|
13
|
+
|
|
14
|
+
## 1.6.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Added expectedTrajectory support to dataset items across all storage backends and API layer. Dataset items can now store trajectory expectations that define expected agent execution steps, ordering, and constraints for trajectory-based evaluation scoring. ([#14902](https://github.com/mastra-ai/mastra/pull/14902))
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`cb15509`](https://github.com/mastra-ai/mastra/commit/cb15509b58f6a83e11b765c945082afc027db972), [`81e4259`](https://github.com/mastra-ai/mastra/commit/81e425939b4ceeb4f586e9b6d89c3b1c1f2d2fe7), [`951b8a1`](https://github.com/mastra-ai/mastra/commit/951b8a1b5ef7e1474c59dc4f2b9fc1a8b1e508b6), [`80c5668`](https://github.com/mastra-ai/mastra/commit/80c5668e365470d3a96d3e953868fd7a643ff67c), [`3d478c1`](https://github.com/mastra-ai/mastra/commit/3d478c1e13f17b80f330ac49d7aa42ef929b93ff), [`2b4ea10`](https://github.com/mastra-ai/mastra/commit/2b4ea10b053e4ea1ab232d536933a4a3c4cba999), [`a0544f0`](https://github.com/mastra-ai/mastra/commit/a0544f0a1e6bd52ac12676228967c1938e43648d), [`6039f17`](https://github.com/mastra-ai/mastra/commit/6039f176f9c457304825ff1df8c83b8e457376c0), [`06b928d`](https://github.com/mastra-ai/mastra/commit/06b928dfc2f5630d023467476cc5919dfa858d0a), [`6a8d984`](https://github.com/mastra-ai/mastra/commit/6a8d9841f2933456ee1598099f488d742b600054), [`c8c86aa`](https://github.com/mastra-ai/mastra/commit/c8c86aa1458017fbd1c0776fdc0c520d129df8a6)]:
|
|
21
|
+
- @mastra/core@1.22.0
|
|
22
|
+
|
|
3
23
|
## 1.6.2-alpha.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-mongodb
|
|
|
3
3
|
description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/mongodb"
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.7.0-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var evals = require('@mastra/core/evals');
|
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
16
|
var package_default = {
|
|
17
|
-
version: "1.
|
|
17
|
+
version: "1.7.0-alpha.0"};
|
|
18
18
|
var MongoDBFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
19
19
|
getSupportedOperators() {
|
|
20
20
|
return {
|
|
@@ -5266,11 +5266,22 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5266
5266
|
);
|
|
5267
5267
|
}
|
|
5268
5268
|
}
|
|
5269
|
-
async getObservationalMemoryHistory(threadId, resourceId, limit = 10) {
|
|
5269
|
+
async getObservationalMemoryHistory(threadId, resourceId, limit = 10, options) {
|
|
5270
5270
|
try {
|
|
5271
5271
|
const lookupKey = this.getOMKey(threadId, resourceId);
|
|
5272
5272
|
const collection = await this.getCollection(OM_TABLE);
|
|
5273
|
-
const
|
|
5273
|
+
const filter = { lookupKey };
|
|
5274
|
+
if (options?.from || options?.to) {
|
|
5275
|
+
const createdAtFilter = {};
|
|
5276
|
+
if (options.from) createdAtFilter["$gte"] = options.from;
|
|
5277
|
+
if (options.to) createdAtFilter["$lte"] = options.to;
|
|
5278
|
+
filter["createdAt"] = createdAtFilter;
|
|
5279
|
+
}
|
|
5280
|
+
let cursor = collection.find(filter).sort({ generationCount: -1 });
|
|
5281
|
+
if (options?.offset != null) {
|
|
5282
|
+
cursor = cursor.skip(options.offset);
|
|
5283
|
+
}
|
|
5284
|
+
const docs = await cursor.limit(limit).toArray();
|
|
5274
5285
|
return docs.map((doc) => this.parseOMDocument(doc));
|
|
5275
5286
|
} catch (error$1) {
|
|
5276
5287
|
throw new error.MastraError(
|
|
@@ -5696,6 +5707,37 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends storage.MemorySto
|
|
|
5696
5707
|
);
|
|
5697
5708
|
}
|
|
5698
5709
|
}
|
|
5710
|
+
async updateObservationalMemoryConfig(input) {
|
|
5711
|
+
try {
|
|
5712
|
+
const collection = await this.getCollection(OM_TABLE);
|
|
5713
|
+
const doc = await collection.findOne({ id: input.id }, { projection: { config: 1 } });
|
|
5714
|
+
if (!doc) {
|
|
5715
|
+
throw new error.MastraError({
|
|
5716
|
+
id: storage.createStorageErrorId("MONGODB", "UPDATE_OM_CONFIG", "NOT_FOUND"),
|
|
5717
|
+
text: `Observational memory record not found: ${input.id}`,
|
|
5718
|
+
domain: error.ErrorDomain.STORAGE,
|
|
5719
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
5720
|
+
details: { id: input.id }
|
|
5721
|
+
});
|
|
5722
|
+
}
|
|
5723
|
+
const existing = doc.config ?? {};
|
|
5724
|
+
const merged = this.deepMergeConfig(existing, input.config);
|
|
5725
|
+
await collection.updateOne({ id: input.id }, { $set: { config: merged, updatedAt: /* @__PURE__ */ new Date() } });
|
|
5726
|
+
} catch (error$1) {
|
|
5727
|
+
if (error$1 instanceof error.MastraError) {
|
|
5728
|
+
throw error$1;
|
|
5729
|
+
}
|
|
5730
|
+
throw new error.MastraError(
|
|
5731
|
+
{
|
|
5732
|
+
id: storage.createStorageErrorId("MONGODB", "UPDATE_OM_CONFIG", "FAILED"),
|
|
5733
|
+
domain: error.ErrorDomain.STORAGE,
|
|
5734
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
5735
|
+
details: { id: input.id }
|
|
5736
|
+
},
|
|
5737
|
+
error$1
|
|
5738
|
+
);
|
|
5739
|
+
}
|
|
5740
|
+
}
|
|
5699
5741
|
// ============================================
|
|
5700
5742
|
// Async Buffering Methods
|
|
5701
5743
|
// ============================================
|