From b2e86465348089182fa4678649c2e4453f93d742 Mon Sep 17 00:00:00 2001 From: gilgardosh Date: Thu, 5 Jan 2023 17:39:37 +0200 Subject: [PATCH] more! --- examples/hive-example/.gitignore | 1 - .../hive-example/sources/authors/openapi.yaml | 1 - packages/types/src/config.ts | 2 +- .../getting-started/customize-mesh-server.mdx | 3 +- .../getting-started/deploy-mesh-gateway.mdx | 14 +++---- website/src/pages/docs/guides/hive.mdx | 38 +++++++++++-------- website/src/pages/docs/handlers/graphql.mdx | 5 ++- website/src/pages/docs/handlers/openapi.mdx | 5 ++- 8 files changed, 38 insertions(+), 31 deletions(-) diff --git a/examples/hive-example/.gitignore b/examples/hive-example/.gitignore index a88040bce2fa5..6b46220957e56 100644 --- a/examples/hive-example/.gitignore +++ b/examples/hive-example/.gitignore @@ -1,3 +1,2 @@ hive.json .env - diff --git a/examples/hive-example/sources/authors/openapi.yaml b/examples/hive-example/sources/authors/openapi.yaml index 1777da030cb52..77fb653aa0242 100644 --- a/examples/hive-example/sources/authors/openapi.yaml +++ b/examples/hive-example/sources/authors/openapi.yaml @@ -47,4 +47,3 @@ components: email: type: string format: email - diff --git a/packages/types/src/config.ts b/packages/types/src/config.ts index 7ca8a688f18de..a6ed9a2b52c75 100644 --- a/packages/types/src/config.ts +++ b/packages/types/src/config.ts @@ -232,7 +232,7 @@ export interface GraphQLHandlerHTTPConfiguration { /** * URL to your endpoint serving all subscription queries for this source */ - subscriptionsEndpoint: string + subscriptionsEndpoint: string; /** * Retry attempts if fails */ diff --git a/website/src/pages/docs/getting-started/customize-mesh-server.mdx b/website/src/pages/docs/getting-started/customize-mesh-server.mdx index a60c4047fb9c1..744839d6f1ef6 100644 --- a/website/src/pages/docs/getting-started/customize-mesh-server.mdx +++ b/website/src/pages/docs/getting-started/customize-mesh-server.mdx @@ -62,4 +62,5 @@ import API from '../../../generated-markdown/ServeConfig.generated.md' ## Provide a standalone server implementation -Creation of own server with Mesh Gateway and its deployment is described in [Deploy a Mesh Gateway](/docs/getting-started/deploy-mesh-gateway) +Creation of own server with Mesh Gateway and its deployment is described in +[Deploy a Mesh Gateway](/docs/getting-started/deploy-mesh-gateway) diff --git a/website/src/pages/docs/getting-started/deploy-mesh-gateway.mdx b/website/src/pages/docs/getting-started/deploy-mesh-gateway.mdx index 6d9bb8e258098..db3866fa7568f 100644 --- a/website/src/pages/docs/getting-started/deploy-mesh-gateway.mdx +++ b/website/src/pages/docs/getting-started/deploy-mesh-gateway.mdx @@ -79,8 +79,8 @@ import { createBuiltMeshHTTPHandler } from './.mesh' export default createBuiltMeshHTTPHandler() ``` -Path `./.mesh` refers to built Mesh folder that should be available in your project root -(together with your project `package.json`) +Path `./.mesh` refers to built Mesh folder that should be available in your project root (together +with your project `package.json`) ### Deploy Mesh on AWS Lambda @@ -98,7 +98,7 @@ const meshHTTP = createBuiltMeshHTTPHandler() export async function handler( event: APIGatewayEvent, - lambdaContext: Context, + lambdaContext: Context ): Promise { const url = new URL(event.path, 'http://localhost') if (event.queryStringParameters != null) { @@ -117,12 +117,12 @@ export async function handler( headers: event.headers as HeadersInit, body: event.body ? Buffer.from(event.body, event.isBase64Encoded ? 'base64' : 'utf8') - : undefined, + : undefined }, { event, - lambdaContext, - }, + lambdaContext + } ) const responseHeaders: Record = {} @@ -135,7 +135,7 @@ export async function handler( statusCode: response.status, headers: responseHeaders, body: await response.text(), - isBase64Encoded: false, + isBase64Encoded: false } } ``` diff --git a/website/src/pages/docs/guides/hive.mdx b/website/src/pages/docs/guides/hive.mdx index 1ed240d0db38b..02ea4d5e81ac4 100644 --- a/website/src/pages/docs/guides/hive.mdx +++ b/website/src/pages/docs/guides/hive.mdx @@ -2,35 +2,38 @@ import { Callout, PackageCmd } from '@theguild/components' # GraphQL Hive Integration -GraphQL Hive is a schema registry, monitoring and analytics tool for your GraphQL API, and it is possible to integrate your GraphQL Mesh application to GraphQL Hive by using the dedicated plugins and transforms. +GraphQL Hive is a schema registry, monitoring and analytics tool for your GraphQL API, and it is +possible to integrate your GraphQL Mesh application to GraphQL Hive by using the dedicated plugins +and transforms. ## Track your Gateway -You can connect your GraphQL Mesh gateway to GraphQL Hive to GraphQL Hive registry to track changes on the unified schema and monitor the operations done by the clients. +You can connect your GraphQL Mesh gateway to GraphQL Hive to GraphQL Hive registry to track changes +on the unified schema and monitor the operations done by the clients. ```yaml filename=".meshrc.yaml" plugins: - hive: - token: "{env.HIVE_TOKEN}" + token: '{env.HIVE_TOKEN}' ``` - - You have to create a project on GraphQL Hive and get an access token - +You have to create a project on GraphQL Hive and get an access token ## Publish and check the gateway schema -Everytime you build GraphQL Mesh gateway, you can find human-readable SDL version of your schema under `.mesh/schema.graphql`. -You can configure your CI to publish and check your schema automatically by using Hive CLI. +Everytime you build GraphQL Mesh gateway, you can find human-readable SDL version of your schema +under `.mesh/schema.graphql`. You can configure your CI to publish and check your schema +automatically by using Hive CLI. [Learn more about managing the schema using GraphQL Hive CLI](https://docs.graphql-hive.com/features/publish-schema#using-hive-cli) ## Track your sources -GraphQL Mesh creates GraphQL APIs from non GraphQL APIs, and it is still possible to register these to GraphQL Hive as a regular GraphQL API. -GraphQL Hive transform hooks into the delegation phase to track operations done to the upstream APIs. +GraphQL Mesh creates GraphQL APIs from non GraphQL APIs, and it is still possible to register these +to GraphQL Hive as a regular GraphQL API. GraphQL Hive transform hooks into the delegation phase to +track operations done to the upstream APIs. @@ -41,14 +44,15 @@ sources: openapi: source: ./openapi.json transforms: - - hive: - token: "{env.MYOAS_HIVE_TOKEN}" + - hive: + token: '{env.MYOAS_HIVE_TOKEN}' ``` ## Publish the source schema seperately then consume it in the gateway -Let's say you have different repos on each service and you want to publish the schema on these repos, and keep the configuration for these services there. -And the gateway will consume these schemas and merge them together. +Let's say you have different repos on each service and you want to publish the schema on these +repos, and keep the configuration for these services there. And the gateway will consume these +schemas and merge them together. ### Step 1: Create a project for the service @@ -80,13 +84,15 @@ You need to install GraphQL Hive CLI and configure it with the token you already [See how to install Hive CLI](https://docs.graphql-hive.com/features/publish-schema#using-hive-cli) -Then you need to run `mesh build` like you do on the gateway to generate the schema, so GraphQL Hive CLI can publish it. +Then you need to run `mesh build` like you do on the gateway to generate the schema, so GraphQL Hive +CLI can publish it. Finally, you can publish the schema `hive schema:publish .mesh/sources/FooService/schema.graphql` ### Step 4: Create Hive CDN URL and token for the service -Go to the service project and click `Connect` on the right top of the page. Copy the URL and header then paste it to the `.meshrc.yml` file. +Go to the service project and click `Connect` on the right top of the page. Copy the URL and header +then paste it to the `.meshrc.yml` file. ```yaml sources: diff --git a/website/src/pages/docs/handlers/graphql.mdx b/website/src/pages/docs/handlers/graphql.mdx index ce4a901d97071..c259a848a6689 100644 --- a/website/src/pages/docs/handlers/graphql.mdx +++ b/website/src/pages/docs/handlers/graphql.mdx @@ -53,7 +53,8 @@ sources: ### Hive Integration -If you use [GraphQL Hive](https://graphql-hive.com/) to manage your GraphQL APIs as a schema registry, you can use the following configuration to fetch your schema from Hive: +If you use [GraphQL Hive](https://graphql-hive.com/) to manage your GraphQL APIs as a schema +registry, you can use the following configuration to fetch your schema from Hive: ```yaml filename=".meshrc.yaml" sources: @@ -63,7 +64,7 @@ sources: endpoint: https://my-api.com/graphql source: https://cdn.graphql-hive.com/asce7c12-753d-hive-bee-d7f2c803e232/sdl?ext=.graphql schemaHeaders: - X-Hive-CDN-Key: "aabTxbEyC78NvSPQNO+qLrrRnBvODJJ8k4sL/2EtIwc=" + X-Hive-CDN-Key: 'aabTxbEyC78NvSPQNO+qLrrRnBvODJJ8k4sL/2EtIwc=' ``` ## Local Schemas diff --git a/website/src/pages/docs/handlers/openapi.mdx b/website/src/pages/docs/handlers/openapi.mdx index 4b41bc513218b..1f8aa94d03dd6 100644 --- a/website/src/pages/docs/handlers/openapi.mdx +++ b/website/src/pages/docs/handlers/openapi.mdx @@ -201,7 +201,8 @@ Also see our example; ## Loading the sources from a CDN like GraphQL Hive or schema registry -GraphQL Mesh supports loading the sources from a CDN or schema registry. You can use the `source` property to load the schema from a CDN or schema registry. +GraphQL Mesh supports loading the sources from a CDN or schema registry. You can use the `source` +property to load the schema from a CDN or schema registry. ```yaml filename=".meshrc.yaml" sources: @@ -210,7 +211,7 @@ sources: openapi: source: https://cdn.graphql-hive.com/asce7c12-753d-hive-bee-d7f2c803e232/sdl?ext=.graphql schemaHeaders: - X-Hive-CDN-Key: "aabTxbEyC78NvSPQNO+qLrrRnBvODJJ8k4sL/2EtIwc=" + X-Hive-CDN-Key: 'aabTxbEyC78NvSPQNO+qLrrRnBvODJJ8k4sL/2EtIwc=' ``` ## Examples