@graphql-tools/wrap 8.1.1-alpha-5d885fa3.0 → 9.0.0-alpha-8ae2f1b1.0
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/index.js +5 -3
- package/index.mjs +6 -4
- package/package.json +4 -4
- package/es5/README.md +0 -5
- package/es5/generateProxyingResolvers.d.ts +0 -4
- package/es5/index.d.ts +0 -5
- package/es5/index.js +0 -1915
- package/es5/index.mjs +0 -1877
- package/es5/introspect.d.ts +0 -4
- package/es5/package.json +0 -38
- package/es5/transforms/ExtractField.d.ts +0 -11
- package/es5/transforms/FilterInputObjectFields.d.ts +0 -10
- package/es5/transforms/FilterInterfaceFields.d.ts +0 -8
- package/es5/transforms/FilterObjectFieldDirectives.d.ts +0 -7
- package/es5/transforms/FilterObjectFields.d.ts +0 -8
- package/es5/transforms/FilterRootFields.d.ts +0 -8
- package/es5/transforms/FilterTypes.d.ts +0 -7
- package/es5/transforms/HoistField.d.ts +0 -22
- package/es5/transforms/MapFields.d.ts +0 -15
- package/es5/transforms/MapLeafValues.d.ts +0 -22
- package/es5/transforms/PruneSchema.d.ts +0 -8
- package/es5/transforms/RemoveObjectFieldDeprecations.d.ts +0 -8
- package/es5/transforms/RemoveObjectFieldDirectives.d.ts +0 -7
- package/es5/transforms/RemoveObjectFieldsWithDeprecation.d.ts +0 -7
- package/es5/transforms/RemoveObjectFieldsWithDirective.d.ts +0 -8
- package/es5/transforms/RenameInputObjectFields.d.ts +0 -13
- package/es5/transforms/RenameInterfaceFields.d.ts +0 -9
- package/es5/transforms/RenameObjectFields.d.ts +0 -9
- package/es5/transforms/RenameRootFields.d.ts +0 -9
- package/es5/transforms/RenameRootTypes.d.ts +0 -12
- package/es5/transforms/RenameTypes.d.ts +0 -14
- package/es5/transforms/TransformCompositeFields.d.ts +0 -21
- package/es5/transforms/TransformEnumValues.d.ts +0 -17
- package/es5/transforms/TransformInputObjectFields.d.ts +0 -16
- package/es5/transforms/TransformInterfaceFields.d.ts +0 -14
- package/es5/transforms/TransformObjectFields.d.ts +0 -14
- package/es5/transforms/TransformQuery.d.ts +0 -24
- package/es5/transforms/TransformRootFields.d.ts +0 -14
- package/es5/transforms/WrapFields.d.ts +0 -24
- package/es5/transforms/WrapQuery.d.ts +0 -12
- package/es5/transforms/WrapType.d.ts +0 -10
- package/es5/transforms/index.d.ts +0 -31
- package/es5/types.d.ts +0 -14
- package/es5/wrapSchema.d.ts +0 -3
package/index.js
CHANGED
|
@@ -50,13 +50,14 @@ function createPossiblyNestedProxyingResolver(subschemaConfig, proxyingResolver)
|
|
|
50
50
|
const responseKey = utils.getResponseKeyFromInfo(info);
|
|
51
51
|
// Check to see if the parent contains a proxied result
|
|
52
52
|
if (delegate.isExternalObject(parent)) {
|
|
53
|
-
const unpathedErrors = delegate.getUnpathedErrors(parent);
|
|
54
53
|
const subschema = delegate.getSubschema(parent, responseKey);
|
|
55
54
|
// If there is a proxied result from this subschema, return it
|
|
56
55
|
// This can happen even for a root field when the root type ia
|
|
57
56
|
// also nested as a field within a different type.
|
|
58
57
|
if (subschemaConfig === subschema && parent[responseKey] !== undefined) {
|
|
59
|
-
|
|
58
|
+
const unpathedErrors = delegate.getUnpathedErrors(parent);
|
|
59
|
+
const initialPath = delegate.getInitialPath(parent);
|
|
60
|
+
return delegate.createExternalValue(parent[responseKey], unpathedErrors, initialPath, subschema, context, info);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -825,8 +826,9 @@ class MapLeafValues {
|
|
|
825
826
|
return originalWrappingSchema;
|
|
826
827
|
}
|
|
827
828
|
transformRequest(originalRequest, _delegationContext, transformationContext) {
|
|
829
|
+
var _a;
|
|
828
830
|
const document = originalRequest.document;
|
|
829
|
-
const variableValues = (originalRequest.variables
|
|
831
|
+
const variableValues = (_a = originalRequest.variables) !== null && _a !== void 0 ? _a : {};
|
|
830
832
|
const operations = document.definitions.filter(def => def.kind === graphql.Kind.OPERATION_DEFINITION);
|
|
831
833
|
const fragments = document.definitions.filter(def => def.kind === graphql.Kind.FRAGMENT_DEFINITION);
|
|
832
834
|
const newOperations = this.transformOperations(operations, variableValues);
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, isSpecifiedScalarType, isScalarType, visit, Kind, TypeInfo, visitWithTypeInfo, isObjectType, isInterfaceType, typeFromAST, isInputType, isLeafType, valueFromAST, getNullableType, BREAK, parse, getIntrospectionQuery, buildClientSchema } from 'graphql';
|
|
2
2
|
import { getRootTypeMap, getResponseKeyFromInfo, mapSchema, MapperKind, renameType, visitData, transformInputValue, visitResult, assertSome, createVariableNameGenerator, updateArgument, relocatedError, getArgumentValues, valueMatchesCriteria, getDirectives, pruneSchema, selectObjectFields, appendObjectFields, modifyObjectFields, removeObjectFields, isAsyncIterable, AggregateError } from '@graphql-tools/utils';
|
|
3
|
-
import { applySchemaTransforms, delegateToSchema, isExternalObject, getUnpathedErrors,
|
|
3
|
+
import { applySchemaTransforms, delegateToSchema, isExternalObject, getSubschema, getUnpathedErrors, getInitialPath, createExternalValue, defaultMergedResolver } from '@graphql-tools/delegate';
|
|
4
4
|
import { ValueOrPromise } from 'value-or-promise';
|
|
5
5
|
|
|
6
6
|
function generateProxyingResolvers(subschemaConfig) {
|
|
@@ -46,13 +46,14 @@ function createPossiblyNestedProxyingResolver(subschemaConfig, proxyingResolver)
|
|
|
46
46
|
const responseKey = getResponseKeyFromInfo(info);
|
|
47
47
|
// Check to see if the parent contains a proxied result
|
|
48
48
|
if (isExternalObject(parent)) {
|
|
49
|
-
const unpathedErrors = getUnpathedErrors(parent);
|
|
50
49
|
const subschema = getSubschema(parent, responseKey);
|
|
51
50
|
// If there is a proxied result from this subschema, return it
|
|
52
51
|
// This can happen even for a root field when the root type ia
|
|
53
52
|
// also nested as a field within a different type.
|
|
54
53
|
if (subschemaConfig === subschema && parent[responseKey] !== undefined) {
|
|
55
|
-
|
|
54
|
+
const unpathedErrors = getUnpathedErrors(parent);
|
|
55
|
+
const initialPath = getInitialPath(parent);
|
|
56
|
+
return createExternalValue(parent[responseKey], unpathedErrors, initialPath, subschema, context, info);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -821,8 +822,9 @@ class MapLeafValues {
|
|
|
821
822
|
return originalWrappingSchema;
|
|
822
823
|
}
|
|
823
824
|
transformRequest(originalRequest, _delegationContext, transformationContext) {
|
|
825
|
+
var _a;
|
|
824
826
|
const document = originalRequest.document;
|
|
825
|
-
const variableValues = (originalRequest.variables
|
|
827
|
+
const variableValues = (_a = originalRequest.variables) !== null && _a !== void 0 ? _a : {};
|
|
826
828
|
const operations = document.definitions.filter(def => def.kind === Kind.OPERATION_DEFINITION);
|
|
827
829
|
const fragments = document.definitions.filter(def => def.kind === Kind.FRAGMENT_DEFINITION);
|
|
828
830
|
const newOperations = this.transformOperations(operations, variableValues);
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/wrap",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-alpha-8ae2f1b1.0",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/delegate": "
|
|
11
|
-
"@graphql-tools/schema": "8.2.1-alpha-
|
|
12
|
-
"@graphql-tools/utils": "
|
|
10
|
+
"@graphql-tools/delegate": "9.0.0-alpha-8ae2f1b1.0",
|
|
11
|
+
"@graphql-tools/schema": "8.2.1-alpha-8ae2f1b1.0",
|
|
12
|
+
"@graphql-tools/utils": "9.0.0-alpha-8ae2f1b1.0",
|
|
13
13
|
"tslib": "~2.3.0",
|
|
14
14
|
"value-or-promise": "1.0.10"
|
|
15
15
|
},
|
package/es5/README.md
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { GraphQLFieldResolver } from 'graphql';
|
|
2
|
-
import { SubschemaConfig, ICreateProxyingResolverOptions } from '@graphql-tools/delegate';
|
|
3
|
-
export declare function generateProxyingResolvers<TContext>(subschemaConfig: SubschemaConfig<any, any, any, TContext>): Record<string, Record<string, GraphQLFieldResolver<any, any>>>;
|
|
4
|
-
export declare function defaultCreateProxyingResolver<TContext>({ subschemaConfig, operation, transformedSchema, }: ICreateProxyingResolverOptions<TContext>): GraphQLFieldResolver<any, any>;
|
package/es5/index.d.ts
DELETED