0.1.1 • Published 6 years ago
cycle-graphql v0.1.1
cycle-graphql
A GraphQL driver for Cycle.js.
API
graphQLActions
Write effects are requested by calling an action generator—a function defined on the graphQLActions
object—and passed to the GraphQL sink.
graphQLActions: object
containing:-
getHeaders()
– resolves with the currently setheaders
object -
query(queryString: string)
– sends thequeryString
to the GraphQL endpoint; also used for mutations and subscriptions -
setHeader(headerName: string, value: string)
– sets theheaderName
header value tovalue
-
unsetHeader(headerName: string)
– unsets theheaderName
header value
-
<action>.as(category: string)
Attaches a category
to the action's result stream, allowing for lookup using the source's select()
.
makeGraphQLDriver(endpoint: string)
Initializes a GraphQL client pointing to endpoint
, returning a source object containing the following:
-
select(category: string): Stream
of results from action requests that were categorized using<action>.as()
.