Skip to content

Commit

Permalink
Correct additional envelop plugins docs (#6553)
Browse files Browse the repository at this point in the history
* envelop plugins

* changeset

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
enisdenjo and github-actions[bot] authored Feb 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4841da9 commit 4b3ea1d
Showing 8 changed files with 22 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_serve-cli-6553-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@graphql-mesh/serve-cli": patch
---
dependencies updates:
- Added dependency [`@graphql-mesh/cross-helpers@^0.4.1` ↗︎](https://www.npmjs.com/package/@graphql-mesh/cross-helpers/v/0.4.1) (to `dependencies`)
- Added dependency [`@graphql-mesh/runtime@^0.97.5` ↗︎](https://www.npmjs.com/package/@graphql-mesh/runtime/v/0.97.5) (to `dependencies`)
- Added dependency [`@graphql-mesh/utils@^0.96.4` ↗︎](https://www.npmjs.com/package/@graphql-mesh/utils/v/0.96.4) (to `dependencies`)
6 changes: 6 additions & 0 deletions .changeset/tall-experts-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@graphql-mesh/runtime": patch
"@graphql-mesh/types": patch
---

Correct additional envelop plugins docs
2 changes: 1 addition & 1 deletion packages/runtime/src/get-mesh.ts
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ export async function getMesh(options: GetMeshOptions): Promise<MeshInstance> {
setFetchFn(fetchFn);
},
},
...(additionalEnvelopPlugins as MeshPlugin<any>[]),
...additionalEnvelopPlugins,
];
const wrappedFetchFn: MeshFetch = wrapFetchWithPlugins(initialPluginList);
await Promise.allSettled(
4 changes: 2 additions & 2 deletions packages/runtime/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DocumentNode, ExecutionResult } from 'graphql';
import { envelop } from '@envelop/core';
import { Plugin } from '@envelop/core';
import {
GraphQLOperation,
KeyValueCache,
@@ -24,7 +24,7 @@ export type GetMeshOptions = {
pubsub?: MeshPubSub;
merger: MeshMerger;
logger?: Logger;
additionalEnvelopPlugins?: Parameters<typeof envelop>[0]['plugins'];
additionalEnvelopPlugins?: Plugin[];
documents?: Source[];
fetchFn?: MeshFetch;
};
2 changes: 1 addition & 1 deletion packages/types/src/config-schema.json
Original file line number Diff line number Diff line change
@@ -4291,7 +4291,7 @@
},
"additionalEnvelopPlugins": {
"type": "string",
"description": "You can provide Envelop plugins"
"description": "Path to a JavaScript file with a default export of Envelop plugins"
},
"plugins": {
"type": "array",
2 changes: 1 addition & 1 deletion packages/types/src/config.ts
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ export interface Config {
*/
skipSSLValidation?: boolean;
/**
* You can provide Envelop plugins
* Path to a JavaScript file with a default export of Envelop plugins
*/
additionalEnvelopPlugins?: string;
plugins?: Plugin[];
5 changes: 3 additions & 2 deletions website/src/pages/docs/guides/error-masking.mdx
Original file line number Diff line number Diff line change
@@ -51,7 +51,8 @@ Envelop allows you to provide your error formatting function as follows:

```ts filename="envelopPlugins.ts"
import { GraphQLError } from 'graphql'
import { PluginOrDisabledPlugin, useMaskedErrors } from '@envelop/core'
import { Plugin, useMaskedErrors } from '@envelop/core'
import { MeshPlugin } from '@graphql-mesh/types'
export const formatError: FormatErrorHandler = err => {
if (err.originalError && err.originalError instanceof GraphQLError === false) {
@@ -61,7 +62,7 @@ export const formatError: FormatErrorHandler = err => {
return err
}
const plugins: PluginOrDisabledPlugin = [
const plugins: MeshPlugin<any>[] = [
useMaskedErrors({
errorMessage: 'Something went wrong.',
formatError
2 changes: 1 addition & 1 deletion website/src/pages/docs/plugins/plugins-introduction.mdx
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ import { useDepthLimit } from '@envelop/depth-limit'
import { useSentry } from '@envelop/sentry'
import { MeshPlugin } from '@graphql-mesh/types'

const plugins: MeshPlugin = [
const plugins: MeshPlugin<any>[] = [
useDepthLimit({
maxDepth: 10
}),

0 comments on commit 4b3ea1d

Please sign in to comment.