Prospero
- Package
- purescript-prospero
- Repository
- rowtype-yoga/purescript-prospero
Re-exports from Prospero.Bun
Re-exports from Prospero.CacheControl
#cacheControlFor Source
cacheControlFor :: forall ctx errs gql. { query :: GqlType | gql } -> Wrapper ctx errs#cacheControl Source
cacheControl :: forall ctx errs. GqlType -> Wrapper ctx errsRe-exports from Prospero.Client
#QueryResult Source
data QueryResult :: Row Type -> Typedata QueryResult r
Constructors
#ClientError Source
type ClientError = { message :: String }#runSelectionWith Source
runSelectionWith :: forall @a result params. ReadForeign { data :: Maybe (Record result), errors :: Maybe (Array ClientError) } => WriteForeign (Record params) => String -> String -> Record params -> Selection a (Record result) params -> Aff (QueryResult result)#runSelection Source
runSelection :: forall @a result params. ReadForeign { data :: Maybe (Record result), errors :: Maybe (Array ClientError) } => WriteForeign (Record params) => String -> Record params -> Selection a (Record result) params -> Aff (QueryResult result)#runQuery Source
runQuery :: forall @q @fields qRow qRL resultRL paramsRL result params. RecordRow q qRow => RowToList qRow qRL => ParseGql fields "Query" qRL resultRL paramsRL => ListToRow resultRL result => ListToRow paramsRL params => WriteForeign (Record params) => ReadForeign { data :: Maybe (Record result), errors :: Maybe (Array ClientError) } => IsSymbol fields => String -> Record params -> Aff (QueryResult result)#runMutationSelection Source
runMutationSelection :: forall @a result params. ReadForeign { data :: Maybe (Record result), errors :: Maybe (Array ClientError) } => WriteForeign (Record params) => String -> Record params -> Selection a (Record result) params -> Aff (QueryResult result)#runMutation Source
runMutation :: forall @q @fields qRow qRL resultRL paramsRL result params. RecordRow q qRow => RowToList qRow qRL => ParseGql fields "Mutation" qRL resultRL paramsRL => ListToRow resultRL result => ListToRow paramsRL params => WriteForeign (Record params) => ReadForeign { data :: Maybe (Record result), errors :: Maybe (Array ClientError) } => IsSymbol fields => String -> Record params -> Aff (QueryResult result)Re-exports from Prospero.DataLoader
#DataLoader Source
newtype DataLoader k vA DataLoader batches and caches individual key lookups. Create one per request to avoid stale caches across requests.
#mkDataLoader Source
mkDataLoader :: forall k v. Ord k => (Array k -> Aff (Map k v)) -> Aff (DataLoader k v)Create a new DataLoader with a batch function.
#load Source
load :: forall k v. Ord k => DataLoader k v -> k -> Aff vLoad a single key. Batches with other concurrent loads and caches the result.
Re-exports from Prospero.Defer
#DeferredResponse Source
type DeferredResponse :: Type -> Row Type -> Typetype DeferredResponse ctx errs = { deferred :: Array (DeferPatch ctx errs), hasDeferred :: Boolean, initial :: Om ctx errs GraphQLResponse }
#DeferPatch Source
type DeferPatch :: Type -> Row Type -> Typetype DeferPatch ctx errs = { execute :: Om ctx errs GraphQLResponse, label :: Maybe String, path :: Array String }
#executeWithDefer Source
executeWithDefer :: forall ctx errs gql. GraphQL ctx errs gql -> String -> Map String InputValue -> DeferredResponse ctx errs#encodePatchResponse Source
encodePatchResponse :: GraphQLResponse -> Maybe String -> Array String -> Boolean -> ResponseValueRe-exports from Prospero.Directive
#CustomDirective Source
type CustomDirective :: Type -> Row Type -> Typetype CustomDirective ctx errs = { apply :: Map String InputValue -> Om ctx errs ResponseValue -> Om ctx errs ResponseValue, args :: Array GqlInputValue, description :: Maybe String, locations :: Array DirectiveLocation, name :: String }
#withDirectives Source
withDirectives :: forall ctx errs gql. Array (CustomDirective ctx errs) -> Schema ctx errs gql -> Schema ctx errs gqlRe-exports from Prospero.Fastify
#SimpleErrs Source
type SimpleErrs :: Row Typetype SimpleErrs = (wrongArgumentType :: String)
#serveGraphQL Source
serveGraphQL :: forall ctxRow errs gql r rl err_ outerRow extra errs'. RowToList (exception :: Error -> Aff GraphQLResponse | r) rl => VariantMatchCases rl err_ (Aff GraphQLResponse) => Union err_ () (exception :: Error | errs) => Union ctxRow extra outerRow => Keys ctxRow => GraphQL (Record ctxRow) errs gql -> { exception :: Error -> Aff GraphQLResponse | r } -> Fastify -> Om (Record outerRow) errs' Unit#runServeGraphQL Source
runServeGraphQL :: forall ctx errs gql r rl err_. RowToList (exception :: Error -> Aff GraphQLResponse | r) rl => VariantMatchCases rl err_ (Aff GraphQLResponse) => Union err_ () (exception :: Error | errs) => GraphQL ctx errs gql -> ctx -> { exception :: Error -> Aff GraphQLResponse | r } -> Fastify -> Effect UnitRe-exports from Prospero.Federation
#EntityResolvers Source
type EntityResolvers :: Type -> Row Type -> Typetype EntityResolvers ctx errs = Map String (EntityDef ctx errs)
#EntityResolver Source
type EntityResolver :: Type -> Row Type -> Typetype EntityResolver ctx errs = Map String InputValue -> Step ctx errs
Re-exports from Prospero.GqlQuery
#Subscription Source
data Subscription resultRe-exports from Prospero.GraphQLError
#GraphQLResponse Source
type GraphQLResponse = { data :: ResponseValue, errors :: Array GraphQLError, extensions :: Object ResponseValue }#GraphQLError Source
type GraphQLError = { extensions :: Object ResponseValue, locations :: Array SourceLocation, message :: String, path :: Array PathSegment }#mkErrorWithCode Source
mkErrorWithCode :: String -> String -> GraphQLError#mkErrorAt Source
mkErrorAt :: String -> Array PathSegment -> GraphQLError#mkError Source
mkError :: String -> GraphQLErrorRe-exports from Prospero.GraphQLWS
#SubscriptionHandler Source
type SubscriptionHandler = { fieldName :: String, selections :: Array Selection, send :: ResponseValue -> Effect Unit } -> Effect (Effect Unit)Re-exports from Prospero.Http
#query Source
query :: forall ctx errs gql. GraphQL ctx errs gql -> String -> Om ctx errs GraphQLResponseExecute a GraphQL query string against a schema
#executeRequestWith Source
executeRequestWith :: forall ctx errs gql. Array (Wrapper ctx errs) -> GraphQL ctx errs gql -> GraphQLRequest -> Om ctx errs GraphQLResponseExecute a GraphQL request with wrappers applied
#executeRequest Source
executeRequest :: forall ctx errs gql. GraphQL ctx errs gql -> GraphQLRequest -> Om ctx errs GraphQLResponseExecute a GraphQL request against a schema, returning a structured response
Re-exports from Prospero.InputValue
#InputError Source
data InputErrorConstructors
MissingArgument StringTypeMismatch { expected :: String, got :: InputValue }ArgumentError { argument :: String, error :: InputError }UnknownEnumValue String
Instances
#FromInputValue Source
class FromInputValue a Instances
FromInputValue StringFromInputValue IntFromInputValue NumberFromInputValue Boolean(FromInputValue a) => FromInputValue (Maybe a)(FromInputValue a) => FromInputValue (Array a)(FromInputValue a) => FromInputValue (Defaulted value a)(RowToList r rl, FromInputRecord rl r) => FromInputValue (Record r)
#newtypeFromInputValue Source
newtypeFromInputValue :: forall a r rl. Newtype a (Record r) => RowToList r rl => FromInputRecord rl r => InputValue -> Either InputError aRe-exports from Prospero.Metadata
#Private Source
newtype Private aInstances
Newtype (Private a) _(HasGqlName a) => HasGqlName (Private a)(HasGqlCacheControl a) => HasGqlCacheControl (Private a)
#Named Source
newtype Named :: Symbol -> Type -> Typenewtype Named gqlName a
Instances
(HasGqlDescription a) => HasGqlDescription (Named gqlName a)(HasGqlDeprecated a) => HasGqlDeprecated (Named gqlName a)(HasGqlDefaultValue a) => HasGqlDefaultValue (Named gqlName a)(HasGqlCost a) => HasGqlCost (Named gqlName a)Newtype (Named gqlName a) _(IsSymbol gqlName) => HasGqlName (Named gqlName a)(HasGqlCacheControl a) => HasGqlCacheControl (Named gqlName a)
#MaxAge Source
newtype MaxAge :: Int -> TimeUnit -> Type -> Typenewtype MaxAge n unit a
Instances
Newtype (MaxAge n unit a) _(HasGqlName a) => HasGqlName (MaxAge n unit a)(Reflectable n Int, ToSeconds unit) => HasGqlCacheControl (MaxAge n unit a)
#InputObject Source
data InputObject#GqlObject_ Source
newtype GqlObject_ :: Symbol -> Type -> Typenewtype GqlObject_ name a
Constructors
Instances
Newtype (GqlObject_ name a) _
#GqlInputObject_ Source
newtype GqlInputObject_ :: Symbol -> Type -> Typenewtype GqlInputObject_ name a
Constructors
Instances
Newtype (GqlInputObject_ name a) _
#Described Source
newtype Described :: Symbol -> Type -> Typenewtype Described desc a
Instances
(IsSymbol desc) => HasGqlDescription (Described desc a)(HasGqlDefaultValue a) => HasGqlDefaultValue (Described desc a)(HasGqlCost a) => HasGqlCost (Described desc a)Newtype (Described desc a) _(HasGqlName a) => HasGqlName (Described desc a)(HasGqlCacheControl a) => HasGqlCacheControl (Described desc a)
#Deprecated Source
newtype Deprecated :: Symbol -> Type -> Typenewtype Deprecated reason a
Instances
(IsSymbol reason) => HasGqlDeprecated (Deprecated reason a)(HasGqlDefaultValue a) => HasGqlDefaultValue (Deprecated reason a)(HasGqlCost a) => HasGqlCost (Deprecated reason a)Newtype (Deprecated reason a) _(HasGqlName a) => HasGqlName (Deprecated reason a)(HasGqlCacheControl a) => HasGqlCacheControl (Deprecated reason a)
#Cost Source
newtype Cost :: Int -> Type -> Typenewtype Cost cost a
Instances
(Reflectable cost Int) => HasGqlCost (Cost cost a)Newtype (Cost cost a) _(HasGqlName a) => HasGqlName (Cost cost a)(HasGqlCacheControl a) => HasGqlCacheControl (Cost cost a)
#deprecated Source
deprecated :: forall @reason a. a -> Deprecated reason aRe-exports from Prospero.PersistedQueries
#persistedQueries Source
persistedQueries :: forall ctx errs gql. PersistedQueryCache -> (GraphQL ctx errs gql -> GraphQLRequest -> Om ctx errs GraphQLResponse) -> GraphQL ctx errs gql -> GraphQLRequest -> ResponseValue -> Om ctx errs GraphQLResponseRe-exports from Prospero.Relay
#PageInfo Source
type PageInfo = GqlObject_ "PageInfo" PageInfoRecord#Connection Source
#mkConnection Source
mkConnection :: forall a. { edges :: Array (Edge a), hasNextPage :: Boolean, hasPreviousPage :: Boolean, totalCount :: Maybe Int } -> Connection a#emptyConnection Source
emptyConnection :: forall a. Connection a#connectionFromArray Source
connectionFromArray :: forall a. Array a -> ConnectionArgs -> Connection aRe-exports from Prospero.ResponseValue
Re-exports from Prospero.RootResolver
#ImplType Source
class ImplType :: Type -> Row Type -> RowList Type -> Row Type -> Constraintclass ImplType (ctx :: Type) (errs :: Row Type) (schemaRL :: RowList Type) (implRow :: Row Type) | ctx errs schemaRL -> implRow
Derives the Om-wrapped implementation row from a pure schema row. Plain fields get wrapped in Om, function fields get their return type wrapped.
Instances
ImplType ctx errs Nil ()(ImplType ctx errs tail tailImpl, Cons name (Record args -> Om ctx errs result) tailImpl implRow, Lacks name tailImpl) => ImplType ctx errs (Cons name (Query (Record args) result) tail) implRow(ImplType ctx errs tail tailImpl, Cons name (Om ctx errs ty) tailImpl implRow, Lacks name tailImpl) => ImplType ctx errs (Cons name (Query Unit ty) tail) implRow(ImplType ctx errs (Cons name inner tail) implRow) => ImplType ctx errs (Cons name (Described desc inner) tail) implRow(ImplType ctx errs (Cons name inner tail) implRow) => ImplType ctx errs (Cons name (Cost cost inner) tail) implRow(ImplType ctx errs (Cons name inner tail) implRow) => ImplType ctx errs (Cons name (MaxAge n unit inner) tail) implRow(ImplType ctx errs (Cons name inner tail) implRow) => ImplType ctx errs (Cons name (Private inner) tail) implRow
#withFederation Source
withFederation :: forall ctx errs gql. EntityResolvers ctx errs -> GraphQL ctx errs gql -> GraphQL ctx errs gql#graphql Source
graphql :: forall @schema schemaRow schemaRL ctx errs implRow qRow mRow sRow qGql mGql sGql. RecordRow schema schemaRow => RowToList schemaRow schemaRL => SplitSchema ctx errs schemaRL implRow qRow mRow sRow => GqlSchema ctx errs (Record qRow) qGql => GqlSchema ctx errs (Record mRow) mGql => GqlSchema ctx errs (Record sRow) sGql => Record implRow -> GraphQL ctx errs qGql#executeQuery Source
executeQuery :: forall ctx errs schemaGql. GraphQL ctx errs schemaGql -> Array Selection -> Om ctx errs ResponseValue#executeOperation Source
executeOperation :: forall ctx errs schemaGql. GraphQL ctx errs schemaGql -> ParsedOperation -> Om ctx errs ResponseValueRe-exports from Prospero.SDL
Re-exports from Prospero.Scalars
Re-exports from Prospero.Schema
#GqlSchema Source
class GqlSchema :: Type -> Row Type -> Type -> Type -> Constraintclass GqlSchema ctx errs a gql | a -> gql
Maps a PureScript type to its GraphQL type-level representation and runtime behavior.
The fundep a -> gql means the GraphQL schema shape is fully determined by the PureScript type.
Instances
GqlSchema ctx errs String (GqlNonNull GqlString)GqlSchema ctx errs Int (GqlNonNull GqlInt)GqlSchema ctx errs Number (GqlNonNull GqlFloat)GqlSchema ctx errs Boolean (GqlNonNull GqlBoolean)GqlSchema ctx errs ID (GqlNonNull GqlID)(GqlSchema ctx errs a gql, StripNonNull gql inner) => GqlSchema ctx errs (Maybe a) (GqlNullable inner)(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Array a) (GqlNonNull (GqlList gql))(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Om ctx errs a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (EventSource a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Edge a) (GqlNonNull (GqlObject "Edge" ()))(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Connection a) (GqlNonNull (GqlObject "Connection" ()))(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Described desc a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Deprecated reason a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Defaulted value a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Cost cost a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (MaxAge n unit a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Named gqlName a) gql(IsSymbol name, GqlSchema ctx errs a gql) => GqlSchema ctx errs (Name name a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Excluded a) gql(GqlSchema ctx errs a gql) => GqlSchema ctx errs (Private a) gql(RowToList args argsRL, FromInputRecord argsRL args, GqlSchemaArgs ctx errs argsRL, GqlSchema ctx errs a gql, ToGqlArgs argsRL argsGql, Cons "wrongArgumentType" String errs_ errs) => GqlSchema ctx errs (Record args -> a) gql(RowToList r rl, GqlSchemaFields ctx errs rl r fieldsGql) => GqlSchema ctx errs (Record r) (GqlNonNull (GqlObject "Object" fieldsGql))(IsSymbol name, RowToList r rl, GqlSchemaFields ctx errs rl r fieldsGql) => GqlSchema ctx errs (GqlObject_ name (Record r)) (GqlNonNull (GqlObject name fieldsGql))(IsSymbol name, Newtype a (Record r), RowToList r rl, GqlSchemaFields ctx errs rl r fieldsGql) => GqlSchema ctx errs (GqlObject_ name a) (GqlNonNull (GqlObject name fieldsGql))(IsSymbol name, Generic a rep, GqlEnumValues rep, GqlEnumResolve rep) => GqlSchema ctx errs (GqlEnum_ name a) (GqlNonNull (GqlEnum name))(IsSymbol name, RowToList row rl, GqlVariantMembers ctx errs rl row) => GqlSchema ctx errs (GqlUnion_ name (Variant row)) (GqlNonNull (GqlUnion name ()))(IsSymbol name, Newtype a (Variant row), RowToList row rl, GqlVariantMembers ctx errs rl row) => GqlSchema ctx errs (GqlUnion_ name a) (GqlNonNull (GqlUnion name ()))(IsSymbol name, RowToList r rl, GqlSchemaArgs ctx errs rl) => GqlSchema ctx errs (GqlInputObject_ name (Record r)) (GqlNonNull (GqlInputObject name ()))(IsSymbol name, Newtype a (Record r), RowToList r rl, GqlSchemaArgs ctx errs rl) => GqlSchema ctx errs (GqlInputObject_ name a) (GqlNonNull (GqlInputObject name ()))(IsGql kind name a, IsSymbol name, GqlSchemaByKind ctx errs kind name a gql) => GqlSchema ctx errs a gql
#genericFromInputValue Source
genericFromInputValue :: forall a rep. Generic a rep => GqlEnumResolve rep => InputValue -> Either InputError aRe-exports from Prospero.Subscription
#EventSource Source
newtype EventSource aAn EventSource emits values to subscribers.
#subscribe Source
subscribe :: forall a m. MonadEffect m => EventSource a -> (a -> Effect Unit) -> m (Effect Unit)Subscribe to an EventSource. Returns an unsubscribe effect.
#mkEventSource Source
mkEventSource :: forall a m. MonadEffect m => m (EventSource a)Create a new EventSource.
#emit Source
emit :: forall a m. MonadEffect m => EventSource a -> a -> m UnitEmit a value to all current subscribers.
Re-exports from Prospero.Tracing
Re-exports from Prospero.Types
#GqlTypeKind Source
Re-exports from Prospero.Upload
Re-exports from Prospero.WebSocket
Re-exports from Prospero.Wrapper
#FieldWrapper Source
data FieldWrapper :: Type -> Row Type -> Typedata FieldWrapper ctx errs
Field wrapper: wraps individual field resolution
Constructors
FieldWrapper (String -> String -> Om ctx errs ResponseValue -> Om ctx errs ResponseValue)
#maxCostFor Source
maxCostFor :: forall ctx errs gql. { query :: GqlType | gql } -> Int -> Wrapper ctx errs#logSlowFields Source
logSlowFields :: forall ctx errs. Int -> Wrapper ctx errsPre-built wrapper: log fields that take longer than a threshold (in milliseconds)
Re-exports from Yoga.Om
#Om Source
newtype Om :: Type -> Row Type -> Type -> Typenewtype Om ctx err a
"dependency injection" via ReaderT which tracks a context, and
checked exceptions and early return with ExceptV.
Instances
Newtype (Om ctx err a) _Functor (Om ctx err)Applicative (Om ctx err)Apply (Om ctx err)Bind (Om ctx err)Monad (Om ctx err)MonadEffect (Om ctx err)MonadAff (Om ctx err)MonadAsk ctx (Om ctx err)MonadReader ctx (Om ctx err)MonadThrow (Variant (Exception err)) (Om ctx err)MonadError (Variant (Exception err)) (Om ctx err)MonadRec (Om ctx err)(Semigroup a) => Semigroup (Om ctx err a)Alt (Om ctx err)Plus (Om ctx err)(RowToList ctx ctxRL, RowToList err errRL, Union ctx _c ctxRow, Keys ctx, Union err _e errRow) => Mapping (ExpandAndRun ctxRow errRow) (Om (Record ctx) err a) (Aff a)(IsSymbol sym, Cons sym a rb rc, Lacks sym rb, RowToList cSmall _cRL, RowToList eSmall _eRL, Union cSmall _c ctxRow, Keys cSmall, Union eSmall _e err) => FoldingWithIndex (SequenceOm ctxRow err) (Proxy sym) (Om (Record ctxRow) err (Builder (Record ra) (Record rb))) (Om (Record cSmall) eSmall a) (Om (Record ctxRow) err (Builder (Record ra) (Record rc)))(RowToList ctx ctxRL, RowToList err errRL) => Mapping CloseOmRows (Om (Record ctx) err a) (Om (Record ctx) err a)Parallel (ParOm ctx err) (Om ctx err)
#runOm Source
runOm :: forall ctx r rl err_ err a. RowToList (exception :: Error -> Aff a | r) rl => VariantMatchCases rl err_ (Aff a) => Union err_ () (Exception err) => ctx -> { exception :: Error -> Aff a | r } -> Om ctx err a -> Aff aInvoke this function in the end and handle all possible errors, e.g.
runOm { token: "123" } { someError: \e -> handleTheError e } someApp
- Modules
- Dev.
Client - Dev.
Schema - Dev.
Server - Prospero
- Prospero.
Bun - Prospero.
CacheControl - Prospero.
Client - Prospero.
Client. GqlUnion - Prospero.
Client. WebSocket - Prospero.
Codegen - Prospero.
Codegen. Main - Prospero.
Crypto - Prospero.
DataLoader - Prospero.
Defer - Prospero.
Directive - Prospero.
Execution - Prospero.
Fastify - Prospero.
Federation - Prospero.
GqlQuery - Prospero.
GqlTypes - Prospero.
GraphQLError - Prospero.
GraphQLWS - Prospero.
Http - Prospero.
InputValue - Prospero.
Introspection - Prospero.
Metadata - Prospero.
Om - Prospero.
Parser - Prospero.
Parser. AST - Prospero.
Parser. GraphQL - Prospero.
Parser. Lexer - Prospero.
Parser. Monad - Prospero.
Parser. Token - Prospero.
PersistedQueries - Prospero.
Relay - Prospero.
ResponseValue - Prospero.
RootResolver - Prospero.
SDL - Prospero.
Scalars - Prospero.
Schema - Prospero.
SchemaTransform - Prospero.
Step - Prospero.
Subscription - Prospero.
Tracing - Prospero.
Types - Prospero.
Upload - Prospero.
Validation - Prospero.
VariantHelper - Prospero.
WebSocket - Prospero.
Wrapper