0.1.1 • Published 8 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: objectcontaining:-
getHeaders()– resolves with the currently setheadersobject -
query(queryString: string)– sends thequeryStringto the GraphQL endpoint; also used for mutations and subscriptions -
setHeader(headerName: string, value: string)– sets theheaderNameheader value tovalue -
unsetHeader(headerName: string)– unsets theheaderNameheader 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): Streamof results from action requests that were categorized using<action>.as().