@schamane/small-graphql-mongoose-middleware
Version:

7 lines (6 loc) • 482 B
TypeScript
import { User } from '../auth/userModel';
export declare const hasRole: (ctx: User, group: string) => boolean;
export declare const assertRole: (ctx: User) => void;
export declare type MyResolverFn<T = unknown> = (rootValue?: any, args?: any, context?: any, info?: any) => T;
export declare const authenticated: <T>(next: MyResolverFn<T>) => (...args: unknown[]) => T;
export declare const onlyWithAdminRole: <T>(next: MyResolverFn<T>, group?: string) => (...args: unknown[]) => T;