-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d07a5e
commit c2722ec
Showing
3 changed files
with
41 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import "reflect-metadata"; | ||
import { ArgsDictionary, ResolverData } from "type-graphql"; | ||
export interface ResolverDataWithArgs<TArgsType extends ArgsDictionary, TContextType = {}> extends ResolverData<TContextType> { | ||
export interface ResolverDataWithArgs<TArgsType extends ArgsDictionary, TContextType extends object = {}> extends ResolverData<TContextType> { | ||
args: TArgsType; | ||
context: TContextType; | ||
} | ||
export declare type Rule<TContextType = {}, TArgsType extends ArgsDictionary = {}> = (D: ResolverDataWithArgs<TArgsType, TContextType>) => boolean | Promise<boolean>; | ||
export declare type Rules<TContextType = {}> = Rule<TContextType> | RuleObject<TContextType> | Rules<TContextType>[]; | ||
export interface RuleObject<TContextType = {}> { | ||
export type Rule<TContextType extends object = {}, TArgsType extends ArgsDictionary = {}> = (D: ResolverDataWithArgs<TArgsType, TContextType>) => boolean | Promise<boolean>; | ||
export type Rules<TContextType extends object = {}> = Rule<TContextType> | RuleObject<TContextType> | Rules<TContextType>[]; | ||
export interface RuleObject<TContextType extends object = {}> { | ||
OR?: Rules<TContextType>[]; | ||
AND?: Rules<TContextType>[]; | ||
NOT?: Rules<TContextType>[]; | ||
} | ||
export declare type AuthCheckerFn<TContextType = {}, TRoleType = Rules<TContextType>> = (resolverData: ResolverData<TContextType>, roles: TRoleType) => boolean | Promise<boolean>; | ||
export declare type FAuthChecker<TContextType = {}, TRoleType = Rules<TContextType>> = AuthCheckerFn<TContextType, TRoleType>; | ||
export type AuthCheckerFn<TContextType extends object = {}, TRoleType = Rules<TContextType>> = (resolverData: ResolverData<TContextType>, roles: TRoleType) => boolean | Promise<boolean>; | ||
export type FAuthChecker<TContextType extends object = {}, TRoleType = Rules<TContextType>> = AuthCheckerFn<TContextType, TRoleType>; | ||
export declare const authResolver: FAuthChecker; | ||
declare const authChecker: FAuthChecker; | ||
export default authChecker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters