How to use the apollo-boost.default function in apollo-boost

To help you get started, we’ve selected a few apollo-boost 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 birkir / graphql-gatsby / examples / with-next / next.config.js View on Github external
exportPathMap: async (pathMap, options) => {
    if (process.argv[1].match(/next-export$/) && !options.dev) {
      // Wait until server becomes ready in export mode
      await promiseRetry((retry, number) => {
        console.log('waiting for server...', number);
        return fetch(`http://localhost:${port}/graphql?query=%7Bsite%7Bid%7D%7D`)
        .then(res => res.status !== 200 && new Error('Failure'))
        .catch(retry);
      });
      await new Promise(resolve => setTimeout(resolve, 1000)); // shjattlari

      const client = new ApolloClient({ uri: `http://localhost:${port}/graphql` });

      const allMediumPostsQuery = gql`query {
        allMediumPost {
          edges {
            node {
              id
              slug
            }
          }
        }
      }`;
      const res = await client.query({ query: allMediumPostsQuery });

      const posts = [].concat(res.data && res.data.allMediumPost.edges || []).reduce((acc, { node }) => {
        acc[`/post/${node.slug}`] = {
          page: '/post',
github alexieyizhe / intern.plus / server / scripts / computeCompanyColor.js View on Github external
logoColor
      }
    }
  }
`;

const UPDATE_COMPANY_COLOR = gql`
  mutation UpdateCompanyColor($id: ID, $color: String) {
    companyUpdate(data: { id: $id, logoColor: $color }) {
      id
      logoColor
    }
  }
`;

const client = new ApolloClient({
  uri: API_URL,
  request: operation => {
    const token = process.env.SERVER_API_TOKEN;
    operation.setContext({
      headers: {
        authorization: token ? `Bearer ${token}` : "",
      },
    });
  },
});

// may throw errors
const getCompanyLogoColor = async imgSrc => {
  const palette = await Vibrant.from(imgSrc).getPalette();
  const bestFitSwatch = palette
    ? palette.LightVibrant ||
github alexieyizhe / intern.plus / server / scripts / addInfoToCompany.js View on Github external
const ApolloClient = require("apollo-boost").default; // eslint-disable-line
const { gql } = require("apollo-boost"); // eslint-disable-line
const chalk = require("chalk"); // eslint-disable-line
const dotenv = require("dotenv"); // eslint-disable-line
dotenv.config();

const COMPANY_KEY = "company";
const JOB_KEY = "job";
const REVIEW_KEY = "user_review";

const companyJsonFile = require(`../data/${COMPANY_KEY}.json`); // eslint-disable-line
const jobJsonFile = require(`../data/${JOB_KEY}.json`); // eslint-disable-line
const reviewJsonFile = require(`../data/${REVIEW_KEY}.json`); // eslint-disable-line
const API_URL = process.env.REACT_APP_DB_GRAPHQL_API_URL;

const client = new ApolloClient({
  uri: API_URL,
  request: operation => {
    const token = process.env.SERVER_API_TOKEN;
    operation.setContext({
      headers: {
        authorization: token ? `Bearer ${token}` : "",
      },
    });
  },
});

const salaryReducer = (acc, cur, curIdx) => {
  const newAcc = acc;

  let curHourlySalary;
  if (cur.pay_period === "hourly") {
github wikimedia / mediawiki-extensions-Wikibase / build / dist-size / analyze / index.js View on Github external
async function main() {
	const client = new ApolloClient( {
		uri: 'https://api.github.com/graphql',
		request: ( operation ) => {
			operation.setContext( {
				headers: {
					authorization: `Bearer ${accessToken}`,
				},
			} );
		},
	} );

	const data = {};
	await Promise.all( files.map(
		async ( filePath ) => {
			data[ filePath ] = await getHistoryForFile( client, repoOwner, repoName, filePath );
			console.info( `Analysed ${filePath}` );
		},