Module

Prospero.Wrapper

Package
purescript-prospero
Repository
rowtype-yoga/purescript-prospero

#Wrapper Source

data Wrapper :: Type -> Row Type -> Typedata Wrapper ctx errs

A collection of wrappers that can be applied to a schema

Constructors

#OverallWrapper Source

type OverallWrapper :: Type -> Row Type -> Typetype OverallWrapper ctx errs = (String -> Om ctx errs GraphQLResponse) -> String -> Om ctx errs GraphQLResponse

Overall wrapper: wraps the entire query processing pipeline

#ParsingWrapper Source

type ParsingWrapper = (String -> Either String (Array Selection)) -> String -> Either String (Array Selection)

Parsing wrapper: wraps query parsing

#ValidationWrapper Source

type ValidationWrapper = (Array Selection -> Array GraphQLError) -> Array Selection -> Array GraphQLError

Validation wrapper: wraps query validation

#ExecutionWrapper Source

type ExecutionWrapper :: Type -> Row Type -> Typetype ExecutionWrapper ctx errs = (Array Selection -> Om ctx errs ResponseValue) -> Array Selection -> Om ctx errs ResponseValue

Execution wrapper: wraps query execution

#FieldWrapper Source

data FieldWrapper :: Type -> Row Type -> Typedata FieldWrapper ctx errs

Field wrapper: wraps individual field resolution

Constructors

#IntrospectionWrapper Source

type IntrospectionWrapper :: Type -> Row Type -> Typetype IntrospectionWrapper ctx errs = (Array Selection -> Om ctx errs ResponseValue) -> Array Selection -> Om ctx errs ResponseValue

Introspection wrapper: wraps introspection queries

#wrapOverall Source

wrapOverall :: forall ctx errs. OverallWrapper ctx errs -> Wrapper ctx errs

#wrapParsing Source

wrapParsing :: forall ctx errs. ParsingWrapper -> Wrapper ctx errs

#wrapValidation Source

wrapValidation :: forall ctx errs. ValidationWrapper -> Wrapper ctx errs

#wrapExecution Source

wrapExecution :: forall ctx errs. ExecutionWrapper ctx errs -> Wrapper ctx errs

#wrapField Source

wrapField :: forall ctx errs. FieldWrapper ctx errs -> Wrapper ctx errs

#wrapIntrospection Source

wrapIntrospection :: forall ctx errs. IntrospectionWrapper ctx errs -> Wrapper ctx errs

#maxDepth Source

maxDepth :: forall ctx errs. Int -> Wrapper ctx errs

Pre-built wrapper: reject queries deeper than maxDepth

#maxFields Source

maxFields :: forall ctx errs. Int -> Wrapper ctx errs

Pre-built wrapper: reject queries with more than maxFields total fields

#maxCost Source

maxCost :: forall ctx errs. GqlType -> Int -> Wrapper ctx errs

Pre-built wrapper: reject queries exceeding a cost budget

#maxCostFor Source

maxCostFor :: forall ctx errs gql. { query :: GqlType | gql } -> Int -> Wrapper ctx errs

#validateLimits Source

validateLimits :: forall ctx errs. GqlType -> { maxCost :: Maybe Int, maxDepth :: Maybe Int, maxFields :: Maybe Int } -> Wrapper ctx errs

Pre-built wrapper: check depth, field count, and cost in a single pass

#validateLimitsFor Source

validateLimitsFor :: forall ctx errs gql. { query :: GqlType | gql } -> { maxCost :: Maybe Int, maxDepth :: Maybe Int, maxFields :: Maybe Int } -> Wrapper ctx errs

#timeout Source

timeout :: forall ctx errs. Int -> Wrapper ctx errs

Pre-built wrapper: apply a timeout to execution (in milliseconds)

#logSlowFields Source

logSlowFields :: forall ctx errs. Int -> Wrapper ctx errs

Pre-built wrapper: log fields that take longer than a threshold (in milliseconds)