Skip to content

Commit

Permalink
fix!: improved multi client support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: graphql operations can no longer be prefixed with a client name
  • Loading branch information
Diizzayy committed Oct 16, 2022
1 parent 24455b8 commit 905bcf3
Show file tree
Hide file tree
Showing 18 changed files with 294 additions and 350 deletions.
10 changes: 5 additions & 5 deletions docs/content/2.advanced/2.multiple-clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ When using multiple clients, you must specify the client that your GraphQL Opera

There are two methods of associating a client:

1. Prefix the GraphQL Operation name with `<clientname>_`.
1. Save the GraphQL Document ending with `<clientname>.gql|graphql`.

```graphql
query github_viewer {
```graphql [nuxt-app/queries/example.github.gql]
query viewer {
viewer {
login
}
}
```

Doing so will automatically link the query above to the predefined spacex client **and drop the client prefix** from the autoImported function. This query will be executable in your app by simply calling `GqlViewer()`
Doing so will automatically link the query above to the client named `github`. This query will be executable in your app by simply calling `GqlViewer()`

::alert
This method takes precedence and overrides all others.
Expand All @@ -84,7 +84,7 @@ There are two methods of associating a client:

**ie:** Given `./nuxt_app/queries/spacex/launches.gql`

All GraphQL operations within `launches.gql` (*that aren't prefixed with a client name*), will automatically be linked to the client matching the name of the GraphQL document's parent directory ie: `spacex`.
All GraphQL operations within `launches.gql` will automatically be linked to the client matching the name of the GraphQL document's parent directory ie: `spacex`.

4. Lastly, GraphQL documents which don't match any of the aforementioned conventions will be linked to the [default client](#default-client).

Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@
"@graphql-codegen/typescript": "^2.7.3",
"@graphql-codegen/typescript-graphql-request": "^4.5.5",
"@graphql-codegen/typescript-operations": "^2.5.3",
"@graphql-tools/graphql-file-loader": "^7.5.5",
"@graphql-tools/load": "^7.7.7",
"@graphql-tools/stitch": "^8.7.13",
"@graphql-tools/wrap": "^9.2.3",
"@nuxt/kit": "3.0.0-rc.11",
"defu": "^6.1.0",
"graphql": "^16.6.0",
"graphql-request": "^5.0.0",
"knitwork": "^0.1.2",
"ohash": "^0.1.5",
"ohmyfetch": "^0.4.19",
"scule": "^0.3.2"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 905bcf3

Please sign in to comment.