@mastra/pg 1.21.1 → 1.22.0-alpha.0

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,24 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.22.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added support for filtering scores by metadata key-value pairs in listScores. ([#22047](https://github.com/mastra-ai/mastra/pull/22047))
8
+
9
+ ```typescript
10
+ const result = await storage.listScores({
11
+ filters: { metadata: { env: 'prod' } },
12
+ });
13
+ ```
14
+
15
+ Each top-level metadata key is matched with exact equality against the stored value. Nested objects and arrays compare structurally (key order doesn't matter) with no partial/subset matching, and an empty metadata filter is a no-op.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`e737014`](https://github.com/mastra-ai/mastra/commit/e737014e0fc7035759762bb5b48baef1d6c0f6a7), [`d6ce34a`](https://github.com/mastra-ai/mastra/commit/d6ce34aeceb06ddf3d595a1eed5cc74f481a46a1), [`e6f8450`](https://github.com/mastra-ai/mastra/commit/e6f845074d478527026b18d85031b23353e1d0a4)]:
20
+ - @mastra/core@1.62.0-alpha.2
21
+
3
22
  ## 1.21.1
4
23
 
5
24
  ### 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.21.1"
6
+ version: "1.22.0-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.21.1",
2
+ "version": "1.22.0-alpha.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -16112,6 +16112,10 @@ function applyScoreFilters(acc, filters) {
16112
16112
  acc.conditions.push(`"scoreSource" = $${acc.next++}`);
16113
16113
  acc.params.push(filters.scoreSource ?? filters.source);
16114
16114
  }
16115
+ if (filters?.metadata && Object.keys(filters.metadata).length > 0) for (const [key, value] of Object.entries(filters.metadata)) {
16116
+ acc.conditions.push(`"metadata"->($${acc.next++}::text) = $${acc.next++}::jsonb`);
16117
+ acc.params.push(key, JSON.stringify(value ?? null));
16118
+ }
16115
16119
  }
16116
16120
  /** OLAP queries take an explicit scorerId / scoreSource pair as identity. */
16117
16121
  function pushScoreIdentity(acc, scorerId, scoreSource) {