graphql-tools 4.0.3 → 4.0.4
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 +40 -15
- package/README.md +5 -0
- package/dist/Interfaces.d.ts +6 -8
- package/dist/stitching/defaultMergedResolver.js +3 -0
- package/dist/stitching/defaultMergedResolver.js.map +1 -1
- package/dist/stitching/typeFromAST.js +10 -0
- package/dist/stitching/typeFromAST.js.map +1 -1
- package/dist/transforms/WrapQuery.js +5 -4
- package/dist/transforms/WrapQuery.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
### vNext
|
|
4
|
+
|
|
5
|
+
* TODO
|
|
6
|
+
|
|
7
|
+
### 4.0.4
|
|
8
|
+
|
|
9
|
+
* Make `WrapQuery` work for non-root fields <br />
|
|
10
|
+
[@mdlavin](https://github.com/mdlavin) in
|
|
11
|
+
[#1007](https://github.com/apollographql/graphql-tools/pull/1008)
|
|
12
|
+
* Update resolvers.md to clarify array usage <br />
|
|
13
|
+
[@alvin777](https://github.com/alvin777) in
|
|
14
|
+
[#1005](https://github.com/apollographql/graphql-tools/pull/1005)
|
|
15
|
+
* Add missing property to `mergeSchemas` api reference. <br />
|
|
16
|
+
[@PlayMa256](https://github.com/PlayMa256) in
|
|
17
|
+
[#1014](https://github.com/apollographql/graphql-tools/pull/1014)
|
|
18
|
+
* Documentation updates for mockServer <br/>
|
|
19
|
+
[@dougshamoo](https://github.com/dougshamoo) in [#1012](https://github.com/apollographql/graphql-tools/pull/1012)
|
|
20
|
+
* Fix default merged resolver behavior <br/>
|
|
21
|
+
[@mfix22](https://github.com/mfix22) in [#983](https://github.com/apollographql/graphql-tools/pull/983)
|
|
22
|
+
* Use `TArgs` generic wherever `IFieldResolver` is used. <br/>
|
|
23
|
+
[@brikou](https://github.com/brikou) in [#955](https://github.com/apollographql/graphql-tools/pull/955)
|
|
24
|
+
* Include deprecations from string SDL in mergeSchemas. <br/>
|
|
25
|
+
[@evans](https://github.com/evans) in [#1041](https://github.com/apollographql/graphql-tools/pull/1041)
|
|
26
|
+
|
|
3
27
|
### 4.0.3
|
|
4
28
|
|
|
5
29
|
* Replaced broken link in docs homepage with Launchpad example <br />
|
|
@@ -14,42 +38,42 @@
|
|
|
14
38
|
* Add support for passing a parsed schema ast to `mergeSchemas` <br/>
|
|
15
39
|
[@ganemone](https://github.com/ganemone) in
|
|
16
40
|
[#977](https://github.com/apollographql/graphql-tools/pull/977)
|
|
17
|
-
* Changes to `extractExtensionDefinitions` to support `graphql-js` union and enum extensions.
|
|
41
|
+
* Changes to `extractExtensionDefinitions` to support `graphql-js` union and enum extensions. <br/>
|
|
18
42
|
[@jansuchy](https://github.com/jansuchy) in [#951](https://github.com/apollographql/graphql-tools/pull/951)
|
|
19
43
|
* Add docs for `mockServer` (closes [#951](https://github.com/apollographql/graphql-tools/issues/94))<br/>
|
|
20
|
-
[@mfix22](https://github.com/mfix22) in [PR #982](https://github.com/apollographql/graphql-tools/pull/982)
|
|
21
|
-
* Fix regression where custom scalars were incorrectly replaced while recreating schema with `visitSchema`.
|
|
44
|
+
[@mfix22](https://github.com/mfix22) in [PR #982](https://github.com/apollographql/graphql-tools/pull/982)
|
|
45
|
+
* Fix regression where custom scalars were incorrectly replaced while recreating schema with `visitSchema`. <br/>
|
|
22
46
|
[@tgriesser](https://github.com/tgriesser) in [#985](https://github.com/apollographql/graphql-tools/pull/985)
|
|
23
47
|
|
|
24
48
|
### 4.0.2
|
|
25
49
|
|
|
26
|
-
* Fix regression in enum input mapping.
|
|
50
|
+
* Fix regression in enum input mapping. <br/>
|
|
27
51
|
[@tgriesser](https://github.com/tgriesser) in [#974](https://github.com/apollographql/graphql-tools/pull/974)
|
|
28
52
|
|
|
29
53
|
### 4.0.1
|
|
30
54
|
|
|
31
|
-
* Fix [regression](https://github.com/apollographql/graphql-tools/issues/962) in enum internal value mapping.
|
|
55
|
+
* Fix [regression](https://github.com/apollographql/graphql-tools/issues/962) in enum internal value mapping. <br/>
|
|
32
56
|
[@tgriesser](https://github.com/tgriesser) in [#973](https://github.com/apollographql/graphql-tools/pull/973)
|
|
33
57
|
|
|
34
58
|
### 4.0.0
|
|
35
59
|
|
|
36
|
-
* Support `graphql` and `@types/graphql` 14.x.
|
|
60
|
+
* Support `graphql` and `@types/graphql` 14.x. <br />
|
|
37
61
|
**NOTE:** `graphql` 14 includes [breaking changes](https://github.com/graphql/graphql-js/releases/tag/v14.0.0). We're bumping the major version of `graphql-tools` to accommodate those breaking changes. If you're planning on using `graphql` 14 with `graphql-tools` 4.0.0, please make sure you've reviewed the `graphql` breaking changes list.
|
|
38
62
|
[@hwillson](https://github.com/hwillson) in [#953](https://github.com/apollographql/graphql-tools/pull/953)
|
|
39
|
-
* Fix template strings usage in guessSchemaByRootField error message.
|
|
63
|
+
* Fix template strings usage in guessSchemaByRootField error message. <br/>
|
|
40
64
|
[@nagelflorian](https://github.com/nagelflorian) in [#936](https://github.com/apollographql/graphql-tools/pull/936)
|
|
41
|
-
* Update `IFieldResolver` to allow typed input args.
|
|
65
|
+
* Update `IFieldResolver` to allow typed input args. <br/>
|
|
42
66
|
[@luk3thomas](https://github.com/luk3thomas) in [#932](https://github.com/apollographql/graphql-tools/pull/932)
|
|
43
|
-
* Changes to `extractExtensionDefinitions` to properly support `graphql-js` input extensions.
|
|
67
|
+
* Changes to `extractExtensionDefinitions` to properly support `graphql-js` input extensions. <br/>
|
|
44
68
|
[@jure](https://github.com/jure) in [#948](https://github.com/apollographql/graphql-tools/pull/948)
|
|
45
|
-
* Stop automatically shallow cloning (via object spread syntax) transformed subscription results. Transformed subscription results are not always objects, which means object spreading can lead to invalid results.
|
|
69
|
+
* Stop automatically shallow cloning (via object spread syntax) transformed subscription results. Transformed subscription results are not always objects, which means object spreading can lead to invalid results. <br/>
|
|
46
70
|
[@ericlewis](https://github.com/ericlewis) in [#928](https://github.com/apollographql/graphql-tools/pull/928)
|
|
47
|
-
* Re-use errors with an `extensions` property to make compatible with Apollo Server and it's built-in errors.
|
|
71
|
+
* Re-use errors with an `extensions` property to make compatible with Apollo Server and it's built-in errors. <br/>
|
|
48
72
|
[@edorsey](https://github.com/edorsey) in [#925](https://github.com/apollographql/graphql-tools/pull/925)
|
|
49
|
-
* Documentation updates.
|
|
50
|
-
[@Amorites](https://github.com/Amorites) in [#944](https://github.com/apollographql/graphql-tools/pull/944)
|
|
51
|
-
[@trevor-scheer](https://github.com/trevor-scheer) in [#946](https://github.com/apollographql/graphql-tools/pull/946)
|
|
52
|
-
[@dnalborczyk](https://github.com/dnalborczyk) in [#934](https://github.com/apollographql/graphql-tools/pull/934)
|
|
73
|
+
* Documentation updates. <br/>
|
|
74
|
+
[@Amorites](https://github.com/Amorites) in [#944](https://github.com/apollographql/graphql-tools/pull/944) <br/>
|
|
75
|
+
[@trevor-scheer](https://github.com/trevor-scheer) in [#946](https://github.com/apollographql/graphql-tools/pull/946) <br/>
|
|
76
|
+
[@dnalborczyk](https://github.com/dnalborczyk) in [#934](https://github.com/apollographql/graphql-tools/pull/934) <br/>
|
|
53
77
|
[@zcei](https://github.com/zcei) in [#933](https://github.com/apollographql/graphql-tools/pull/933)
|
|
54
78
|
|
|
55
79
|
### v3.1.1
|
|
@@ -104,6 +128,7 @@
|
|
|
104
128
|
### v3.0.0
|
|
105
129
|
|
|
106
130
|
* Schema transforms and delegation
|
|
131
|
+
|
|
107
132
|
* Substantial rewrite of internals of `mergeSchemas` and `delegateToSchema`
|
|
108
133
|
* A new API for schema transforms has been introduced: [Docs](https://www.apollographql.com/docs/graphql-tools/schema-transforms.html)
|
|
109
134
|
* `delegateToSchema` is now a public API: [Docs](https://www.apollographql.com/docs/graphql-tools/schema-delegation.html)
|
package/README.md
CHANGED
|
@@ -120,3 +120,8 @@ This example has the entire type definition in one string and all resolvers in o
|
|
|
120
120
|
## Contributions
|
|
121
121
|
|
|
122
122
|
Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!
|
|
123
|
+
|
|
124
|
+
## Maintainers
|
|
125
|
+
|
|
126
|
+
- [@hwillson](https://github.com/hwillson) (Apollo)
|
|
127
|
+
- [@benjamn](https://github.com/benjamn) (Apollo)
|
package/dist/Interfaces.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ export interface IAddResolveFunctionsToSchemaOptions {
|
|
|
14
14
|
resolverValidationOptions?: IResolverValidationOptions;
|
|
15
15
|
inheritResolversFromInterfaces?: boolean;
|
|
16
16
|
}
|
|
17
|
-
export interface IResolverOptions<TSource = any, TContext = any> {
|
|
17
|
+
export interface IResolverOptions<TSource = any, TContext = any, TArgs = any> {
|
|
18
18
|
fragment?: string;
|
|
19
|
-
resolve?: IFieldResolver<TSource, TContext>;
|
|
20
|
-
subscribe?: IFieldResolver<TSource, TContext>;
|
|
19
|
+
resolve?: IFieldResolver<TSource, TContext, TArgs>;
|
|
20
|
+
subscribe?: IFieldResolver<TSource, TContext, TArgs>;
|
|
21
21
|
__resolveType?: GraphQLTypeResolver<TSource, TContext>;
|
|
22
22
|
__isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
|
|
23
23
|
}
|
|
@@ -55,15 +55,13 @@ export declare type MergeInfo = {
|
|
|
55
55
|
fragment: string;
|
|
56
56
|
}>;
|
|
57
57
|
};
|
|
58
|
-
export declare type IFieldResolver<TSource, TContext, TArgs = {
|
|
59
|
-
[argument: string]: any;
|
|
60
|
-
}> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo & {
|
|
58
|
+
export declare type IFieldResolver<TSource, TContext, TArgs = Record<string, any>> = (source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo & {
|
|
61
59
|
mergeInfo: MergeInfo;
|
|
62
60
|
}) => any;
|
|
63
61
|
export declare type ITypedef = (() => ITypedef[]) | string | DocumentNode;
|
|
64
62
|
export declare type ITypeDefinitions = ITypedef | ITypedef[];
|
|
65
|
-
export declare type IResolverObject<TSource = any, TContext = any> = {
|
|
66
|
-
[key: string]: IFieldResolver<TSource, TContext> | IResolverOptions<TSource, TContext> | IResolverObject<TSource, TContext>;
|
|
63
|
+
export declare type IResolverObject<TSource = any, TContext = any, TArgs = any> = {
|
|
64
|
+
[key: string]: IFieldResolver<TSource, TContext, TArgs> | IResolverOptions<TSource, TContext> | IResolverObject<TSource, TContext>;
|
|
67
65
|
};
|
|
68
66
|
export declare type IEnumResolver = {
|
|
69
67
|
[key: string]: string | number;
|
|
@@ -16,6 +16,9 @@ var defaultMergedResolver = function (parent, args, context, info) {
|
|
|
16
16
|
throw error_1.locatedError(new Error(errorResult.error.message), info.fieldNodes, graphql_1.responsePathAsArray(info.path));
|
|
17
17
|
}
|
|
18
18
|
var result = parent[responseKey];
|
|
19
|
+
if (result == null) {
|
|
20
|
+
result = parent[info.fieldName];
|
|
21
|
+
}
|
|
19
22
|
// subscription result mapping
|
|
20
23
|
if (!result && parent.data && parent.data[responseKey]) {
|
|
21
24
|
result = parent.data[responseKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMergedResolver.js","sourceRoot":"","sources":["../../src/stitching/defaultMergedResolver.ts"],"names":[],"mappings":";AAAA,mCAAoE;AACpE,uCAA6C;AAC7C,mCAA2E;AAC3E,mEAAkE;AAElE,8BAA8B;AAC9B,wCAAwC;AACxC,wCAAwC;AACxC,IAAM,qBAAqB,GAAmC,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;IACxF,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,IAAM,WAAW,GAAG,+CAAsB,CAAC,IAAI,CAAC,CAAC;IACjD,IAAM,WAAW,GAAG,4BAAmB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAE7D,IAAI,WAAW,CAAC,IAAI,KAAK,KAAK,EAAE;QAC9B,MAAM,oBAAY,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,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,WAAW,CAAC,CAAC;IAEjC,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACjC;IAED,8BAA8B;IAC9B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QACtD,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KACnC;IAED,IAAI,WAAW,CAAC,MAAM,EAAE;QACtB,MAAM,GAAG,mCAA0B,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KACjE;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,qBAAqB,CAAC"}
|
|
@@ -89,10 +89,20 @@ function makeInputObjectType(node) {
|
|
|
89
89
|
function makeFields(nodes) {
|
|
90
90
|
var result = {};
|
|
91
91
|
nodes.forEach(function (node) {
|
|
92
|
+
var deprecatedDirective = node.directives.find(function (directive) {
|
|
93
|
+
return directive && directive.name && directive.name.value === 'deprecated';
|
|
94
|
+
});
|
|
95
|
+
var deprecatedArgument = deprecatedDirective &&
|
|
96
|
+
deprecatedDirective.arguments &&
|
|
97
|
+
deprecatedDirective.arguments.find(function (arg) { return arg && arg.name && arg.name.value === 'reason'; });
|
|
98
|
+
var deprecationReason = deprecatedArgument &&
|
|
99
|
+
deprecatedArgument.value &&
|
|
100
|
+
deprecatedArgument.value.value;
|
|
92
101
|
result[node.name.value] = {
|
|
93
102
|
type: resolveType(node.type, 'object'),
|
|
94
103
|
args: makeValues(node.arguments),
|
|
95
104
|
description: graphql_1.getDescription(node, backcompatOptions),
|
|
105
|
+
deprecationReason: deprecationReason,
|
|
96
106
|
};
|
|
97
107
|
});
|
|
98
108
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeFromAST.js","sourceRoot":"","sources":["../../src/stitching/typeFromAST.ts"],"names":[],"m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CAAC,CAAC,CAAC;QACvD,KAAK,cAAI,CAAC,aAAa;YACrB,OAAO,IAAI,wBAAc,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D;YACE,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KACjD;AACH,CAAC;AAED,SAAS,eAAe,CACtB,IAAY,EACZ,IAAsC;IAEtC,IAAI,WAAgB,CAAC;IACrB,IAAI,IAAI,KAAK,QAAQ,EAAE;QACrB,WAAW,GAAG,2BAAiB,CAAC;KACjC;SAAM,IAAI,IAAI,KAAK,WAAW,EAAE;QAC/B,WAAW,GAAG,8BAAoB,CAAC;KACpC;SAAM;QACL,WAAW,GAAG,gCAAsB,CAAC;KACtC;IAED,OAAO,IAAI,WAAW,CAAC;QACrB,IAAI,MAAA;QACJ,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,IAAI,EAAE,uBAAa;aACpB;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -48,11 +48,12 @@ var WrapQuery = /** @class */ (function () {
|
|
|
48
48
|
return __assign({}, originalRequest, { document: newDocument });
|
|
49
49
|
};
|
|
50
50
|
WrapQuery.prototype.transformResult = function (originalResult) {
|
|
51
|
-
var
|
|
52
|
-
if (
|
|
51
|
+
var rootData = originalResult.data;
|
|
52
|
+
if (rootData) {
|
|
53
|
+
var data = rootData;
|
|
53
54
|
var path = this.path.slice();
|
|
54
55
|
while (path.length > 1) {
|
|
55
|
-
var next = path.
|
|
56
|
+
var next = path.shift();
|
|
56
57
|
if (data[next]) {
|
|
57
58
|
data = data[next];
|
|
58
59
|
}
|
|
@@ -60,7 +61,7 @@ var WrapQuery = /** @class */ (function () {
|
|
|
60
61
|
data[path[0]] = this.extractor(data[path[0]]);
|
|
61
62
|
}
|
|
62
63
|
return {
|
|
63
|
-
data:
|
|
64
|
+
data: rootData,
|
|
64
65
|
errors: originalResult.errors
|
|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