Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-reactive-schema

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-reactive-schema

Apollo Link that provides a reactive-graphql execution environment to perform operations on a provided reactive schema.

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

Apollo Link that provides a reactive-graphql execution environment to perform operations on a provided reactive schema.

Installation

npm install apollo-link-reactive-schema --save

Usage

import { ApolloClient } from 'apollo-client';
import { from } from 'rxjs';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ReactiveSchemaLink } from 'apollo-link-reactive-schema';
import { gql } from 'graphql-tag';

import schema from './path/to/your/schema';

const graphqlClient = new ApolloClient({
  cache: new InMemoryCache(),
  link: new ReactiveSchemaLink({ schema }),
  // without this option watchQuery won't be streaming
  // see https://github.com/apollographql/apollo-client/issues/4322
  queryDeduplication: false
});

const query = gql`
  # don't forget the @live directive, otherwise you'll experience
  # difficulties with subscription>unsubscription>subscription
  query @live {
    someReactiveField
  }
`;

const $res = graphqlClient.watchQuery({ query });
$res.subscribe(res => console.log(res));

Options

The ReactiveSchemaLink constructor can be called with an object with the following properties:

  • schema: an executable graphql schema
  • context: an object passed to the resolvers, following the graphql specification or a function that accepts the operation and returns the resolver context.

FAQs

Package last updated on 30 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc