Socket
Book a DemoInstallSign in
Socket

apollo-link-prime

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-prime

Apollo link for Prime

latest
Source
npmnpm
Version
0.3.3
Version published
Maintainers
1
Created
Source

Apollo Link provider for Prime

Installation

yarn add -S apollo-link-prime

or

npm install -S apollo-link-prime

Usage

import { PrimeLink } from 'apollo-link-prime';

const apolloClient = new ApolloClient({
  link: PrimeLink({
    url: 'https://prime.example.com',
    accessToken?: '',
    ssrMode?: false,
    linkResolver?: (document, schema) => '/',
    cookies?: { [key: string]: string },
  }),
  cache: new InMemoryCache()
});
parametertypedefaultdescription
urlstringrequiredAbsolute URL with no path at the end to a Prime endpoint
accessTokenstringundefinedPermanent server token or JWT access token (private api enabled)
ssrModebooleanfalseIf enabled, client will store a preview cookie and reload the page.
linkResolverFunctionundefinedThis function can return a redirect path for the previewed document in question
cookiesobjectundefinedPass cookies from express etc. in object format. The link will read stored preview cookie from ssrMode

Client

You read preview state and clear it with the following utility functions.

import { clearPreview, isPreviewing } from 'apollo-link-prime';

// client code

if (isPreviewing()) {
  button.onclick = () => clearPreview();
}

Keywords

graphql

FAQs

Package last updated on 14 Feb 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