How to use the graphql-anywhere/lib/async.graphql function in graphql-anywhere

To help you get started, we’ve selected a few graphql-anywhere examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Canner / apollo-link-firebase / src / rtdb / link.ts View on Github external
return new Observable(observer => {
      graphql(
        getResolver(operationType),
        queryWithTypename,
        rootValue,
        context,
        operation.variables
      )
      .then(data => {
        observer.next({ data });
        observer.complete();
      })
      .catch(err => {
        if (err.name === 'AbortError') {
          return;
        }
        if (err.result && err.result.errors) {
          observer.next(err.result);
github Canner / apollo-link-firebase / src / rtdb / resolver.ts View on Github external
export const resolve = (
  query: DocumentNode,
  rootValue?: any,
  contextValue?: any,
  variableValues?: VariableMap
): Promise => {
  return graphql(
    getResolver(contextValue.operationType),
    query,
    rootValue,
    contextValue,
    variableValues
  );
}
github Canner / canner / packages / canner-graphql-interface / src / link.ts View on Github external
return new Observable(observer => {
        graphql(
          graphqlResolver,
          queryWithTypename,
          {},
          {document: queryWithTypename, connectors},
          operation.variables
        )
        .then(data => {
          observer.next({ data });
          observer.complete();
        })
        .catch(err => {
          if (err.name === 'AbortError') {
            return;
          }
          if (err.result && err.result.errors) {
            observer.next(err.result);
github Rsullivan00 / apollo-link-json-api / src / jsonApiLink.ts View on Github external
new Observable(observer => {
          graphql(
            resolver,
            queryWithTypename,
            data,
            requestContext,
            variables,
            resolverOptions,
          )
            .then(data => {
              setContext({
                restResponses: (context.restResponses || []).concat(
                  requestContext.responses,
                ),
              });
              observer.next({ data, errors });
              observer.complete();
            })
github Lucifier129 / graphql-dynamic / src / index.js View on Github external
return async (query, variables, context, rootValue) => {
    let errors = []

    variables = createVariables(variables)

    context = {
      errors,
      variables,
      ...context
    }

    let data = await graphql(resolver, query, rootValue, context, variables)

    return { errors, data }
  }
}
github strvcom / dep-manager-web / src / utils / RestLink.ts View on Github external
new Observable(subscriber => {
          graphql(
            resolver,
            typeNamedQuery,
            data,
            this.resolverMap,
            operation.variables
          )
            .then(resolvedData => {
              subscriber.next({ data: resolvedData, ...rest })
              subscriber.complete()
            })
            .catch(err => {
              if (err.name === 'AbortError') return
              if (err.result && err.result.errors) {
                subscriber.next(err.result)
              }
              subscriber.error(err)
github Canner / apollo-link-firebase / src / rtdb / subscriptionLink.ts View on Github external
const callback = (snapshot: firebaseDatabase.DataSnapshot) => {
        const root: ResolverRoot = {rootSnapshot: snapshot};
        graphql(
          queryResolver,
          queryWithTypename,
          root,
          context,
          operation.variables
        )
        .then(data => {
          observer.next({ data });
        })
        .catch(err => {
          if (err.name === 'AbortError') {
            return;
          }
          if (err.result && err.result.errors) {
            observer.next(err.result);
          }

graphql-anywhere

Run GraphQL queries with no schema and just one resolver

MIT
Latest version published 2 years ago

Package Health Score

80 / 100
Full package analysis