|
1 | 1 | # @graphql-tools/executor
|
2 | 2 |
|
| 3 | +## 1.2.7 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#6280](https://github.com/ardatan/graphql-tools/pull/6280) |
| 8 | + [`7dcd0af`](https://github.com/ardatan/graphql-tools/commit/7dcd0affcae14d8798426f3e2556b91a19df5986) |
| 9 | + Thanks [@ardatan](https://github.com/ardatan)! - Since the executor is version agnostic, it should |
| 10 | + respect the schemas created with older versions. |
| 11 | + |
| 12 | + So if a type resolver returns a type instead of type name which is required since `graphql@16`, |
| 13 | + the executor should handle it correctly. |
| 14 | + |
| 15 | + See the following example: |
| 16 | + |
| 17 | + ```ts |
| 18 | + // Assume that the following code is executed with `graphql@15` |
| 19 | + import { execute } from '@graphql-tools/executor' |
| 20 | + |
| 21 | + const BarType = new GraphQLObjectType({ |
| 22 | + name: 'Bar', |
| 23 | + fields: { |
| 24 | + bar: { |
| 25 | + type: GraphQLString, |
| 26 | + resolve: () => 'bar' |
| 27 | + } |
| 28 | + } |
| 29 | + }) |
| 30 | + const BazType = new GraphQLObjectType({ |
| 31 | + name: 'Baz', |
| 32 | + fields: { |
| 33 | + baz: { |
| 34 | + type: GraphQLString, |
| 35 | + resolve: () => 'baz' |
| 36 | + } |
| 37 | + } |
| 38 | + }) |
| 39 | + const BarBazType = new GraphQLUnionType({ |
| 40 | + name: 'BarBaz', |
| 41 | + types: [BarType, BazType], |
| 42 | + // This is the resolver that returns the type instead of type name |
| 43 | + resolveType(obj) { |
| 44 | + if ('bar' in obj) { |
| 45 | + return BarType |
| 46 | + } |
| 47 | + if ('baz' in obj) { |
| 48 | + return BazType |
| 49 | + } |
| 50 | + } |
| 51 | + }) |
| 52 | + const QueryType = new GraphQLObjectType({ |
| 53 | + name: 'Query', |
| 54 | + fields: { |
| 55 | + barBaz: { |
| 56 | + type: BarBazType, |
| 57 | + resolve: () => ({ bar: 'bar' }) |
| 58 | + } |
| 59 | + } |
| 60 | + }) |
| 61 | + const schema = new GraphQLSchema({ |
| 62 | + query: QueryType |
| 63 | + }) |
| 64 | + |
| 65 | + const result = await execute({ |
| 66 | + schema, |
| 67 | + document: parse(/* GraphQL */ ` |
| 68 | + query { |
| 69 | + barBaz { |
| 70 | + ... on Bar { |
| 71 | + bar |
| 72 | + } |
| 73 | + ... on Baz { |
| 74 | + baz |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + `) |
| 79 | + }) |
| 80 | + |
| 81 | + expect(result).toEqual({ |
| 82 | + data: { |
| 83 | + barBaz: { |
| 84 | + bar: 'bar' |
| 85 | + } |
| 86 | + } |
| 87 | + }) |
| 88 | + ``` |
| 89 | + |
3 | 90 | ## 1.2.6
|
4 | 91 |
|
5 | 92 | ### Patch Changes
|
6 | 93 |
|
7 |
| -- [#6038](https://github.com/ardatan/graphql-tools/pull/6038) [`02dd9ac`](https://github.com/ardatan/graphql-tools/commit/02dd9ac2ee92f6e390098a91753c1bcf5ef71cbc) Thanks [@ardatan](https://github.com/ardatan)! - Some libraries like `undici` throw objects that are not `Error` instances when the response is tried to parse as JSON but failed. |
8 |
| - In that case, executor prints an error like below; |
| 94 | +- [#6038](https://github.com/ardatan/graphql-tools/pull/6038) |
| 95 | + [`02dd9ac`](https://github.com/ardatan/graphql-tools/commit/02dd9ac2ee92f6e390098a91753c1bcf5ef71cbc) |
| 96 | + Thanks [@ardatan](https://github.com/ardatan)! - Some libraries like `undici` throw objects that |
| 97 | + are not `Error` instances when the response is tried to parse as JSON but failed. In that case, |
| 98 | + executor prints an error like below; |
9 | 99 |
|
10 | 100 | ```
|
11 | 101 | NonErrorThrown: Unexpected error value: {...}
|
|
17 | 107 | at async Promise.all (index 0)
|
18 | 108 | ```
|
19 | 109 |
|
20 |
| - But actually the shape of the object matches the `Error` interface. |
21 |
| - In that case, the executor now coerces the object to an `Error` instance by taking `message`, `stack`, `name` and `cause` properties. |
22 |
| - So the user will get the error correctly. |
| 110 | + But actually the shape of the object matches the `Error` interface. In that case, the executor now |
| 111 | + coerces the object to an `Error` instance by taking `message`, `stack`, `name` and `cause` |
| 112 | + properties. So the user will get the error correctly. |
23 | 113 |
|
24 | 114 | ## 1.2.5
|
25 | 115 |
|
26 | 116 | ### Patch Changes
|
27 | 117 |
|
28 |
| -- [#6020](https://github.com/ardatan/graphql-tools/pull/6020) [`b07be2b`](https://github.com/ardatan/graphql-tools/commit/b07be2b2f588345f85167776e8d31e976b110e1f) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Correctly raise `AbortError` for defer payloads |
| 118 | +- [#6020](https://github.com/ardatan/graphql-tools/pull/6020) |
| 119 | + [`b07be2b`](https://github.com/ardatan/graphql-tools/commit/b07be2b2f588345f85167776e8d31e976b110e1f) |
| 120 | + Thanks [@n1ru4l](https://github.com/n1ru4l)! - Correctly raise `AbortError` for defer payloads |
29 | 121 |
|
30 | 122 | ## 1.2.4
|
31 | 123 |
|
32 | 124 | ### Patch Changes
|
33 | 125 |
|
34 |
| -- [#6009](https://github.com/ardatan/graphql-tools/pull/6009) [`14a001e`](https://github.com/ardatan/graphql-tools/commit/14a001e7b82aa30371bb97c33cf0b5c145270ddf) Thanks [@n1ru4l](https://github.com/n1ru4l)! - correctly raise abort exception for Promise and sync execution |
| 126 | +- [#6009](https://github.com/ardatan/graphql-tools/pull/6009) |
| 127 | + [`14a001e`](https://github.com/ardatan/graphql-tools/commit/14a001e7b82aa30371bb97c33cf0b5c145270ddf) |
| 128 | + Thanks [@n1ru4l](https://github.com/n1ru4l)! - correctly raise abort exception for Promise and |
| 129 | + sync execution |
35 | 130 |
|
36 | 131 | ## 1.2.3
|
37 | 132 |
|
38 | 133 | ### Patch Changes
|
39 | 134 |
|
40 |
| -- [#6006](https://github.com/ardatan/graphql-tools/pull/6006) [`a5364eb`](https://github.com/ardatan/graphql-tools/commit/a5364eb0723376ad67492369415e17c7d4568d77) Thanks [@n1ru4l](https://github.com/n1ru4l)! - fix rejecting when canceling async iterable returned from normalized executor |
| 135 | +- [#6006](https://github.com/ardatan/graphql-tools/pull/6006) |
| 136 | + [`a5364eb`](https://github.com/ardatan/graphql-tools/commit/a5364eb0723376ad67492369415e17c7d4568d77) |
| 137 | + Thanks [@n1ru4l](https://github.com/n1ru4l)! - fix rejecting when canceling async iterable |
| 138 | + returned from normalized executor |
41 | 139 |
|
42 | 140 | ## 1.2.2
|
43 | 141 |
|
44 | 142 | ### Patch Changes
|
45 | 143 |
|
46 |
| -- [#5965](https://github.com/ardatan/graphql-tools/pull/5965) [`3e10da6`](https://github.com/ardatan/graphql-tools/commit/3e10da6b2bf97bdf40317a6d88a0cc6412fd0974) Thanks [@n1ru4l](https://github.com/n1ru4l)! - revert subscription event source error handling to graphql-js behaviour |
| 144 | +- [#5965](https://github.com/ardatan/graphql-tools/pull/5965) |
| 145 | + [`3e10da6`](https://github.com/ardatan/graphql-tools/commit/3e10da6b2bf97bdf40317a6d88a0cc6412fd0974) |
| 146 | + Thanks [@n1ru4l](https://github.com/n1ru4l)! - revert subscription event source error handling to |
| 147 | + graphql-js behaviour |
47 | 148 |
|
48 |
| -- Updated dependencies [[`baf3c28`](https://github.com/ardatan/graphql-tools/commit/baf3c28f43dcfafffd15386daeb153bc2895c1b3)]: |
| 149 | +- Updated dependencies |
| 150 | + [[`baf3c28`](https://github.com/ardatan/graphql-tools/commit/baf3c28f43dcfafffd15386daeb153bc2895c1b3)]: |
49 | 151 | - @graphql-tools/utils@10.1.1
|
50 | 152 |
|
51 | 153 | ## 1.2.1
|
52 | 154 |
|
53 | 155 | ### Patch Changes
|
54 | 156 |
|
55 |
| -- [#5913](https://github.com/ardatan/graphql-tools/pull/5913) [`83c0af0`](https://github.com/ardatan/graphql-tools/commit/83c0af0713ff2ce55ccfb97a1810ecfecfeab703) Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates: |
56 |
| - - Updated dependency [`@graphql-tools/utils@^10.0.13` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.0.13) (from `^10.0.8`, in `dependencies`) |
| 157 | +- [#5913](https://github.com/ardatan/graphql-tools/pull/5913) |
| 158 | + [`83c0af0`](https://github.com/ardatan/graphql-tools/commit/83c0af0713ff2ce55ccfb97a1810ecfecfeab703) |
| 159 | + Thanks [@enisdenjo](https://github.com/enisdenjo)! - dependencies updates: |
| 160 | + - Updated dependency |
| 161 | + [`@graphql-tools/utils@^10.0.13` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.0.13) |
| 162 | + (from `^10.0.8`, in `dependencies`) |
57 | 163 |
|
58 | 164 | ## 1.2.0
|
59 | 165 |
|
|
0 commit comments