Skip to content

Commit

Permalink
feat: move 'graphql' to peerDependencies. Add support for v15 of 'gra…
Browse files Browse the repository at this point in the history
…phql'
  • Loading branch information
JohnDaly committed Aug 1, 2022
1 parent 7fb1a32 commit ebe786c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"chalk": "4.1.1",
"chokidar": "^3.4.2",
"cookie": "^0.4.2",
"graphql": "^16.3.0",
"headers-polyfill": "^3.0.4",
"inquirer": "^8.2.0",
"is-node-process": "^1.0.1",
Expand Down Expand Up @@ -116,6 +115,7 @@
"eslint-plugin-prettier": "^3.4.0",
"fs-extra": "^10.0.0",
"fs-teardown": "^0.3.0",
"graphql": "^16.3.0",
"jest": "26",
"json-bigint": "^1.0.0",
"lint-staged": "^11.0.1",
Expand All @@ -134,6 +134,7 @@
"webpack-dev-server": "^3.11.2"
},
"peerDependencies": {
"graphql": "^15.0.0 || ^16.0.0",
"typescript": ">= 4.2.x <= 4.7.x"
},
"peerDependenciesMeta": {
Expand Down
8 changes: 4 additions & 4 deletions src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const standardGraphQLHandlers = {
* })
* @see {@link https://mswjs.io/docs/api/graphql/query `graphql.query()`}
*/
query: createScopedGraphQLHandler(OperationTypeNode.QUERY, '*'),
query: createScopedGraphQLHandler('query' as OperationTypeNode, '*'),

/**
* Captures a GraphQL mutation by a given name.
Expand All @@ -93,14 +93,14 @@ const standardGraphQLHandlers = {
* })
* @see {@link https://mswjs.io/docs/api/graphql/mutation `graphql.mutation()`}
*/
mutation: createScopedGraphQLHandler(OperationTypeNode.MUTATION, '*'),
mutation: createScopedGraphQLHandler('mutation' as OperationTypeNode, '*'),
}

function createGraphQLLink(url: Path): typeof standardGraphQLHandlers {
return {
operation: createGraphQLOperationHandler(url),
query: createScopedGraphQLHandler(OperationTypeNode.QUERY, url),
mutation: createScopedGraphQLHandler(OperationTypeNode.MUTATION, url),
query: createScopedGraphQLHandler('query' as OperationTypeNode, url),
mutation: createScopedGraphQLHandler('mutation' as OperationTypeNode, url),
}
}

Expand Down

0 comments on commit ebe786c

Please sign in to comment.