@graphql-codegen/client-preset 4.6.3-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691 → 4.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,8 @@ const tslib_1 = require("tslib");
6
6
  const documents_1 = require("@graphql-tools/documents");
7
7
  const crypto = tslib_1.__importStar(require("crypto"));
8
8
  const graphql_1 = require("graphql");
9
+ const CLIENT_DIRECTIVE_NAME = 'client';
10
+ const CONNECTION_DIRECTIVE_NAME = 'connection';
9
11
  /**
10
12
  * This function generates a hash from a document node.
11
13
  */
@@ -30,12 +32,22 @@ function normalizeAndPrintDocumentNode(documentNode) {
30
32
  */
31
33
  const sanitizedDocument = (0, graphql_1.visit)(documentNode, {
32
34
  [graphql_1.Kind.FIELD](field) {
33
- if (field.directives?.some(directive => directive.name.value === 'client')) {
35
+ if (field.directives?.some(directive => directive.name.value === CLIENT_DIRECTIVE_NAME)) {
36
+ return null;
37
+ }
38
+ },
39
+ [graphql_1.Kind.FRAGMENT_SPREAD](spread) {
40
+ if (spread.directives?.some(directive => directive.name.value === CLIENT_DIRECTIVE_NAME)) {
41
+ return null;
42
+ }
43
+ },
44
+ [graphql_1.Kind.INLINE_FRAGMENT](fragment) {
45
+ if (fragment.directives?.some(directive => directive.name.value === CLIENT_DIRECTIVE_NAME)) {
34
46
  return null;
35
47
  }
36
48
  },
37
49
  [graphql_1.Kind.DIRECTIVE](directive) {
38
- if (directive.name.value === 'connection') {
50
+ if (directive.name.value === CONNECTION_DIRECTIVE_NAME) {
39
51
  return null;
40
52
  }
41
53
  },
@@ -1,6 +1,8 @@
1
1
  import { printExecutableGraphQLDocument } from '@graphql-tools/documents';
2
2
  import * as crypto from 'crypto';
3
3
  import { Kind, visit } from 'graphql';
4
+ const CLIENT_DIRECTIVE_NAME = 'client';
5
+ const CONNECTION_DIRECTIVE_NAME = 'connection';
4
6
  /**
5
7
  * This function generates a hash from a document node.
6
8
  */
@@ -25,12 +27,22 @@ export function normalizeAndPrintDocumentNode(documentNode) {
25
27
  */
26
28
  const sanitizedDocument = visit(documentNode, {
27
29
  [Kind.FIELD](field) {
28
- if (field.directives?.some(directive => directive.name.value === 'client')) {
30
+ if (field.directives?.some(directive => directive.name.value === CLIENT_DIRECTIVE_NAME)) {
31
+ return null;
32
+ }
33
+ },
34
+ [Kind.FRAGMENT_SPREAD](spread) {
35
+ if (spread.directives?.some(directive => directive.name.value === CLIENT_DIRECTIVE_NAME)) {
36
+ return null;
37
+ }
38
+ },
39
+ [Kind.INLINE_FRAGMENT](fragment) {
40
+ if (fragment.directives?.some(directive => directive.name.value === CLIENT_DIRECTIVE_NAME)) {
29
41
  return null;
30
42
  }
31
43
  },
32
44
  [Kind.DIRECTIVE](directive) {
33
- if (directive.name.value === 'connection') {
45
+ if (directive.name.value === CONNECTION_DIRECTIVE_NAME) {
34
46
  return null;
35
47
  }
36
48
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/client-preset",
3
- "version": "4.6.3-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691",
3
+ "version": "4.6.3",
4
4
  "description": "GraphQL Code Generator preset for client.",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
@@ -9,12 +9,12 @@
9
9
  "@babel/helper-plugin-utils": "^7.20.2",
10
10
  "@babel/template": "^7.20.7",
11
11
  "@graphql-codegen/add": "^5.0.3",
12
- "@graphql-codegen/typed-document-node": "5.0.14-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691",
13
- "@graphql-codegen/typescript": "4.1.4-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691",
14
- "@graphql-codegen/typescript-operations": "4.5.0-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691",
15
- "@graphql-codegen/gql-tag-operations": "4.0.15-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691",
12
+ "@graphql-codegen/typed-document-node": "^5.0.14",
13
+ "@graphql-codegen/typescript": "^4.1.4",
14
+ "@graphql-codegen/typescript-operations": "^4.5.0",
15
+ "@graphql-codegen/gql-tag-operations": "4.0.15",
16
16
  "@graphql-codegen/plugin-helpers": "^5.1.0",
17
- "@graphql-codegen/visitor-plugin-common": "5.7.0-rc-20250219102003-0cfdb198f6db97ac8540d9a444235fd6705a0691",
17
+ "@graphql-codegen/visitor-plugin-common": "^5.7.0",
18
18
  "@graphql-typed-document-node/core": "3.2.0",
19
19
  "@graphql-tools/documents": "^1.0.0",
20
20
  "@graphql-tools/utils": "^10.0.0",