import '@akago/vine-lucid';
import _ from 'lodash';
export const LIST_FILTER_SEPARATOR = '__';
export class AKListFilter {
    static parseQueryString(queryString, filters, model, allowedFields) {
        const qsFilters = _.omitBy(structuredClone(queryString), (__, key) => {
            const baseKey = _(key).split('__').dropRight().join('__');
            !allowedFields.includes(baseKey);
        });
        const queryTranform = (dbQuery) => {
            const localQsFilters = structuredClone(qsFilters);
            for (const filter of filters) {
                if (filter.matches(localQsFilters)) {
                    filter.apply(dbQuery, localQsFilters, model);
                    filter.clear(localQsFilters);
                }
            }
        };
        return queryTranform;
    }
}
//# sourceMappingURL=index.js.map