@mastra/mongodb 1.6.1-alpha.0 → 1.6.1-alpha.2
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/index.cjs +37 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts +2 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/package.json +4 -4
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.6.1-alpha.
|
|
15
|
+
version: "1.6.1-alpha.2"};
|
|
16
16
|
var MongoDBFilterTranslator = class extends BaseFilterTranslator {
|
|
17
17
|
getSupportedOperators() {
|
|
18
18
|
return {
|
|
@@ -3037,6 +3037,42 @@ var MongoDBExperimentsStorage = class _MongoDBExperimentsStorage extends Experim
|
|
|
3037
3037
|
}
|
|
3038
3038
|
}
|
|
3039
3039
|
// -------------------------------------------------------------------------
|
|
3040
|
+
// Aggregation
|
|
3041
|
+
// -------------------------------------------------------------------------
|
|
3042
|
+
async getReviewSummary() {
|
|
3043
|
+
try {
|
|
3044
|
+
const collection = await this.getCollection(TABLE_EXPERIMENT_RESULTS);
|
|
3045
|
+
const pipeline = [
|
|
3046
|
+
{
|
|
3047
|
+
$group: {
|
|
3048
|
+
_id: "$experimentId",
|
|
3049
|
+
total: { $sum: 1 },
|
|
3050
|
+
needsReview: { $sum: { $cond: [{ $eq: ["$status", "needs-review"] }, 1, 0] } },
|
|
3051
|
+
reviewed: { $sum: { $cond: [{ $eq: ["$status", "reviewed"] }, 1, 0] } },
|
|
3052
|
+
complete: { $sum: { $cond: [{ $eq: ["$status", "complete"] }, 1, 0] } }
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
];
|
|
3056
|
+
const results = await collection.aggregate(pipeline).toArray();
|
|
3057
|
+
return results.map((row) => ({
|
|
3058
|
+
experimentId: row._id,
|
|
3059
|
+
total: Number(row.total ?? 0),
|
|
3060
|
+
needsReview: Number(row.needsReview ?? 0),
|
|
3061
|
+
reviewed: Number(row.reviewed ?? 0),
|
|
3062
|
+
complete: Number(row.complete ?? 0)
|
|
3063
|
+
}));
|
|
3064
|
+
} catch (error) {
|
|
3065
|
+
throw new MastraError(
|
|
3066
|
+
{
|
|
3067
|
+
id: createStorageErrorId("MONGODB", "GET_REVIEW_SUMMARY", "FAILED"),
|
|
3068
|
+
domain: ErrorDomain.STORAGE,
|
|
3069
|
+
category: ErrorCategory.THIRD_PARTY
|
|
3070
|
+
},
|
|
3071
|
+
error
|
|
3072
|
+
);
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
// -------------------------------------------------------------------------
|
|
3040
3076
|
// Cleanup
|
|
3041
3077
|
// -------------------------------------------------------------------------
|
|
3042
3078
|
async dangerouslyClearAll() {
|