import { AnyAbility } from '../PureAbility'; import { Rule } from '../Rule'; import { RuleOf } from '../RuleIndex'; import { Subject, SubjectType } from '../types'; export type GetRuleFields> = (rule: R) => string[]; export interface PermittedFieldsOptions { fieldsFrom: GetRuleFields>; } export declare function permittedFieldsOf(ability: T, action: Parameters[0], subject: Parameters[1], options: PermittedFieldsOptions): string[]; export type GetSubjectTypeAllFieldsExtractor = (subjectType: SubjectType) => string[]; /** * Helper class to make custom `accessibleFieldsBy` helper function */ export declare class AccessibleFields { private readonly _ability; private readonly _action; private readonly _getAllFields; constructor(_ability: AnyAbility, _action: string, _getAllFields: GetSubjectTypeAllFieldsExtractor); /** * Returns accessible fields for Model type */ ofType(subjectType: Extract): string[]; /** * Returns accessible fields for particular document */ of(subject: Exclude): string[]; private _getRuleFields; }