diff --git a/.eslintrc.json b/.eslintrc.json
index 094adbf9908a9..bfe9904ae1633 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -3,7 +3,12 @@
"parserOptions": {
"project": "./tsconfig.json"
},
- "extends": ["eslint:recommended", "standard", "prettier", "plugin:@typescript-eslint/recommended"],
+ "extends": [
+ "eslint:recommended",
+ "standard",
+ "prettier",
+ "plugin:@typescript-eslint/recommended"
+ ],
"plugins": ["@typescript-eslint"],
"rules": {
"no-empty": "off",
@@ -28,7 +33,10 @@
"import/no-nodejs-modules": "error",
"no-eval": "off",
"no-use-before-define": "off",
- "import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/*.test.ts", "**/*.spec.ts"] }]
+ "import/no-extraneous-dependencies": [
+ "error",
+ { "devDependencies": ["**/*.test.ts", "**/*.spec.ts"] }
+ ]
},
"env": {
"es6": true,
@@ -45,7 +53,7 @@
}
}
],
- "ignorePatterns": ["dist", "node_modules", "examples", "website", "scripts"],
+ "ignorePatterns": ["dist", "node_modules", "examples", "website", "scripts", ".bob"],
"globals": {
"BigInt": true
}
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 9e537b877fc8c..8c6d4d128e721 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -7,9 +7,14 @@ about: Create a bug report to help us improve
-_Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_
+_Progress of the issue based on the
+[Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_
-- [ ] 1. The issue provides a reproduction available on [Github](https://github.com/Urigo/graphql-mesh/tree/master/examples/hello-world), [Stackblitz](https://stackblitz.com/github/Urigo/graphql-mesh/tree/master/examples/hello-world) or [CodeSandbox](https://codesandbox.io/s/github/Urigo/graphql-mesh/tree/master/examples/hello-world)
+- [ ] 1. The issue provides a reproduction available on
+ [Github](https://github.com/Urigo/graphql-mesh/tree/master/examples/hello-world),
+ [Stackblitz](https://stackblitz.com/github/Urigo/graphql-mesh/tree/master/examples/hello-world)
+ or
+ [CodeSandbox](https://codesandbox.io/s/github/Urigo/graphql-mesh/tree/master/examples/hello-world)
> Make sure to fork this template and run `yarn generate` in the terminal.
>
@@ -25,8 +30,7 @@ _Progress of the issue based on the [Contributor Workflow](https://github.com/th
-**To Reproduce**
-Steps to reproduce the behavior:
+**To Reproduce** Steps to reproduce the behavior:
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 4867decdecd16..aae65e0b8bfc3 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -2,4 +2,6 @@ blank_issues_enabled: false
contact_links:
- name: Have a question?
url: https://github.com/Urigo/graphql-mesh/discussions/new
- about: Not sure about something? need help from the community? have a question to our team? please ask and answer questions here.
+ about:
+ Not sure about something? need help from the community? have a question to our team? please
+ ask and answer questions here.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 40f0b1feaef8b..8995e4493728e 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,10 +1,12 @@
🚨 **IMPORTANT: Please do not create a Pull Request without creating an issue first.**
-_Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request._
+_Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
+the pull request._
## Description
-Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
+Please include a summary of the change and which issue is fixed. Please also include relevant
+motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
@@ -14,16 +16,19 @@ Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
-- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as
+ expected)
- [ ] This change requires a documentation update
## Screenshots/Sandbox (if appropriate/relevant):
-Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate
+Adding links to sandbox or providing screenshots can help us understand more about this PR and take
+action on it as appropriate
## How Has This Been Tested?
-Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
+Please describe the tests that you ran to verify your changes. Provide instructions so we can
+reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
@@ -36,7 +41,9 @@ Please describe the tests that you ran to verify your changes. Provide instructi
## Checklist:
-- [ ] I have followed the [CONTRIBUTING](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md) doc and the style guidelines of this project
+- [ ] I have followed the
+ [CONTRIBUTING](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md) doc and the
+ style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
@@ -47,4 +54,5 @@ Please describe the tests that you ran to verify your changes. Provide instructi
## Further comments
-If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
+If this is a relatively large or complex change, kick off the discussion by explaining why you chose
+the solution you did and what alternatives you considered, etc...
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 3749d85297043..5988282c5edee 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -34,10 +34,7 @@ jobs:
POSTGRES_PASSWORD: docker
# Set health checks to wait until postgres has started
options: >-
- --health-cmd pg_isready
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
+ --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
@@ -47,7 +44,9 @@ jobs:
MYSQL_ROOT_PASSWORD: passwd
ports:
- 33306:3306
- options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+ options:
+ --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s
+ --health-retries=3
steps:
- name: Checkout
@@ -67,7 +66,10 @@ jobs:
${{runner.os}}-${{matrix.node-version}}-jest-
- name: Download Postgres Dump
- run: 'curl https://raw.githubusercontent.com/morenoh149/postgresDBSamples/master/worldDB-1.0/world.sql -o /tmp/backup.sql'
+ run:
+ 'curl
+ https://raw.githubusercontent.com/morenoh149/postgresDBSamples/master/worldDB-1.0/world.sql
+ -o /tmp/backup.sql'
- name: Load Postgres Data
uses: tj-actions/pg-restore@v4.7
with:
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index 8c3deb3a0d806..f318594d92914 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -11,7 +11,9 @@ on:
jobs:
deployment:
runs-on: ubuntu-latest
- if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
+ if:
+ github.event.pull_request.head.repo.full_name == github.repository || github.event_name ==
+ 'push'
steps:
- name: checkout
uses: actions/checkout@v3
@@ -28,7 +30,8 @@ jobs:
name: build and deploy website
env:
NEXT_BASE_PATH: ${{ github.ref == 'refs/heads/master' && '/graphql/mesh' || '' }}
- SITE_URL: ${{ github.ref == 'refs/heads/master' && 'https://the-guild.dev/graphql/mesh' || '' }}
+ SITE_URL:
+ ${{ github.ref == 'refs/heads/master' && 'https://the-guild.dev/graphql/mesh' || '' }}
NEXT_PUBLIC_ALGOLIA_INDEX_NAME: ${{ secrets.NEXT_PUBLIC_ALGOLIA_INDEX_NAME }}
NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY }}
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.NEXT_PUBLIC_ALGOLIA_APP_ID }}
diff --git a/.prettierignore b/.prettierignore
index 21992fe293982..63ded79da74a4 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -5,3 +5,4 @@
dist/
.mesh/
/.husky/_/
+.bob/
diff --git a/README.md b/README.md
index 7fd3af965de60..4744fef3f78f1 100644
--- a/README.md
+++ b/README.md
@@ -7,16 +7,24 @@
https://www.graphql-mesh.com
-GraphQL Mesh allows you to use GraphQL query language to access data in remote APIs that don't run GraphQL (and also ones that do run GraphQL).
-It can be used as a gateway to other services or run as a local GraphQL schema that aggregates data from remote APIs.
+GraphQL Mesh allows you to use GraphQL query language to access data in remote APIs that don't run
+GraphQL (and also ones that do run GraphQL). It can be used as a gateway to other services or run as
+a local GraphQL schema that aggregates data from remote APIs.
-The goal of GraphQL Mesh is to let developers easily access services that are written in other APIs specs (such as gRPC, OpenAPI/Swagger, OData, SOAP/WSDL, Apache Thrift, Mongoose, PostgreSQL, Neo4j, and also GraphQL) with GraphQL queries and mutations.
+The goal of GraphQL Mesh is to let developers easily access services that are written in other APIs
+specs (such as gRPC, OpenAPI/Swagger, OData, SOAP/WSDL, Apache Thrift, Mongoose, PostgreSQL, Neo4j,
+and also GraphQL) with GraphQL queries and mutations.
-GraphQL Mesh gives the developer the ability to modify the output schemas, link types across schemas and merge schema types. You can even add custom GraphQL types and resolvers that fit your needs.
+GraphQL Mesh gives the developer the ability to modify the output schemas, link types across schemas
+and merge schema types. You can even add custom GraphQL types and resolvers that fit your needs.
-It allows developers to control the way they fetch data, and overcome issues related to backend implementation, legacy API services, chosen schema specification and non-typed APIs.
+It allows developers to control the way they fetch data, and overcome issues related to backend
+implementation, legacy API services, chosen schema specification and non-typed APIs.
-GraphQL Mesh is acting as a proxy to your data, and uses common libraries to wrap your existing API services. You can use this proxy locally in your service or application by running the GraphQL schema locally (with GraphQL `execute`), or you can deploy this as a gateway layer to your internal service.
+GraphQL Mesh is acting as a proxy to your data, and uses common libraries to wrap your existing API
+services. You can use this proxy locally in your service or application by running the GraphQL
+schema locally (with GraphQL `execute`), or you can deploy this as a gateway layer to your internal
+service.
## How does it work?
@@ -42,7 +50,8 @@ To get started with the basics, install the following:
$ yarn add graphql @graphql-mesh/runtime @graphql-mesh/cli
```
-Then, you need to install a Mesh handler, according to your API needs. You can see the list of all available built-in handlers in this README, under the `Supported APIs` section.
+Then, you need to install a Mesh handler, according to your API needs. You can see the list of all
+available built-in handlers in this README, under the `Supported APIs` section.
For example, if you wish to use OpenAPI handler, install the handler that matches your needs:
@@ -63,13 +72,18 @@ Then, this handler will be available for you to use in your config file.
## Contributions
-Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!
+Contributions, issues and feature requests are very welcome. If you are using this package and fixed
+a bug for yourself, please consider submitting a PR!
-And if this is your first time contributing to this project, please do read our [Contributor Workflow Guide](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md) before you get started off.
+And if this is your first time contributing to this project, please do read our
+[Contributor Workflow Guide](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md)
+before you get started off.
### Code of Conduct
-Help us keep GraphQL Mesh open and inclusive. Please read and follow our [Code of Conduct](https://github.com/the-guild-org/Stack/blob/master/CODE_OF_CONDUCT.md) as adopted from [Contributor Covenant](https://www.contributor-covenant.org/)
+Help us keep GraphQL Mesh open and inclusive. Please read and follow our
+[Code of Conduct](https://github.com/the-guild-org/Stack/blob/master/CODE_OF_CONDUCT.md) as adopted
+from [Contributor Covenant](https://www.contributor-covenant.org/)
### License
diff --git a/examples/auth0/privateAPI.js b/examples/auth0/privateAPI.js
index c11d3969dc213..27feb9c126751 100644
--- a/examples/auth0/privateAPI.js
+++ b/examples/auth0/privateAPI.js
@@ -7,7 +7,7 @@ http
JSON.stringify({
code: 'I am a secret code',
timestamp: Date.now(),
- })
+ }),
);
})
.listen(3001, 'localhost', () => {
diff --git a/examples/graphql-file-upload-example/frontend/README.md b/examples/graphql-file-upload-example/frontend/README.md
index 02aac3f6ea17c..a460c41225704 100644
--- a/examples/graphql-file-upload-example/frontend/README.md
+++ b/examples/graphql-file-upload-example/frontend/README.md
@@ -17,7 +17,8 @@ You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.\
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests)
+for more information.
### `yarn build`
@@ -27,44 +28,58 @@ It correctly bundles React in production mode and optimizes the build for the be
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
-See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for
+more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
-If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time.
+This command will remove the single build dependency from your project.
-Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel,
+ESLint, etc) right into your project so you have full control over them. All of the commands except
+`eject` will still work, but they will point to the copied scripts so you can tweak them. At this
+point you’re on your own.
-You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle
+deployments, and you shouldn’t feel obligated to use this feature. However we understand that this
+tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
-You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+You can learn more in the
+[Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
-This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
+This section has moved here:
+[https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
-This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
+This section has moved here:
+[https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
-This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
+This section has moved here:
+[https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
-This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
+This section has moved here:
+[https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
-This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
+This section has moved here:
+[https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `yarn build` fails to minify
-This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
+This section has moved here:
+[https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
diff --git a/examples/graphql-file-upload-example/frontend/src/index.css b/examples/graphql-file-upload-example/frontend/src/index.css
index 7323ae85c542d..89e57c7ccfe1f 100644
--- a/examples/graphql-file-upload-example/frontend/src/index.css
+++ b/examples/graphql-file-upload-example/frontend/src/index.css
@@ -1,7 +1,7 @@
body {
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
- 'Droid Sans', 'Helvetica Neue', sans-serif;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
diff --git a/examples/graphql-file-upload-example/frontend/src/index.js b/examples/graphql-file-upload-example/frontend/src/index.js
index ef2edf8ea3fc4..b0a768f12c016 100644
--- a/examples/graphql-file-upload-example/frontend/src/index.js
+++ b/examples/graphql-file-upload-example/frontend/src/index.js
@@ -8,7 +8,7 @@ ReactDOM.render(
,
- document.getElementById('root')
+ document.getElementById('root'),
);
// If you want to start measuring performance in your app, pass a function
diff --git a/examples/graphql-file-upload-example/resize-image/server.js b/examples/graphql-file-upload-example/resize-image/server.js
index 99f8e8dfabb06..29430fb23a04c 100644
--- a/examples/graphql-file-upload-example/resize-image/server.js
+++ b/examples/graphql-file-upload-example/resize-image/server.js
@@ -31,7 +31,7 @@ module.exports = function startServer() {
() =>
new Promise(resolve => {
server.close(resolve);
- })
+ }),
);
});
});
diff --git a/examples/graphql-file-upload-example/test/graphql-file-upload-example.test.js b/examples/graphql-file-upload-example/test/graphql-file-upload-example.test.js
index 2d614a3bbf741..44c6a3e6f7696 100644
--- a/examples/graphql-file-upload-example/test/graphql-file-upload-example.test.js
+++ b/examples/graphql-file-upload-example/test/graphql-file-upload-example.test.js
@@ -34,7 +34,7 @@ describe('Upload Example', () => {
`,
{
upload: file,
- }
+ },
);
expect(result?.data?.uploadFile?.filename).toBe('test.txt');
});
diff --git a/examples/graphql-file-upload-example/upload-files/server.js b/examples/graphql-file-upload-example/upload-files/server.js
index 1191b42102bc3..9d26d05933fd4 100644
--- a/examples/graphql-file-upload-example/upload-files/server.js
+++ b/examples/graphql-file-upload-example/upload-files/server.js
@@ -65,7 +65,7 @@ module.exports = function startServer() {
() =>
new Promise(resolve => {
server.close(resolve);
- })
+ }),
);
});
});
diff --git a/examples/hasura-openbrewery-geodb/README.md b/examples/hasura-openbrewery-geodb/README.md
index 43a5a10bdcabb..092309f4bc20c 100644
--- a/examples/hasura-openbrewery-geodb/README.md
+++ b/examples/hasura-openbrewery-geodb/README.md
@@ -3,23 +3,29 @@
This example takes two API sources and merges them together:
1. Postgres GeoDB - a seed database of geo locations and their metadata (uses Hasura GraphQL Engine)
-2. OpenBrewery API - a free API for public information on breweries, cideries, brewpubs, and bottleshops.
+2. OpenBrewery API - a free API for public information on breweries, cideries, brewpubs, and
+ bottleshops.
-The two schemas are connected and let you search for locations, and then fetch breweries that are located in that location.
+The two schemas are connected and let you search for locations, and then fetch breweries that are
+located in that location.
### Create GeoDB Database
-Because a running Postgres DB is required, you need to setup local Postgres running, and load the schema and data seed.
+Because a running Postgres DB is required, you need to setup local Postgres running, and load the
+schema and data seed.
To do that, run the following:
-1. Install and run Postgres using Docker - `docker run --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432 postgres`
+1. Install and run Postgres using Docker -
+ `docker run --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432 postgres`
2. Install Postgres CLI: `brew upgrade postgresql` (or, you can use any of your favorite tool)
-3. Seed the DB with data: `curl https://raw.githubusercontent.com/morenoh149/postgresDBSamples/master/worldDB-1.0/world.sql | psql -h localhost -d postgres -U postgres`
+3. Seed the DB with data:
+ `curl https://raw.githubusercontent.com/morenoh149/postgresDBSamples/master/worldDB-1.0/world.sql | psql -h localhost -d postgres -U postgres`
### Create Hasura Instance
-We need to install Hasura using Docker but we will use a special version of Hasura to benefit from Remote Joins;
+We need to install Hasura using Docker but we will use a special version of Hasura to benefit from
+Remote Joins;
```sh
docker run -d -p 8080:8080 \
@@ -30,8 +36,8 @@ docker run -d -p 8080:8080 \
### Create GraphQL Mesh Project
-We need to have `yarn` and Node.js on our computer to run GraphQL Mesh locally.
-Run the following command to create a new project on an empty directory;
+We need to have `yarn` and Node.js on our computer to run GraphQL Mesh locally. Run the following
+command to create a new project on an empty directory;
```sh
yarn init
@@ -45,9 +51,11 @@ yarn add graphql @graphql-mesh/cli @graphql-mesh/json-schema
### Create Proxy GraphQL API to OpenBrewery
-OpenBrewery doesn't have any kind of recognized schema metadata, so we need to create our own using JSON Schema Handler;
+OpenBrewery doesn't have any kind of recognized schema metadata, so we need to create our own using
+JSON Schema Handler;
-In OpenBrewery's documentation, they have examples for both request and response objects. Let's create files for each inside `/json-schemas` directory;
+In OpenBrewery's documentation, they have examples for both request and response objects. Let's
+create files for each inside `/json-schemas` directory;
```json filename="breweries.json"
// breweries.json
@@ -114,23 +122,30 @@ yarn mesh dev
### Connect new OpenBrewery API to Hasura
-Go to [Remote Schemas](http://localhost:8080/console/remote-schemas/manage/schemas) tab in Hasura and add our OpenBrewery GraphQL API which has `http://host.docker.internal:4000/graphql`.
+Go to [Remote Schemas](http://localhost:8080/console/remote-schemas/manage/schemas) tab in Hasura
+and add our OpenBrewery GraphQL API which has `http://host.docker.internal:4000/graphql`.
-> `host.docker.internal` is used because Docker accesses your host machine `localhost` under this alias.
+> `host.docker.internal` is used because Docker accesses your host machine `localhost` under this
+> alias.
### Create GraphQL fields for GeoDB
-Go to [Data](http://localhost:8080/console/data/schema/public) tab in Hasura and track all the tables to see how complex relationships work with Mesh.
+Go to [Data](http://localhost:8080/console/data/schema/public) tab in Hasura and track all the
+tables to see how complex relationships work with Mesh.
### Create Remote Join between GeoDB and OpenBrewery
-Let's say we would like to see breweries in a specific city. Go to [Data](http://localhost:8080/console/data/schema/public) tab in Hasura and scroll down to **Remote Relationships** section. Add `breweries` field to `City` by connecting `breweries.by_city` argument and `City.name` parent field like below;
+Let's say we would like to see breweries in a specific city. Go to
+[Data](http://localhost:8080/console/data/schema/public) tab in Hasura and scroll down to **Remote
+Relationships** section. Add `breweries` field to `City` by connecting `breweries.by_city` argument
+and `City.name` parent field like below;
![image](https://user-images.githubusercontent.com/20847995/83945179-a71fa200-a811-11ea-81fc-e641e68bc9ce.png)
### Make a query to see how it works
-Go to [GraphiQL](http://localhost:8080/console/api-explorer) and make a query like below to see how the integration works;
+Go to [GraphiQL](http://localhost:8080/console/api-explorer) and make a query like below to see how
+the integration works;
```graphql
{
diff --git a/examples/hello-world/tests/hello-world.test.js b/examples/hello-world/tests/hello-world.test.js
index e63b4013b0194..3807a30685342 100644
--- a/examples/hello-world/tests/hello-world.test.js
+++ b/examples/hello-world/tests/hello-world.test.js
@@ -15,7 +15,7 @@ describe('Hello World', () => {
expect(
introspectionFromSchema(lexicographicSortSchema(schema), {
descriptions: false,
- })
+ }),
).toMatchSnapshot();
});
it('should give correct response', async () => {
diff --git a/examples/json-schema-covid/README.md b/examples/json-schema-covid/README.md
index abb3a226d412c..6ad10e86824a6 100644
--- a/examples/json-schema-covid/README.md
+++ b/examples/json-schema-covid/README.md
@@ -8,11 +8,15 @@ It's a small test :)
## Why & What?
-I want to extend a public [Covid graphQL endpoint](https://covid-19-two-rust.vercel.app/api/graphql) with some other data like the population of the country. Sounds like a good scenario for [graphql-mesh](https://github.com/Urigo/graphql-mesh)!
+I want to extend a public [Covid graphQL endpoint](https://covid-19-two-rust.vercel.app/api/graphql)
+with some other data like the population of the country. Sounds like a good scenario for
+[graphql-mesh](https://github.com/Urigo/graphql-mesh)!
-For this I found an API with [country population data](https://datasource.kapsarc.org/explore/dataset/world-population/table/?disjunctive.country_name&rows=1&q=France&sort=year).
+For this I found an API with
+[country population data](https://datasource.kapsarc.org/explore/dataset/world-population/table/?disjunctive.country_name&rows=1&q=France&sort=year).
-I did it in few steps... That you can find in the file [example-query.graphql](./example-query.graphql)
+I did it in few steps... That you can find in the file
+[example-query.graphql](./example-query.graphql)
- STEP1: 2 sources side by side
- STEP2: 2 sources combined
diff --git a/examples/json-schema-covid/tests/json-schema-covid.test.js b/examples/json-schema-covid/tests/json-schema-covid.test.js
index 47c4a6cd2d793..b2e0aa6371ac7 100644
--- a/examples/json-schema-covid/tests/json-schema-covid.test.js
+++ b/examples/json-schema-covid/tests/json-schema-covid.test.js
@@ -18,16 +18,21 @@ describe('JSON Schema Covid', () => {
expect(
printSchema(lexicographicSortSchema(schema), {
descriptions: false,
- })
+ }),
).toMatchSnapshot('json-schema-covid-schema');
});
it('should give correct response for STEP 1: 2 sources side by side', async () => {
- const getDataStep1Query = await readFile(join(__dirname, '../example-queries/getData_step1.graphql'), 'utf8');
+ const getDataStep1Query = await readFile(
+ join(__dirname, '../example-queries/getData_step1.graphql'),
+ 'utf8',
+ );
const { execute } = await mesh$;
const result = await execute(getDataStep1Query);
expect(result.errors).toBeFalsy();
// Check exposed response metadata
- expect(result.data?.population?._response).toMatchSnapshot('json-schema-covid-response-metadata');
+ expect(result.data?.population?._response).toMatchSnapshot(
+ 'json-schema-covid-response-metadata',
+ );
expect(typeof result?.data?.case?.confirmed).toBe('number');
expect(result?.data?.case?.countryRegion).toBe('France');
@@ -38,7 +43,10 @@ describe('JSON Schema Covid', () => {
expect(typeof result?.data?.population?.records[0]?.fields?.value).toBe('number');
});
it.skip('should give correct response for STEP1: 2 sources side by side', async () => {
- const getDataStep1Query = await readFile(join(__dirname, '../example-queries/getData_step1.graphql'), 'utf8');
+ const getDataStep1Query = await readFile(
+ join(__dirname, '../example-queries/getData_step1.graphql'),
+ 'utf8',
+ );
const { execute } = await mesh$;
const result = await execute(getDataStep1Query);
expect(result.errors?.length).toBeFalsy();
@@ -51,7 +59,10 @@ describe('JSON Schema Covid', () => {
expect(typeof result?.data?.population?.records[0]?.fields?.value).toBe('number');
});
it.skip('should give correct response for STEP2: 2 sources combined', async () => {
- const getDataStep2Query = await readFile(join(__dirname, '../example-queries/getData_step2.graphql'), 'utf8');
+ const getDataStep2Query = await readFile(
+ join(__dirname, '../example-queries/getData_step2.graphql'),
+ 'utf8',
+ );
const { execute } = await mesh$;
const result = await execute(getDataStep2Query);
expect(result.errors).toBeFalsy();
@@ -62,7 +73,10 @@ describe('JSON Schema Covid', () => {
expect(typeof result?.data?.case?.population?.records[0]?.fields?.value).toBe('number');
});
it.skip('should give correct response for STEP3_1: 2 sources combined to get ratios', async () => {
- const getDataStep3_1Query = await readFile(join(__dirname, '../example-queries/getData_step3_1.graphql'), 'utf8');
+ const getDataStep3_1Query = await readFile(
+ join(__dirname, '../example-queries/getData_step3_1.graphql'),
+ 'utf8',
+ );
const { execute } = await mesh$;
const result = await execute(getDataStep3_1Query);
expect(result.errors).toBeFalsy();
@@ -71,7 +85,10 @@ describe('JSON Schema Covid', () => {
expect(typeof result?.data?.at?.deathRatio).toBe('number');
});
it.skip('should give correct response for STEP3_2: 2 sources combined to get ratios & case & population', async () => {
- const getDataStep3_2Query = await readFile(join(__dirname, '../example-queries/getData_step3_2.graphql'), 'utf8');
+ const getDataStep3_2Query = await readFile(
+ join(__dirname, '../example-queries/getData_step3_2.graphql'),
+ 'utf8',
+ );
const { execute } = await mesh$;
const result = await execute(getDataStep3_2Query);
expect(result.errors).toBeFalsy();
diff --git a/examples/json-schema-example/tests/json-schema-example.test.js b/examples/json-schema-example/tests/json-schema-example.test.js
index 6f8e406532221..a0cd6785de082 100644
--- a/examples/json-schema-example/tests/json-schema-example.test.js
+++ b/examples/json-schema-example/tests/json-schema-example.test.js
@@ -15,7 +15,7 @@ describe('JSON Schema Example', () => {
expect(
printSchema(lexicographicSortSchema(schema), {
descriptions: false,
- })
+ }),
).toMatchSnapshot();
});
it('should give correct response', async () => {
diff --git a/examples/json-schema-subscriptions/README.md b/examples/json-schema-subscriptions/README.md
index 9a830e3c48da7..e2dfcbb07b3cf 100644
--- a/examples/json-schema-subscriptions/README.md
+++ b/examples/json-schema-subscriptions/README.md
@@ -2,15 +2,16 @@
This example has a schemaless API Server that has two endpoints and one webhook;
-GET `/todos` returns all `Todo` entities kept on inmemory database.
-POST `/todo` adds a new `Todo` to the inmemory database and returns it with a generated id
+GET `/todos` returns all `Todo` entities kept on inmemory database. POST `/todo` adds a new `Todo`
+to the inmemory database and returns it with a generated id
Everytime you call `/todo` endpoint, it sends `Todo` as a payload
#### How to run
-You can run API server with `yarn start:api` command and Mesh with `yarn start:mesh` then you can try the example queries you see in the playground.
-You can go to the GraphQL Playground with this URL; `http://localhost:4000/graphql`
+You can run API server with `yarn start:api` command and Mesh with `yarn start:mesh` then you can
+try the example queries you see in the playground. You can go to the GraphQL Playground with this
+URL; `http://localhost:4000/graphql`
#### Extra: Live Queries
diff --git a/examples/mongoose-example/src/models.js b/examples/mongoose-example/src/models.js
index 85f511430ad3b..b69a2c555a26a 100644
--- a/examples/mongoose-example/src/models.js
+++ b/examples/mongoose-example/src/models.js
@@ -10,7 +10,7 @@ const LanguagesSchema = new Schema(
},
{
_id: false, // disable `_id` field for `Language` schema
- }
+ },
);
const AddressSchema = new Schema({
@@ -59,7 +59,7 @@ const UserSchema = new Schema(
},
{
collection: 'user_users',
- }
+ },
);
UserSchema.index({ gender: 1, age: -1 });
diff --git a/examples/mysql-employees/tests/mysql-employees.test.js b/examples/mysql-employees/tests/mysql-employees.test.js
index cdc5477944ced..9db2e772d79a3 100644
--- a/examples/mysql-employees/tests/mysql-employees.test.js
+++ b/examples/mysql-employees/tests/mysql-employees.test.js
@@ -16,7 +16,7 @@ describe('MySQL Employees', () => {
expect(
printSchema(lexicographicSortSchema(schema), {
descriptions: false,
- })
+ }),
).toMatchSnapshot('mysql-employees-schema');
});
it('should give correct response for example queries', async () => {
diff --git a/examples/mysql-rfam/tests/mysql-rfam.test.js b/examples/mysql-rfam/tests/mysql-rfam.test.js
index 142376c32ccb6..612076f25fb16 100644
--- a/examples/mysql-rfam/tests/mysql-rfam.test.js
+++ b/examples/mysql-rfam/tests/mysql-rfam.test.js
@@ -18,7 +18,7 @@ describe.skip('MySQL Rfam', () => {
expect(
printSchema(lexicographicSortSchema(schema), {
descriptions: false,
- })
+ }),
).toMatchSnapshot('mysql-rfam-schema');
});
it('should give correct response for example queries', async () => {
diff --git a/examples/nextjs-apollo-example/README.md b/examples/nextjs-apollo-example/README.md
index 8d8bdf763b519..0dd5fde0fd519 100644
--- a/examples/nextjs-apollo-example/README.md
+++ b/examples/nextjs-apollo-example/README.md
@@ -1,4 +1,5 @@
-This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
+This is a [Next.js](https://nextjs.org/) project bootstrapped with
+[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
@@ -12,13 +13,19 @@ yarn dev
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
-You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
+You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the
+file.
-[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
+[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on
+[http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in
+`pages/api/hello.js`.
-The GraphQL Playground can be accessed on [http://localhost:3000/api/graphql](http://localhost:3000/api/graphql). This endpoint can be edited in `pages/api/graphql.ts`.
+The GraphQL Playground can be accessed on
+[http://localhost:3000/api/graphql](http://localhost:3000/api/graphql). This endpoint can be edited
+in `pages/api/graphql.ts`.
-The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
+The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as
+[API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
@@ -27,10 +34,14 @@ To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
-You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
+You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your
+feedback and contributions are welcome!
## Deploy on Vercel
-The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
+The easiest way to deploy your Next.js app is to use the
+[Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme)
+from the creators of Next.js.
-Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
+Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more
+details.
diff --git a/examples/nextjs-apollo-example/server/server.ts b/examples/nextjs-apollo-example/server/server.ts
index 8c1fa55946c14..d68f762d2d8c4 100644
--- a/examples/nextjs-apollo-example/server/server.ts
+++ b/examples/nextjs-apollo-example/server/server.ts
@@ -13,7 +13,9 @@ export default async function createApolloServer() {
introspection: !isProd,
cache,
executor: async requestContext => {
- const { schema, execute, contextFactory } = getEnveloped({ req: requestContext.request.http });
+ const { schema, execute, contextFactory } = getEnveloped({
+ req: requestContext.request.http,
+ });
return execute({
schema: schema,
diff --git a/examples/nextjs-apollo-example/styles/globals.css b/examples/nextjs-apollo-example/styles/globals.css
index e2e6d0f00d203..713c7421f48ad 100644
--- a/examples/nextjs-apollo-example/styles/globals.css
+++ b/examples/nextjs-apollo-example/styles/globals.css
@@ -2,8 +2,8 @@ html,
body {
padding: 0;
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans,
- Helvetica Neue, sans-serif;
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell,
+ Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
diff --git a/examples/nextjs-sdk-example/README.md b/examples/nextjs-sdk-example/README.md
index 8d8bdf763b519..0dd5fde0fd519 100644
--- a/examples/nextjs-sdk-example/README.md
+++ b/examples/nextjs-sdk-example/README.md
@@ -1,4 +1,5 @@
-This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
+This is a [Next.js](https://nextjs.org/) project bootstrapped with
+[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
@@ -12,13 +13,19 @@ yarn dev
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
-You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
+You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the
+file.
-[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
+[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on
+[http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in
+`pages/api/hello.js`.
-The GraphQL Playground can be accessed on [http://localhost:3000/api/graphql](http://localhost:3000/api/graphql). This endpoint can be edited in `pages/api/graphql.ts`.
+The GraphQL Playground can be accessed on
+[http://localhost:3000/api/graphql](http://localhost:3000/api/graphql). This endpoint can be edited
+in `pages/api/graphql.ts`.
-The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
+The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as
+[API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
@@ -27,10 +34,14 @@ To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
-You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
+You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your
+feedback and contributions are welcome!
## Deploy on Vercel
-The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
+The easiest way to deploy your Next.js app is to use the
+[Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme)
+from the creators of Next.js.
-Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
+Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more
+details.
diff --git a/examples/nextjs-sdk-example/styles/globals.css b/examples/nextjs-sdk-example/styles/globals.css
index e2e6d0f00d203..713c7421f48ad 100644
--- a/examples/nextjs-sdk-example/styles/globals.css
+++ b/examples/nextjs-sdk-example/styles/globals.css
@@ -2,8 +2,8 @@ html,
body {
padding: 0;
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans,
- Helvetica Neue, sans-serif;
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell,
+ Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
diff --git a/examples/odata-microsoft/README.md b/examples/odata-microsoft/README.md
index bf0055998e7e6..7e9d20b162345 100644
--- a/examples/odata-microsoft/README.md
+++ b/examples/odata-microsoft/README.md
@@ -1,10 +1,18 @@
# GraphQL Mesh for Microsoft Graph
-**Note:** This project is based on [Microsoft's GraphQL for Microsoft Graph Demo](https://github.com/microsoftgraph/graphql-demo)
+**Note:** This project is based on
+[Microsoft's GraphQL for Microsoft Graph Demo](https://github.com/microsoftgraph/graphql-demo)
## About
-This is a _demo_ that enables basic, read-only querying of the [Microsoft Graph API](https://developer.microsoft.com/en-us/graph/) using [GraphQL query syntax](http://graphql.org/learn/queries/). GraphQL enables clients to request exactly the resources and properties that they need instead of making REST requests for each resource and consolidating the responses. To create a GraphQL service, this demo translates the [Microsoft Graph OData $metadata document](https://graph.microsoft.com/v1.0/$metadata) to a GraphQL schema and generates the necessary resolvers. Please note we are providing this demo code for evaluation as-is.
+This is a _demo_ that enables basic, read-only querying of the
+[Microsoft Graph API](https://developer.microsoft.com/en-us/graph/) using
+[GraphQL query syntax](http://graphql.org/learn/queries/). GraphQL enables clients to request
+exactly the resources and properties that they need instead of making REST requests for each
+resource and consolidating the responses. To create a GraphQL service, this demo translates the
+[Microsoft Graph OData $metadata document](https://graph.microsoft.com/v1.0/$metadata) to a GraphQL
+schema and generates the necessary resolvers. Please note we are providing this demo code for
+evaluation as-is.
![Animation of sample request](https://user-images.githubusercontent.com/20847995/81301438-b92aeb00-9081-11ea-8bd3-c9e10d73ac8f.gif)
@@ -12,7 +20,8 @@ This is a _demo_ that enables basic, read-only querying of the [Microsoft Graph
1. Clone the repo
2. Install dependencies (`npm install`)
-3. Navigate to the [App Registration Portal](https://apps.dev.microsoft.com/), set up a [new web app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration)
+3. Navigate to the [App Registration Portal](https://apps.dev.microsoft.com/), set up a
+ [new web app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration)
4. Configure App Id and redirect URIs in the AppConfiguration of build/index.html
5. Run `npm start` and go to `localhost:4000`
diff --git a/examples/odata-microsoft/public/index.html b/examples/odata-microsoft/public/index.html
index ff2bcdbd4406d..129194292dbb8 100644
--- a/examples/odata-microsoft/public/index.html
+++ b/examples/odata-microsoft/public/index.html
@@ -36,7 +36,11 @@
-
+