Skip to content

Commit

Permalink
chore(client): use graphl.web
Browse files Browse the repository at this point in the history
  • Loading branch information
deini committed Sep 5, 2024
1 parent b677add commit 92eeb52
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 66 deletions.
5 changes: 1 addition & 4 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@
"dist"
],
"dependencies": {
"@0no-co/graphql.web": "^1.0.8",
"std-env": "^3.7.0"
},
"peerDependencies": {
"graphql": "^16.0.0"
},
"devDependencies": {
"@bigcommerce/eslint-config": "^2.9.1",
"@bigcommerce/eslint-config-catalyst": "workspace:^",
"@types/node": "^20.16.1",
"dotenv-cli": "^7.4.2",
"eslint": "^8.57.0",
"graphql": "^16.9.0",
"prettier": "^3.3.3",
"tsup": "^8.2.4",
"typescript": "^5.5.4"
Expand Down
12 changes: 9 additions & 3 deletions packages/client/src/utils/getOperationName.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { DefinitionNode, Kind, OperationDefinitionNode, parse } from 'graphql';
import { DefinitionNode, OperationDefinitionNode, parse } from '@0no-co/graphql.web';

function isOperationDefinitionNode(node: DefinitionNode): node is OperationDefinitionNode {
return node.kind === Kind.OPERATION_DEFINITION;
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
return node.kind === 'OperationDefinition';
}

export const getOperationInfo = (document: string) => {
interface OperationInfo {
name?: string;
type: 'query' | 'mutation' | 'subscription';
}

export const getOperationInfo = (document: string): OperationInfo => {
const documentNode = parse(document);

const operationInfo = documentNode.definitions.filter(isOperationDefinitionNode).map((def) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/utils/normalizeQuery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DocumentNode, print } from 'graphql';
import { DocumentNode, print } from '@0no-co/graphql.web';

import { DocumentDecoration } from '../types';

Expand Down
79 changes: 21 additions & 58 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 92eeb52

Please sign in to comment.