import { SelectQueryBuilder, WhereExpressionBuilder } from "typeorm";
import { BasicFilterDto } from "../dtos/basic-filters.dto";
import { ActiveUserData } from "../interfaces/active-user-data.interface";
export declare enum FilterCombinator {
    AND = "$and",
    OR = "$or"
}
export declare enum UserIdFields {
    CREATED_BY = "createdBy",
    UPDATED_BY = "updatedBy"
}
export declare class CrudHelperService {
    constructor();
    private readonly logger;
    private orderOptions;
    applyFilters(qb: WhereExpressionBuilder, filters: any, alias: string, selectQb: SelectQueryBuilder<any>): void;
    private buildOperatorQuery;
    private normalizeObjectKeys;
    normalize(value: string | string[]): string[];
    private normalizeAndFilterPopulateAttributes;
    extractUserIdFieldsFromPopulate(value: string | string[]): UserIdFields[];
    private isRelationJoined;
    private hasJoins;
    buildFilterQuery(qb: SelectQueryBuilder<any>, basicFilterDto: BasicFilterDto, entityAlias: string, internationalisation?: boolean, draftPublishWorkflow?: boolean, moduleRef?: any, filterCombinator?: FilterCombinator, applyPagination?: boolean, applySorting?: boolean): SelectQueryBuilder<any>;
    additionalRelationsRequiredForMediaPopulation(normalizedPopulateMedia: string[]): string[];
    private buildPopulateQuery;
    private sanitizeAlias;
    private isAliasJoined;
    private getExistingJoinAlias;
    private ensureRelationPathJoined;
    private getDriver;
    private buildDateGranularityExpression;
    private buildGroupByExpression;
    applyGroupBySelections(qb: SelectQueryBuilder<any>, groupBy: string[], entityAlias: string): {
        aliasMap: Record<string, string>;
        formatMap: Record<string, string>;
        expressionMap: Record<string, string>;
    };
    private buildAggregateExpression;
    applyAggregates(qb: SelectQueryBuilder<any>, aggregates: string[] | undefined, entityAlias: string): Record<string, string>;
    applyGroupSortingAndPagination(qb: SelectQueryBuilder<any>, sort: string[] | undefined, aliasMap: Record<string, string>, limit?: number, offset?: number): void;
    countGroups(qb: SelectQueryBuilder<any>): Promise<number>;
    private buildJoinQueryForRelation;
    private wrapFieldWithAlias;
    isAggregateField(field: string): boolean;
    isAggregateFieldKey(key: string, aggregateAliases: Set<string>): boolean;
    getFieldFromQueryFieldKey(queryFieldKey: string, alias: string): string;
    buildGroupByRecordsQuery(qb: SelectQueryBuilder<any>, group: any, alias: string, groupAliasMap?: Record<string, string>, aggregateAliasMap?: Record<string, string>, groupExpressionMap?: Record<string, string>): SelectQueryBuilder<any>;
    private formatGroupValue;
    private getGroupFieldValues;
    private normalizeGroupValue;
    getGroupName(group: any, aggregateAliases: Set<string>, groupByFields: string[], groupAliasMap: Record<string, string>, groupFormatMap: Record<string, string | undefined>): string;
    getGroupValue(group: any, groupByFields: string[], groupAliasMap: Record<string, string>): any;
    createGroupRecords(group: any, aggregateAliases: Set<string>, groupData: any, groupByFields: string[], groupAliasMap: Record<string, string>, groupFormatMap: Record<string, string | undefined>): {
        groupName: string;
        groupData: any;
    };
    createGroupMeta(group: any, aggregateAliases: Set<string>, groupByFields: string[], groupAliasMap: Record<string, string>, groupFormatMap: Record<string, string | undefined>): {
        groupName: string;
        groupValue: any;
    };
    countGroupedRecords(qb: SelectQueryBuilder<any>, basicFilterDto: BasicFilterDto, entityAlias: string): Promise<number>;
    hasReadPermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasWritePermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasUpdatePermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasPublishPermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasUnpublishPermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasDeletePermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasCreatePermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
    hasRecoverPermissionOnModel: (activeUser: ActiveUserData, modelName: string) => boolean;
}
//# sourceMappingURL=crud-helper.service.d.ts.map