UNPKG

@getcronit/pylon

Version:

![Pylon cover](https://github.com/user-attachments/assets/c28e49b2-5672-4849-826e-8b2eab0360cc)

34 lines (33 loc) 1.34 kB
import { FieldNode, GraphQLError, GraphQLErrorExtensions, GraphQLResolveInfo } from 'graphql'; import { AsyncLocalStorage } from 'async_hooks'; import { Context } from './context'; export interface Resolvers { Query: Record<string, any>; Mutation?: Record<string, any>; Subscription?: Record<string, any>; } export interface ExecutionContext { info: GraphQLResolveInfo; selectedFields: { name: string; fieldNodes: FieldNode[]; returnType?: any; }[]; } export declare const executionAsyncContext: AsyncLocalStorage<ExecutionContext>; export declare const getResolveInfo: () => ExecutionContext; export declare const getSelectedFields: (info: GraphQLResolveInfo, fieldNodes?: readonly FieldNode[], parentType?: any) => any[]; /** * Converts a set of resolvers into a corresponding set of GraphQL resolvers. * @param resolvers The original resolvers. * @returns The converted GraphQL resolvers. */ export declare const resolversToGraphQLResolvers: (resolvers: Resolvers, configureContext?: (context: Context) => Context) => Resolvers; export declare class ServiceError extends GraphQLError { extensions: GraphQLErrorExtensions; constructor(message: string, extensions: { code: string; statusCode: number; details?: Record<string, any>; }, error?: Error); }