Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Jul 27, 2022
1 parent d7ca3cb commit 1165479
Show file tree
Hide file tree
Showing 15 changed files with 1,553 additions and 8,072 deletions.
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,23 @@
"packages/**/src/**/*.{ts,tsx}": [
"eslint --fix"
],
"**/*.{ts,tsx,graphql,yml,json,md,mdx,js}": [
"**/*.{ts,tsx,graphql,yml,json,md,js}": [
"prettier --write"
]
},
"workspaces": {
"packages": [
"./packages/*",
"./packages/cache/*",
"./packages/handlers/*",
"./packages/transforms/*",
"./packages/mergers/*",
"./packages/plugins/*",
"./examples/*",
"./examples/federation-example/*",
"./examples/graphql-file-upload-example/frontend",
"./website",
"./packages/loaders/*"
]
},
"workspaces": [
"./website",
"./packages/*",
"./packages/cache/*",
"./packages/handlers/*",
"./packages/transforms/*",
"./packages/mergers/*",
"./packages/plugins/*",
"./examples/*",
"./examples/federation-example/*",
"./examples/graphql-file-upload-example/frontend",
"./packages/loaders/*"
],
"resolutions": {
"graphql": "16.5.0",
"@changesets/apply-release-plan": "6.0.0"
Expand Down
16 changes: 16 additions & 0 deletions patches/guild-docs+3.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/node_modules/guild-docs/esm/mermaid.js b/node_modules/guild-docs/esm/mermaid.js
index 0c0a96a..f24e85b 100644
--- a/node_modules/guild-docs/esm/mermaid.js
+++ b/node_modules/guild-docs/esm/mermaid.js
@@ -1,6 +1,10 @@
import React, { useEffect, useState } from 'react';
import mermaid from 'mermaid';
-import { useTheme } from '@theguild/components';
+// Got error while running `next build`
+// > Build error occurred
+// Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/Users/dimitri/Desktop/GUILD/graphql-mesh/node_modules/@theguild/components/'
+// imported from /Users/dimitri/Desktop/GUILD/graphql-mesh/node_modules/guild-docs/esm/mermaid.js
+import { useTheme } from 'next-themes';
/**
* Assign a unique ID to each mermaid svg as per requirements of `mermaid.render`.
*/
5 changes: 4 additions & 1 deletion website/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { withGuildDocs } from 'guild-docs/next.config';

export default withGuildDocs({
eslint: {
ignoreDuringBuilds: true,
},
redirects: () => [
{
source: '/docs/introduction',
destination: '/docs',
permanent: true,
},
],
})
});
4 changes: 3 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "website",
"version": "0.8.2",
"type": "module",
"private": true,
"scripts": {
"algolia-sync": "node scripts/algolia-ci.mjs",
Expand Down Expand Up @@ -39,8 +40,9 @@
"@types/node": "18.6.1",
"@types/react": "18.0.15",
"cross-env": "7.0.3",
"eslint-config-next": "12.2.2",
"eslint-config-next": "12.2.3",
"postcss-import": "14.1.0",
"tailwindcss": "3.1.6",
"typescript": "4.7.4"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ The getting started ["Your first Gateway with Mesh"](/docs/getting-started/your-

This guide will show how to add 2 new sources (Authors and Stores) to achieve the following Gateway setup:

<components.Graph>

```mermaid
graph TD;
subgraph AA [" "]
A[Mobile app];
Expand All @@ -39,8 +38,7 @@ C --> Z;
Z --> E;
Z --> F;
Z --> G;

</components.Graph>
```

We will go further than just add new Sources by shaping the Unified Schema to accept the following query:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ GraphQL Mesh provides a **reliable and production-ready server implementation**

{/* TODO(charly): add links to "persisted queries" and "live queries" */}

<components.Graph>

```mermaid
graph LR;
subgraph A [GraphQL Mesh Gateway]
subgraph A1 [Sources]
Expand All @@ -35,8 +34,7 @@ A11 & A12 & A13 --> A22
A22 --> A21
A21 --> A34
A33 & A34 --> A35

</components.Graph>
```

Customizing your GraphQL Mesh Gateway server can be achieved in 2 ways:

Expand Down
6 changes: 2 additions & 4 deletions website/src/pages/docs/getting-started/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Working with Mesh means dealing with 4 main concepts: _Sources_, _Handlers_, _Tr
3. All Sources' GraphQL Schema are merged into a final _Unified Schema_.
4. Finally, if applicable, configured transformations, called _Transforms_, are applied to the _Unified Schema_.

<components.Graph>

```mermaid
graph LR;
subgraph A [GraphQL Mesh server]
A0[Unified Schema]
Expand Down Expand Up @@ -39,8 +38,7 @@ end
B11--translated to GraphQL Schemas by handler-->A111
B21--translated to GraphQL Schemas by handler-->A121
B31--translated to GraphQL Schemas by handler-->A311

</components.Graph>
```

The above GraphQL Mesh Gateway has 3 configured _Sources_:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Callout from 'nextra-theme-docs/callout'
import { Callout } from '@theguild/components'

# How to: Configure Sources with no definition

Expand All @@ -14,15 +14,14 @@ We will again use the ["Books" example REST API](https://github.com/charlypoly/g

However, let's pretend that the "Books" API is not providing any OpenAPI definition file:

<components.Graph>
```mermaid
graph TD;
subgraph BB [" "]
G[Books REST API without OpenAPI definition];
end
Z[Mesh Gateway GraphQL API]
Z --> G;

</components.Graph>
```

Once again, GraphQL Mesh gots you covered with the `@graphql-mesh/json-schema` handler that will help provide a definition of the API.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ All the documentation tutorials and guides rely on the "Books", "Authors" and "S

Our goal is to build a Unified GraphQL Schema through a Mesh Gateway that incorporates our 3 example services as follows:

<components.Graph>

```mermaid
graph TD;
subgraph AA [" "]
A[Mobile app];
Expand All @@ -37,13 +36,11 @@ C --> Z;
Z --> E;
Z --> F;
Z --> G;

</components.Graph>
```

In this tutorial, **we will first start by creating a Mesh configuration that incorporates the Books REST API**, as follows:

<components.Graph>

```mermaid
graph TD;
subgraph AA [" "]
A[Mobile app];
Expand All @@ -58,8 +55,7 @@ A --> Z;
B --> Z;
C --> Z;
Z --> G;

</components.Graph>
```

Creating the complete Mesh Gateway that combines "Books", "Authors", and "Stores" APIs in a unified Schema will be covered in the ["Setup a Gateway with many Sources" guide](/docs/guides/combine-many-sources).

Expand Down
6 changes: 2 additions & 4 deletions website/src/pages/docs/guides/file-uploads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Similarly, just a few configuration changes will be necessary to forward file up

The following Gateway integrates a "UploadFiles" Source that has file upload capabilities:

<components.Graph>

```mermaid
graph TD;
subgraph BB [" "]
E[ResizeImages API];
Expand All @@ -18,8 +17,7 @@ end
Z[Mesh Gateway GraphQL API];
Z --> E;
Z --> F;

</components.Graph>
```

To support forwarding file uploads to the "UploadFiles" Source, we will need to add the `maxRequestBodySize` to the `serve` configuration:

Expand Down
18 changes: 6 additions & 12 deletions website/src/pages/docs/guides/performances-best-practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Fortunately, GraphQL Mesh provides a way to batch requests with specific `additi

Our [`multiple-sources`](https://github.com/charlypoly/graphql-mesh-docs-first-gateway/tree/master/packages/multiple-sources) example Gateway:

<components.Graph>

```mermaid
graph TD;
subgraph AA [" "]
A[Mobile app];
Expand All @@ -28,8 +27,7 @@ C --> Z;
Z --> E;
Z --> F;
Z --> G;

</components.Graph>
```

Will emit multiple requests to the "Authors" API when resolving the nested `Book.author` field:

Expand All @@ -53,8 +51,7 @@ query bestSellersByStore {
}
```

<components.Graph>

```mermaid
sequenceDiagram
participant Mesh Gateway
participant Book.author resolver
Expand All @@ -65,8 +62,7 @@ Mesh Gateway->>Book.author resolver: Query.stores[0].bookSells[0].book[6].author
Book.author resolver->>Authors API: GetAuthor(input: \{ id: "754" \})
Mesh Gateway->>Book.author resolver: Query.stores[0].bookSells[0].book[7].author
Book.author resolver->>Authors API: GetAuthor(input: \{ id: "332" \})

</components.Graph>
```

Fortunately, Mesh allows an extra directive-based configuration to provide a "batching" query that will help resolve many record of the same type.

Expand Down Expand Up @@ -132,8 +128,7 @@ additionalTypeDefs: |

Now, our Mesh Gateway will try to batch calls to the "Authors" API when resolving `Book.author`:

<components.Graph>

```mermaid
sequenceDiagram
participant Mesh Gateway
participant Book.author resolver
Expand All @@ -142,5 +137,4 @@ Mesh Gateway->>Book.author resolver: Query.stores[0].bookSells[0].book[0].author
Mesh Gateway->>Book.author resolver: Query.stores[0].bookSells[0].book[6].author
Mesh Gateway->>Book.author resolver: Query.stores[0].bookSells[0].book[7].author
Book.author resolver->>Authors API: GetAuthors(input: \{ ids: ["123", "754", "332"] \})

</components.Graph>
```
6 changes: 2 additions & 4 deletions website/src/pages/docs/transforms/transforms-introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ Specifying transforms at the Source level helps to isolate each Source definitio

The diagram below explains how Mesh process applied when building the final unified Schema and SDK:

<components.Graph>

```mermaid
graph LR;
subgraph A [GraphQL Mesh server]
subgraph A1 [Sources]
Expand Down Expand Up @@ -99,8 +98,7 @@ A115 & A125 & A315 --> A23 --> A32
A114 & A124 & A314 --> A21
A21 --> A22 --> A34
A32 & A33 & A34 --> A35

</components.Graph>
```

The above diagram highlights 2 important points when working with transforms:

Expand Down
Loading

0 comments on commit 1165479

Please sign in to comment.