@mastra/pg 1.8.4-alpha.0 → 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 CHANGED
@@ -1,5 +1,30 @@
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
+
19
+ ## 1.8.4-alpha.1
20
+
21
+ ### Patch Changes
22
+
23
+ - The internal architecture of observational memory has been refactored. The public API and behavior remain unchanged. ([#14453](https://github.com/mastra-ai/mastra/pull/14453))
24
+
25
+ - Updated dependencies [[`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067), [`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778)]:
26
+ - @mastra/core@1.18.0-alpha.0
27
+
3
28
  ## 1.8.4-alpha.0
4
29
 
5
30
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.8.4-alpha.0"
6
+ version: "1.8.4-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.4-alpha.0",
2
+ "version": "1.8.4-alpha.2",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
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 });