Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
typeDefs: typeof ApolloClientLocalSchemaToken.optional,
schema: typeof GraphQLSchemaToken.optional,
resolvers: typeof ApolloClientResolversToken.optional,
defaultOptions: typeof ApolloClientDefaultOptionsToken.optional,
};
function Container() {}
const ApolloClientPlugin: FusionPlugin<
ApolloClientDepsType,
InitApolloClientType<*>
> = createPlugin({
deps: {
getCache: GetApolloClientCacheToken.optional,
endpoint: GraphQLEndpointToken.optional,
fetch: __NODE__ ? FetchToken.optional : FetchToken,
includeCredentials: ApolloClientCredentialsToken.optional,
apolloContext: ApolloContextToken.optional,
getApolloLinks: GetApolloClientLinksToken.optional,
typeDefs: ApolloClientLocalSchemaToken.optional,
schema: GraphQLSchemaToken.optional,
resolvers: ApolloClientResolversToken.optional,
defaultOptions: ApolloClientDefaultOptionsToken.optional,
},
provides({
getCache = ctx =>
// don't automatically add typename when handling POST requests via the executor. This saves size on the response
new InMemoryCache({
addTypename: ctx.method === 'POST' ? false : true,
}),
endpoint = '/graphql',
fetch,
function getDeps(): DepsType {
if (__NODE__) {
return {
apolloContext: ApolloContextToken.optional,
logger: LoggerToken.optional,
schema: GraphQLSchemaToken.optional,
endpoint: GraphQLEndpointToken.optional,
getApolloClient: ApolloClientToken,
getDataFromTree: GetDataFromTreeToken.optional,
bodyParserConfig: ApolloBodyParserConfigToken.optional,
defaultOptionsConfig: ApolloDefaultOptionsConfigToken.optional,
};
}
// $FlowFixMe
return {
getApolloClient: ApolloClientToken,
};
}
const pluginFactory: () => PluginType = () =>
createPlugin({
deps: {
fetch: FetchToken.optional,
hydrationState: HydrationStateToken.optional,
events: UniversalEventsToken.optional,
},
provides: ({fetch = window.fetch, hydrationState, events} = {}) => {
class I18n {
locale: string;
translations: TranslationsObjectType;
requestedKeys: Set;
constructor() {
const {localeCode, translations} =
hydrationState || loadTranslations();
this.requestedKeys = new Set();
this.translations = translations || {};
if (localeCode) {
this.locale = localeCode;