import { AKListFilter } from './index.js';
export class AKRegexListFilter extends AKListFilter {
    regex;
    operator;
    constructor(regex, operator) {
        super();
        this.regex = regex;
        this.operator = operator;
    }
    validFields(qsFilters) {
        return Object.keys(qsFilters).filter((f) => f.match(this.regex));
    }
    matches(qsFilters) {
        return this.validFields(qsFilters).length > 0;
    }
    apply(dbQuery, qsFilters, model) {
        this.validFields(qsFilters).forEach((field) => {
            this.operator(dbQuery, field, qsFilters[field], model);
        });
    }
    clear(qsFilters) {
        this.validFields(qsFilters).forEach((field) => {
            delete qsFilters[field];
        });
    }
}
//# sourceMappingURL=regex.js.map