Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import { ApolloClient, IntrospectionFragmentMatcher } from 'react-apollo'
import { SubscriptionClient } from 'subscriptions-transport-ws'
const WebSocket = window.require('ws')
const Store = window.require('electron-store')
const { is } = window.require('electron-util')
const fs = window.require('fs')
const store = new Store({ name: is.development ? 'onyx-dev' : 'onyx' })
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData: {
__schema: {
types: [
{
kind: 'UNION',
name: 'MessageBlock',
possibleTypes: [
{
name: 'MessageBlockText',
},
{
name: 'MessageBlockFile',
},
{
name: 'MessageBlockAction',
},
import { ApolloClient, toIdValue, IntrospectionFragmentMatcher } from 'react-apollo';
import { createNetworkInterface } from 'apollo-upload-client';
import * as Sentry from '@sentry/browser';
import { getDiscussionSlug } from './utils/globalFunctions';
import { getFullPath } from './utils/routeMap';
import fetch from 'isomorphic-fetch'; // eslint-disable-line
const myFragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData: {
__schema: {
types: [
{
kind: 'INTERFACE',
name: 'IdeaInterface',
possibleTypes: [{ name: 'Idea' }, { name: 'Thematic' }]
}
]
}
}
});
// The object id retrieved is already unique, it's actually
// ObjectType:primaryKey encoded in base64, so we define our
// own dataIdFromObject instead of using the default one `${o.__typename}:o.id`.
// @flow
import { IntrospectionFragmentMatcher } from 'react-apollo'
import ApolloClient, { createNetworkInterface } from 'apollo-client'
import { SubscriptionClient } from 'subscriptions-transport-ws'
import RNFS from 'react-native-fs'
import OnyxWebSocket from '../OnyxWebSocket'
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData: {
__schema: {
types: [
{
kind: 'UNION',
name: 'MessageBlock',
possibleTypes: [
{
name: 'MessageBlockText',
},
{
name: 'MessageBlockFile',
},
{
name: 'MessageBlockAction',
},
const configureStore = async (initialState, history) => {
const sagaMiddleware = createSagaMiddleware()
const networkInterface = createNetworkInterface({ uri: apiUrl })
const schemaMeta = await networkInterface.query({
query: introspectionQuery,
})
const client = new ApolloClient({
shouldBatch: true,
networkInterface: networkInterface,
fragmentMatcher: new IntrospectionFragmentMatcher({
introspectionQueryResultData: schemaMeta.data,
}),
})
const finalCreateStore = compose(
applyMiddleware(
client.middleware(),
thunk,
sagaMiddleware,
routerMiddleware(history),
),
browser ? persistState('auth') : (m) => m,
devMiddlewares
)(createStore)
const store = finalCreateStore(reducer(client), initialState)
import { IntrospectionFragmentMatcher } from 'react-apollo';
import introspectionQueryResultData from '../../tools/fragmentMatcher.json';
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
});
export default fragmentMatcher;
import { ApolloClient, createNetworkInterface, IntrospectionFragmentMatcher } from 'react-apollo'
import { API_BASE_URL, API_AUTHORIZATION_HEADER } from '../constants'
let apolloClient = null
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData: {
__schema: {
types: [
{
kind: 'UNION',
name: 'Reward',
possibleTypes: [
{
name: 'Goodie'
},
{
name: 'MembershipType'
}
]
}
]