Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct additional envelop plugins docs #6553

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Up @@ -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(
Expand Down
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,
Expand All @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
5 changes: 3 additions & 2 deletions website/src/pages/docs/guides/error-masking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -61,7 +62,7 @@ export const formatError: FormatErrorHandler = err => {
return err
}

const plugins: PluginOrDisabledPlugin = [
const plugins: MeshPlugin<any>[] = [
useMaskedErrors({
errorMessage: 'Something went wrong.',
formatError
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/docs/plugins/plugins-introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}),
Expand Down
Loading