BlueRain OS
  • Introduction
  • API
    • API Reference
  • Guides
    • Apps
      • Installation
      • Creating an App
      • Configuration
    • Components
      • Registering Components
      • Extending Components
      • Replacing Components
      • Accessing Raw Components
      • Components & HoCs
    • Filters
      • Known Filters
    • Plugins
      • Installation
      • Configuration
      • Creating a Plugin
  • Miscellaneous
    • JSON to React
  • Plugins
    • Apollo
    • Internationalization
    • Material UI
    • React Router
    • Redux
    • Redux Devtools
    • Why Did You Update
Powered by GitBook
On this page
  • Usage
  • Components
  • Filters
  • plugin.apollo.config
  • plugin.apollo.networkInterface
  • API
  • ApolloPluginConfigs
  • ApolloPlugin
  1. Plugins

Apollo

PreviousJSON to ReactNextInternationalization

Last updated 6 years ago

A fully-featured, production ready caching GraphQL client for every server or UI framework.

Usage

Run the following command in the plugin directoy:

npm i --save @blueeast/bluerain-plugin-apollo

Then in your boot function, pass the plugin like this:

import BR from '@blueeast/bluerain-os';
import ApolloPlugin from '@blueeast/bluerain-plugin-apollo';

BR.boot({
    plugins: [ApolloPlugin]
})

Components

None.

Filters

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

plugin.apollo.config

This hook gives the ability to modify the plugin configurations.

Parameters:

Name

Type

Description

config

Object

Plugin configurations

Returns:

Name

Type

Description

config

Object

Plugin configurations

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
        })
    }
);

plugin.apollo.networkInterface

This hook gives the ability to hook into Apollo's network interface. A usecase can be to apply middlewares to it.

Parameters:

Name

Type

Description

networkInterface

Object

Apollo's networkInterface object

Returns:

Name

Type

Description

networkInterface

Object

Apollo's networkInterface object

API

ApolloPluginConfigs

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

Properties

  • subscriptionClient SubscriptionClientOptions SubscriptionClient params, if subscriptions are activated

  • networkInterface NetworkInterfaceOptions NetworkInterface params

  • client ApolloClientOptions Apollo client params

ApolloPlugin

Extends Plugin

Main Apollo Plugin class.

Properties

getClient

Returns Apollo client

Returns ApolloClient

getSubscriptionClient

Returns Apollo's Subscription Client

Returns SubscriptionClient

subscriptions [default: false] Activate subscriptions

wsUri URI of websocket server

pluginName "ApolloPlugin"

slug "apollo"

Github Repo
boolean
string
string
string