hasura-connector
Advanced tools
Comparing version 0.0.2 to 0.0.3
35
index.js
@@ -1,11 +0,18 @@ | ||
const {ApolloClient, split, InMemoryCache, HttpLink} = require("apollo-boost"); | ||
const {WebSocketLink} = require('@apollo/client/link/ws'); | ||
"use strict"; | ||
const fetch = global.fetch || (typeof window === 'undefined' | ||
? require('node-fetch') | ||
: require('whatwg-fetch')); | ||
const { | ||
ApolloClient, | ||
split, | ||
InMemoryCache, | ||
HttpLink | ||
} = require("apollo-boost"); | ||
const { | ||
WebSocketLink | ||
} = require('@apollo/client/link/ws'); | ||
const fetch = global.fetch || (typeof window === 'undefined' ? require('node-fetch') : require('whatwg-fetch')); | ||
const cache = new InMemoryCache(); | ||
const createClient = (url) => { | ||
const createClient = url => { | ||
const wsLink = process.browser ? new WebSocketLink({ | ||
@@ -17,3 +24,2 @@ uri: `ws://${url}/v1/graphql`, | ||
}) : null; | ||
const httpLink = new HttpLink({ | ||
@@ -23,15 +29,12 @@ uri: `http://${url}/v1/graphql`, | ||
}); | ||
return new ApolloClient({ | ||
cache, | ||
link: process.browser ? split( | ||
({query}) => { | ||
return true; | ||
}, | ||
wsLink, | ||
httpLink, | ||
) : httpLink, | ||
link: process.browser ? split(({ | ||
query | ||
}) => { | ||
return true; | ||
}, wsLink, httpLink) : httpLink | ||
}); | ||
} | ||
}; | ||
module.exports = createClient; |
{ | ||
"name": "hasura-connector", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Hasura connect package", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1200
32