@mastra/core 0.9.5-alpha.0 → 0.10.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.
Files changed (168) hide show
  1. package/README.md +3 -2
  2. package/dist/agent/index.cjs +2 -2
  3. package/dist/agent/index.d.cts +12 -13
  4. package/dist/agent/index.d.ts +12 -13
  5. package/dist/agent/index.js +1 -1
  6. package/dist/{base-CI7Uz2GO.d.ts → base-DttB7sJD.d.ts} +1172 -1130
  7. package/dist/{base-BV8SNIdm.d.cts → base-aJ3etsh5.d.cts} +1172 -1130
  8. package/dist/{base-H7siSAfu.d.cts → base-aPYtPBT2.d.cts} +3 -3
  9. package/dist/{base-4Z34GQL8.d.ts → base-tc5kgDTD.d.ts} +3 -3
  10. package/dist/base.cjs +2 -2
  11. package/dist/base.d.cts +2 -3
  12. package/dist/base.d.ts +2 -3
  13. package/dist/base.js +1 -1
  14. package/dist/bundler/index.cjs +2 -2
  15. package/dist/bundler/index.d.cts +2 -3
  16. package/dist/bundler/index.d.ts +2 -3
  17. package/dist/bundler/index.js +1 -1
  18. package/dist/{chunk-W4BSLENO.js → chunk-2NTUAUGH.js} +1 -1
  19. package/dist/{chunk-MF5BUJO6.js → chunk-2PW6UJMW.js} +57 -9
  20. package/dist/{chunk-HKCSQI7G.cjs → chunk-2U7ZZUFO.cjs} +2 -2
  21. package/dist/{workflows/vNext/index.js → chunk-3SQ3G2EJ.js} +16 -15
  22. package/dist/chunk-5HULBQ2W.cjs +38 -0
  23. package/dist/{chunk-BATBI3D4.cjs → chunk-5JRD3NDP.cjs} +15 -15
  24. package/dist/{chunk-EYQLTWRJ.cjs → chunk-5W2G7S44.cjs} +33 -58
  25. package/dist/chunk-75Z4BZEE.js +36 -0
  26. package/dist/{chunk-S3Y7QBO7.cjs → chunk-AOGUTJUO.cjs} +57 -50
  27. package/dist/{chunk-BZUIFK6C.js → chunk-BPTSLJHA.js} +9 -9
  28. package/dist/{chunk-JBJ7KXN5.js → chunk-C3ICEF6E.js} +1 -1
  29. package/dist/{chunk-E4FAXBUV.cjs → chunk-CWSFP2HS.cjs} +2 -2
  30. package/dist/{chunk-RWWUZTAK.js → chunk-E7CLY6SK.js} +41 -34
  31. package/dist/{chunk-235X76GC.js → chunk-FI7R232B.js} +2 -2
  32. package/dist/chunk-GQ2XQ4UN.js +321 -0
  33. package/dist/{chunk-6EPEYXAE.js → chunk-J7GDGV6F.js} +1 -1
  34. package/dist/{chunk-NLBJOFNG.js → chunk-JW5TMK2L.js} +1 -1
  35. package/dist/{chunk-NOPY74PV.js → chunk-KJQFFEEQ.js} +1 -1
  36. package/dist/{chunk-V2Q2FEVO.cjs → chunk-KSPHQSZX.cjs} +2 -2
  37. package/dist/{chunk-SU4O2A72.js → chunk-LHRZV5VG.js} +1 -22
  38. package/dist/chunk-NMDM4IZN.cjs +78 -0
  39. package/dist/chunk-OBEALYTK.js +74 -0
  40. package/dist/{chunk-PU2TNRKO.js → chunk-OCT2762Q.js} +1 -1
  41. package/dist/{chunk-5DUFC7TV.cjs → chunk-P7BGXOQV.cjs} +2 -2
  42. package/dist/{chunk-NQE264UM.cjs → chunk-PIZM25KI.cjs} +2 -23
  43. package/dist/{chunk-S7J63JOG.cjs → chunk-RVS6OUJN.cjs} +2 -2
  44. package/dist/{chunk-LF5CE7LU.cjs → chunk-SKG2NIZW.cjs} +2 -2
  45. package/dist/chunk-SWW4EBUZ.cjs +96 -0
  46. package/dist/{chunk-RGE4UF6A.cjs → chunk-TMPFLJLG.cjs} +2 -2
  47. package/dist/{workflows/vNext/index.cjs → chunk-TTKQ37ZZ.cjs} +21 -20
  48. package/dist/{chunk-F7HNPG53.cjs → chunk-U3L3NEOM.cjs} +58 -10
  49. package/dist/chunk-VHLL4AZK.js +90 -0
  50. package/dist/{chunk-EG74VBSP.cjs → chunk-YEULQPUY.cjs} +6 -6
  51. package/dist/{chunk-RVKA5VUT.js → chunk-ZB3LEHL2.js} +31 -56
  52. package/dist/{chunk-TAFOICHR.js → chunk-ZKN6HYYQ.js} +1 -1
  53. package/dist/chunk-ZZDAC5KD.cjs +325 -0
  54. package/dist/deployer/index.cjs +2 -2
  55. package/dist/deployer/index.d.cts +2 -3
  56. package/dist/deployer/index.d.ts +2 -3
  57. package/dist/deployer/index.js +1 -1
  58. package/dist/eval/index.d.cts +12 -13
  59. package/dist/eval/index.d.ts +12 -13
  60. package/dist/hooks/index.d.cts +1 -1
  61. package/dist/hooks/index.d.ts +1 -1
  62. package/dist/index.cjs +71 -158
  63. package/dist/index.d.cts +16 -24
  64. package/dist/index.d.ts +16 -24
  65. package/dist/index.js +16 -23
  66. package/dist/integration/index.cjs +3 -3
  67. package/dist/integration/index.d.cts +11 -12
  68. package/dist/integration/index.d.ts +11 -12
  69. package/dist/integration/index.js +1 -1
  70. package/dist/llm/index.d.cts +11 -12
  71. package/dist/llm/index.d.ts +11 -12
  72. package/dist/logger/index.cjs +18 -17
  73. package/dist/logger/index.d.cts +42 -2
  74. package/dist/logger/index.d.ts +42 -2
  75. package/dist/logger/index.js +2 -1
  76. package/dist/{index-QV27jkxQ.d.ts → logger-EhZkzZOr.d.cts} +38 -52
  77. package/dist/{index-QV27jkxQ.d.cts → logger-EhZkzZOr.d.ts} +38 -52
  78. package/dist/mastra/index.cjs +2 -2
  79. package/dist/mastra/index.d.cts +10 -11
  80. package/dist/mastra/index.d.ts +10 -11
  81. package/dist/mastra/index.js +1 -1
  82. package/dist/mcp/index.cjs +4 -4
  83. package/dist/mcp/index.d.cts +13 -14
  84. package/dist/mcp/index.d.ts +13 -14
  85. package/dist/mcp/index.js +2 -2
  86. package/dist/memory/index.cjs +4 -4
  87. package/dist/memory/index.d.cts +11 -12
  88. package/dist/memory/index.d.ts +11 -12
  89. package/dist/memory/index.js +1 -1
  90. package/dist/network/index.cjs +8 -8
  91. package/dist/network/index.d.cts +11 -12
  92. package/dist/network/index.d.ts +11 -12
  93. package/dist/network/index.js +4 -4
  94. package/dist/relevance/index.cjs +4 -4
  95. package/dist/relevance/index.d.cts +14 -15
  96. package/dist/relevance/index.d.ts +14 -15
  97. package/dist/relevance/index.js +1 -1
  98. package/dist/server/index.cjs +4 -0
  99. package/dist/server/index.d.cts +14 -13
  100. package/dist/server/index.d.ts +14 -13
  101. package/dist/server/index.js +4 -1
  102. package/dist/storage/index.cjs +184 -3
  103. package/dist/storage/index.d.cts +82 -12
  104. package/dist/storage/index.d.ts +82 -12
  105. package/dist/storage/index.js +186 -1
  106. package/dist/telemetry/index.d.cts +13 -14
  107. package/dist/telemetry/index.d.ts +13 -14
  108. package/dist/telemetry/otel-vendor.cjs +2 -2
  109. package/dist/telemetry/otel-vendor.d.cts +1 -1
  110. package/dist/telemetry/otel-vendor.d.ts +1 -1
  111. package/dist/telemetry/otel-vendor.js +1 -1
  112. package/dist/tools/index.cjs +4 -4
  113. package/dist/tools/index.d.cts +11 -12
  114. package/dist/tools/index.d.ts +11 -12
  115. package/dist/tools/index.js +1 -1
  116. package/dist/tts/index.cjs +2 -2
  117. package/dist/tts/index.d.cts +2 -3
  118. package/dist/tts/index.d.ts +2 -3
  119. package/dist/tts/index.js +1 -1
  120. package/dist/{types-BtMyV38I.d.ts → types-Bo1uigWx.d.cts} +1 -1
  121. package/dist/{types-BtMyV38I.d.cts → types-Bo1uigWx.d.ts} +1 -1
  122. package/dist/utils.cjs +16 -16
  123. package/dist/utils.d.cts +14 -15
  124. package/dist/utils.d.ts +14 -15
  125. package/dist/utils.js +1 -1
  126. package/dist/vector/filter/index.cjs +189 -7
  127. package/dist/vector/filter/index.js +190 -1
  128. package/dist/vector/index.cjs +2 -2
  129. package/dist/vector/index.d.cts +10 -24
  130. package/dist/vector/index.d.ts +10 -24
  131. package/dist/vector/index.js +1 -1
  132. package/dist/voice/index.cjs +4 -4
  133. package/dist/voice/index.d.cts +11 -12
  134. package/dist/voice/index.d.ts +11 -12
  135. package/dist/voice/index.js +1 -1
  136. package/dist/workflows/index.cjs +17 -69
  137. package/dist/workflows/index.d.cts +195 -75
  138. package/dist/workflows/index.d.ts +195 -75
  139. package/dist/workflows/index.js +1 -1
  140. package/dist/workflows/legacy/index.cjs +90 -0
  141. package/dist/workflows/legacy/index.d.cts +87 -0
  142. package/dist/workflows/legacy/index.d.ts +87 -0
  143. package/dist/workflows/legacy/index.js +1 -0
  144. package/package.json +19 -41
  145. package/workflows/legacy.d.ts +1 -0
  146. package/dist/chunk-CMPPXW4U.js +0 -154
  147. package/dist/chunk-GH6EMQSO.js +0 -131
  148. package/dist/chunk-JMJXBE7L.js +0 -843
  149. package/dist/chunk-LGERQTJM.js +0 -190
  150. package/dist/chunk-O44MSFMZ.cjs +0 -168
  151. package/dist/chunk-T6DN4C76.cjs +0 -134
  152. package/dist/chunk-UCZWRJRW.cjs +0 -667
  153. package/dist/chunk-YK3XJ52U.cjs +0 -192
  154. package/dist/chunk-YNOTY72R.cjs +0 -845
  155. package/dist/chunk-ZY2DW2VQ.js +0 -658
  156. package/dist/storage/libsql/index.cjs +0 -588
  157. package/dist/storage/libsql/index.d.cts +0 -104
  158. package/dist/storage/libsql/index.d.ts +0 -104
  159. package/dist/storage/libsql/index.js +0 -585
  160. package/dist/vector/libsql/index.cjs +0 -14
  161. package/dist/vector/libsql/index.d.cts +0 -86
  162. package/dist/vector/libsql/index.d.ts +0 -86
  163. package/dist/vector/libsql/index.js +0 -1
  164. package/dist/workflows/vNext/index.d.cts +0 -209
  165. package/dist/workflows/vNext/index.d.ts +0 -209
  166. package/storage/libsql.d.ts +0 -1
  167. package/vector/libsql.d.ts +0 -1
  168. package/workflows/vNext.d.ts +0 -1
@@ -1,10 +1,192 @@
1
1
  'use strict';
2
2
 
3
- var chunkYK3XJ52U_cjs = require('../../chunk-YK3XJ52U.cjs');
3
+ // src/vector/filter/base.ts
4
+ var BaseFilterTranslator = class _BaseFilterTranslator {
5
+ /**
6
+ * Operator type checks
7
+ */
8
+ isOperator(key) {
9
+ return key.startsWith("$");
10
+ }
11
+ static BASIC_OPERATORS = ["$eq", "$ne"];
12
+ static NUMERIC_OPERATORS = ["$gt", "$gte", "$lt", "$lte"];
13
+ static ARRAY_OPERATORS = ["$in", "$nin", "$all", "$elemMatch"];
14
+ static LOGICAL_OPERATORS = ["$and", "$or", "$not", "$nor"];
15
+ static ELEMENT_OPERATORS = ["$exists"];
16
+ static REGEX_OPERATORS = ["$regex", "$options"];
17
+ static DEFAULT_OPERATORS = {
18
+ logical: _BaseFilterTranslator.LOGICAL_OPERATORS,
19
+ basic: _BaseFilterTranslator.BASIC_OPERATORS,
20
+ numeric: _BaseFilterTranslator.NUMERIC_OPERATORS,
21
+ array: _BaseFilterTranslator.ARRAY_OPERATORS,
22
+ element: _BaseFilterTranslator.ELEMENT_OPERATORS,
23
+ regex: _BaseFilterTranslator.REGEX_OPERATORS
24
+ };
25
+ isLogicalOperator(key) {
26
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.logical.includes(key);
27
+ }
28
+ isBasicOperator(key) {
29
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.basic.includes(key);
30
+ }
31
+ isNumericOperator(key) {
32
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.numeric.includes(key);
33
+ }
34
+ isArrayOperator(key) {
35
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.array.includes(key);
36
+ }
37
+ isElementOperator(key) {
38
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.element.includes(key);
39
+ }
40
+ isRegexOperator(key) {
41
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.regex.includes(key);
42
+ }
43
+ isFieldOperator(key) {
44
+ return this.isOperator(key) && !this.isLogicalOperator(key);
45
+ }
46
+ isCustomOperator(key) {
47
+ const support = this.getSupportedOperators();
48
+ return support.custom?.includes(key) ?? false;
49
+ }
50
+ getSupportedOperators() {
51
+ return _BaseFilterTranslator.DEFAULT_OPERATORS;
52
+ }
53
+ isValidOperator(key) {
54
+ const support = this.getSupportedOperators();
55
+ const allSupported = Object.values(support).flat();
56
+ return allSupported.includes(key);
57
+ }
58
+ /**
59
+ * Value normalization for comparison operators
60
+ */
61
+ normalizeComparisonValue(value) {
62
+ if (value instanceof Date) {
63
+ return value.toISOString();
64
+ }
65
+ if (typeof value === "number" && Object.is(value, -0)) {
66
+ return 0;
67
+ }
68
+ return value;
69
+ }
70
+ /**
71
+ * Helper method to simulate $all operator using $and + $eq when needed.
72
+ * Some vector stores don't support $all natively.
73
+ */
74
+ simulateAllOperator(field, values) {
75
+ return {
76
+ $and: values.map((value) => ({
77
+ [field]: { $in: [this.normalizeComparisonValue(value)] }
78
+ }))
79
+ };
80
+ }
81
+ /**
82
+ * Utility functions for type checking
83
+ */
84
+ isPrimitive(value) {
85
+ return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
86
+ }
87
+ isRegex(value) {
88
+ return value instanceof RegExp;
89
+ }
90
+ isEmpty(obj) {
91
+ return obj === null || obj === void 0 || typeof obj === "object" && Object.keys(obj).length === 0;
92
+ }
93
+ static ErrorMessages = {
94
+ UNSUPPORTED_OPERATOR: (op) => `Unsupported operator: ${op}`,
95
+ INVALID_LOGICAL_OPERATOR_LOCATION: (op, path) => `Logical operator ${op} cannot be used at field level: ${path}`,
96
+ NOT_REQUIRES_OBJECT: `$not operator requires an object`,
97
+ NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
98
+ INVALID_LOGICAL_OPERATOR_CONTENT: (path) => `Logical operators must contain field conditions, not direct operators: ${path}`,
99
+ INVALID_TOP_LEVEL_OPERATOR: (op) => `Invalid top-level operator: ${op}`,
100
+ ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
101
+ };
102
+ /**
103
+ * Helper to handle array value normalization consistently
104
+ */
105
+ normalizeArrayValues(values) {
106
+ return values.map((value) => this.normalizeComparisonValue(value));
107
+ }
108
+ validateFilter(filter) {
109
+ const validation = this.validateFilterSupport(filter);
110
+ if (!validation.supported) {
111
+ throw new Error(validation.messages.join(", "));
112
+ }
113
+ }
114
+ /**
115
+ * Validates if a filter structure is supported by the specific vector DB
116
+ * and returns detailed validation information.
117
+ */
118
+ validateFilterSupport(node, path = "") {
119
+ const messages = [];
120
+ if (this.isPrimitive(node) || this.isEmpty(node)) {
121
+ return { supported: true, messages: [] };
122
+ }
123
+ if (Array.isArray(node)) {
124
+ const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
125
+ const arrayMessages = arrayResults.flatMap((r) => r.messages);
126
+ return {
127
+ supported: arrayResults.every((r) => r.supported),
128
+ messages: arrayMessages
129
+ };
130
+ }
131
+ const nodeObj = node;
132
+ let isSupported = true;
133
+ for (const [key, value] of Object.entries(nodeObj)) {
134
+ const newPath = path ? `${path}.${key}` : key;
135
+ if (this.isOperator(key)) {
136
+ if (!this.isValidOperator(key)) {
137
+ isSupported = false;
138
+ messages.push(_BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(key));
139
+ continue;
140
+ }
141
+ if (!path && !this.isLogicalOperator(key)) {
142
+ isSupported = false;
143
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
144
+ continue;
145
+ }
146
+ if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
147
+ isSupported = false;
148
+ messages.push(_BaseFilterTranslator.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
149
+ continue;
150
+ }
151
+ if (this.isLogicalOperator(key)) {
152
+ if (key === "$not") {
153
+ if (Array.isArray(value) || typeof value !== "object") {
154
+ isSupported = false;
155
+ messages.push(_BaseFilterTranslator.ErrorMessages.NOT_REQUIRES_OBJECT);
156
+ continue;
157
+ }
158
+ if (this.isEmpty(value)) {
159
+ isSupported = false;
160
+ messages.push(_BaseFilterTranslator.ErrorMessages.NOT_CANNOT_BE_EMPTY);
161
+ continue;
162
+ }
163
+ continue;
164
+ }
165
+ if (path && !this.isLogicalOperator(path.split(".").pop())) {
166
+ isSupported = false;
167
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
168
+ continue;
169
+ }
170
+ if (Array.isArray(value)) {
171
+ const hasDirectOperators = value.some(
172
+ (item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0])
173
+ );
174
+ if (hasDirectOperators) {
175
+ isSupported = false;
176
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
177
+ continue;
178
+ }
179
+ }
180
+ }
181
+ }
182
+ const nestedValidation = this.validateFilterSupport(value, newPath);
183
+ if (!nestedValidation.supported) {
184
+ isSupported = false;
185
+ messages.push(...nestedValidation.messages);
186
+ }
187
+ }
188
+ return { supported: isSupported, messages };
189
+ }
190
+ };
4
191
 
5
-
6
-
7
- Object.defineProperty(exports, "BaseFilterTranslator", {
8
- enumerable: true,
9
- get: function () { return chunkYK3XJ52U_cjs.BaseFilterTranslator; }
10
- });
192
+ exports.BaseFilterTranslator = BaseFilterTranslator;
@@ -1 +1,190 @@
1
- export { BaseFilterTranslator } from '../../chunk-LGERQTJM.js';
1
+ // src/vector/filter/base.ts
2
+ var BaseFilterTranslator = class _BaseFilterTranslator {
3
+ /**
4
+ * Operator type checks
5
+ */
6
+ isOperator(key) {
7
+ return key.startsWith("$");
8
+ }
9
+ static BASIC_OPERATORS = ["$eq", "$ne"];
10
+ static NUMERIC_OPERATORS = ["$gt", "$gte", "$lt", "$lte"];
11
+ static ARRAY_OPERATORS = ["$in", "$nin", "$all", "$elemMatch"];
12
+ static LOGICAL_OPERATORS = ["$and", "$or", "$not", "$nor"];
13
+ static ELEMENT_OPERATORS = ["$exists"];
14
+ static REGEX_OPERATORS = ["$regex", "$options"];
15
+ static DEFAULT_OPERATORS = {
16
+ logical: _BaseFilterTranslator.LOGICAL_OPERATORS,
17
+ basic: _BaseFilterTranslator.BASIC_OPERATORS,
18
+ numeric: _BaseFilterTranslator.NUMERIC_OPERATORS,
19
+ array: _BaseFilterTranslator.ARRAY_OPERATORS,
20
+ element: _BaseFilterTranslator.ELEMENT_OPERATORS,
21
+ regex: _BaseFilterTranslator.REGEX_OPERATORS
22
+ };
23
+ isLogicalOperator(key) {
24
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.logical.includes(key);
25
+ }
26
+ isBasicOperator(key) {
27
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.basic.includes(key);
28
+ }
29
+ isNumericOperator(key) {
30
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.numeric.includes(key);
31
+ }
32
+ isArrayOperator(key) {
33
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.array.includes(key);
34
+ }
35
+ isElementOperator(key) {
36
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.element.includes(key);
37
+ }
38
+ isRegexOperator(key) {
39
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.regex.includes(key);
40
+ }
41
+ isFieldOperator(key) {
42
+ return this.isOperator(key) && !this.isLogicalOperator(key);
43
+ }
44
+ isCustomOperator(key) {
45
+ const support = this.getSupportedOperators();
46
+ return support.custom?.includes(key) ?? false;
47
+ }
48
+ getSupportedOperators() {
49
+ return _BaseFilterTranslator.DEFAULT_OPERATORS;
50
+ }
51
+ isValidOperator(key) {
52
+ const support = this.getSupportedOperators();
53
+ const allSupported = Object.values(support).flat();
54
+ return allSupported.includes(key);
55
+ }
56
+ /**
57
+ * Value normalization for comparison operators
58
+ */
59
+ normalizeComparisonValue(value) {
60
+ if (value instanceof Date) {
61
+ return value.toISOString();
62
+ }
63
+ if (typeof value === "number" && Object.is(value, -0)) {
64
+ return 0;
65
+ }
66
+ return value;
67
+ }
68
+ /**
69
+ * Helper method to simulate $all operator using $and + $eq when needed.
70
+ * Some vector stores don't support $all natively.
71
+ */
72
+ simulateAllOperator(field, values) {
73
+ return {
74
+ $and: values.map((value) => ({
75
+ [field]: { $in: [this.normalizeComparisonValue(value)] }
76
+ }))
77
+ };
78
+ }
79
+ /**
80
+ * Utility functions for type checking
81
+ */
82
+ isPrimitive(value) {
83
+ return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
84
+ }
85
+ isRegex(value) {
86
+ return value instanceof RegExp;
87
+ }
88
+ isEmpty(obj) {
89
+ return obj === null || obj === void 0 || typeof obj === "object" && Object.keys(obj).length === 0;
90
+ }
91
+ static ErrorMessages = {
92
+ UNSUPPORTED_OPERATOR: (op) => `Unsupported operator: ${op}`,
93
+ INVALID_LOGICAL_OPERATOR_LOCATION: (op, path) => `Logical operator ${op} cannot be used at field level: ${path}`,
94
+ NOT_REQUIRES_OBJECT: `$not operator requires an object`,
95
+ NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
96
+ INVALID_LOGICAL_OPERATOR_CONTENT: (path) => `Logical operators must contain field conditions, not direct operators: ${path}`,
97
+ INVALID_TOP_LEVEL_OPERATOR: (op) => `Invalid top-level operator: ${op}`,
98
+ ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
99
+ };
100
+ /**
101
+ * Helper to handle array value normalization consistently
102
+ */
103
+ normalizeArrayValues(values) {
104
+ return values.map((value) => this.normalizeComparisonValue(value));
105
+ }
106
+ validateFilter(filter) {
107
+ const validation = this.validateFilterSupport(filter);
108
+ if (!validation.supported) {
109
+ throw new Error(validation.messages.join(", "));
110
+ }
111
+ }
112
+ /**
113
+ * Validates if a filter structure is supported by the specific vector DB
114
+ * and returns detailed validation information.
115
+ */
116
+ validateFilterSupport(node, path = "") {
117
+ const messages = [];
118
+ if (this.isPrimitive(node) || this.isEmpty(node)) {
119
+ return { supported: true, messages: [] };
120
+ }
121
+ if (Array.isArray(node)) {
122
+ const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
123
+ const arrayMessages = arrayResults.flatMap((r) => r.messages);
124
+ return {
125
+ supported: arrayResults.every((r) => r.supported),
126
+ messages: arrayMessages
127
+ };
128
+ }
129
+ const nodeObj = node;
130
+ let isSupported = true;
131
+ for (const [key, value] of Object.entries(nodeObj)) {
132
+ const newPath = path ? `${path}.${key}` : key;
133
+ if (this.isOperator(key)) {
134
+ if (!this.isValidOperator(key)) {
135
+ isSupported = false;
136
+ messages.push(_BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(key));
137
+ continue;
138
+ }
139
+ if (!path && !this.isLogicalOperator(key)) {
140
+ isSupported = false;
141
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
142
+ continue;
143
+ }
144
+ if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
145
+ isSupported = false;
146
+ messages.push(_BaseFilterTranslator.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
147
+ continue;
148
+ }
149
+ if (this.isLogicalOperator(key)) {
150
+ if (key === "$not") {
151
+ if (Array.isArray(value) || typeof value !== "object") {
152
+ isSupported = false;
153
+ messages.push(_BaseFilterTranslator.ErrorMessages.NOT_REQUIRES_OBJECT);
154
+ continue;
155
+ }
156
+ if (this.isEmpty(value)) {
157
+ isSupported = false;
158
+ messages.push(_BaseFilterTranslator.ErrorMessages.NOT_CANNOT_BE_EMPTY);
159
+ continue;
160
+ }
161
+ continue;
162
+ }
163
+ if (path && !this.isLogicalOperator(path.split(".").pop())) {
164
+ isSupported = false;
165
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
166
+ continue;
167
+ }
168
+ if (Array.isArray(value)) {
169
+ const hasDirectOperators = value.some(
170
+ (item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0])
171
+ );
172
+ if (hasDirectOperators) {
173
+ isSupported = false;
174
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
175
+ continue;
176
+ }
177
+ }
178
+ }
179
+ }
180
+ const nestedValidation = this.validateFilterSupport(value, newPath);
181
+ if (!nestedValidation.supported) {
182
+ isSupported = false;
183
+ messages.push(...nestedValidation.messages);
184
+ }
185
+ }
186
+ return { supported: isSupported, messages };
187
+ }
188
+ };
189
+
190
+ export { BaseFilterTranslator };
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkNQE264UM_cjs = require('../chunk-NQE264UM.cjs');
3
+ var chunkPIZM25KI_cjs = require('../chunk-PIZM25KI.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "MastraVector", {
8
8
  enumerable: true,
9
- get: function () { return chunkNQE264UM_cjs.MastraVector; }
9
+ get: function () { return chunkPIZM25KI_cjs.MastraVector; }
10
10
  });
@@ -1,9 +1,8 @@
1
- import { M as MastraBase } from '../base-H7siSAfu.cjs';
1
+ import { M as MastraBase } from '../base-aPYtPBT2.cjs';
2
2
  import { VectorFilter } from './filter/index.cjs';
3
3
  import '@opentelemetry/api';
4
- import '../index-QV27jkxQ.cjs';
4
+ import '../logger-EhZkzZOr.cjs';
5
5
  import 'stream';
6
- import 'pino';
7
6
  import '@opentelemetry/sdk-trace-base';
8
7
 
9
8
  interface QueryResult {
@@ -29,13 +28,11 @@ interface UpsertVectorParams {
29
28
  metadata?: Record<string, any>[];
30
29
  ids?: string[];
31
30
  }
32
- type UpsertVectorArgs = [string, number[][], Record<string, any>[], string[]?];
33
31
  interface CreateIndexParams {
34
32
  indexName: string;
35
33
  dimension: number;
36
34
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
37
35
  }
38
- type CreateIndexArgs = [string, number, 'cosine' | 'euclidean' | 'dotproduct'];
39
36
  interface QueryVectorParams {
40
37
  indexName: string;
41
38
  queryVector: number[];
@@ -43,15 +40,12 @@ interface QueryVectorParams {
43
40
  filter?: VectorFilter;
44
41
  includeVector?: boolean;
45
42
  }
46
- type QueryVectorArgs = [string, number[], number, VectorFilter?, boolean?];
47
43
  interface DescribeIndexParams {
48
44
  indexName: string;
49
45
  }
50
- type DescribeIndexArgs = [string];
51
46
  interface DeleteIndexParams {
52
47
  indexName: string;
53
48
  }
54
- type DeleteIndexArgs = [string];
55
49
  interface UpdateVectorParams {
56
50
  indexName: string;
57
51
  id: string;
@@ -60,31 +54,23 @@ interface UpdateVectorParams {
60
54
  metadata?: Record<string, any>;
61
55
  };
62
56
  }
63
- type UpdateVectorArgs = [string, string, {
64
- vector?: number[];
65
- metadata?: Record<string, any>;
66
- }];
67
57
  interface DeleteVectorParams {
68
58
  indexName: string;
69
59
  id: string;
70
60
  }
71
- type DeleteVectorArgs = [string, string];
72
- type ParamsToArgs<T> = [T] | (T extends QueryVectorParams ? QueryVectorArgs : never) | (T extends UpsertVectorParams ? UpsertVectorArgs : never) | (T extends CreateIndexParams ? CreateIndexArgs : never) | (T extends DescribeIndexParams ? DescribeIndexArgs : never) | (T extends DeleteIndexParams ? DeleteIndexArgs : never) | (T extends UpdateVectorParams ? UpdateVectorArgs : never) | (T extends DeleteVectorParams ? DeleteVectorArgs : never);
73
61
 
74
62
  declare abstract class MastraVector extends MastraBase {
75
63
  constructor();
76
64
  get indexSeparator(): string;
77
- private readonly baseKeys;
78
- protected normalizeArgs<T, E extends any[] = never>(method: string, [first, ...rest]: ParamsToArgs<T> | E, extendedKeys?: string[]): T;
79
- abstract query<E extends QueryVectorArgs = QueryVectorArgs>(...args: ParamsToArgs<QueryVectorParams> | E): Promise<QueryResult[]>;
80
- abstract upsert<E extends UpsertVectorArgs = UpsertVectorArgs>(...args: ParamsToArgs<UpsertVectorParams> | E): Promise<string[]>;
81
- abstract createIndex<E extends CreateIndexArgs = CreateIndexArgs>(...args: ParamsToArgs<CreateIndexParams> | E): Promise<void>;
65
+ abstract query(params: QueryVectorParams): Promise<QueryResult[]>;
66
+ abstract upsert(params: UpsertVectorParams): Promise<string[]>;
67
+ abstract createIndex(params: CreateIndexParams): Promise<void>;
82
68
  abstract listIndexes(): Promise<string[]>;
83
- abstract describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
84
- abstract deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
85
- abstract updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
86
- abstract deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
69
+ abstract describeIndex(params: DescribeIndexParams): Promise<IndexStats>;
70
+ abstract deleteIndex(params: DeleteIndexParams): Promise<void>;
71
+ abstract updateVector(params: UpdateVectorParams): Promise<void>;
72
+ abstract deleteVector(params: DeleteVectorParams): Promise<void>;
87
73
  protected validateExistingIndex(indexName: string, dimension: number, metric: string): Promise<void>;
88
74
  }
89
75
 
90
- export { type CreateIndexArgs, type CreateIndexParams, type DeleteIndexArgs, type DeleteIndexParams, type DeleteVectorArgs, type DeleteVectorParams, type DescribeIndexArgs, type DescribeIndexParams, type IndexStats, MastraVector, type ParamsToArgs, type QueryResult, type QueryVectorArgs, type QueryVectorParams, type UpdateVectorArgs, type UpdateVectorParams, type UpsertVectorArgs, type UpsertVectorParams };
76
+ export { type CreateIndexParams, type DeleteIndexParams, type DeleteVectorParams, type DescribeIndexParams, type IndexStats, MastraVector, type QueryResult, type QueryVectorParams, type UpdateVectorParams, type UpsertVectorParams };
@@ -1,9 +1,8 @@
1
- import { M as MastraBase } from '../base-4Z34GQL8.js';
1
+ import { M as MastraBase } from '../base-tc5kgDTD.js';
2
2
  import { VectorFilter } from './filter/index.js';
3
3
  import '@opentelemetry/api';
4
- import '../index-QV27jkxQ.js';
4
+ import '../logger-EhZkzZOr.js';
5
5
  import 'stream';
6
- import 'pino';
7
6
  import '@opentelemetry/sdk-trace-base';
8
7
 
9
8
  interface QueryResult {
@@ -29,13 +28,11 @@ interface UpsertVectorParams {
29
28
  metadata?: Record<string, any>[];
30
29
  ids?: string[];
31
30
  }
32
- type UpsertVectorArgs = [string, number[][], Record<string, any>[], string[]?];
33
31
  interface CreateIndexParams {
34
32
  indexName: string;
35
33
  dimension: number;
36
34
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
37
35
  }
38
- type CreateIndexArgs = [string, number, 'cosine' | 'euclidean' | 'dotproduct'];
39
36
  interface QueryVectorParams {
40
37
  indexName: string;
41
38
  queryVector: number[];
@@ -43,15 +40,12 @@ interface QueryVectorParams {
43
40
  filter?: VectorFilter;
44
41
  includeVector?: boolean;
45
42
  }
46
- type QueryVectorArgs = [string, number[], number, VectorFilter?, boolean?];
47
43
  interface DescribeIndexParams {
48
44
  indexName: string;
49
45
  }
50
- type DescribeIndexArgs = [string];
51
46
  interface DeleteIndexParams {
52
47
  indexName: string;
53
48
  }
54
- type DeleteIndexArgs = [string];
55
49
  interface UpdateVectorParams {
56
50
  indexName: string;
57
51
  id: string;
@@ -60,31 +54,23 @@ interface UpdateVectorParams {
60
54
  metadata?: Record<string, any>;
61
55
  };
62
56
  }
63
- type UpdateVectorArgs = [string, string, {
64
- vector?: number[];
65
- metadata?: Record<string, any>;
66
- }];
67
57
  interface DeleteVectorParams {
68
58
  indexName: string;
69
59
  id: string;
70
60
  }
71
- type DeleteVectorArgs = [string, string];
72
- type ParamsToArgs<T> = [T] | (T extends QueryVectorParams ? QueryVectorArgs : never) | (T extends UpsertVectorParams ? UpsertVectorArgs : never) | (T extends CreateIndexParams ? CreateIndexArgs : never) | (T extends DescribeIndexParams ? DescribeIndexArgs : never) | (T extends DeleteIndexParams ? DeleteIndexArgs : never) | (T extends UpdateVectorParams ? UpdateVectorArgs : never) | (T extends DeleteVectorParams ? DeleteVectorArgs : never);
73
61
 
74
62
  declare abstract class MastraVector extends MastraBase {
75
63
  constructor();
76
64
  get indexSeparator(): string;
77
- private readonly baseKeys;
78
- protected normalizeArgs<T, E extends any[] = never>(method: string, [first, ...rest]: ParamsToArgs<T> | E, extendedKeys?: string[]): T;
79
- abstract query<E extends QueryVectorArgs = QueryVectorArgs>(...args: ParamsToArgs<QueryVectorParams> | E): Promise<QueryResult[]>;
80
- abstract upsert<E extends UpsertVectorArgs = UpsertVectorArgs>(...args: ParamsToArgs<UpsertVectorParams> | E): Promise<string[]>;
81
- abstract createIndex<E extends CreateIndexArgs = CreateIndexArgs>(...args: ParamsToArgs<CreateIndexParams> | E): Promise<void>;
65
+ abstract query(params: QueryVectorParams): Promise<QueryResult[]>;
66
+ abstract upsert(params: UpsertVectorParams): Promise<string[]>;
67
+ abstract createIndex(params: CreateIndexParams): Promise<void>;
82
68
  abstract listIndexes(): Promise<string[]>;
83
- abstract describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
84
- abstract deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
85
- abstract updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
86
- abstract deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
69
+ abstract describeIndex(params: DescribeIndexParams): Promise<IndexStats>;
70
+ abstract deleteIndex(params: DeleteIndexParams): Promise<void>;
71
+ abstract updateVector(params: UpdateVectorParams): Promise<void>;
72
+ abstract deleteVector(params: DeleteVectorParams): Promise<void>;
87
73
  protected validateExistingIndex(indexName: string, dimension: number, metric: string): Promise<void>;
88
74
  }
89
75
 
90
- export { type CreateIndexArgs, type CreateIndexParams, type DeleteIndexArgs, type DeleteIndexParams, type DeleteVectorArgs, type DeleteVectorParams, type DescribeIndexArgs, type DescribeIndexParams, type IndexStats, MastraVector, type ParamsToArgs, type QueryResult, type QueryVectorArgs, type QueryVectorParams, type UpdateVectorArgs, type UpdateVectorParams, type UpsertVectorArgs, type UpsertVectorParams };
76
+ export { type CreateIndexParams, type DeleteIndexParams, type DeleteVectorParams, type DescribeIndexParams, type IndexStats, MastraVector, type QueryResult, type QueryVectorParams, type UpdateVectorParams, type UpsertVectorParams };
@@ -1 +1 @@
1
- export { MastraVector } from '../chunk-SU4O2A72.js';
1
+ export { MastraVector } from '../chunk-LHRZV5VG.js';
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkS7J63JOG_cjs = require('../chunk-S7J63JOG.cjs');
3
+ var chunkRVS6OUJN_cjs = require('../chunk-RVS6OUJN.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "CompositeVoice", {
8
8
  enumerable: true,
9
- get: function () { return chunkS7J63JOG_cjs.CompositeVoice; }
9
+ get: function () { return chunkRVS6OUJN_cjs.CompositeVoice; }
10
10
  });
11
11
  Object.defineProperty(exports, "DefaultVoice", {
12
12
  enumerable: true,
13
- get: function () { return chunkS7J63JOG_cjs.DefaultVoice; }
13
+ get: function () { return chunkRVS6OUJN_cjs.DefaultVoice; }
14
14
  });
15
15
  Object.defineProperty(exports, "MastraVoice", {
16
16
  enumerable: true,
17
- get: function () { return chunkS7J63JOG_cjs.MastraVoice; }
17
+ get: function () { return chunkRVS6OUJN_cjs.MastraVoice; }
18
18
  });
@@ -1,26 +1,25 @@
1
- export { bw as CompositeVoice, bx as DefaultVoice, bv as MastraVoice, bu as VoiceConfig, bt as VoiceEventMap, bs as VoiceEventType } from '../base-BV8SNIdm.cjs';
1
+ export { bm as CompositeVoice, bn as DefaultVoice, bl as MastraVoice, bk as VoiceConfig, bj as VoiceEventMap, bi as VoiceEventType } from '../base-aJ3etsh5.cjs';
2
2
  import 'ai';
3
- import '../base-H7siSAfu.cjs';
3
+ import '../base-aPYtPBT2.cjs';
4
4
  import '@opentelemetry/api';
5
- import '../index-QV27jkxQ.cjs';
5
+ import '../logger-EhZkzZOr.cjs';
6
6
  import 'stream';
7
- import 'pino';
8
7
  import '@opentelemetry/sdk-trace-base';
9
- import '../types-BtMyV38I.cjs';
8
+ import '../types-Bo1uigWx.cjs';
10
9
  import 'sift';
11
10
  import 'zod';
12
11
  import 'json-schema';
13
- import '../runtime-context/index.cjs';
14
- import 'xstate';
15
- import 'node:events';
12
+ import '../deployer/index.cjs';
13
+ import '../bundler/index.cjs';
16
14
  import 'node:http';
17
15
  import 'hono';
18
- import '../tts/index.cjs';
16
+ import '../runtime-context/index.cjs';
19
17
  import '../vector/index.cjs';
20
18
  import '../vector/filter/index.cjs';
21
- import 'events';
22
- import '../deployer/index.cjs';
23
- import '../bundler/index.cjs';
24
19
  import 'hono/cors';
25
20
  import 'hono-openapi';
21
+ import '../tts/index.cjs';
22
+ import 'xstate';
23
+ import 'node:events';
24
+ import 'events';
26
25
  import 'ai/test';
@@ -1,26 +1,25 @@
1
- export { bw as CompositeVoice, bx as DefaultVoice, bv as MastraVoice, bu as VoiceConfig, bt as VoiceEventMap, bs as VoiceEventType } from '../base-CI7Uz2GO.js';
1
+ export { bm as CompositeVoice, bn as DefaultVoice, bl as MastraVoice, bk as VoiceConfig, bj as VoiceEventMap, bi as VoiceEventType } from '../base-DttB7sJD.js';
2
2
  import 'ai';
3
- import '../base-4Z34GQL8.js';
3
+ import '../base-tc5kgDTD.js';
4
4
  import '@opentelemetry/api';
5
- import '../index-QV27jkxQ.js';
5
+ import '../logger-EhZkzZOr.js';
6
6
  import 'stream';
7
- import 'pino';
8
7
  import '@opentelemetry/sdk-trace-base';
9
- import '../types-BtMyV38I.js';
8
+ import '../types-Bo1uigWx.js';
10
9
  import 'sift';
11
10
  import 'zod';
12
11
  import 'json-schema';
13
- import '../runtime-context/index.js';
14
- import 'xstate';
15
- import 'node:events';
12
+ import '../deployer/index.js';
13
+ import '../bundler/index.js';
16
14
  import 'node:http';
17
15
  import 'hono';
18
- import '../tts/index.js';
16
+ import '../runtime-context/index.js';
19
17
  import '../vector/index.js';
20
18
  import '../vector/filter/index.js';
21
- import 'events';
22
- import '../deployer/index.js';
23
- import '../bundler/index.js';
24
19
  import 'hono/cors';
25
20
  import 'hono-openapi';
21
+ import '../tts/index.js';
22
+ import 'xstate';
23
+ import 'node:events';
24
+ import 'events';
26
25
  import 'ai/test';