@dodi-smart/ttlock-graphql-api
Version:
TTLock GraphQL API
28 lines • 974 B
TypeScript
import { CORSOptions, YogaInitialContext } from 'graphql-yoga';
export type TTLockGraphQLContext = {
isAllowed: (context: Context) => boolean | Promise<boolean>;
userClaims?: UserHasuraClaims;
isAdmin: boolean;
};
export type Authentication = {
accessToken?: string;
refreshToken?: string;
};
export type Context = YogaInitialContext & TTLockGraphQLContext;
export type CreateServerProps = {
cors?: CORSOptions;
isAllowed?: (context: Context) => boolean | Promise<boolean>;
provideAuth: (context: Context) => Authentication | Promise<Authentication>;
onUpdateSession: (context: Context, auth: Authentication) => void | Promise<void>;
graphqlEndpoint?: string;
healthCheckEndpoint?: string;
graphiql?: boolean;
};
export type UserHasuraClaims = {
'x-hasura-user-id': string;
'x-hasura-default-role': string;
'x-hasura-allowed-roles': string[];
} & {
[key: string]: string;
};
//# sourceMappingURL=types.d.ts.map