@budibase/shared-core 2.21.3 → 2.21.4
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/dist/index.js +24 -1
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5231,7 +5231,30 @@ var runLuceneQuery = (docs, query) => {
|
|
|
5231
5231
|
}
|
|
5232
5232
|
);
|
|
5233
5233
|
const docMatch = (doc) => {
|
|
5234
|
-
|
|
5234
|
+
const filterFunctions = {
|
|
5235
|
+
string: stringMatch,
|
|
5236
|
+
fuzzy: fuzzyMatch,
|
|
5237
|
+
range: rangeMatch,
|
|
5238
|
+
equal: equalMatch,
|
|
5239
|
+
notEqual: notEqualMatch,
|
|
5240
|
+
empty: emptyMatch,
|
|
5241
|
+
notEmpty: notEmptyMatch,
|
|
5242
|
+
oneOf,
|
|
5243
|
+
contains,
|
|
5244
|
+
containsAny,
|
|
5245
|
+
notContains
|
|
5246
|
+
};
|
|
5247
|
+
const activeFilterKeys = Object.entries(query || {}).filter(
|
|
5248
|
+
([key, value]) => !["allOr", "onEmptyFilter"].includes(key) && value && Object.keys(value).length > 0
|
|
5249
|
+
).map(([key]) => key);
|
|
5250
|
+
const results = activeFilterKeys.map((filterKey) => {
|
|
5251
|
+
return filterFunctions[filterKey]?.(doc) ?? false;
|
|
5252
|
+
});
|
|
5253
|
+
if (query.allOr) {
|
|
5254
|
+
return results.some((result) => result === true);
|
|
5255
|
+
} else {
|
|
5256
|
+
return results.every((result) => result === true);
|
|
5257
|
+
}
|
|
5235
5258
|
};
|
|
5236
5259
|
return docs.filter(docMatch);
|
|
5237
5260
|
};
|