@mastra/pg 1.8.4-alpha.1 → 1.8.4-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 +16 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -0
- 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 +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 1.8.4-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add `getReviewSummary()` to experiments storage for aggregating review status counts ([#14649](https://github.com/mastra-ai/mastra/pull/14649))
|
|
8
|
+
|
|
9
|
+
Query experiment results grouped by experiment ID, returning counts of `needs-review`, `reviewed`, and `complete` items in a single query instead of fetching all results client-side.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const summary = await storage.experiments.getReviewSummary();
|
|
13
|
+
// [{ experimentId: 'exp-1', needsReview: 3, reviewed: 5, complete: 2, total: 10 }, ...]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`dc9fc19`](https://github.com/mastra-ai/mastra/commit/dc9fc19da4437f6b508cc355f346a8856746a76b), [`260fe12`](https://github.com/mastra-ai/mastra/commit/260fe1295fe7354e39d6def2775e0797a7a277f0)]:
|
|
17
|
+
- @mastra/core@1.18.0-alpha.1
|
|
18
|
+
|
|
3
19
|
## 1.8.4-alpha.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -5764,6 +5764,38 @@ var ExperimentsPG = class _ExperimentsPG extends storage.ExperimentsStorage {
|
|
|
5764
5764
|
);
|
|
5765
5765
|
}
|
|
5766
5766
|
}
|
|
5767
|
+
// --- Aggregation ---
|
|
5768
|
+
async getReviewSummary() {
|
|
5769
|
+
try {
|
|
5770
|
+
const tableName = getTableName2({ indexName: storage.TABLE_EXPERIMENT_RESULTS, schemaName: getSchemaName2(this.#schema) });
|
|
5771
|
+
const rows = await this.#db.client.manyOrNone(
|
|
5772
|
+
`SELECT
|
|
5773
|
+
"experimentId",
|
|
5774
|
+
COUNT(*)::int as total,
|
|
5775
|
+
SUM(CASE WHEN status = 'needs-review' THEN 1 ELSE 0 END)::int as "needsReview",
|
|
5776
|
+
SUM(CASE WHEN status = 'reviewed' THEN 1 ELSE 0 END)::int as reviewed,
|
|
5777
|
+
SUM(CASE WHEN status = 'complete' THEN 1 ELSE 0 END)::int as complete
|
|
5778
|
+
FROM ${tableName}
|
|
5779
|
+
GROUP BY "experimentId"`
|
|
5780
|
+
);
|
|
5781
|
+
return (rows || []).map((row) => ({
|
|
5782
|
+
experimentId: row.experimentId,
|
|
5783
|
+
total: Number(row.total ?? 0),
|
|
5784
|
+
needsReview: Number(row.needsReview ?? 0),
|
|
5785
|
+
reviewed: Number(row.reviewed ?? 0),
|
|
5786
|
+
complete: Number(row.complete ?? 0)
|
|
5787
|
+
}));
|
|
5788
|
+
} catch (error$1) {
|
|
5789
|
+
throw new error.MastraError(
|
|
5790
|
+
{
|
|
5791
|
+
id: storage.createStorageErrorId("PG", "GET_REVIEW_SUMMARY", "FAILED"),
|
|
5792
|
+
domain: error.ErrorDomain.STORAGE,
|
|
5793
|
+
category: error.ErrorCategory.THIRD_PARTY
|
|
5794
|
+
},
|
|
5795
|
+
error$1
|
|
5796
|
+
);
|
|
5797
|
+
}
|
|
5798
|
+
}
|
|
5767
5799
|
// --- Clear ---
|
|
5768
5800
|
async dangerouslyClearAll() {
|
|
5769
5801
|
await this.#db.clearTable({ tableName: storage.TABLE_EXPERIMENT_RESULTS });
|