@graphcommerce/graphql-codegen-relay-optimizer-plugin 6.0.0-canary.26 → 6.0.0-canary.27

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,262 @@
1
+ # Change Log
2
+
3
+ ## 6.0.0-canary.27
4
+
5
+ ## 6.0.0-canary.26
6
+
7
+ ## 6.0.0-canary.25
8
+
9
+ ## 6.0.0-canary.24
10
+
11
+ ## 6.0.0-canary.23
12
+
13
+ ## 6.0.0-canary.22
14
+
15
+ ## 6.0.0-canary.21
16
+
17
+ ## 6.0.0-canary.20
18
+
19
+ ## 5.2.0-canary.19
20
+
21
+ ## 5.2.0-canary.18
22
+
23
+ ## 5.2.0-canary.17
24
+
25
+ ## 5.2.0-canary.16
26
+
27
+ ## 5.2.0-canary.15
28
+
29
+ ## 5.2.0-canary.14
30
+
31
+ ## 5.2.0-canary.13
32
+
33
+ ## 5.2.0-canary.12
34
+
35
+ ## 5.2.0-canary.11
36
+
37
+ ## 5.2.0-canary.10
38
+
39
+ ## 5.2.0-canary.9
40
+
41
+ ## 5.2.0-canary.8
42
+
43
+ ## 5.2.0-canary.7
44
+
45
+ ## 5.2.0-canary.6
46
+
47
+ ## 5.2.0-canary.5
48
+
49
+ ## 5.2.0-canary.4
50
+
51
+ ## 5.2.0-canary.3
52
+
53
+ ## 5.2.0-canary.2
54
+
55
+ ## 5.2.0-canary.1
56
+
57
+ ## 5.2.0-canary.0
58
+
59
+ ## 5.1.1
60
+
61
+ ## 5.1.1-canary.1
62
+
63
+ ## 5.1.1-canary.0
64
+
65
+ ## 5.1.0
66
+
67
+ ### Patch Changes
68
+
69
+ - [#1752](https://github.com/graphcommerce-org/graphcommerce/pull/1752) [`2a6a4d9ec`](https://github.com/graphcommerce-org/graphcommerce/commit/2a6a4d9ecfa1b58a66ba9b9d00016d6feda9aa95) - Updated dependencies to latest versions, except for nextjs; Solve tons of peer dependency issues.
70
+
71
+ - Updated the @mui/material package
72
+ - Removed dependencies on react-hook-form-mui and @playwright/test
73
+ - Upgraded dependencies including type-fest and graphql-mesh
74
+ - Solved peer dependency issues ([@paales](https://github.com/paales))
75
+
76
+ ## 5.1.0-canary.11
77
+
78
+ ## 5.1.0-canary.10
79
+
80
+ ## 5.1.0-canary.9
81
+
82
+ ## 5.1.0-canary.8
83
+
84
+ ## 5.1.0-canary.7
85
+
86
+ ## 5.1.0-canary.6
87
+
88
+ ## 5.1.0-canary.5
89
+
90
+ ## 5.1.0-canary.4
91
+
92
+ ## 5.1.0-canary.3
93
+
94
+ ### Patch Changes
95
+
96
+ - [#1752](https://github.com/graphcommerce-org/graphcommerce/pull/1752) [`2a6a4d9ec`](https://github.com/graphcommerce-org/graphcommerce/commit/2a6a4d9ecfa1b58a66ba9b9d00016d6feda9aa95) - Updated dependencies to latest versions, except for nextjs; Solve tons of peer dependency issues.
97
+
98
+ - Updated the @mui/material package
99
+ - Removed dependencies on react-hook-form-mui and @playwright/test
100
+ - Upgraded dependencies including type-fest and graphql-mesh
101
+ - Solved peer dependency issues ([@paales](https://github.com/paales))
102
+
103
+ ## 5.1.0-canary.2
104
+
105
+ ## 5.1.0-canary.1
106
+
107
+ ## 5.1.0-canary.0
108
+
109
+ ## 5.0.0
110
+
111
+ ### Major Changes
112
+
113
+ - [#1734](https://github.com/graphcommerce-org/graphcommerce/pull/1734) [`e4c7fe17e`](https://github.com/graphcommerce-org/graphcommerce/commit/e4c7fe17e413e37362ceae92e67f1b3a5f62d398) - Bump major version of all packages ([@github-actions](https://github.com/apps/github-actions))
114
+
115
+ ## 5.0.0-canary.14
116
+
117
+ ## 4.0.0-canary.0
118
+
119
+ ### Major Changes
120
+
121
+ - [`e4c7fe17e`](https://github.com/graphcommerce-org/graphcommerce/commit/e4c7fe17e413e37362ceae92e67f1b3a5f62d398) - Bump major version of all packages ([@paales](https://github.com/paales))
122
+
123
+ ## 3.0.11
124
+
125
+ ### Patch Changes
126
+
127
+ - [#1702](https://github.com/graphcommerce-org/graphcommerce/pull/1702) [`abb15ef4a`](https://github.com/graphcommerce-org/graphcommerce/commit/abb15ef4a79b12eddb32cc006e5d1d31dd06ac2d) Thanks [@paales](https://github.com/paales)! - Added canary releases to GraphCommerce
128
+
129
+ ## 3.0.11-canary.0
130
+
131
+ ### Patch Changes
132
+
133
+ - [`abb15ef4a`](https://github.com/graphcommerce-org/graphcommerce/commit/abb15ef4a79b12eddb32cc006e5d1d31dd06ac2d) Thanks [@paales](https://github.com/paales)! - Added canary releases to GraphCommerce
134
+
135
+ ## 3.0.10
136
+
137
+ ### Patch Changes
138
+
139
+ - [#1598](https://github.com/graphcommerce-org/graphcommerce/pull/1598) [`707dbc73d`](https://github.com/graphcommerce-org/graphcommerce/commit/707dbc73d181204d88fdbbd2e09340e25b2b5f7b) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
140
+
141
+ ## 3.0.9
142
+
143
+ ### Patch Changes
144
+
145
+ - [#1552](https://github.com/graphcommerce-org/graphcommerce/pull/1552) [`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce) Thanks [@paales](https://github.com/paales)! - Updated to Next.js v12.2.2 and other packages and made compatible
146
+
147
+ ## 3.0.8
148
+
149
+ ### Patch Changes
150
+
151
+ - [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
152
+
153
+ ## 3.0.7
154
+
155
+ ### Patch Changes
156
+
157
+ - [#1426](https://github.com/graphcommerce-org/graphcommerce/pull/1426) [`100f4c38c`](https://github.com/graphcommerce-org/graphcommerce/commit/100f4c38c8fcda4bc6e0425e38028b550b60adc2) Thanks [@paales](https://github.com/paales)! - Upgrade packages
158
+
159
+ ## 3.0.6
160
+
161
+ ### Patch Changes
162
+
163
+ - [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
164
+
165
+ ## 3.0.5
166
+
167
+ ### Patch Changes
168
+
169
+ - [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name.
170
+
171
+ * [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
172
+
173
+ ## 3.0.4
174
+
175
+ ### Patch Changes
176
+
177
+ - [#1285](https://github.com/ho-nl/m2-pwa/pull/1285) [`c85294ba6`](https://github.com/ho-nl/m2-pwa/commit/c85294ba6d742ce78c074559a1e95409b25a5017) Thanks [@paales](https://github.com/paales)! - upgraded dependencies
178
+
179
+ ## 3.0.3
180
+
181
+ ### Patch Changes
182
+
183
+ - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
184
+
185
+ ## 3.0.2
186
+
187
+ ### Patch Changes
188
+
189
+ - [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders.
190
+
191
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon.
192
+
193
+ This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually.
194
+
195
+ ## 3.0.1
196
+
197
+ ### Patch Changes
198
+
199
+ - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository
200
+
201
+ ## 3.0.0
202
+
203
+ ### Major Changes
204
+
205
+ - [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
206
+
207
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
208
+
209
+ ## [2.102.6](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.102.5...@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.102.6) (2021-10-18)
210
+
211
+ ### Bug Fixes
212
+
213
+ - graphql-mesh missing inmemory lru ([6c71c25](https://github.com/ho-nl/m2-pwa/commit/6c71c256911072ace19037616e0ce2ab478bf070))
214
+
215
+ ## [2.102.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.102.0...@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.102.1) (2021-09-28)
216
+
217
+ ### Bug Fixes
218
+
219
+ - do not build on install ([254e2a6](https://github.com/ho-nl/m2-pwa/commit/254e2a6f4b2a7e81f46466a0abe06ae2f3a79575))
220
+
221
+ # [2.102.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.101.3...@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.102.0) (2021-09-28)
222
+
223
+ ### Features
224
+
225
+ - add postinstall commands to run properly on deploy ([d512ee3](https://github.com/ho-nl/m2-pwa/commit/d512ee3ba5c3a9573651ec5333595fe2f1aa141c))
226
+
227
+ ## [2.101.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.101.2...@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.101.3) (2021-09-27)
228
+
229
+ ### Bug Fixes
230
+
231
+ - build packages before releasing ([c4761cf](https://github.com/ho-nl/m2-pwa/commit/c4761cf6d1810c140fd56f6eac8fca922f8c0edc))
232
+
233
+ ## [2.101.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.101.0...@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.101.1) (2021-09-27)
234
+
235
+ **Note:** Version bump only for package @graphcommerce/graphql-codegen-relay-optimizer-plugin
236
+
237
+ # 2.101.0 (2021-09-27)
238
+
239
+ ### Bug Fixes
240
+
241
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
242
+ - make packages private so they dont get published accidently ([f7b693f](https://github.com/ho-nl/m2-pwa/commit/f7b693ff6a4d232d0871f6a68922d14678853a96))
243
+
244
+ ### Features
245
+
246
+ - created stacked-pages package ([d86008e](https://github.com/ho-nl/m2-pwa/commit/d86008ee659ccb25b194a41d624b394a1ddbd088))
247
+ - **next-config:** introduced package to streamline the setup of new examples ([b8a3958](https://github.com/ho-nl/m2-pwa/commit/b8a39584e5b529fcaa22db67d3f986b91ae683ad))
248
+ - next.js 11 ([7d61407](https://github.com/ho-nl/m2-pwa/commit/7d614075a778f488045034f74be4f75b93f63c43))
249
+ - renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
250
+ - working on EmailForm ([f16141f](https://github.com/ho-nl/m2-pwa/commit/f16141f8cc0dfeaef8dee2a3e635bda898550a51))
251
+
252
+ ## 2.0.8 (2020-10-28)
253
+
254
+ ### Features
255
+
256
+ - added near-operation-file graphql codegen structure ([e25bdd1](https://github.com/ho-nl/m2-pwa/commit/e25bdd130ac41325619a7d0648e3cb68f2380d32))
257
+
258
+ ## [2.100.11](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.100.10...@graphcommerce/graphql-codegen-relay-optimizer-plugin@2.100.11) (2021-07-26)
259
+
260
+ ### Bug Fixes
261
+
262
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/graphql-codegen-relay-optimizer-plugin",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.0.0-canary.26",
5
+ "version": "6.0.0-canary.27",
6
6
  "description": "GraphQL Code Generator plugin for optimizing your GraphQL queries relay style.",
7
7
  "license": "MIT",
8
8
  "type": "commonjs",
@@ -16,17 +16,17 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@ardatan/relay-compiler": "12.0.0",
19
- "@graphql-codegen/plugin-helpers": "4.0.0",
19
+ "@graphql-codegen/plugin-helpers": "4.1.0",
20
20
  "graphql": "16.6.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.26",
24
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.26",
25
- "@types/jest": "29.2.4",
23
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.27",
24
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.27",
25
+ "@types/jest": "29.4.0",
26
26
  "@types/relay-compiler": "8.0.3",
27
- "jest": "29.3.1",
28
- "ts-jest": "29.0.3",
29
- "typescript": "4.9.4"
27
+ "jest": "29.4.3",
28
+ "ts-jest": "29.0.5",
29
+ "typescript": "4.9.5"
30
30
  },
31
31
  "prettier": "@graphcommerce/prettier-config-pwa",
32
32
  "eslint": {
@@ -37,11 +37,5 @@
37
37
  "parserOptions": {
38
38
  "project": "./tsconfig.json"
39
39
  }
40
- },
41
- "files": [
42
- "dist/**/*",
43
- "src",
44
- "LICENSE",
45
- "README.md"
46
- ]
40
+ }
47
41
  }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "exclude": ["**/node_modules", "example", "dist", "**/.*/", "__tests__", "__mocks__"],
3
+ "include": ["**/*.ts", "**/*.tsx"],
4
+ "extends": "@graphcommerce/typescript-config-pwa/node.json",
5
+ "compilerOptions": {
6
+ "rootDir": "src",
7
+ "outDir": "dist",
8
+ "noLib": false,
9
+ "noEmit": false,
10
+ "sourceMap": false,
11
+ "strict": true
12
+ }
13
+ }
@@ -1,136 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const graphql_1 = require("graphql");
4
- const __1 = require("..");
5
- const testSchema = (0, graphql_1.buildSchema)(/* GraphQL */ `
6
- type Avatar {
7
- id: ID!
8
- url: String!
9
- }
10
-
11
- type User {
12
- id: ID!
13
- login: String!
14
- avatar(height: Int!, width: Int!): Avatar
15
- }
16
-
17
- type Query {
18
- user: User!
19
- users: [User!]!
20
- }
21
- `);
22
- it('can be called', async () => {
23
- const testDocument = (0, graphql_1.parse)(/* GraphQL */ `
24
- query user {
25
- user {
26
- id
27
- }
28
- }
29
- `);
30
- await (0, __1.plugin)(testSchema, [{ document: testDocument }], {});
31
- });
32
- it('can be called with queries that include connection fragments', async () => {
33
- const testDocument = (0, graphql_1.parse)(/* GraphQL */ `
34
- query user {
35
- users @connection(key: "foo") {
36
- id
37
- }
38
- }
39
- `);
40
- await (0, __1.plugin)(testSchema, [{ document: testDocument }], {});
41
- });
42
- it('can inline @argumentDefinitions/@arguments annotated fragments', async () => {
43
- const fragmentDocument = (0, graphql_1.parse)(/* GraphQL */ `
44
- fragment UserLogin on User
45
- @argumentDefinitions(
46
- height: { type: "Int", defaultValue: 10 }
47
- width: { type: "Int", defaultValue: 10 }
48
- ) {
49
- id
50
- login
51
- avatar(width: $width, height: $height) {
52
- id
53
- url
54
- }
55
- }
56
- `);
57
- const queryDocument = (0, graphql_1.parse)(/* GraphQL */ `
58
- query user {
59
- users {
60
- ...UserLogin @arguments(height: 30, width: 30)
61
- }
62
- }
63
- `);
64
- const input = [{ document: fragmentDocument }, { document: queryDocument }];
65
- await (0, __1.plugin)(testSchema, input, {});
66
- const queryDoc = input.find((doc) => doc.document?.definitions[0].kind === 'OperationDefinition');
67
- expect(queryDoc).toBeDefined();
68
- expect((0, graphql_1.print)(queryDoc?.document)).toBeSimilarStringTo(/* GraphQL */ `
69
- query user {
70
- users {
71
- id
72
- login
73
- avatar(width: 30, height: 30) {
74
- id
75
- url
76
- }
77
- }
78
- }
79
- `);
80
- });
81
- it('handles unions with interfaces the correct way', async () => {
82
- const schema = (0, graphql_1.buildSchema)(/* GraphQL */ `
83
- type User {
84
- id: ID!
85
- login: String!
86
- }
87
-
88
- interface Error {
89
- message: String!
90
- }
91
-
92
- type UserNotFoundError implements Error {
93
- message: String!
94
- }
95
-
96
- type UserBlockedError implements Error {
97
- message: String!
98
- }
99
-
100
- union UserResult = User | UserNotFoundError | UserBlockedError
101
-
102
- type Query {
103
- user: UserResult!
104
- }
105
- `);
106
- const queryDocument = (0, graphql_1.parse)(/* GraphQL */ `
107
- query user {
108
- user {
109
- ... on User {
110
- id
111
- login
112
- }
113
- ... on Error {
114
- message
115
- }
116
- }
117
- }
118
- `);
119
- const input = [{ document: queryDocument }];
120
- await (0, __1.plugin)(schema, input, {});
121
- const queryDoc = input.find((doc) => doc.document?.definitions[0].kind === 'OperationDefinition');
122
- expect(queryDoc).toBeDefined();
123
- expect((0, graphql_1.print)(queryDoc?.document)).toBeSimilarStringTo(/* GraphQL */ `
124
- query user {
125
- user {
126
- ... on User {
127
- id
128
- login
129
- }
130
- ... on Error {
131
- message
132
- }
133
- }
134
- }
135
- `);
136
- });
@@ -1,145 +0,0 @@
1
- // import '@graphql-codegen/testing'
2
- import { Types } from '@graphql-codegen/plugin-helpers'
3
- import { buildSchema, parse, print, ASTNode } from 'graphql'
4
- import { plugin } from '..'
5
-
6
- const testSchema = buildSchema(/* GraphQL */ `
7
- type Avatar {
8
- id: ID!
9
- url: String!
10
- }
11
-
12
- type User {
13
- id: ID!
14
- login: String!
15
- avatar(height: Int!, width: Int!): Avatar
16
- }
17
-
18
- type Query {
19
- user: User!
20
- users: [User!]!
21
- }
22
- `)
23
-
24
- it('can be called', async () => {
25
- const testDocument = parse(/* GraphQL */ `
26
- query user {
27
- user {
28
- id
29
- }
30
- }
31
- `)
32
- await plugin(testSchema, [{ document: testDocument }], {})
33
- })
34
-
35
- it('can be called with queries that include connection fragments', async () => {
36
- const testDocument = parse(/* GraphQL */ `
37
- query user {
38
- users @connection(key: "foo") {
39
- id
40
- }
41
- }
42
- `)
43
- await plugin(testSchema, [{ document: testDocument }], {})
44
- })
45
-
46
- it('can inline @argumentDefinitions/@arguments annotated fragments', async () => {
47
- const fragmentDocument = parse(/* GraphQL */ `
48
- fragment UserLogin on User
49
- @argumentDefinitions(
50
- height: { type: "Int", defaultValue: 10 }
51
- width: { type: "Int", defaultValue: 10 }
52
- ) {
53
- id
54
- login
55
- avatar(width: $width, height: $height) {
56
- id
57
- url
58
- }
59
- }
60
- `)
61
- const queryDocument = parse(/* GraphQL */ `
62
- query user {
63
- users {
64
- ...UserLogin @arguments(height: 30, width: 30)
65
- }
66
- }
67
- `)
68
- const input: Types.DocumentFile[] = [{ document: fragmentDocument }, { document: queryDocument }]
69
- await plugin(testSchema, input, {})
70
- const queryDoc = input.find((doc) => doc.document?.definitions[0].kind === 'OperationDefinition')
71
-
72
- expect(queryDoc).toBeDefined()
73
- expect(print(queryDoc?.document as ASTNode)).toBeSimilarStringTo(/* GraphQL */ `
74
- query user {
75
- users {
76
- id
77
- login
78
- avatar(width: 30, height: 30) {
79
- id
80
- url
81
- }
82
- }
83
- }
84
- `)
85
- })
86
-
87
- it('handles unions with interfaces the correct way', async () => {
88
- const schema = buildSchema(/* GraphQL */ `
89
- type User {
90
- id: ID!
91
- login: String!
92
- }
93
-
94
- interface Error {
95
- message: String!
96
- }
97
-
98
- type UserNotFoundError implements Error {
99
- message: String!
100
- }
101
-
102
- type UserBlockedError implements Error {
103
- message: String!
104
- }
105
-
106
- union UserResult = User | UserNotFoundError | UserBlockedError
107
-
108
- type Query {
109
- user: UserResult!
110
- }
111
- `)
112
-
113
- const queryDocument = parse(/* GraphQL */ `
114
- query user {
115
- user {
116
- ... on User {
117
- id
118
- login
119
- }
120
- ... on Error {
121
- message
122
- }
123
- }
124
- }
125
- `)
126
-
127
- const input: Types.DocumentFile[] = [{ document: queryDocument }]
128
- await plugin(schema, input, {})
129
- const queryDoc = input.find((doc) => doc.document?.definitions[0].kind === 'OperationDefinition')
130
-
131
- expect(queryDoc).toBeDefined()
132
- expect(print(queryDoc?.document as ASTNode)).toBeSimilarStringTo(/* GraphQL */ `
133
- query user {
134
- user {
135
- ... on User {
136
- id
137
- login
138
- }
139
- ... on Error {
140
- message
141
- }
142
- }
143
- }
144
- `)
145
- })