@graphcommerce/graphql-codegen-relay-optimizer-plugin 6.0.0-canary.26 → 6.0.0-canary.28
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 +264 -0
- package/package.json +9 -15
- package/tsconfig.json +13 -0
- package/dist/__tests__/index.spec.js +0 -136
- package/src/__tests__/index.spec.ts +0 -145
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## 6.0.0-canary.28
|
|
4
|
+
|
|
5
|
+
## 6.0.0-canary.27
|
|
6
|
+
|
|
7
|
+
## 6.0.0-canary.26
|
|
8
|
+
|
|
9
|
+
## 6.0.0-canary.25
|
|
10
|
+
|
|
11
|
+
## 6.0.0-canary.24
|
|
12
|
+
|
|
13
|
+
## 6.0.0-canary.23
|
|
14
|
+
|
|
15
|
+
## 6.0.0-canary.22
|
|
16
|
+
|
|
17
|
+
## 6.0.0-canary.21
|
|
18
|
+
|
|
19
|
+
## 6.0.0-canary.20
|
|
20
|
+
|
|
21
|
+
## 5.2.0-canary.19
|
|
22
|
+
|
|
23
|
+
## 5.2.0-canary.18
|
|
24
|
+
|
|
25
|
+
## 5.2.0-canary.17
|
|
26
|
+
|
|
27
|
+
## 5.2.0-canary.16
|
|
28
|
+
|
|
29
|
+
## 5.2.0-canary.15
|
|
30
|
+
|
|
31
|
+
## 5.2.0-canary.14
|
|
32
|
+
|
|
33
|
+
## 5.2.0-canary.13
|
|
34
|
+
|
|
35
|
+
## 5.2.0-canary.12
|
|
36
|
+
|
|
37
|
+
## 5.2.0-canary.11
|
|
38
|
+
|
|
39
|
+
## 5.2.0-canary.10
|
|
40
|
+
|
|
41
|
+
## 5.2.0-canary.9
|
|
42
|
+
|
|
43
|
+
## 5.2.0-canary.8
|
|
44
|
+
|
|
45
|
+
## 5.2.0-canary.7
|
|
46
|
+
|
|
47
|
+
## 5.2.0-canary.6
|
|
48
|
+
|
|
49
|
+
## 5.2.0-canary.5
|
|
50
|
+
|
|
51
|
+
## 5.2.0-canary.4
|
|
52
|
+
|
|
53
|
+
## 5.2.0-canary.3
|
|
54
|
+
|
|
55
|
+
## 5.2.0-canary.2
|
|
56
|
+
|
|
57
|
+
## 5.2.0-canary.1
|
|
58
|
+
|
|
59
|
+
## 5.2.0-canary.0
|
|
60
|
+
|
|
61
|
+
## 5.1.1
|
|
62
|
+
|
|
63
|
+
## 5.1.1-canary.1
|
|
64
|
+
|
|
65
|
+
## 5.1.1-canary.0
|
|
66
|
+
|
|
67
|
+
## 5.1.0
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- [#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.
|
|
72
|
+
|
|
73
|
+
- Updated the @mui/material package
|
|
74
|
+
- Removed dependencies on react-hook-form-mui and @playwright/test
|
|
75
|
+
- Upgraded dependencies including type-fest and graphql-mesh
|
|
76
|
+
- Solved peer dependency issues ([@paales](https://github.com/paales))
|
|
77
|
+
|
|
78
|
+
## 5.1.0-canary.11
|
|
79
|
+
|
|
80
|
+
## 5.1.0-canary.10
|
|
81
|
+
|
|
82
|
+
## 5.1.0-canary.9
|
|
83
|
+
|
|
84
|
+
## 5.1.0-canary.8
|
|
85
|
+
|
|
86
|
+
## 5.1.0-canary.7
|
|
87
|
+
|
|
88
|
+
## 5.1.0-canary.6
|
|
89
|
+
|
|
90
|
+
## 5.1.0-canary.5
|
|
91
|
+
|
|
92
|
+
## 5.1.0-canary.4
|
|
93
|
+
|
|
94
|
+
## 5.1.0-canary.3
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- [#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.
|
|
99
|
+
|
|
100
|
+
- Updated the @mui/material package
|
|
101
|
+
- Removed dependencies on react-hook-form-mui and @playwright/test
|
|
102
|
+
- Upgraded dependencies including type-fest and graphql-mesh
|
|
103
|
+
- Solved peer dependency issues ([@paales](https://github.com/paales))
|
|
104
|
+
|
|
105
|
+
## 5.1.0-canary.2
|
|
106
|
+
|
|
107
|
+
## 5.1.0-canary.1
|
|
108
|
+
|
|
109
|
+
## 5.1.0-canary.0
|
|
110
|
+
|
|
111
|
+
## 5.0.0
|
|
112
|
+
|
|
113
|
+
### Major Changes
|
|
114
|
+
|
|
115
|
+
- [#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))
|
|
116
|
+
|
|
117
|
+
## 5.0.0-canary.14
|
|
118
|
+
|
|
119
|
+
## 4.0.0-canary.0
|
|
120
|
+
|
|
121
|
+
### Major Changes
|
|
122
|
+
|
|
123
|
+
- [`e4c7fe17e`](https://github.com/graphcommerce-org/graphcommerce/commit/e4c7fe17e413e37362ceae92e67f1b3a5f62d398) - Bump major version of all packages ([@paales](https://github.com/paales))
|
|
124
|
+
|
|
125
|
+
## 3.0.11
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- [#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
|
|
130
|
+
|
|
131
|
+
## 3.0.11-canary.0
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- [`abb15ef4a`](https://github.com/graphcommerce-org/graphcommerce/commit/abb15ef4a79b12eddb32cc006e5d1d31dd06ac2d) Thanks [@paales](https://github.com/paales)! - Added canary releases to GraphCommerce
|
|
136
|
+
|
|
137
|
+
## 3.0.10
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- [#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
|
|
142
|
+
|
|
143
|
+
## 3.0.9
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- [#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
|
|
148
|
+
|
|
149
|
+
## 3.0.8
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- [#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
|
|
154
|
+
|
|
155
|
+
## 3.0.7
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- [#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
|
|
160
|
+
|
|
161
|
+
## 3.0.6
|
|
162
|
+
|
|
163
|
+
### Patch Changes
|
|
164
|
+
|
|
165
|
+
- [#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
|
|
166
|
+
|
|
167
|
+
## 3.0.5
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- [#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.
|
|
172
|
+
|
|
173
|
+
* [#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
|
|
174
|
+
|
|
175
|
+
## 3.0.4
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- [#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
|
|
180
|
+
|
|
181
|
+
## 3.0.3
|
|
182
|
+
|
|
183
|
+
### Patch Changes
|
|
184
|
+
|
|
185
|
+
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
|
|
186
|
+
|
|
187
|
+
## 3.0.2
|
|
188
|
+
|
|
189
|
+
### Patch Changes
|
|
190
|
+
|
|
191
|
+
- [#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.
|
|
192
|
+
|
|
193
|
+
* [#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.
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
## 3.0.1
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- [`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
|
|
202
|
+
|
|
203
|
+
## 3.0.0
|
|
204
|
+
|
|
205
|
+
### Major Changes
|
|
206
|
+
|
|
207
|
+
- [#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
|
|
208
|
+
|
|
209
|
+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
210
|
+
|
|
211
|
+
## [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)
|
|
212
|
+
|
|
213
|
+
### Bug Fixes
|
|
214
|
+
|
|
215
|
+
- graphql-mesh missing inmemory lru ([6c71c25](https://github.com/ho-nl/m2-pwa/commit/6c71c256911072ace19037616e0ce2ab478bf070))
|
|
216
|
+
|
|
217
|
+
## [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)
|
|
218
|
+
|
|
219
|
+
### Bug Fixes
|
|
220
|
+
|
|
221
|
+
- do not build on install ([254e2a6](https://github.com/ho-nl/m2-pwa/commit/254e2a6f4b2a7e81f46466a0abe06ae2f3a79575))
|
|
222
|
+
|
|
223
|
+
# [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)
|
|
224
|
+
|
|
225
|
+
### Features
|
|
226
|
+
|
|
227
|
+
- add postinstall commands to run properly on deploy ([d512ee3](https://github.com/ho-nl/m2-pwa/commit/d512ee3ba5c3a9573651ec5333595fe2f1aa141c))
|
|
228
|
+
|
|
229
|
+
## [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)
|
|
230
|
+
|
|
231
|
+
### Bug Fixes
|
|
232
|
+
|
|
233
|
+
- build packages before releasing ([c4761cf](https://github.com/ho-nl/m2-pwa/commit/c4761cf6d1810c140fd56f6eac8fca922f8c0edc))
|
|
234
|
+
|
|
235
|
+
## [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)
|
|
236
|
+
|
|
237
|
+
**Note:** Version bump only for package @graphcommerce/graphql-codegen-relay-optimizer-plugin
|
|
238
|
+
|
|
239
|
+
# 2.101.0 (2021-09-27)
|
|
240
|
+
|
|
241
|
+
### Bug Fixes
|
|
242
|
+
|
|
243
|
+
- ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
|
|
244
|
+
- make packages private so they dont get published accidently ([f7b693f](https://github.com/ho-nl/m2-pwa/commit/f7b693ff6a4d232d0871f6a68922d14678853a96))
|
|
245
|
+
|
|
246
|
+
### Features
|
|
247
|
+
|
|
248
|
+
- created stacked-pages package ([d86008e](https://github.com/ho-nl/m2-pwa/commit/d86008ee659ccb25b194a41d624b394a1ddbd088))
|
|
249
|
+
- **next-config:** introduced package to streamline the setup of new examples ([b8a3958](https://github.com/ho-nl/m2-pwa/commit/b8a39584e5b529fcaa22db67d3f986b91ae683ad))
|
|
250
|
+
- next.js 11 ([7d61407](https://github.com/ho-nl/m2-pwa/commit/7d614075a778f488045034f74be4f75b93f63c43))
|
|
251
|
+
- 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))
|
|
252
|
+
- working on EmailForm ([f16141f](https://github.com/ho-nl/m2-pwa/commit/f16141f8cc0dfeaef8dee2a3e635bda898550a51))
|
|
253
|
+
|
|
254
|
+
## 2.0.8 (2020-10-28)
|
|
255
|
+
|
|
256
|
+
### Features
|
|
257
|
+
|
|
258
|
+
- added near-operation-file graphql codegen structure ([e25bdd1](https://github.com/ho-nl/m2-pwa/commit/e25bdd130ac41325619a7d0648e3cb68f2380d32))
|
|
259
|
+
|
|
260
|
+
## [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)
|
|
261
|
+
|
|
262
|
+
### Bug Fixes
|
|
263
|
+
|
|
264
|
+
- 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.
|
|
5
|
+
"version": "6.0.0-canary.28",
|
|
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.
|
|
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.
|
|
24
|
-
"@graphcommerce/prettier-config-pwa": "6.0.0-canary.
|
|
25
|
-
"@types/jest": "29.
|
|
23
|
+
"@graphcommerce/eslint-config-pwa": "6.0.0-canary.28",
|
|
24
|
+
"@graphcommerce/prettier-config-pwa": "6.0.0-canary.28",
|
|
25
|
+
"@types/jest": "29.4.0",
|
|
26
26
|
"@types/relay-compiler": "8.0.3",
|
|
27
|
-
"jest": "29.3
|
|
28
|
-
"ts-jest": "29.0.
|
|
29
|
-
"typescript": "4.9.
|
|
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
|
-
})
|