@teambit/graphql 1.0.649 → 1.0.651
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_ui","_client","_ws","_error","_crossFetch","_createLink","_graphqlProvider","_graphql","_renderLifecycle","_logging","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GraphqlUI","constructor","client","children","createElement","GraphQLProvider","GraphqlRenderPlugins","createClient","uri","state","subscriptionUri","host","defaultOptions","query","fetchPolicy","watchQuery","mutate","undefined","ApolloClient","link","createLink","cache","createCache","createSsrClient","serverUrl","headers","ApolloLink","from","onError","logError","createHttpLink","credentials","fetch","crossFetch","ssrMode","InMemoryCache","restore","httpLink","HttpLink","subsLink","WebSocketLink","options","reconnect","hybridLink","createSplitLink","errorLogger","provider","graphqlUI","exports","UIRuntime","GraphqlAspect","addRuntime"],"sources":["graphql.ui.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { UIRuntime } from '@teambit/ui';\n\nimport { InMemoryCache, ApolloClient, ApolloLink, HttpLink, createHttpLink } from '@apollo/client';\nimport type { DefaultOptions, NormalizedCacheObject } from '@apollo/client';\nimport { WebSocketLink } from '@apollo/client/link/ws';\nimport { onError } from '@apollo/client/link/error';\n\nimport crossFetch from 'cross-fetch';\n\nimport { createSplitLink } from './create-link';\nimport { GraphQLProvider } from './graphql-provider';\nimport { GraphqlAspect } from './graphql.aspect';\nimport { GraphqlRenderPlugins } from './render-lifecycle';\nimport { logError } from './logging';\n\n/**\n * Type of gql client.\n * Used to abstract Apollo client, so consumers could import the type from graphql.ui, and not have to depend on @apollo/client directly\n * */\nexport type GraphQLClient<T> = ApolloClient<T>;\n\ntype ClientOptions = {\n /** Preset in-memory cache with state (e.g. continue state from SSR) */\n state?: NormalizedCacheObject;\n /** endpoint for websocket connections */\n subscriptionUri?: string;\n /** host extension id (workspace or scope). Used to configure the client */\n host?: string;\n};\n\nexport class GraphqlUI {\n createClient(uri: string, { state, subscriptionUri, host }: ClientOptions = {}) {\n const defaultOptions: DefaultOptions | undefined
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_ui","_client","_ws","_error","_crossFetch","_createLink","_graphqlProvider","_graphql","_renderLifecycle","_logging","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GraphqlUI","constructor","client","children","createElement","GraphQLProvider","GraphqlRenderPlugins","createClient","uri","state","subscriptionUri","host","defaultOptions","query","fetchPolicy","watchQuery","mutate","undefined","ApolloClient","link","createLink","cache","createCache","createSsrClient","serverUrl","headers","ApolloLink","from","onError","logError","createHttpLink","credentials","fetch","crossFetch","ssrMode","InMemoryCache","restore","httpLink","HttpLink","subsLink","WebSocketLink","options","reconnect","hybridLink","createSplitLink","errorLogger","provider","graphqlUI","exports","UIRuntime","GraphqlAspect","addRuntime"],"sources":["graphql.ui.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { UIRuntime } from '@teambit/ui';\n\nimport { InMemoryCache, ApolloClient, ApolloLink, HttpLink, createHttpLink } from '@apollo/client';\nimport type { DefaultOptions, NormalizedCacheObject } from '@apollo/client';\nimport { WebSocketLink } from '@apollo/client/link/ws';\nimport { onError } from '@apollo/client/link/error';\n\nimport crossFetch from 'cross-fetch';\n\nimport { createSplitLink } from './create-link';\nimport { GraphQLProvider } from './graphql-provider';\nimport { GraphqlAspect } from './graphql.aspect';\nimport { GraphqlRenderPlugins } from './render-lifecycle';\nimport { logError } from './logging';\n\n/**\n * Type of gql client.\n * Used to abstract Apollo client, so consumers could import the type from graphql.ui, and not have to depend on @apollo/client directly\n * */\nexport type GraphQLClient<T> = ApolloClient<T>;\n\ntype ClientOptions = {\n /** Preset in-memory cache with state (e.g. continue state from SSR) */\n state?: NormalizedCacheObject;\n /** endpoint for websocket connections */\n subscriptionUri?: string;\n /** host extension id (workspace or scope). Used to configure the client */\n host?: string;\n};\n\nexport class GraphqlUI {\n createClient(uri: string, { state, subscriptionUri, host }: ClientOptions = {}) {\n const defaultOptions: DefaultOptions | undefined =\n host === 'teambit.workspace/workspace'\n ? {\n query: {\n fetchPolicy: 'network-only',\n },\n watchQuery: {\n fetchPolicy: 'network-only',\n },\n mutate: {\n fetchPolicy: 'network-only',\n },\n }\n : undefined;\n const client = new ApolloClient({\n link: this.createLink(uri, { subscriptionUri }),\n cache: this.createCache({ state }),\n defaultOptions,\n });\n\n return client;\n }\n\n createSsrClient({ serverUrl, headers }: { serverUrl: string; headers: any }) {\n const link = ApolloLink.from([\n onError(logError),\n createHttpLink({\n credentials: 'include',\n uri: serverUrl,\n headers,\n fetch: crossFetch,\n }),\n ]);\n\n const client = new ApolloClient({\n ssrMode: true,\n link,\n cache: this.createCache(),\n });\n\n return client;\n }\n\n private createCache({ state }: { state?: NormalizedCacheObject } = {}) {\n const cache = new InMemoryCache();\n\n if (state) cache.restore(state);\n\n return cache;\n }\n\n private createLink(uri: string, { subscriptionUri }: { subscriptionUri?: string } = {}) {\n const httpLink = new HttpLink({ credentials: 'include', uri });\n const subsLink = subscriptionUri\n ? new WebSocketLink({\n uri: subscriptionUri,\n options: { reconnect: true },\n })\n : undefined;\n\n const hybridLink = subsLink ? createSplitLink(httpLink, subsLink) : httpLink;\n const errorLogger = onError(logError);\n\n return ApolloLink.from([errorLogger, hybridLink]);\n }\n\n /**\n * get the graphQL provider\n */\n getProvider = ({ client, children }: { client: GraphQLClient<any>; children: ReactNode }) => {\n return <GraphQLProvider client={client}>{children}</GraphQLProvider>;\n };\n\n readonly renderPlugins = new GraphqlRenderPlugins(this);\n\n static runtime = UIRuntime;\n static dependencies = [];\n static slots = [];\n\n static async provider() {\n const graphqlUI = new GraphqlUI();\n\n return graphqlUI;\n }\n}\n\n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ules/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.651/dist/graphql.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_graphql@1.0.651/dist/graphql.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_ssr","_server","_lodash","_uiFoundationUi","_graphqlProvider","_graphql","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ALLOWED_HEADERS","GraphqlRenderPlugins","constructor","graphqlUI","GraphqlAspect","id","browser","port","location","serverUrl","client","createSsrClient","headers","pick","ctx","app","getMarkupFromTree","tree","renderFunction","ReactDOMServer","renderToStaticMarkup","undefined","json","JSON","stringify","extract","raw","state","parse","console","error","host","window","isInsecure","protocol","wsUrl","createClient","subscriptionUri","_client","renderCtx","children","createElement","getProvider","isBrowser","BrowserGqlProvider","ServerGqlProvider","getClient","browserInit","exports","GraphQLProvider"],"sources":["render-lifecycle.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n// Calling getMarkupFromTree instead of getDataFromTree so we can control the render function\n// This is required since upgrade to @apollo/client v3.6.9 because otherwise the ssr is not working since\n// webpack is not bundling the react-dom/server\nimport { getMarkupFromTree } from '@apollo/client/react/ssr';\nimport ReactDOMServer from 'react-dom/server';\nimport type { ApolloClient, NormalizedCacheObject } from '@apollo/client';\nimport { pick } from 'lodash';\n\nimport { isBrowser } from '@teambit/ui-foundation.ui.is-browser';\nimport type { SSR } from '@teambit/ui';\n\nimport type { GraphqlUI, GraphQLClient } from './graphql.ui.runtime';\nimport { GraphQLProvider } from './graphql-provider';\nimport { GraphqlAspect } from './graphql.aspect';\n\ntype RenderContext = {\n client: GraphQLClient<any>;\n};\n\nconst ALLOWED_HEADERS = ['cookie'];\n\nexport class GraphqlRenderPlugins implements SSR.RenderPlugin<RenderContext, { state?: NormalizedCacheObject }> {\n constructor(private graphqlUI: GraphqlUI) {
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_ssr","_server","_lodash","_uiFoundationUi","_graphqlProvider","_graphql","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ALLOWED_HEADERS","GraphqlRenderPlugins","constructor","graphqlUI","GraphqlAspect","id","browser","port","location","serverUrl","client","createSsrClient","headers","pick","ctx","app","getMarkupFromTree","tree","renderFunction","ReactDOMServer","renderToStaticMarkup","undefined","json","JSON","stringify","extract","raw","state","parse","console","error","host","window","isInsecure","protocol","wsUrl","createClient","subscriptionUri","_client","renderCtx","children","createElement","getProvider","isBrowser","BrowserGqlProvider","ServerGqlProvider","getClient","browserInit","exports","GraphQLProvider"],"sources":["render-lifecycle.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n// Calling getMarkupFromTree instead of getDataFromTree so we can control the render function\n// This is required since upgrade to @apollo/client v3.6.9 because otherwise the ssr is not working since\n// webpack is not bundling the react-dom/server\nimport { getMarkupFromTree } from '@apollo/client/react/ssr';\nimport ReactDOMServer from 'react-dom/server';\nimport type { ApolloClient, NormalizedCacheObject } from '@apollo/client';\nimport { pick } from 'lodash';\n\nimport { isBrowser } from '@teambit/ui-foundation.ui.is-browser';\nimport type { SSR } from '@teambit/ui';\n\nimport type { GraphqlUI, GraphQLClient } from './graphql.ui.runtime';\nimport { GraphQLProvider } from './graphql-provider';\nimport { GraphqlAspect } from './graphql.aspect';\n\ntype RenderContext = {\n client: GraphQLClient<any>;\n};\n\nconst ALLOWED_HEADERS = ['cookie'];\n\nexport class GraphqlRenderPlugins implements SSR.RenderPlugin<RenderContext, { state?: NormalizedCacheObject }> {\n constructor(private graphqlUI: GraphqlUI) {}\n\n key = GraphqlAspect.id;\n\n serverInit = ({ browser }: SSR.SsrSession) => {\n const port = browser?.location.port || 3000;\n const serverUrl = `http://localhost:${port}/graphql`;\n\n const client = this.graphqlUI.createSsrClient({\n serverUrl,\n headers: pick(browser?.headers, ALLOWED_HEADERS),\n });\n\n const ctx: RenderContext = { client };\n return ctx;\n };\n\n /**\n * Eagerly and recursively execute all gql queries in the app.\n * Data will be available in gqlClient.extract()\n */\n onBeforeRender = async (ctx: RenderContext, app: ReactNode) => {\n await getMarkupFromTree({ tree: app, renderFunction: ReactDOMServer.renderToStaticMarkup });\n };\n\n serialize = (ctx?: RenderContext) => {\n const client = ctx?.client;\n if (!client) return undefined;\n\n return {\n json: JSON.stringify(client.extract()),\n };\n };\n\n deserialize = (raw?: string) => {\n if (!raw) return { state: undefined };\n let state: NormalizedCacheObject | undefined;\n try {\n state = JSON.parse(raw);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('[GraphQL] failed deserializing state from DOM', e);\n }\n\n return { state };\n };\n\n private _client: ApolloClient<NormalizedCacheObject> | undefined = undefined;\n\n browserInit = ({ state }: { state?: NormalizedCacheObject } = {}, { host }: { host?: string } = {}) => {\n const { location } = window;\n const isInsecure = location.protocol === 'http:';\n const wsUrl = `${isInsecure ? 'ws:' : 'wss:'}//${location.host}/subscriptions`;\n\n const client = this.graphqlUI.createClient('/graphql', { state, subscriptionUri: wsUrl, host });\n this._client = client;\n\n return { client };\n };\n\n getClient() {\n if (!this._client) return this.browserInit().client;\n return this._client;\n }\n\n private BrowserGqlProvider = ({ renderCtx, children }: { renderCtx?: RenderContext; children: ReactNode }) => {\n if (!renderCtx?.client) throw new TypeError('GQL client is not initialized, make sure `.browserInit()` executes');\n\n return <this.graphqlUI.getProvider client={renderCtx?.client}>{children}</this.graphqlUI.getProvider>;\n };\n\n reactContext = isBrowser ? this.BrowserGqlProvider : ServerGqlProvider;\n}\n\nfunction ServerGqlProvider({ renderCtx, children }: { renderCtx?: RenderContext; children: ReactNode }) {\n if (!renderCtx?.client)\n throw new TypeError('GQL client has not been initialized during SSR, make sure `.serverInit()` executes');\n\n const { client } = renderCtx;\n return <GraphQLProvider client={client}>{children}</GraphQLProvider>;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,gBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,eAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,iBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,gBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiD,SAAAC,uBAAAQ,CAAA,WAAAA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B,CAAC;AACtE","ignoreList":[]}
|
package/graphql.ui.runtime.tsx
CHANGED
@@ -31,21 +31,24 @@ type ClientOptions = {
|
|
31
31
|
|
32
32
|
export class GraphqlUI {
|
33
33
|
createClient(uri: string, { state, subscriptionUri, host }: ClientOptions = {}) {
|
34
|
-
const defaultOptions: DefaultOptions | undefined =
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
34
|
+
const defaultOptions: DefaultOptions | undefined =
|
35
|
+
host === 'teambit.workspace/workspace'
|
36
|
+
? {
|
37
|
+
query: {
|
38
|
+
fetchPolicy: 'network-only',
|
39
|
+
},
|
40
|
+
watchQuery: {
|
41
|
+
fetchPolicy: 'network-only',
|
42
|
+
},
|
43
|
+
mutate: {
|
44
|
+
fetchPolicy: 'network-only',
|
45
|
+
},
|
46
|
+
}
|
47
|
+
: undefined;
|
45
48
|
const client = new ApolloClient({
|
46
49
|
link: this.createLink(uri, { subscriptionUri }),
|
47
50
|
cache: this.createCache({ state }),
|
48
|
-
defaultOptions
|
51
|
+
defaultOptions,
|
49
52
|
});
|
50
53
|
|
51
54
|
return client;
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/graphql",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.651",
|
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.651"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"@graphql-modules/core": "0.7.17",
|
@@ -32,10 +32,10 @@
|
|
32
32
|
"bufferutil": "4.0.3",
|
33
33
|
"@teambit/harmony": "0.4.7",
|
34
34
|
"@teambit/ui-foundation.ui.is-browser": "0.0.500",
|
35
|
-
"@teambit/cli": "0.0.
|
36
|
-
"@teambit/logger": "0.0.
|
35
|
+
"@teambit/cli": "0.0.1228",
|
36
|
+
"@teambit/logger": "0.0.1321",
|
37
37
|
"@teambit/toolbox.network.get-port": "1.0.10",
|
38
|
-
"@teambit/ui": "1.0.
|
38
|
+
"@teambit/ui": "1.0.651"
|
39
39
|
},
|
40
40
|
"devDependencies": {
|
41
41
|
"@types/cors": "2.8.10",
|
@@ -45,10 +45,10 @@
|
|
45
45
|
"@types/node-fetch": "2.5.12",
|
46
46
|
"@types/mocha": "9.1.0",
|
47
47
|
"@teambit/harmony.envs.core-aspect-env": "0.0.69",
|
48
|
-
"@teambit/harmony.testing.load-aspect": "0.0.
|
49
|
-
"@teambit/lanes": "1.0.
|
50
|
-
"@teambit/workspace.testing.mock-workspace": "0.0.
|
51
|
-
"@teambit/workspace": "1.0.
|
48
|
+
"@teambit/harmony.testing.load-aspect": "0.0.314",
|
49
|
+
"@teambit/lanes": "1.0.652",
|
50
|
+
"@teambit/workspace.testing.mock-workspace": "0.0.94",
|
51
|
+
"@teambit/workspace": "1.0.651"
|
52
52
|
},
|
53
53
|
"peerDependencies": {
|
54
54
|
"@apollo/client": "^3.6.0",
|
package/render-lifecycle.tsx
CHANGED
@@ -21,7 +21,7 @@ type RenderContext = {
|
|
21
21
|
const ALLOWED_HEADERS = ['cookie'];
|
22
22
|
|
23
23
|
export class GraphqlRenderPlugins implements SSR.RenderPlugin<RenderContext, { state?: NormalizedCacheObject }> {
|
24
|
-
constructor(private graphqlUI: GraphqlUI) {
|
24
|
+
constructor(private graphqlUI: GraphqlUI) {}
|
25
25
|
|
26
26
|
key = GraphqlAspect.id;
|
27
27
|
|