@teambit/graphql 1.0.1173 → 1.0.1174
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.
|
@@ -5,7 +5,6 @@ import { makeRemoteExecutableSchema, introspectSchema } from 'apollo-server';
|
|
|
5
5
|
import { WebSocketLink } from 'apollo-link-ws';
|
|
6
6
|
import { split, ApolloLink } from 'apollo-link';
|
|
7
7
|
import { getMainDefinition } from 'apollo-utilities';
|
|
8
|
-
import { SubscriptionClient } from 'subscriptions-transport-ws';
|
|
9
8
|
import ws from 'ws';
|
|
10
9
|
import type { GraphQLServer } from '../graphql-server';
|
|
11
10
|
|
|
@@ -36,9 +35,17 @@ async function getRemoteSchema({ uri, subscriptionsUri }) {
|
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// Pass the config rather than a pre-built SubscriptionClient. WebSocketLink tells the two
|
|
39
|
+
// apart with `paramsOrClient instanceof SubscriptionClient`, and that check fails whenever
|
|
40
|
+
// apollo-link-ws resolves a different physical copy of subscriptions-transport-ws than this
|
|
41
|
+
// file does - which a hoisted node_modules layout produces as soon as two versions of the
|
|
42
|
+
// package end up in the tree. It then reads `.uri` off the client (a real one stores `.url`),
|
|
43
|
+
// so the client is built with an undefined URL and `new URL(undefined)` throws.
|
|
44
|
+
const wsLink = new WebSocketLink({
|
|
45
|
+
uri: subscriptionsUri,
|
|
46
|
+
options: { reconnect: true },
|
|
47
|
+
webSocketImpl: ws,
|
|
48
|
+
});
|
|
42
49
|
|
|
43
50
|
// Using the ability to split links, we can send data to each link
|
|
44
51
|
// depending on what kind of operation is being sent
|
|
@@ -53,13 +53,6 @@ function _apolloUtilities() {
|
|
|
53
53
|
};
|
|
54
54
|
return data;
|
|
55
55
|
}
|
|
56
|
-
function _subscriptionsTransportWs() {
|
|
57
|
-
const data = require("subscriptions-transport-ws");
|
|
58
|
-
_subscriptionsTransportWs = function () {
|
|
59
|
-
return data;
|
|
60
|
-
};
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
56
|
function _ws() {
|
|
64
57
|
const data = _interopRequireDefault(require("ws"));
|
|
65
58
|
_ws = function () {
|
|
@@ -98,11 +91,19 @@ async function getRemoteSchema({
|
|
|
98
91
|
});
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
94
|
+
// Pass the config rather than a pre-built SubscriptionClient. WebSocketLink tells the two
|
|
95
|
+
// apart with `paramsOrClient instanceof SubscriptionClient`, and that check fails whenever
|
|
96
|
+
// apollo-link-ws resolves a different physical copy of subscriptions-transport-ws than this
|
|
97
|
+
// file does - which a hoisted node_modules layout produces as soon as two versions of the
|
|
98
|
+
// package end up in the tree. It then reads `.uri` off the client (a real one stores `.url`),
|
|
99
|
+
// so the client is built with an undefined URL and `new URL(undefined)` throws.
|
|
100
|
+
const wsLink = new (_apolloLinkWs().WebSocketLink)({
|
|
101
|
+
uri: subscriptionsUri,
|
|
102
|
+
options: {
|
|
103
|
+
reconnect: true
|
|
104
|
+
},
|
|
105
|
+
webSocketImpl: _ws().default
|
|
106
|
+
});
|
|
106
107
|
|
|
107
108
|
// Using the ability to split links, we can send data to each link
|
|
108
109
|
// depending on what kind of operation is being sent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nodeFetch","data","_interopRequireDefault","require","_apolloLinkContext","_apolloLinkHttp","_apolloServer","_apolloLinkWs","_apolloLink","_apolloUtilities","
|
|
1
|
+
{"version":3,"names":["_nodeFetch","data","_interopRequireDefault","require","_apolloLinkContext","_apolloLinkHttp","_apolloServer","_apolloLinkWs","_apolloLink","_apolloUtilities","_ws","e","__esModule","default","getRemoteSchema","uri","subscriptionsUri","wrappingLink","ApolloLink","operation","forward","map","response","context","getContext","headers","get","graphqlContext","res","setHeader","http","HttpLink","fetch","httpLink","setContext","request","previousContext","concat","makeRemoteExecutableSchema","schema","introspectSchema","link","wsLink","WebSocketLink","options","reconnect","webSocketImpl","ws","split","definition","getMainDefinition","query","kind","createRemoteSchemas","servers","schemasP","server","Promise","all"],"sources":["create-remote-schemas.ts"],"sourcesContent":["import fetch from 'node-fetch';\nimport { setContext } from 'apollo-link-context';\nimport { HttpLink } from 'apollo-link-http';\nimport { makeRemoteExecutableSchema, introspectSchema } from 'apollo-server';\nimport { WebSocketLink } from 'apollo-link-ws';\nimport { split, ApolloLink } from 'apollo-link';\nimport { getMainDefinition } from 'apollo-utilities';\nimport ws from 'ws';\nimport type { GraphQLServer } from '../graphql-server';\n\nasync function getRemoteSchema({ uri, subscriptionsUri }) {\n const wrappingLink = new ApolloLink((operation, forward) => {\n return forward(operation).map((response) => {\n const context = operation.getContext();\n if (context?.response?.headers?.get('set-cookie')) {\n context?.graphqlContext?.res?.setHeader('set-cookie', context?.response?.headers?.get('set-cookie'));\n }\n return response;\n });\n });\n // @ts-ignore\n const http = new HttpLink({ uri, fetch });\n const httpLink = setContext((request, previousContext) => {\n return {\n headers: previousContext?.graphqlContext?.headers,\n };\n })\n .concat(wrappingLink)\n .concat(http);\n\n if (!subscriptionsUri) {\n return makeRemoteExecutableSchema({\n schema: await introspectSchema(httpLink),\n link: httpLink,\n });\n }\n\n // Pass the config rather than a pre-built SubscriptionClient. WebSocketLink tells the two\n // apart with `paramsOrClient instanceof SubscriptionClient`, and that check fails whenever\n // apollo-link-ws resolves a different physical copy of subscriptions-transport-ws than this\n // file does - which a hoisted node_modules layout produces as soon as two versions of the\n // package end up in the tree. It then reads `.uri` off the client (a real one stores `.url`),\n // so the client is built with an undefined URL and `new URL(undefined)` throws.\n const wsLink = new WebSocketLink({\n uri: subscriptionsUri,\n options: { reconnect: true },\n webSocketImpl: ws,\n });\n\n // Using the ability to split links, we can send data to each link\n // depending on what kind of operation is being sent\n const link = split(\n (operation) => {\n const definition = getMainDefinition(operation.query);\n return definition.kind === 'OperationDefinition' && definition.operation === 'subscription';\n },\n wsLink,\n httpLink\n );\n\n return makeRemoteExecutableSchema({\n schema: await introspectSchema(httpLink),\n link,\n });\n}\n\nexport async function createRemoteSchemas(servers: GraphQLServer[]) {\n const schemasP = servers.map(async (server) => {\n return getRemoteSchema({\n uri: server.uri,\n subscriptionsUri: server.subscriptionsUri,\n });\n });\n\n return Promise.all(schemasP);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,cAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,iBAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,gBAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,IAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,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AAC;EACJ;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMS,MAAM,GAAG,KAAIC,6BAAa,EAAC;IAC/B5B,GAAG,EAAEC,gBAAgB;IACrB4B,OAAO,EAAE;MAAEC,SAAS,EAAE;IAAK,CAAC;IAC5BC,aAAa,EAAEC;EACjB,CAAC,CAAC;;EAEF;EACA;EACA,MAAMN,IAAI,GAAG,IAAAO,mBAAK,EACf7B,SAAS,IAAK;IACb,MAAM8B,UAAU,GAAG,IAAAC,oCAAiB,EAAC/B,SAAS,CAACgC,KAAK,CAAC;IACrD,OAAOF,UAAU,CAACG,IAAI,KAAK,qBAAqB,IAAIH,UAAU,CAAC9B,SAAS,KAAK,cAAc;EAC7F,CAAC,EACDuB,MAAM,EACNT,QACF,CAAC;EAED,OAAO,IAAAK,0CAA0B,EAAC;IAChCC,MAAM,EAAE,MAAM,IAAAC,gCAAgB,EAACP,QAAQ,CAAC;IACxCQ;EACF,CAAC,CAAC;AACJ;AAEO,eAAeY,mBAAmBA,CAACC,OAAwB,EAAE;EAClE,MAAMC,QAAQ,GAAGD,OAAO,CAACjC,GAAG,CAAC,MAAOmC,MAAM,IAAK;IAC7C,OAAO1C,eAAe,CAAC;MACrBC,GAAG,EAAEyC,MAAM,CAACzC,GAAG;MACfC,gBAAgB,EAAEwC,MAAM,CAACxC;IAC3B,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOyC,OAAO,CAACC,GAAG,CAACH,QAAQ,CAAC;AAC9B","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_graphql@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_graphql@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_graphql@1.0.1174/dist/graphql.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_graphql@1.0.1174/dist/graphql.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/graphql",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1174",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/graphql",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "graphql",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1174"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@graphql-modules/core": "0.7.17",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"graphql-disable-introspection": "^1.2.0",
|
|
18
18
|
"graphql-subscriptions": "1.2.0",
|
|
19
19
|
"http-proxy": "1.18.1",
|
|
20
|
-
"subscriptions-transport-ws": "0.9.
|
|
20
|
+
"subscriptions-transport-ws": "0.9.19",
|
|
21
21
|
"cross-fetch": "3.1.5",
|
|
22
22
|
"lodash": "4.17.21",
|
|
23
23
|
"apollo-link-context": "1.0.20",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@teambit/logger": "0.0.1486",
|
|
36
36
|
"@teambit/toolbox.network.get-port": "1.0.28",
|
|
37
37
|
"@teambit/ui-foundation.ui.is-browser": "0.0.500",
|
|
38
|
-
"@teambit/ui": "1.0.
|
|
38
|
+
"@teambit/ui": "1.0.1174"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/cors": "2.8.10",
|