@graphql-tools/delegate 10.0.0 → 10.0.1-alpha-20230802133417-afe71701
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/cjs/Transformer.js +2 -2
- package/cjs/defaultMergedResolver.js +1 -1
- package/cjs/delegateToSchema.js +10 -6
- package/cjs/finalizeGatewayRequest.js +3 -1
- package/cjs/mergeFields.js +6 -2
- package/cjs/prepareGatewayDocument.js +4 -2
- package/cjs/subschemaConfig.js +6 -2
- package/esm/Transformer.js +2 -2
- package/esm/checkResultAndHandleErrors.js +1 -1
- package/esm/defaultMergedResolver.js +1 -1
- package/esm/delegateToSchema.js +11 -7
- package/esm/finalizeGatewayRequest.js +5 -3
- package/esm/mergeFields.js +8 -4
- package/esm/prepareGatewayDocument.js +6 -4
- package/esm/resolveExternalValue.js +1 -1
- package/esm/subschemaConfig.js +6 -2
- package/esm/types.js +1 -1
- package/package.json +1 -1
- package/typings/Subschema.d.cts +1 -1
- package/typings/Subschema.d.ts +1 -1
- package/typings/createRequest.d.cts +1 -1
- package/typings/createRequest.d.ts +1 -1
- package/typings/delegateToSchema.d.cts +1 -1
- package/typings/delegateToSchema.d.ts +1 -1
- package/typings/mergeFields.d.cts +3 -3
- package/typings/mergeFields.d.ts +3 -3
- package/typings/prepareGatewayDocument.d.cts +1 -1
- package/typings/prepareGatewayDocument.d.ts +1 -1
- package/typings/resolveExternalValue.d.cts +1 -1
- package/typings/resolveExternalValue.d.ts +1 -1
- package/typings/types.d.cts +3 -2
- package/typings/types.d.ts +3 -2
package/cjs/Transformer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Transformer = void 0;
|
|
4
|
-
const prepareGatewayDocument_js_1 = require("./prepareGatewayDocument.js");
|
|
5
|
-
const finalizeGatewayRequest_js_1 = require("./finalizeGatewayRequest.js");
|
|
6
4
|
const checkResultAndHandleErrors_js_1 = require("./checkResultAndHandleErrors.js");
|
|
5
|
+
const finalizeGatewayRequest_js_1 = require("./finalizeGatewayRequest.js");
|
|
6
|
+
const prepareGatewayDocument_js_1 = require("./prepareGatewayDocument.js");
|
|
7
7
|
class Transformer {
|
|
8
8
|
constructor(context) {
|
|
9
9
|
this.transformations = [];
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.defaultMergedResolver = void 0;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
|
-
const resolveExternalValue_js_1 = require("./resolveExternalValue.js");
|
|
7
6
|
const mergeFields_js_1 = require("./mergeFields.js");
|
|
7
|
+
const resolveExternalValue_js_1 = require("./resolveExternalValue.js");
|
|
8
8
|
/**
|
|
9
9
|
* Resolver that knows how to:
|
|
10
10
|
* a) handle aliases for proxied schemas
|
package/cjs/delegateToSchema.js
CHANGED
|
@@ -4,13 +4,13 @@ exports.createDefaultExecutor = exports.delegateRequest = exports.delegateToSche
|
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const value_or_promise_1 = require("value-or-promise");
|
|
6
6
|
const batch_execute_1 = require("@graphql-tools/batch-execute");
|
|
7
|
+
const executor_1 = require("@graphql-tools/executor");
|
|
7
8
|
const utils_1 = require("@graphql-tools/utils");
|
|
8
|
-
const
|
|
9
|
-
const Subschema_js_1 = require("./Subschema.js");
|
|
9
|
+
const applySchemaTransforms_js_1 = require("./applySchemaTransforms.js");
|
|
10
10
|
const createRequest_js_1 = require("./createRequest.js");
|
|
11
|
+
const Subschema_js_1 = require("./Subschema.js");
|
|
12
|
+
const subschemaConfig_js_1 = require("./subschemaConfig.js");
|
|
11
13
|
const Transformer_js_1 = require("./Transformer.js");
|
|
12
|
-
const applySchemaTransforms_js_1 = require("./applySchemaTransforms.js");
|
|
13
|
-
const executor_1 = require("@graphql-tools/executor");
|
|
14
14
|
function delegateToSchema(options) {
|
|
15
15
|
const { info, schema, rootValue = schema.rootValue ?? info.rootValue, operationName = info.operation.name?.value, operation = (0, createRequest_js_1.getDelegatingOperation)(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes = info.fieldNodes, context, } = options;
|
|
16
16
|
const request = (0, createRequest_js_1.createRequest)({
|
|
@@ -86,7 +86,9 @@ function getDelegationContext({ request, schema, fieldName, returnType, args, in
|
|
|
86
86
|
args,
|
|
87
87
|
context: request.context,
|
|
88
88
|
info,
|
|
89
|
-
returnType: returnType ??
|
|
89
|
+
returnType: returnType ??
|
|
90
|
+
info?.returnType ??
|
|
91
|
+
getDelegationReturnType(targetSchema, operation, targetFieldName),
|
|
90
92
|
transforms: subschemaOrSubschemaConfig.transforms != null
|
|
91
93
|
? subschemaOrSubschemaConfig.transforms.concat(transforms)
|
|
92
94
|
: transforms,
|
|
@@ -106,7 +108,9 @@ function getDelegationContext({ request, schema, fieldName, returnType, args, in
|
|
|
106
108
|
args,
|
|
107
109
|
context: request.context,
|
|
108
110
|
info,
|
|
109
|
-
returnType: returnType ??
|
|
111
|
+
returnType: returnType ??
|
|
112
|
+
info?.returnType ??
|
|
113
|
+
getDelegationReturnType(subschemaOrSubschemaConfig, operation, targetFieldName),
|
|
110
114
|
transforms,
|
|
111
115
|
transformedSchema: transformedSchema ?? subschemaOrSubschemaConfig,
|
|
112
116
|
skipTypeMerging,
|
|
@@ -187,7 +187,9 @@ const variablesVisitorKeys = {
|
|
|
187
187
|
function finalizeSelectionSet(schema, type, validFragments, selectionSet) {
|
|
188
188
|
const usedFragments = [];
|
|
189
189
|
const usedVariables = [];
|
|
190
|
-
const typeInfo = graphql_1.versionInfo.major < 16
|
|
190
|
+
const typeInfo = graphql_1.versionInfo.major < 16
|
|
191
|
+
? new graphql_1.TypeInfo(schema, undefined, type)
|
|
192
|
+
: new graphql_1.TypeInfo(schema, type);
|
|
191
193
|
const filteredSelectionSet = (0, graphql_1.visit)(selectionSet, (0, graphql_1.visitWithTypeInfo)(typeInfo, {
|
|
192
194
|
[graphql_1.Kind.FIELD]: {
|
|
193
195
|
enter: node => {
|
package/cjs/mergeFields.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeFields = exports.getActualFieldNodes = exports.getUnpathedErrors = exports.getSubschema = exports.annotateExternalObject = exports.isExternalObject = void 0;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
|
+
const value_or_promise_1 = require("value-or-promise");
|
|
5
6
|
const utils_1 = require("@graphql-tools/utils");
|
|
6
7
|
const symbols_js_1 = require("./symbols.js");
|
|
7
|
-
const value_or_promise_1 = require("value-or-promise");
|
|
8
8
|
function isExternalObject(data) {
|
|
9
9
|
return data[symbols_js_1.UNPATHED_ERRORS_SYMBOL] !== undefined;
|
|
10
10
|
}
|
|
@@ -35,7 +35,11 @@ exports.getActualFieldNodes = (0, utils_1.memoize1)(function (fieldNode) {
|
|
|
35
35
|
return [fieldNode];
|
|
36
36
|
});
|
|
37
37
|
function mergeFields(mergedTypeInfo, object, sourceSubschema, context, info) {
|
|
38
|
-
const delegationMaps = mergedTypeInfo.delegationPlanBuilder(info.schema, sourceSubschema, info.variableValues != null && Object.keys(info.variableValues).length > 0
|
|
38
|
+
const delegationMaps = mergedTypeInfo.delegationPlanBuilder(info.schema, sourceSubschema, info.variableValues != null && Object.keys(info.variableValues).length > 0
|
|
39
|
+
? info.variableValues
|
|
40
|
+
: EMPTY_OBJECT, info.fragments != null && Object.keys(info.fragments).length > 0
|
|
41
|
+
? info.fragments
|
|
42
|
+
: EMPTY_OBJECT, info.fieldNodes?.length
|
|
39
43
|
? info.fieldNodes.length === 1
|
|
40
44
|
? (0, exports.getActualFieldNodes)(info.fieldNodes[0])
|
|
41
45
|
: info.fieldNodes
|
|
@@ -58,7 +58,8 @@ function visitSelectionSet(node, fragmentReplacements, schema, typeInfo, possibl
|
|
|
58
58
|
}
|
|
59
59
|
for (const possibleTypeName of possibleTypes) {
|
|
60
60
|
const maybePossibleType = schema.getType(possibleTypeName);
|
|
61
|
-
if (maybePossibleType != null &&
|
|
61
|
+
if (maybePossibleType != null &&
|
|
62
|
+
(0, utils_1.implementsAbstractType)(schema, parentType, maybePossibleType)) {
|
|
62
63
|
newSelections.add(generateInlineFragment(possibleTypeName, selection.selectionSet));
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -73,7 +74,8 @@ function visitSelectionSet(node, fragmentReplacements, schema, typeInfo, possibl
|
|
|
73
74
|
for (const replacement of fragmentReplacements[fragmentName]) {
|
|
74
75
|
const typeName = replacement.typeName;
|
|
75
76
|
const maybeReplacementType = schema.getType(typeName);
|
|
76
|
-
if (maybeReplacementType != null &&
|
|
77
|
+
if (maybeReplacementType != null &&
|
|
78
|
+
(0, utils_1.implementsAbstractType)(schema, parentType, maybeType)) {
|
|
77
79
|
newSelections.add({
|
|
78
80
|
kind: graphql_1.Kind.FRAGMENT_SPREAD,
|
|
79
81
|
name: {
|
package/cjs/subschemaConfig.js
CHANGED
|
@@ -13,9 +13,13 @@ function cloneSubschemaConfig(subschemaConfig) {
|
|
|
13
13
|
if (newSubschemaConfig.merge != null) {
|
|
14
14
|
newSubschemaConfig.merge = { ...subschemaConfig.merge };
|
|
15
15
|
for (const typeName in newSubschemaConfig.merge) {
|
|
16
|
-
const mergedTypeConfig = (newSubschemaConfig.merge[typeName] = {
|
|
16
|
+
const mergedTypeConfig = (newSubschemaConfig.merge[typeName] = {
|
|
17
|
+
...(subschemaConfig.merge?.[typeName] ?? {}),
|
|
18
|
+
});
|
|
17
19
|
if (mergedTypeConfig.entryPoints != null) {
|
|
18
|
-
mergedTypeConfig.entryPoints = mergedTypeConfig.entryPoints.map(entryPoint => ({
|
|
20
|
+
mergedTypeConfig.entryPoints = mergedTypeConfig.entryPoints.map(entryPoint => ({
|
|
21
|
+
...entryPoint,
|
|
22
|
+
}));
|
|
19
23
|
}
|
|
20
24
|
if (mergedTypeConfig.fields != null) {
|
|
21
25
|
const fields = (mergedTypeConfig.fields = { ...mergedTypeConfig.fields });
|
package/esm/Transformer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { prepareGatewayDocument } from './prepareGatewayDocument.js';
|
|
2
|
-
import { finalizeGatewayRequest } from './finalizeGatewayRequest.js';
|
|
3
1
|
import { checkResultAndHandleErrors } from './checkResultAndHandleErrors.js';
|
|
2
|
+
import { finalizeGatewayRequest } from './finalizeGatewayRequest.js';
|
|
3
|
+
import { prepareGatewayDocument } from './prepareGatewayDocument.js';
|
|
4
4
|
export class Transformer {
|
|
5
5
|
constructor(context) {
|
|
6
6
|
this.transformations = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { responsePathAsArray,
|
|
1
|
+
import { locatedError, responsePathAsArray, } from 'graphql';
|
|
2
2
|
import { getResponseKeyFromInfo, relocatedError } from '@graphql-tools/utils';
|
|
3
3
|
import { resolveExternalValue } from './resolveExternalValue.js';
|
|
4
4
|
export function checkResultAndHandleErrors(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defaultFieldResolver } from 'graphql';
|
|
2
2
|
import { getResponseKeyFromInfo } from '@graphql-tools/utils';
|
|
3
|
-
import { resolveExternalValue } from './resolveExternalValue.js';
|
|
4
3
|
import { getSubschema, getUnpathedErrors, isExternalObject } from './mergeFields.js';
|
|
4
|
+
import { resolveExternalValue } from './resolveExternalValue.js';
|
|
5
5
|
/**
|
|
6
6
|
* Resolver that knows how to:
|
|
7
7
|
* a) handle aliases for proxied schemas
|
package/esm/delegateToSchema.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { validate, } from 'graphql';
|
|
2
2
|
import { ValueOrPromise } from 'value-or-promise';
|
|
3
3
|
import { getBatchingExecutor } from '@graphql-tools/batch-execute';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { normalizedExecutor } from '@graphql-tools/executor';
|
|
5
|
+
import { getDefinedRootType, getOperationASTFromRequest, isAsyncIterable, mapAsyncIterator, memoize1, } from '@graphql-tools/utils';
|
|
6
|
+
import { applySchemaTransforms } from './applySchemaTransforms.js';
|
|
7
7
|
import { createRequest, getDelegatingOperation } from './createRequest.js';
|
|
8
|
+
import { Subschema } from './Subschema.js';
|
|
9
|
+
import { isSubschemaConfig } from './subschemaConfig.js';
|
|
8
10
|
import { Transformer } from './Transformer.js';
|
|
9
|
-
import { applySchemaTransforms } from './applySchemaTransforms.js';
|
|
10
|
-
import { normalizedExecutor } from '@graphql-tools/executor';
|
|
11
11
|
export function delegateToSchema(options) {
|
|
12
12
|
const { info, schema, rootValue = schema.rootValue ?? info.rootValue, operationName = info.operation.name?.value, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes = info.fieldNodes, context, } = options;
|
|
13
13
|
const request = createRequest({
|
|
@@ -81,7 +81,9 @@ function getDelegationContext({ request, schema, fieldName, returnType, args, in
|
|
|
81
81
|
args,
|
|
82
82
|
context: request.context,
|
|
83
83
|
info,
|
|
84
|
-
returnType: returnType ??
|
|
84
|
+
returnType: returnType ??
|
|
85
|
+
info?.returnType ??
|
|
86
|
+
getDelegationReturnType(targetSchema, operation, targetFieldName),
|
|
85
87
|
transforms: subschemaOrSubschemaConfig.transforms != null
|
|
86
88
|
? subschemaOrSubschemaConfig.transforms.concat(transforms)
|
|
87
89
|
: transforms,
|
|
@@ -101,7 +103,9 @@ function getDelegationContext({ request, schema, fieldName, returnType, args, in
|
|
|
101
103
|
args,
|
|
102
104
|
context: request.context,
|
|
103
105
|
info,
|
|
104
|
-
returnType: returnType ??
|
|
106
|
+
returnType: returnType ??
|
|
107
|
+
info?.returnType ??
|
|
108
|
+
getDelegationReturnType(subschemaOrSubschemaConfig, operation, targetFieldName),
|
|
105
109
|
transforms,
|
|
106
110
|
transformedSchema: transformedSchema ?? subschemaOrSubschemaConfig,
|
|
107
111
|
skipTypeMerging,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getNamedType, isAbstractType, isInterfaceType, isObjectType, Kind, TypeInfo, TypeNameMetaFieldDef,
|
|
2
|
-
import {
|
|
1
|
+
import { getNamedType, versionInfo as graphqlVersionInfo, isAbstractType, isInterfaceType, isObjectType, Kind, TypeInfo, TypeNameMetaFieldDef, visit, visitWithTypeInfo, } from 'graphql';
|
|
2
|
+
import { createVariableNameGenerator, getDefinedRootType, implementsAbstractType, inspect, serializeInputValue, updateArgument, } from '@graphql-tools/utils';
|
|
3
3
|
import { getDocumentMetadata } from './getDocumentMetadata.js';
|
|
4
4
|
function finalizeGatewayDocument(targetSchema, fragments, operations) {
|
|
5
5
|
let usedVariables = [];
|
|
@@ -183,7 +183,9 @@ const variablesVisitorKeys = {
|
|
|
183
183
|
function finalizeSelectionSet(schema, type, validFragments, selectionSet) {
|
|
184
184
|
const usedFragments = [];
|
|
185
185
|
const usedVariables = [];
|
|
186
|
-
const typeInfo = graphqlVersionInfo.major < 16
|
|
186
|
+
const typeInfo = graphqlVersionInfo.major < 16
|
|
187
|
+
? new TypeInfo(schema, undefined, type)
|
|
188
|
+
: new TypeInfo(schema, type);
|
|
187
189
|
const filteredSelectionSet = visit(selectionSet, visitWithTypeInfo(typeInfo, {
|
|
188
190
|
[Kind.FIELD]: {
|
|
189
191
|
enter: node => {
|
package/esm/mergeFields.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { collectFields, memoize1, relocatedError } from '@graphql-tools/utils';
|
|
3
|
-
import { FIELD_SUBSCHEMA_MAP_SYMBOL, OBJECT_SUBSCHEMA_SYMBOL, UNPATHED_ERRORS_SYMBOL } from './symbols.js';
|
|
1
|
+
import { GraphQLError, locatedError, responsePathAsArray, } from 'graphql';
|
|
4
2
|
import { ValueOrPromise } from 'value-or-promise';
|
|
3
|
+
import { collectFields, memoize1, relocatedError } from '@graphql-tools/utils';
|
|
4
|
+
import { FIELD_SUBSCHEMA_MAP_SYMBOL, OBJECT_SUBSCHEMA_SYMBOL, UNPATHED_ERRORS_SYMBOL, } from './symbols.js';
|
|
5
5
|
export function isExternalObject(data) {
|
|
6
6
|
return data[UNPATHED_ERRORS_SYMBOL] !== undefined;
|
|
7
7
|
}
|
|
@@ -28,7 +28,11 @@ export const getActualFieldNodes = memoize1(function (fieldNode) {
|
|
|
28
28
|
return [fieldNode];
|
|
29
29
|
});
|
|
30
30
|
export function mergeFields(mergedTypeInfo, object, sourceSubschema, context, info) {
|
|
31
|
-
const delegationMaps = mergedTypeInfo.delegationPlanBuilder(info.schema, sourceSubschema, info.variableValues != null && Object.keys(info.variableValues).length > 0
|
|
31
|
+
const delegationMaps = mergedTypeInfo.delegationPlanBuilder(info.schema, sourceSubschema, info.variableValues != null && Object.keys(info.variableValues).length > 0
|
|
32
|
+
? info.variableValues
|
|
33
|
+
: EMPTY_OBJECT, info.fragments != null && Object.keys(info.fragments).length > 0
|
|
34
|
+
? info.fragments
|
|
35
|
+
: EMPTY_OBJECT, info.fieldNodes?.length
|
|
32
36
|
? info.fieldNodes.length === 1
|
|
33
37
|
? getActualFieldNodes(info.fieldNodes[0])
|
|
34
38
|
: info.fieldNodes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getNamedType, isAbstractType, isCompositeType, isInterfaceType, Kind, TypeInfo, visit, visitWithTypeInfo, } from 'graphql';
|
|
2
|
+
import { getRootTypeNames, implementsAbstractType, memoize2, } from '@graphql-tools/utils';
|
|
3
3
|
import { getDocumentMetadata } from './getDocumentMetadata.js';
|
|
4
4
|
export function prepareGatewayDocument(originalDocument, transformedSchema, returnType, infoSchema) {
|
|
5
5
|
const wrappedConcreteTypesDocument = wrapConcreteTypes(returnType, transformedSchema, originalDocument);
|
|
@@ -54,7 +54,8 @@ function visitSelectionSet(node, fragmentReplacements, schema, typeInfo, possibl
|
|
|
54
54
|
}
|
|
55
55
|
for (const possibleTypeName of possibleTypes) {
|
|
56
56
|
const maybePossibleType = schema.getType(possibleTypeName);
|
|
57
|
-
if (maybePossibleType != null &&
|
|
57
|
+
if (maybePossibleType != null &&
|
|
58
|
+
implementsAbstractType(schema, parentType, maybePossibleType)) {
|
|
58
59
|
newSelections.add(generateInlineFragment(possibleTypeName, selection.selectionSet));
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -69,7 +70,8 @@ function visitSelectionSet(node, fragmentReplacements, schema, typeInfo, possibl
|
|
|
69
70
|
for (const replacement of fragmentReplacements[fragmentName]) {
|
|
70
71
|
const typeName = replacement.typeName;
|
|
71
72
|
const maybeReplacementType = schema.getType(typeName);
|
|
72
|
-
if (maybeReplacementType != null &&
|
|
73
|
+
if (maybeReplacementType != null &&
|
|
74
|
+
implementsAbstractType(schema, parentType, maybeType)) {
|
|
73
75
|
newSelections.add({
|
|
74
76
|
kind: Kind.FRAGMENT_SPREAD,
|
|
75
77
|
name: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNullableType, isCompositeType, isListType,
|
|
1
|
+
import { getNullableType, isAbstractType, isCompositeType, isListType, locatedError, } from 'graphql';
|
|
2
2
|
import { annotateExternalObject, isExternalObject, mergeFields } from './mergeFields.js';
|
|
3
3
|
export function resolveExternalValue(result, unpathedErrors, subschema, context, info, returnType = getReturnType(info), skipTypeMerging) {
|
|
4
4
|
const type = getNullableType(returnType);
|
package/esm/subschemaConfig.js
CHANGED
|
@@ -9,9 +9,13 @@ export function cloneSubschemaConfig(subschemaConfig) {
|
|
|
9
9
|
if (newSubschemaConfig.merge != null) {
|
|
10
10
|
newSubschemaConfig.merge = { ...subschemaConfig.merge };
|
|
11
11
|
for (const typeName in newSubschemaConfig.merge) {
|
|
12
|
-
const mergedTypeConfig = (newSubschemaConfig.merge[typeName] = {
|
|
12
|
+
const mergedTypeConfig = (newSubschemaConfig.merge[typeName] = {
|
|
13
|
+
...(subschemaConfig.merge?.[typeName] ?? {}),
|
|
14
|
+
});
|
|
13
15
|
if (mergedTypeConfig.entryPoints != null) {
|
|
14
|
-
mergedTypeConfig.entryPoints = mergedTypeConfig.entryPoints.map(entryPoint => ({
|
|
16
|
+
mergedTypeConfig.entryPoints = mergedTypeConfig.entryPoints.map(entryPoint => ({
|
|
17
|
+
...entryPoint,
|
|
18
|
+
}));
|
|
15
19
|
}
|
|
16
20
|
if (mergedTypeConfig.fields != null) {
|
|
17
21
|
const fields = (mergedTypeConfig.fields = { ...mergedTypeConfig.fields });
|
package/esm/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FIELD_SUBSCHEMA_MAP_SYMBOL, OBJECT_SUBSCHEMA_SYMBOL, UNPATHED_ERRORS_SYMBOL, } from './symbols.js';
|
package/package.json
CHANGED
package/typings/Subschema.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { SubschemaConfig, Transform, MergedTypeConfig, CreateProxyingResolverFn, BatchingOptions } from './types.cjs';
|
|
3
2
|
import { Executor } from '@graphql-tools/utils';
|
|
3
|
+
import { BatchingOptions, CreateProxyingResolverFn, MergedTypeConfig, SubschemaConfig, Transform } from './types.cjs';
|
|
4
4
|
export declare function isSubschema(value: any): value is Subschema;
|
|
5
5
|
interface ISubschema<K = any, V = any, C = K, TContext = Record<string, any>> extends SubschemaConfig<K, V, C, TContext> {
|
|
6
6
|
transformedSchema: GraphQLSchema;
|
package/typings/Subschema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { SubschemaConfig, Transform, MergedTypeConfig, CreateProxyingResolverFn, BatchingOptions } from './types.js';
|
|
3
2
|
import { Executor } from '@graphql-tools/utils';
|
|
3
|
+
import { BatchingOptions, CreateProxyingResolverFn, MergedTypeConfig, SubschemaConfig, Transform } from './types.js';
|
|
4
4
|
export declare function isSubschema(value: any): value is Subschema;
|
|
5
5
|
interface ISubschema<K = any, V = any, C = K, TContext = Record<string, any>> extends SubschemaConfig<K, V, C, TContext> {
|
|
6
6
|
transformedSchema: GraphQLSchema;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphQLObjectType, GraphQLSchema, OperationTypeNode } from 'graphql';
|
|
2
2
|
import { ExecutionRequest } from '@graphql-tools/utils';
|
|
3
3
|
import { ICreateRequest } from './types.cjs';
|
|
4
4
|
export declare function getDelegatingOperation(parentType: GraphQLObjectType, schema: GraphQLSchema): OperationTypeNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphQLObjectType, GraphQLSchema, OperationTypeNode } from 'graphql';
|
|
2
2
|
import { ExecutionRequest } from '@graphql-tools/utils';
|
|
3
3
|
import { ICreateRequest } from './types.js';
|
|
4
4
|
export declare function getDelegatingOperation(parentType: GraphQLObjectType, schema: GraphQLSchema): OperationTypeNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { Executor } from '@graphql-tools/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { IDelegateRequestOptions, IDelegateToSchemaOptions } from './types.cjs';
|
|
4
4
|
export declare function delegateToSchema<TContext extends Record<string, any> = Record<string, any>, TArgs extends Record<string, any> = any>(options: IDelegateToSchemaOptions<TContext, TArgs>): any;
|
|
5
5
|
export declare function delegateRequest<TContext extends Record<string, any> = Record<string, any>, TArgs extends Record<string, any> = any>(options: IDelegateRequestOptions<TContext, TArgs>): any;
|
|
6
6
|
export declare const createDefaultExecutor: (schema: GraphQLSchema) => Executor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { Executor } from '@graphql-tools/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { IDelegateRequestOptions, IDelegateToSchemaOptions } from './types.js';
|
|
4
4
|
export declare function delegateToSchema<TContext extends Record<string, any> = Record<string, any>, TArgs extends Record<string, any> = any>(options: IDelegateToSchemaOptions<TContext, TArgs>): any;
|
|
5
5
|
export declare function delegateRequest<TContext extends Record<string, any> = Record<string, any>, TArgs extends Record<string, any> = any>(options: IDelegateRequestOptions<TContext, TArgs>): any;
|
|
6
6
|
export declare const createDefaultExecutor: (schema: GraphQLSchema) => Executor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ExternalObject, MergedTypeInfo, SubschemaConfig } from './types.cjs';
|
|
3
|
-
import { Subschema } from './Subschema.cjs';
|
|
1
|
+
import { FieldNode, GraphQLError, GraphQLResolveInfo, GraphQLSchema } from 'graphql';
|
|
4
2
|
import { ValueOrPromise } from 'value-or-promise';
|
|
3
|
+
import { Subschema } from './Subschema.cjs';
|
|
4
|
+
import { ExternalObject, MergedTypeInfo, SubschemaConfig } from './types.cjs';
|
|
5
5
|
export declare function isExternalObject(data: any): data is ExternalObject;
|
|
6
6
|
export declare function annotateExternalObject<TContext>(object: any, errors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext> | undefined, subschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>): ExternalObject;
|
|
7
7
|
export declare function getSubschema(object: ExternalObject, responseKey: string): GraphQLSchema | SubschemaConfig;
|
package/typings/mergeFields.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ExternalObject, MergedTypeInfo, SubschemaConfig } from './types.js';
|
|
3
|
-
import { Subschema } from './Subschema.js';
|
|
1
|
+
import { FieldNode, GraphQLError, GraphQLResolveInfo, GraphQLSchema } from 'graphql';
|
|
4
2
|
import { ValueOrPromise } from 'value-or-promise';
|
|
3
|
+
import { Subschema } from './Subschema.js';
|
|
4
|
+
import { ExternalObject, MergedTypeInfo, SubschemaConfig } from './types.js';
|
|
5
5
|
export declare function isExternalObject(data: any): data is ExternalObject;
|
|
6
6
|
export declare function annotateExternalObject<TContext>(object: any, errors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext> | undefined, subschemaMap: Record<string, GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>>): ExternalObject;
|
|
7
7
|
export declare function getSubschema(object: ExternalObject, responseKey: string): GraphQLSchema | SubschemaConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DocumentNode,
|
|
1
|
+
import { DocumentNode, GraphQLOutputType, GraphQLSchema } from 'graphql';
|
|
2
2
|
export declare function prepareGatewayDocument(originalDocument: DocumentNode, transformedSchema: GraphQLSchema, returnType: GraphQLOutputType, infoSchema?: GraphQLSchema): DocumentNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DocumentNode,
|
|
1
|
+
import { DocumentNode, GraphQLOutputType, GraphQLSchema } from 'graphql';
|
|
2
2
|
export declare function prepareGatewayDocument(originalDocument: DocumentNode, transformedSchema: GraphQLSchema, returnType: GraphQLOutputType, infoSchema?: GraphQLSchema): DocumentNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphQLError, GraphQLOutputType, GraphQLResolveInfo, GraphQLSchema } from 'graphql';
|
|
2
2
|
import { SubschemaConfig } from './types.cjs';
|
|
3
3
|
export declare function resolveExternalValue<TContext extends Record<string, any>>(result: any, unpathedErrors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext>, context?: Record<string, any>, info?: GraphQLResolveInfo, returnType?: GraphQLOutputType, skipTypeMerging?: boolean): any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphQLError, GraphQLOutputType, GraphQLResolveInfo, GraphQLSchema } from 'graphql';
|
|
2
2
|
import { SubschemaConfig } from './types.js';
|
|
3
3
|
export declare function resolveExternalValue<TContext extends Record<string, any>>(result: any, unpathedErrors: Array<GraphQLError>, subschema: GraphQLSchema | SubschemaConfig<any, any, any, TContext>, context?: Record<string, any>, info?: GraphQLResolveInfo, returnType?: GraphQLOutputType, skipTypeMerging?: boolean): any;
|
package/typings/types.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GraphQLSchema, GraphQLOutputType, SelectionSetNode, FieldNode, GraphQLResolveInfo, GraphQLFieldResolver, FragmentDefinitionNode, GraphQLObjectType, VariableDefinitionNode, OperationTypeNode, GraphQLError, GraphQLNamedType } from 'graphql';
|
|
2
1
|
import DataLoader from 'dataloader';
|
|
2
|
+
import { FieldNode, FragmentDefinitionNode, GraphQLError, GraphQLFieldResolver, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLResolveInfo, GraphQLSchema, OperationTypeNode, SelectionSetNode, VariableDefinitionNode } from 'graphql';
|
|
3
3
|
import { ExecutionRequest, ExecutionResult, Executor } from '@graphql-tools/utils';
|
|
4
4
|
import { Subschema } from './Subschema.cjs';
|
|
5
|
-
import {
|
|
5
|
+
import { FIELD_SUBSCHEMA_MAP_SYMBOL, OBJECT_SUBSCHEMA_SYMBOL, UNPATHED_ERRORS_SYMBOL } from './symbols.cjs';
|
|
6
6
|
export type SchemaTransform<TContext = Record<any, string>> = (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>) => GraphQLSchema;
|
|
7
7
|
export type RequestTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionRequest;
|
|
8
8
|
export type ResultTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalResult: ExecutionResult, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionResult;
|
|
@@ -112,6 +112,7 @@ export interface MergedTypeResolverOptions<K = any, V = any> {
|
|
|
112
112
|
args?: (originalResult: any) => Record<string, any>;
|
|
113
113
|
argsFromKeys?: (keys: ReadonlyArray<K>) => Record<string, any>;
|
|
114
114
|
valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>;
|
|
115
|
+
dataLoaderOptions?: DataLoader.Options<K, V>;
|
|
115
116
|
}
|
|
116
117
|
export interface MergedFieldConfig {
|
|
117
118
|
selectionSet?: string;
|
package/typings/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GraphQLSchema, GraphQLOutputType, SelectionSetNode, FieldNode, GraphQLResolveInfo, GraphQLFieldResolver, FragmentDefinitionNode, GraphQLObjectType, VariableDefinitionNode, OperationTypeNode, GraphQLError, GraphQLNamedType } from 'graphql';
|
|
2
1
|
import DataLoader from 'dataloader';
|
|
2
|
+
import { FieldNode, FragmentDefinitionNode, GraphQLError, GraphQLFieldResolver, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLResolveInfo, GraphQLSchema, OperationTypeNode, SelectionSetNode, VariableDefinitionNode } from 'graphql';
|
|
3
3
|
import { ExecutionRequest, ExecutionResult, Executor } from '@graphql-tools/utils';
|
|
4
4
|
import { Subschema } from './Subschema.js';
|
|
5
|
-
import {
|
|
5
|
+
import { FIELD_SUBSCHEMA_MAP_SYMBOL, OBJECT_SUBSCHEMA_SYMBOL, UNPATHED_ERRORS_SYMBOL } from './symbols.js';
|
|
6
6
|
export type SchemaTransform<TContext = Record<any, string>> = (originalWrappingSchema: GraphQLSchema, subschemaConfig: SubschemaConfig<any, any, any, TContext>) => GraphQLSchema;
|
|
7
7
|
export type RequestTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalRequest: ExecutionRequest, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionRequest;
|
|
8
8
|
export type ResultTransform<T = Record<string, any>, TContext = Record<any, string>> = (originalResult: ExecutionResult, delegationContext: DelegationContext<TContext>, transformationContext: T) => ExecutionResult;
|
|
@@ -112,6 +112,7 @@ export interface MergedTypeResolverOptions<K = any, V = any> {
|
|
|
112
112
|
args?: (originalResult: any) => Record<string, any>;
|
|
113
113
|
argsFromKeys?: (keys: ReadonlyArray<K>) => Record<string, any>;
|
|
114
114
|
valuesFromResults?: (results: any, keys: ReadonlyArray<K>) => Array<V>;
|
|
115
|
+
dataLoaderOptions?: DataLoader.Options<K, V>;
|
|
115
116
|
}
|
|
116
117
|
export interface MergedFieldConfig {
|
|
117
118
|
selectionSet?: string;
|