graphql-apollo-client 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example.js +11 -11
- package/index.js +3 -3
- package/package.json +8 -3
package/example.js
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
const { configureClient, gql } = require('
|
1
|
+
const { configureClient, gql } = require('graphql-apollo-client');
|
2
2
|
|
3
|
-
const GRAPHQL_ENDPOINT =
|
4
|
-
const GRAPHQL_ENDPOINT_WS =
|
5
|
-
const TOKEN =
|
3
|
+
const GRAPHQL_ENDPOINT = 'https://api.ecomon.no';
|
4
|
+
const GRAPHQL_ENDPOINT_WS = 'wss://api.ecomon.no';
|
5
|
+
const TOKEN = 'Bearer intermediary-api-key_858bef2f-5b67-49b2-b7e0-c07a093f98be';
|
6
6
|
|
7
7
|
const client = configureClient({
|
8
8
|
httpEndpoint: GRAPHQL_ENDPOINT,
|
9
9
|
wsEndpoint: GRAPHQL_ENDPOINT_WS,
|
10
|
-
bearerToken: TOKEN
|
11
|
-
})
|
12
|
-
|
13
|
-
|
10
|
+
bearerToken: TOKEN,
|
11
|
+
});
|
14
12
|
|
15
13
|
// Test subscription
|
16
14
|
client
|
@@ -23,11 +21,13 @@ client
|
|
23
21
|
}
|
24
22
|
}
|
25
23
|
`,
|
26
|
-
variables: {}
|
24
|
+
variables: {},
|
27
25
|
})
|
28
26
|
.subscribe({
|
29
27
|
next(data) {
|
30
28
|
console.log(data);
|
29
|
+
},
|
30
|
+
error(err) {
|
31
|
+
console.log(err)
|
31
32
|
}
|
32
|
-
})
|
33
|
-
|
33
|
+
})
|
package/index.js
CHANGED
@@ -6,8 +6,8 @@ const WebSocket = require("ws");
|
|
6
6
|
const ApolloLink = require("apollo-link");
|
7
7
|
const { createHttpLink } = require("apollo-link-http");
|
8
8
|
const { getMainDefinition } = require("apollo-utilities");
|
9
|
-
const fetch = (...args) =>
|
10
|
-
|
9
|
+
// const fetch = (...args) =>
|
10
|
+
// import("node-fetch").then(({ default: fetch }) => fetch(...args));
|
11
11
|
|
12
12
|
/**
|
13
13
|
*
|
@@ -31,7 +31,7 @@ const configureClient = ({ httpEndpoint, wsEndpoint, bearerToken }) => {
|
|
31
31
|
|
32
32
|
const httpLink = createHttpLink({
|
33
33
|
uri: httpEndpoint,
|
34
|
-
fetch: fetch,
|
34
|
+
// fetch: fetch,
|
35
35
|
headers: {
|
36
36
|
Authorization: bearerToken
|
37
37
|
}
|
package/package.json
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "graphql-apollo-client",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"main": "index.js",
|
5
5
|
"license": "MIT",
|
6
|
+
"repository": "https://github.com/mxshahan/graphql-apollo-client.git",
|
6
7
|
"dependencies": {
|
7
8
|
"apollo-cache-inmemory": "1.6.6",
|
8
9
|
"apollo-client": "2.6.10",
|
@@ -23,6 +24,10 @@
|
|
23
24
|
"start": "node index.js",
|
24
25
|
"dev": "nodemon example.js"
|
25
26
|
},
|
26
|
-
"keywords": [
|
27
|
+
"keywords": [
|
28
|
+
" nodejs",
|
29
|
+
"graphql",
|
30
|
+
" javascript"
|
31
|
+
],
|
27
32
|
"description": ""
|
28
|
-
}
|
33
|
+
}
|