@mastra/convex 1.9.1-alpha.0 → 1.9.1-alpha.1

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.
@@ -3,7 +3,7 @@ name: mastra-convex
3
3
  description: Documentation for @mastra/convex. Use when working with @mastra/convex APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/convex"
6
- version: "1.9.1-alpha.0"
6
+ version: "1.9.1-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.1-alpha.0",
2
+ "version": "1.9.1-alpha.1",
3
3
  "package": "@mastra/convex",
4
4
  "exports": {
5
5
  "ConvexCacheClient": {
@@ -10,7 +10,7 @@
10
10
  "ConvexNativeVector": {
11
11
  "types": "dist/vector/native.d.ts",
12
12
  "implementation": "dist/index.js",
13
- "line": 2884
13
+ "line": 2875
14
14
  },
15
15
  "ConvexServerCache": {
16
16
  "types": "dist/cache/index.d.ts",
package/dist/index.cjs CHANGED
@@ -2791,38 +2791,29 @@ var ConvexVector = class extends _mastra_core_vector.MastraVector {
2791
2791
  if (!value.some((cond) => this.matchesFilterConditions(recordMetadata, cond))) return false;
2792
2792
  continue;
2793
2793
  }
2794
- if (typeof value === "object" && value !== null && "$in" in value) {
2795
- if (!Array.isArray(value.$in) || !value.$in.includes(recordMetadata[key])) return false;
2796
- continue;
2797
- }
2798
- if (typeof value === "object" && value !== null && "$nin" in value) {
2799
- if (Array.isArray(value.$nin) && value.$nin.includes(recordMetadata[key])) return false;
2800
- continue;
2801
- }
2802
- if (typeof value === "object" && value !== null && "$gt" in value) {
2803
- if (!(recordMetadata[key] > value.$gt)) return false;
2804
- continue;
2805
- }
2806
- if (typeof value === "object" && value !== null && "$gte" in value) {
2807
- if (!(recordMetadata[key] >= value.$gte)) return false;
2808
- continue;
2809
- }
2810
- if (typeof value === "object" && value !== null && "$lt" in value) {
2811
- if (!(recordMetadata[key] < value.$lt)) return false;
2812
- continue;
2813
- }
2814
- if (typeof value === "object" && value !== null && "$lte" in value) {
2815
- if (!(recordMetadata[key] <= value.$lte)) return false;
2816
- continue;
2817
- }
2818
- if (typeof value === "object" && value !== null && "$ne" in value) {
2819
- if (recordMetadata[key] === value.$ne) return false;
2794
+ if (typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).some((k) => k.startsWith("$"))) {
2795
+ if (!this.matchesFieldOperators(recordMetadata[key], value)) return false;
2820
2796
  continue;
2821
2797
  }
2822
2798
  if (recordMetadata[key] !== value) return false;
2823
2799
  }
2824
2800
  return true;
2825
2801
  }
2802
+ matchesFieldOperators(fieldValue, operators) {
2803
+ return Object.entries(operators).every(([operator, operand]) => {
2804
+ switch (operator) {
2805
+ case "$eq": return fieldValue === operand;
2806
+ case "$ne": return fieldValue !== operand;
2807
+ case "$in": return Array.isArray(operand) && operand.includes(fieldValue);
2808
+ case "$nin": return !(Array.isArray(operand) && operand.includes(fieldValue));
2809
+ case "$gt": return fieldValue > operand;
2810
+ case "$gte": return fieldValue >= operand;
2811
+ case "$lt": return fieldValue < operand;
2812
+ case "$lte": return fieldValue <= operand;
2813
+ default: return false;
2814
+ }
2815
+ });
2816
+ }
2826
2817
  async callStorage(request) {
2827
2818
  return this.client.callStorage(request);
2828
2819
  }