How to use the apollo-utilities.graphQLResultHasError function in apollo-utilities

To help you get started, we’ve selected a few apollo-utilities 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 apollographql / apollo-client / packages / apollo-client / src / data / store.ts View on Github external
public markMutationResult(mutation: {
    mutationId: string;
    result: ExecutionResult;
    document: DocumentNode;
    variables: any;
    updateQueries: { [queryId: string]: QueryWithUpdater };
    update: ((proxy: DataProxy, mutationResult: Object) => void) | undefined;
  }) {
    // Incorporate the result from this mutation into the store
    if (!graphQLResultHasError(mutation.result)) {
      const cacheWrites: Cache.WriteOptions[] = [{
        result: mutation.result.data,
        dataId: 'ROOT_MUTATION',
        query: mutation.document,
        variables: mutation.variables,
      }];

      const { updateQueries } = mutation;
      if (updateQueries) {
        Object.keys(updateQueries).forEach(id => {
          const { query, updater } = updateQueries[id];

          // Read the current query result from the store.
          const { result: currentQueryResult, complete } = this.cache.diff({
            query: query.document,
            variables: query.variables,
github awslabs / aws-mobile-appsync-sdk-js / packages / aws-appsync / src / deltaSync.ts View on Github external
error: (err) => {
                        resolve();

                        error = err;
                        unsubscribeAll();

                        if (graphQLResultHasError(err) || err.graphQLErrors) {
                            // send error to observable, unsubscribe all, do not enqueue
                            observer.error(err);
                            return;
                        }

                        enqueueAgain();
                    }
                });
github apollographql / apollo-client / packages / apollo-client / src / core / QueryManager.ts View on Github external
next(result: ExecutionResult) {
          if (graphQLResultHasError(result) && errorPolicy === 'none') {
            error = new ApolloError({
              graphQLErrors: result.errors,
            });
            return;
          }

          self.mutationStore.markMutationResult(mutationId);

          if (fetchPolicy !== 'no-cache') {
            self.dataStore.markMutationResult({
              mutationId,
              result,
              document: mutation,
              variables,
              updateQueries: generateUpdateQueriesInfo(),
              update: updateWithProxyFn,
github apollographql / apollo-client / packages / apollo-client / src / data / store.ts View on Github external
public markQueryResult(
    result: ExecutionResult,
    document: DocumentNode,
    variables: any,
    fetchMoreForQueryId: string | undefined,
    ignoreErrors: boolean = false,
  ) {
    let writeWithErrors = !graphQLResultHasError(result);
    if (ignoreErrors && graphQLResultHasError(result) && result.data) {
      writeWithErrors = true;
    }
    if (!fetchMoreForQueryId && writeWithErrors) {
      this.cache.write({
        result: result.data,
        dataId: 'ROOT_QUERY',
        query: document,
        variables: variables,
      });
    }
  }
github apollographql / apollo-client / packages / apollo-client / src / data / store.ts View on Github external
public markQueryResult(
    result: ExecutionResult,
    document: DocumentNode,
    variables: any,
    fetchMoreForQueryId: string | undefined,
    ignoreErrors: boolean = false,
  ) {
    let writeWithErrors = !graphQLResultHasError(result);
    if (ignoreErrors && graphQLResultHasError(result) && result.data) {
      writeWithErrors = true;
    }
    if (!fetchMoreForQueryId && writeWithErrors) {
      this.cache.write({
        result: result.data,
        dataId: 'ROOT_QUERY',
        query: document,
        variables: variables,
      });
    }
  }
github apollographql / apollo-client / packages / apollo-client / src / data / store.ts View on Github external
public markQueryResult(
    result: ExecutionResult,
    document: DocumentNode,
    variables: any,
    fetchMoreForQueryId: string | undefined,
    ignoreErrors: boolean = false,
  ) {
    let writeWithErrors = !graphQLResultHasError(result);
    if (ignoreErrors && graphQLResultHasError(result) && result.data) {
      writeWithErrors = true;
    }
    if (!fetchMoreForQueryId && writeWithErrors) {
      this.cache.write({
        result: result.data,
        dataId: 'ROOT_QUERY',
        query: document,
        variables: variables,
      });
    }
  }
github apollographql / apollo-client / packages / apollo-client / src / core / QueryManager.ts View on Github external
).map(result => {
        if (!fetchPolicy || fetchPolicy !== 'no-cache') {
          this.dataStore.markSubscriptionResult(
            result,
            query,
            variables,
          );
          this.broadcastQueries();
        }

        if (graphQLResultHasError(result)) {
          throw new ApolloError({
            graphQLErrors: result.errors,
          });
        }

        return result;
      });
github Grantimus9 / vuegraphqlphx / assets / node_modules / apollo-client / data / store.js View on Github external
DataStore.prototype.markMutationResult = function (mutation) {
        var _this = this;
        if (!graphQLResultHasError(mutation.result)) {
            var cacheWrites_1 = [];
            cacheWrites_1.push({
                result: mutation.result.data,
                dataId: 'ROOT_MUTATION',
                query: mutation.document,
                variables: mutation.variables,
            });
            if (mutation.updateQueries) {
                Object.keys(mutation.updateQueries)
                    .filter(function (id) { return mutation.updateQueries[id]; })
                    .forEach(function (queryId) {
                    var _a = mutation.updateQueries[queryId], query = _a.query, updater = _a.updater;
                    var _b = _this.cache.diff({
                        query: query.document,
                        variables: query.variables,
                        returnPartialData: true,
github apollographql / apollo-client / packages / apollo-client / src / data / store.ts View on Github external
public markQueryResult(
    result: ExecutionResult,
    document: DocumentNode,
    variables: any,
    fetchMoreForQueryId: string | undefined,
    ignoreErrors: boolean = false,
  ) {
    let writeWithErrors = !graphQLResultHasError(result);
    if (ignoreErrors && graphQLResultHasError(result) && result.data) {
      writeWithErrors = true;
    }
    if (!fetchMoreForQueryId && writeWithErrors) {
      this.cache.write({
        result: result.data,
        dataId: 'ROOT_QUERY',
        query: document,
        variables: variables,
      });
    }
  }