bluerain-apollo-plugin

A fully-featured, production ready caching GraphQL client for every server or UI framework. https://blueeast.gitbook.io/bluerain-plugin-apollo

Screenshots

NA

Components

This plugin registers following components in the Component registry, so they can be reused later by other apps and plugins;

Hooks

This plugin provides complete flexibility to modify the apollo client. This is done by providing various filter hooks at different stages of store initialization.

bluerain.system.app

This hook gives the ability to modify the main System App component that gets wrapped in Redux's Provider.

Parameters:

Returns:

Example:

This example wraps the System App with a Apollo provider by using a replaceReduxProvider higher order component (HOC).

  import BR from '@blueeast/bluerain-os';
  import withApolloProvider from './withApolloProvider';

  'bluerain.system.app': App => {
              return withApolloProvider(App, client);
          }

plugin.apollo.config

This hook gives the ability to modify the plugin configurations.

Parameters:

Returns:

Example:

This example activates subscriptions in apollo client.

  import BR from '@blueeast/bluerain-os';

  BR.Filters.add(
      'plugin.apollo.config',
      function ActivateApolloSubscriptions(configs) {
          return Object.assign({}, configs, {
              subscriptions: true
          })
      }
  );

This hook gives the ability to provide uri for websocket server

Parameters:

Returns:

Example:

  'plugin.apollo.links': (links) => {
              return links;
          }

plugin.apollo.cache:

This Hook clears cache of the of Apollo store

plugin.system.initialized:

This Hook Create apollo client when all plugins and apps are initialized

API

  • ApolloPluginConfigs

    This is the default configuration set that is used at boot time.

    Properties

    • httpLinkOptions HttpLinks URI link of websocket server

    • clientOptions ApolloClientOptions Apollo client params

    ApolloPlugin

    Extends Plugin

    Main Apollo Plugin class.

    Plugin Properties

    getClient

    Returns Apollo client

Last updated