removing apollo fetch

This commit is contained in:
Nikola Bjelo committed 2018-10-10 16:36:17 +02:00
1 parent e87d293d2c
commit 9fc35b5bc8
3 files changed
+50 -85

No files matched your search

+33 -76
View File
@@ -59,14 +59,6 @@
"graphql-extensions": "^0.0.x"
}
},
"apollo-fetch": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/apollo-fetch/-/apollo-fetch-0.7.0.tgz",
"integrity": "sha512-0oHsDW3Zxx+Of1wuqcOXruNj4Kv55WN69tkIjwkCQDEIrgCpgA2scjChFsgflSVMy/1mkTKCY1Mc0TYJhNRzmw==",
"requires": {
"cross-fetch": "^1.0.0"
}
},
"apollo-link": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.3.tgz",
@@ -76,6 +68,23 @@
"zen-observable-ts": "^0.8.10"
}
},
"apollo-link-http": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/apollo-link-http/-/apollo-link-http-1.5.5.tgz",
"integrity": "sha512-C5N6N/mRwmepvtzO27dgMEU3MMtRKSqcljBkYNZmWwH11BxkUQ5imBLPM3V4QJXNE7NFuAQAB5PeUd4ligivTQ==",
"requires": {
"apollo-link": "^1.2.3",
"apollo-link-http-common": "^0.2.5"
}
},
"apollo-link-http-common": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/apollo-link-http-common/-/apollo-link-http-common-0.2.5.tgz",
"integrity": "sha512-6FV1wr5AqAyJ64Em1dq5hhGgiyxZE383VJQmhIoDVc3MyNcFL92TkhxREOs4rnH2a9X2iJMko7nodHSGLC6d8w==",
"requires": {
"apollo-link": "^1.2.3"
}
},
"apollo-server-core": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-1.4.0.tgz",
@@ -1369,15 +1378,6 @@
"capture-stack-trace": "^1.0.0"
}
},
"cross-fetch": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-1.1.1.tgz",
"integrity": "sha512-+VJE04+UfxxmBfcnmAu/lKor53RUCx/1ilOti4p+JgrnLQ4AZZIRoe2OEd76VaHyWQmQxqKnV+TaqjHC4r0HWw==",
"requires": {
"node-fetch": "1.7.3",
"whatwg-fetch": "2.0.3"
}
},
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
@@ -1534,14 +1534,6 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"requires": {
"iconv-lite": "~0.4.13"
}
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -1887,8 +1879,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@@ -1909,14 +1900,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -1931,20 +1920,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -2061,8 +2047,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@@ -2074,7 +2059,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -2089,7 +2073,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -2097,14 +2080,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -2123,7 +2104,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -2204,8 +2184,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -2217,7 +2196,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -2303,8 +2281,7 @@
"safe-buffer": {
"version": "5.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -2340,7 +2317,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -2360,7 +2336,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -2404,14 +2379,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
@@ -2642,14 +2615,6 @@
"statuses": ">= 1.4.0 < 2"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
@@ -2904,7 +2869,8 @@
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
},
"is-windows": {
"version": "1.0.2",
@@ -3206,13 +3172,9 @@
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
},
"node-fetch": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.2.0.tgz",
"integrity": "sha512-OayFWziIxiHY8bCUyLX6sTpDH8Jsbp4FfYd1j1f7vZyfgkcOnAyM4oQR16f8a0s7Gl/viMGRey8eScYk4V4EZA=="
},
"nodemon": {
"version": "1.18.4",
@@ -5124,11 +5086,6 @@
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"whatwg-fetch": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz",
"integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ="
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+3 -2
View File
@@ -24,12 +24,13 @@
"nodemon": "^1.18.4"
},
"dependencies": {
"apollo-fetch": "^0.7.0",
"apollo-link-http": "^1.5.5",
"apollo-server-express": "^1.1.0",
"body-parser": "^1.18.3",
"dotenv": "^6.1.0",
"express": "^4.16.3",
"graphql": "^14.0.2",
"graphql-tools": "^4.0.0"
"graphql-tools": "^4.0.0",
"node-fetch": "^2.2.0"
}
}
+14 -7
View File
@@ -3,19 +3,26 @@ import bodyParser from 'body-parser'
import 'dotenv/config'
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express'
import { makeRemoteExecutableSchema, mergeSchemas, introspectSchema } from 'graphql-tools'
import { createApolloFetch } from 'apollo-fetch'
import fetch from 'node-fetch'
import { createHttpLink } from 'apollo-link-http'
async function run () {
const createRemoteSchema = async (uri) => {
const fetcher = createApolloFetch({ uri })
const makeDatabaseServiceLink = () => createHttpLink({
uri: uri,
fetch
})
const databaseServiceSchemaDefinition = await introspectSchema(makeDatabaseServiceLink())
return makeRemoteExecutableSchema({
schema: await introspectSchema(fetcher),
fetcher
schema: databaseServiceSchemaDefinition,
link: makeDatabaseServiceLink()
})
}
const teamsSchema = await createRemoteSchema(process.env.TEAMS_API_URL)
console.log(teamsSchema)
// const usersSchema = await createRemoteSchema(process.env.USERS_API_URL)
const keyvaultSchema = await createRemoteSchema(process.env.KEYVAULT_API_URL)
// const usersSchema = await createRemoteSchema(process.env.USERS_API_URL)
// const keyvaultSchema = await createRemoteSchema(process.env.KEYVAULT_API_URL)
@@ -28,7 +35,7 @@ async function run () {
// `
const schema = mergeSchemas({
schemas: [teamsSchema]
schemas: [teamsSchema, keyvaultSchema]
// schemas: [teamsSchema, usersSchema, keyvaultSchema, linkSchemaDefs],
// resolvers: mergeInfo => ({
// Team: {
@@ -58,7 +65,7 @@ async function run () {
graphiqlExpress({
endpointURL: '/graphql',
query: `
query {
{
teams{
edges{
node{