@mastra/mongodb 1.5.3 → 1.5.4
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 +18 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-storage-mongodb.md +5 -5
- package/dist/docs/references/reference-vectors-mongodb.md +32 -32
- package/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { saveScorePayloadSchema } from '@mastra/core/evals';
|
|
|
12
12
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
|
-
version: "1.5.
|
|
15
|
+
version: "1.5.4"};
|
|
16
16
|
var MongoDBFilterTranslator = class extends BaseFilterTranslator {
|
|
17
17
|
getSupportedOperators() {
|
|
18
18
|
return {
|
|
@@ -3794,7 +3794,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
|
|
|
3794
3794
|
generationCount: Number(doc.generationCount || 0),
|
|
3795
3795
|
activeObservations: doc.activeObservations || "",
|
|
3796
3796
|
// Handle new chunk-based structure
|
|
3797
|
-
bufferedObservationChunks: doc.bufferedObservationChunks
|
|
3797
|
+
bufferedObservationChunks: Array.isArray(doc.bufferedObservationChunks) ? doc.bufferedObservationChunks : void 0,
|
|
3798
3798
|
// Deprecated fields (for backward compatibility)
|
|
3799
3799
|
bufferedObservations: doc.activeObservationsPendingUpdate || void 0,
|
|
3800
3800
|
bufferedObservationTokens: doc.bufferedObservationTokens ? Number(doc.bufferedObservationTokens) : void 0,
|
|
@@ -3945,7 +3945,7 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
|
|
|
3945
3945
|
totalTokensObserved: record.totalTokensObserved || 0,
|
|
3946
3946
|
observationTokenCount: record.observationTokenCount || 0,
|
|
3947
3947
|
observedMessageIds: record.observedMessageIds || null,
|
|
3948
|
-
bufferedObservationChunks: record.bufferedObservationChunks
|
|
3948
|
+
bufferedObservationChunks: Array.isArray(record.bufferedObservationChunks) ? record.bufferedObservationChunks : [],
|
|
3949
3949
|
bufferedReflection: record.bufferedReflection || null,
|
|
3950
3950
|
bufferedReflectionTokens: record.bufferedReflectionTokens ?? null,
|
|
3951
3951
|
bufferedReflectionInputTokens: record.bufferedReflectionInputTokens ?? null,
|
|
@@ -4286,17 +4286,17 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
|
|
|
4286
4286
|
suggestedContinuation: input.chunk.suggestedContinuation,
|
|
4287
4287
|
currentTask: input.chunk.currentTask
|
|
4288
4288
|
};
|
|
4289
|
-
const
|
|
4289
|
+
const now = /* @__PURE__ */ new Date();
|
|
4290
|
+
const setStage = {
|
|
4291
|
+
updatedAt: now,
|
|
4292
|
+
bufferedObservationChunks: {
|
|
4293
|
+
$concatArrays: [{ $ifNull: ["$bufferedObservationChunks", []] }, [newChunk]]
|
|
4294
|
+
}
|
|
4295
|
+
};
|
|
4290
4296
|
if (input.lastBufferedAtTime) {
|
|
4291
|
-
|
|
4297
|
+
setStage.lastBufferedAtTime = input.lastBufferedAtTime;
|
|
4292
4298
|
}
|
|
4293
|
-
const result = await collection.updateOne(
|
|
4294
|
-
{ id: input.id },
|
|
4295
|
-
{
|
|
4296
|
-
$push: { bufferedObservationChunks: newChunk },
|
|
4297
|
-
$set
|
|
4298
|
-
}
|
|
4299
|
-
);
|
|
4299
|
+
const result = await collection.updateOne({ id: input.id }, [{ $set: setStage }]);
|
|
4300
4300
|
if (result.matchedCount === 0) {
|
|
4301
4301
|
throw new MastraError({
|
|
4302
4302
|
id: createStorageErrorId("MONGODB", "UPDATE_BUFFERED_OBSERVATIONS", "NOT_FOUND"),
|
|
@@ -4409,7 +4409,7 @@ ${activatedContent}` : activatedContent;
|
|
|
4409
4409
|
activeObservations: newActive,
|
|
4410
4410
|
observationTokenCount: newTokenCount,
|
|
4411
4411
|
pendingMessageTokens: newPending,
|
|
4412
|
-
bufferedObservationChunks: remainingChunks
|
|
4412
|
+
bufferedObservationChunks: remainingChunks,
|
|
4413
4413
|
lastObservedAt,
|
|
4414
4414
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4415
4415
|
}
|