@evoke-platform/ui-components 1.0.0-dev.251 → 1.0.0-dev.252
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.
@@ -35,11 +35,12 @@ export type TreeViewObject = {
|
|
35
35
|
name: string;
|
36
36
|
properties: TreeViewProperty[];
|
37
37
|
};
|
38
|
-
export type MongoDBQueryValue = null | string | {
|
38
|
+
export type MongoDBQueryValue = null | string | boolean | {
|
39
39
|
$not?: {
|
40
40
|
$regex?: string;
|
41
41
|
};
|
42
42
|
$regex?: string;
|
43
|
+
$expr?: boolean;
|
43
44
|
$eq?: unknown;
|
44
45
|
$ne?: unknown;
|
45
46
|
$lt?: unknown;
|
@@ -159,14 +159,20 @@ export function parseMongoDB(mongoQuery) {
|
|
159
159
|
* @returns {RuleType | undefined} - A RuleType if the value is valid, otherwise undefined.
|
160
160
|
*/
|
161
161
|
const parseRule = (key, value) => {
|
162
|
-
if (
|
162
|
+
if (key === '$expr') {
|
163
|
+
return undefined;
|
164
|
+
}
|
165
|
+
else if (value === null) {
|
163
166
|
return {
|
164
167
|
field: key,
|
165
168
|
operator: 'null',
|
166
169
|
value: null,
|
167
170
|
};
|
168
171
|
}
|
169
|
-
else if (typeof value === 'string' ||
|
172
|
+
else if (typeof value === 'string' ||
|
173
|
+
typeof value === 'number' ||
|
174
|
+
typeof value === 'boolean' ||
|
175
|
+
'$eq' in value) {
|
170
176
|
return {
|
171
177
|
field: key,
|
172
178
|
operator: '=',
|
@@ -260,13 +266,13 @@ export function parseMongoDB(mongoQuery) {
|
|
260
266
|
if ('$and' in query && isArray(query.$and)) {
|
261
267
|
return {
|
262
268
|
combinator: 'and',
|
263
|
-
rules: query.$and.map(parseGroup),
|
269
|
+
rules: query.$and.map(parseGroup).filter((rule) => rule !== undefined),
|
264
270
|
};
|
265
271
|
}
|
266
272
|
else if ('$or' in query && isArray(query.$or)) {
|
267
273
|
return {
|
268
274
|
combinator: 'or',
|
269
|
-
rules: query.$or.map(parseGroup),
|
275
|
+
rules: query.$or.map(parseGroup).filter((rule) => rule !== undefined),
|
270
276
|
};
|
271
277
|
}
|
272
278
|
else if (isEmpty(query)) {
|