Skip to content

Commit 7155417

Browse files
saihajenisdenjoardatan
authored
Upgrade to envelop v3 (#1660)
* update envelop * bring error formatter here * feat: create a wrapped schema * changeset for now * useOnResolver envelop plugin proposal * run canary for v3 * do not run deps * fix version * plz * remove * update envelop * error masking works * plz build * update to new envelop * Fix tests * works * update * resolve to envelop v3 * deno resolve import to envelop/core 3 * code review * update guide * unnecessary cast * use own isGraphQL * dev is when not prod * use http validation context generic * use yoga types * plugins need to inherit the context * patch envelop core * patch envelop response-cache * partial yoga masked error opts * appearantly dev env is when dev env * remove unused * remove more * relative imports need .js * Go * Go Co-authored-by: enisdenjo <[email protected]> Co-authored-by: Arda TANRIKULU <[email protected]>
1 parent 46b98e0 commit 7155417

File tree

21 files changed

+281
-140
lines changed

21 files changed

+281
-140
lines changed

.changeset/strong-peas-exercise.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'graphql-yoga': major
3+
---
4+
5+
update to Envelop `useMaskedError` plugin
6+
7+
- Removed handleValidationErrors and handleParseErrors
8+
- Renamed formatError to maskError
9+
10+
Checkout envelop docs for more details https://www.the-guild.dev/graphql/envelop/v3/guides/migrating-from-v2-to-v3#8-update-options-for-usemaskederrors-plugin

examples/apollo-federation/gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"dependencies": {
1010
"@apollo/gateway": "^0.52.0",
11-
"@envelop/apollo-federation": "^2.5.0",
11+
"@envelop/apollo-federation": "3.0.1",
1212
"graphql-yoga": "3.0.0-next.4",
1313
"graphql": "^16.5.0"
1414
}

examples/fastify-modules/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"check": "tsc --pretty --noEmit"
88
},
99
"dependencies": {
10-
"@envelop/graphql-modules": "3.6.0",
10+
"@envelop/graphql-modules": "4.0.1",
1111
"@graphql-tools/load-files": "6.6.1",
1212
"graphql-yoga": "3.0.0-next.4",
1313
"fastify": "4.7.0",

examples/generic-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"typescript": "4.8.4"
2020
},
2121
"dependencies": {
22-
"@envelop/generic-auth": "4.6.0",
22+
"@envelop/generic-auth": "5.0.1",
2323
"graphql-yoga": "3.0.0-next.4",
2424
"graphql": "16.6.0"
2525
}

examples/live-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"typescript": "4.8.4"
1414
},
1515
"dependencies": {
16-
"@envelop/live-query": "4.2.0",
16+
"@envelop/live-query": "5.0.1",
1717
"@n1ru4l/in-memory-live-query-store": "0.10.0",
1818
"graphql-yoga": "3.0.0-next.4",
1919
"graphql": "16.6.0"

examples/sveltekit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"vite": "3.1.6"
3636
},
3737
"dependencies": {
38-
"@envelop/graphql-jit": "4.6.0",
38+
"@envelop/graphql-jit": "5.0.1",
3939
"graphql-yoga": "3.0.0-next.4",
4040
"graphql": "16.6.0"
4141
},

import-map.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@graphql-tools/utils": "npm:@graphql-tools/utils",
88
"graphql": "npm:graphql",
99
"dset": "npm:dset",
10-
"@envelop/core": "npm:@envelop/core@2",
10+
"@envelop/core": "npm:@envelop/core@3",
1111
"@envelop/parser-cache": "npm:@envelop/parser-cache",
1212
"@envelop/validation-cache": "npm:@envelop/validation-cache",
1313
"@whatwg-node/fetch": "npm:@whatwg-node/fetch",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"weak-napi": "2.0.2"
9696
},
9797
"resolutions": {
98-
"graphql": "16.6.0"
98+
"graphql": "16.6.0",
99+
"@envelop/core": "3.0.2"
99100
}
100101
}

packages/graphql-yoga/__tests__/context.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ describe('Context', () => {
120120
const onContextBuildingFn = jest.fn(
121121
(() => {}) as Plugin['onContextBuilding'],
122122
)
123-
const onResolverCalledFn = jest.fn((() => {}) as Plugin['onResolverCalled'])
124123

125124
const yoga = createYoga({
126125
schema,
@@ -131,7 +130,6 @@ describe('Context', () => {
131130
onParse: onParseFn,
132131
onValidate: onValidateFn,
133132
onContextBuilding: onContextBuildingFn,
134-
onResolverCalled: onResolverCalledFn,
135133
},
136134
],
137135
})
@@ -157,8 +155,5 @@ describe('Context', () => {
157155

158156
expect(onContextBuildingFn.mock.lastCall[0].context.params).toEqual(params)
159157
expect(onContextBuildingFn.mock.lastCall[0].context.request).toBeDefined()
160-
161-
expect(onResolverCalledFn.mock.lastCall[0].context.params).toEqual(params)
162-
expect(onResolverCalledFn.mock.lastCall[0].context.request).toBeDefined()
163158
})
164159
})

packages/graphql-yoga/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
},
5050
"dependencies": {
5151
"@graphql-tools/utils": "8.12.0",
52-
"@envelop/core": "^2.5.0",
53-
"@envelop/parser-cache": "^4.6.0",
54-
"@envelop/validation-cache": "^4.6.0",
52+
"@envelop/core": "3.0.2",
53+
"@envelop/parser-cache": "5.0.1",
54+
"@envelop/validation-cache": "5.0.1",
5555
"@graphql-typed-document-node/core": "^3.1.1",
5656
"@graphql-tools/schema": "^9.0.0",
5757
"@graphql-yoga/subscription": "^3.0.0-next.0",
@@ -63,8 +63,8 @@
6363
"devDependencies": {
6464
"@types/node": "16.11.64",
6565
"html-minifier-terser": "7.0.0",
66-
"@envelop/disable-introspection": "^3.5.0",
67-
"@envelop/live-query": "^4.1.0",
66+
"@envelop/disable-introspection": "4.0.1",
67+
"@envelop/live-query": "5.0.1",
6868
"graphql": "^16.0.1",
6969
"graphql-scalars": "1.18.0",
7070
"graphql-http": "^1.6.0",

0 commit comments

Comments
 (0)