declare global { interface Window { __APOLLO_STATE__: any; __GRAPHQL__: any; __SCHEMA__: any; } } import * as React from 'react'; import { InMemoryCache } from "apollo-cache-inmemory"; import { createHttpLink } from 'apollo-link-http'; import {ApolloProvider, ApolloConsumer, getDataFromTree} from "react-apollo"; import ApolloClient from 'apollo-client'; //import { ApolloLink } from 'apollo-link'; import { SchemaLink } from 'apollo-link-schema'; //import fetch from 'node-fetch'; require('es6-promise').polyfill(); import 'isomorphic-fetch'; /** * we MUST NOT IMPORT CONTEXTs directly, but require them at time of use generally from Infrastructure-Components * because this then resolves to node_modules */ //import AttachDataLayer from './attach-data-layer'; import Types from '../types'; import { extractObject, INFRASTRUCTURE_MODES, loadConfigurationFromModule } from '../libs/loader'; /** * */ export const createServerSideClient = (link) => new ApolloClient({ //ssrMode: true, // Remember that this is the interface the SSR server will use to connect to the // API server, so we need to ensure it isn't firewalled, etc link:link, cache: new InMemoryCache(), }); /** * Puts the preloaded state in a string that can be put into a