import { type AuthorizerResponse, type BouncerAuthorizer } from './types.ts'; type AuthorizerToAbility = Authorizer extends (user: infer User, ...args: infer Args) => AuthorizerResponse | Promise ? { allowGuest: false; original: Authorizer; execute(user: User | null, ...args: Args): AuthorizerResponse | Promise; } : never; /** * Helper to convert a user defined authorizer function to a bouncer ability. * The ability function wraps authorization logic and handles guest access control. * * @param options Configuration options for the ability * @param authorizer Authorization function to wrap * * @example * ```js * const editPost = ability((user, post) => { * return user.id === post.authorId * }) * * const viewPost = ability({ allowGuest: true }, (user, post) => { * return post.isPublished || (user && user.id === post.authorId) * }) * ``` */ export declare function ability>(options: { allowGuest: boolean; }, authorizer: Authorizer): AuthorizerToAbility; export declare function ability>(authorizer: Authorizer): AuthorizerToAbility; export {};