@mastra/mongodb 1.9.2-alpha.0 → 1.9.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 +20 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +24 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -12
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -7,12 +7,13 @@ import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
|
7
7
|
import { randomUUID } from 'crypto';
|
|
8
8
|
import { MessageList } from '@mastra/core/agent';
|
|
9
9
|
import { saveScorePayloadSchema } from '@mastra/core/evals';
|
|
10
|
+
import { skillSnapshotFieldValuesEqual } from '@mastra/core/storage/domains/skills';
|
|
10
11
|
|
|
11
12
|
// src/vector/index.ts
|
|
12
13
|
|
|
13
14
|
// package.json
|
|
14
15
|
var package_default = {
|
|
15
|
-
version: "1.9.
|
|
16
|
+
version: "1.9.4"};
|
|
16
17
|
var MongoDBFilterTranslator = class extends BaseFilterTranslator {
|
|
17
18
|
getSupportedOperators() {
|
|
18
19
|
return {
|
|
@@ -5222,13 +5223,15 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5222
5223
|
text: `Thread ${id} not found`
|
|
5223
5224
|
});
|
|
5224
5225
|
}
|
|
5226
|
+
const now = /* @__PURE__ */ new Date();
|
|
5225
5227
|
const updatedThread = {
|
|
5226
5228
|
...thread,
|
|
5227
5229
|
title,
|
|
5228
5230
|
metadata: {
|
|
5229
5231
|
...thread.metadata,
|
|
5230
5232
|
...metadata
|
|
5231
|
-
}
|
|
5233
|
+
},
|
|
5234
|
+
updatedAt: now
|
|
5232
5235
|
};
|
|
5233
5236
|
try {
|
|
5234
5237
|
const collection = await this.getCollection(TABLE_THREADS);
|
|
@@ -5237,7 +5240,8 @@ var MemoryStorageMongoDB = class _MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5237
5240
|
{
|
|
5238
5241
|
$set: {
|
|
5239
5242
|
title,
|
|
5240
|
-
metadata: updatedThread.metadata
|
|
5243
|
+
metadata: updatedThread.metadata,
|
|
5244
|
+
updatedAt: now
|
|
5241
5245
|
}
|
|
5242
5246
|
}
|
|
5243
5247
|
);
|
|
@@ -9250,15 +9254,23 @@ var MongoDBSkillsStorage = class _MongoDBSkillsStorage extends SkillsStorage {
|
|
|
9250
9254
|
});
|
|
9251
9255
|
}
|
|
9252
9256
|
const existingSnapshot = this.extractSnapshotFields(latestVersion);
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9257
|
+
const changedFields = Object.keys(configFields).filter(
|
|
9258
|
+
(field) => !skillSnapshotFieldValuesEqual(
|
|
9259
|
+
configFields[field],
|
|
9260
|
+
existingSnapshot[field]
|
|
9261
|
+
)
|
|
9262
|
+
);
|
|
9263
|
+
if (changedFields.length > 0) {
|
|
9264
|
+
await this.createVersion({
|
|
9265
|
+
id: randomUUID(),
|
|
9266
|
+
skillId: id,
|
|
9267
|
+
versionNumber: latestVersion.versionNumber + 1,
|
|
9268
|
+
...existingSnapshot,
|
|
9269
|
+
...configFields,
|
|
9270
|
+
changedFields,
|
|
9271
|
+
changeMessage: `Updated: ${changedFields.join(", ")}`
|
|
9272
|
+
});
|
|
9273
|
+
}
|
|
9262
9274
|
}
|
|
9263
9275
|
if (metadataFields.authorId !== void 0) updateDoc.authorId = metadataFields.authorId;
|
|
9264
9276
|
if (metadataFields.visibility !== void 0) updateDoc.visibility = metadataFields.visibility;
|