Merge pull request #14669 from Budibase/better-types-on-removeInvalidFilters
Remove an implicit any from removeInvalidFilters.
This commit is contained in:
commit
6b3867faee
|
@ -16,11 +16,11 @@ export const removeInvalidFilters = (
|
|||
|
||||
validFields = validFields.map(f => f.toLowerCase())
|
||||
for (const filterKey of Object.keys(result) as (keyof SearchFilters)[]) {
|
||||
const filter = result[filterKey]
|
||||
if (!filter || typeof filter !== "object") {
|
||||
continue
|
||||
}
|
||||
if (isLogicalSearchOperator(filterKey)) {
|
||||
const filter = result[filterKey]
|
||||
if (!filter || typeof filter !== "object") {
|
||||
continue
|
||||
}
|
||||
const resultingConditions: SearchFilters[] = []
|
||||
for (const condition of filter.conditions) {
|
||||
const resultingCondition = removeInvalidFilters(condition, validFields)
|
||||
|
@ -36,6 +36,11 @@ export const removeInvalidFilters = (
|
|||
continue
|
||||
}
|
||||
|
||||
const filter = result[filterKey]
|
||||
if (!filter || typeof filter !== "object") {
|
||||
continue
|
||||
}
|
||||
|
||||
for (const columnKey of Object.keys(filter)) {
|
||||
const possibleKeys = [columnKey, db.removeKeyNumbering(columnKey)].map(
|
||||
c => c.toLowerCase()
|
||||
|
|
|
@ -68,6 +68,8 @@ type RangeFilter = Record<
|
|||
[InternalSearchFilterOperator.COMPLEX_ID_OPERATOR]?: never
|
||||
}
|
||||
|
||||
type LogicalFilter = { conditions: SearchFilters[] }
|
||||
|
||||
export type AnySearchFilter = BasicFilter | ArrayFilter | RangeFilter
|
||||
|
||||
export interface SearchFilters {
|
||||
|
@ -92,12 +94,8 @@ export interface SearchFilters {
|
|||
// specific document type (such as just rows)
|
||||
documentType?: DocumentType
|
||||
|
||||
[LogicalOperator.AND]?: {
|
||||
conditions: SearchFilters[]
|
||||
}
|
||||
[LogicalOperator.OR]?: {
|
||||
conditions: SearchFilters[]
|
||||
}
|
||||
[LogicalOperator.AND]?: LogicalFilter
|
||||
[LogicalOperator.OR]?: LogicalFilter
|
||||
}
|
||||
|
||||
export type SearchFilterKey = keyof Omit<
|
||||
|
|
Loading…
Reference in New Issue