@graphql-tools/delegate 8.5.3 → 8.6.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.
@@ -1,6 +1,5 @@
1
1
  import { GraphQLSchema, GraphQLObjectType, OperationTypeNode } from 'graphql';
2
2
  import { ExecutionRequest } from '@graphql-tools/utils';
3
- import { ICreateRequestFromInfo, ICreateRequest } from './types';
3
+ import { ICreateRequest } from './types';
4
4
  export declare function getDelegatingOperation(parentType: GraphQLObjectType, schema: GraphQLSchema): OperationTypeNode;
5
- export declare function createRequestFromInfo({ info, rootValue, operationName, operation, fieldName, selectionSet, fieldNodes, context, }: ICreateRequestFromInfo): ExecutionRequest;
6
5
  export declare function createRequest({ sourceSchema, sourceParentType, sourceFieldName, fragments, variableDefinitions, variableValues, targetRootValue, targetOperationName, targetOperation, targetFieldName, selectionSet, fieldNodes, context, info, }: ICreateRequest): ExecutionRequest;
package/index.js CHANGED
@@ -968,24 +968,6 @@ function getDelegatingOperation(parentType, schema) {
968
968
  }
969
969
  return 'query';
970
970
  }
971
- function createRequestFromInfo({ info, rootValue, operationName, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes = info.fieldNodes, context, }) {
972
- return createRequest({
973
- sourceSchema: info.schema,
974
- sourceParentType: info.parentType,
975
- sourceFieldName: info.fieldName,
976
- fragments: info.fragments,
977
- variableDefinitions: info.operation.variableDefinitions,
978
- variableValues: info.variableValues,
979
- targetRootValue: rootValue,
980
- targetOperationName: operationName,
981
- targetOperation: operation,
982
- targetFieldName: fieldName,
983
- selectionSet,
984
- fieldNodes,
985
- context,
986
- info,
987
- });
988
- }
989
971
  function createRequest({ sourceSchema, sourceParentType, sourceFieldName, fragments, variableDefinitions, variableValues, targetRootValue, targetOperationName, targetOperation, targetFieldName, selectionSet, fieldNodes, context, info, }) {
990
972
  var _a, _b;
991
973
  let newSelectionSet;
@@ -1146,16 +1128,23 @@ function cloneSubschemaConfig(subschemaConfig) {
1146
1128
  }
1147
1129
 
1148
1130
  function delegateToSchema(options) {
1149
- const { info, schema, rootValue, operationName, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes, context, } = options;
1150
- const request = createRequestFromInfo({
1151
- info,
1152
- operation,
1153
- fieldName,
1131
+ var _a, _b;
1132
+ const { info, schema, rootValue = (_a = schema.rootValue) !== null && _a !== void 0 ? _a : info.rootValue, operationName = (_b = info.operation.name) === null || _b === void 0 ? void 0 : _b.value, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes = info.fieldNodes, context, } = options;
1133
+ const request = createRequest({
1134
+ sourceSchema: info.schema,
1135
+ sourceParentType: info.parentType,
1136
+ sourceFieldName: info.fieldName,
1137
+ fragments: info.fragments,
1138
+ variableDefinitions: info.operation.variableDefinitions,
1139
+ variableValues: info.variableValues,
1140
+ targetRootValue: rootValue,
1141
+ targetOperationName: operationName,
1142
+ targetOperation: operation,
1143
+ targetFieldName: fieldName,
1154
1144
  selectionSet,
1155
1145
  fieldNodes,
1156
- rootValue: rootValue !== null && rootValue !== void 0 ? rootValue : schema.rootValue,
1157
- operationName,
1158
1146
  context,
1147
+ info,
1159
1148
  });
1160
1149
  return delegateRequest({
1161
1150
  ...options,
@@ -1279,7 +1268,6 @@ exports.applySchemaTransforms = applySchemaTransforms;
1279
1268
  exports.cloneSubschemaConfig = cloneSubschemaConfig;
1280
1269
  exports.createDefaultExecutor = createDefaultExecutor;
1281
1270
  exports.createRequest = createRequest;
1282
- exports.createRequestFromInfo = createRequestFromInfo;
1283
1271
  exports.defaultMergedResolver = defaultMergedResolver;
1284
1272
  exports.delegateRequest = delegateRequest;
1285
1273
  exports.delegateToSchema = delegateToSchema;
package/index.mjs CHANGED
@@ -964,24 +964,6 @@ function getDelegatingOperation(parentType, schema) {
964
964
  }
965
965
  return 'query';
966
966
  }
967
- function createRequestFromInfo({ info, rootValue, operationName, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes = info.fieldNodes, context, }) {
968
- return createRequest({
969
- sourceSchema: info.schema,
970
- sourceParentType: info.parentType,
971
- sourceFieldName: info.fieldName,
972
- fragments: info.fragments,
973
- variableDefinitions: info.operation.variableDefinitions,
974
- variableValues: info.variableValues,
975
- targetRootValue: rootValue,
976
- targetOperationName: operationName,
977
- targetOperation: operation,
978
- targetFieldName: fieldName,
979
- selectionSet,
980
- fieldNodes,
981
- context,
982
- info,
983
- });
984
- }
985
967
  function createRequest({ sourceSchema, sourceParentType, sourceFieldName, fragments, variableDefinitions, variableValues, targetRootValue, targetOperationName, targetOperation, targetFieldName, selectionSet, fieldNodes, context, info, }) {
986
968
  var _a, _b;
987
969
  let newSelectionSet;
@@ -1142,16 +1124,23 @@ function cloneSubschemaConfig(subschemaConfig) {
1142
1124
  }
1143
1125
 
1144
1126
  function delegateToSchema(options) {
1145
- const { info, schema, rootValue, operationName, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes, context, } = options;
1146
- const request = createRequestFromInfo({
1147
- info,
1148
- operation,
1149
- fieldName,
1127
+ var _a, _b;
1128
+ const { info, schema, rootValue = (_a = schema.rootValue) !== null && _a !== void 0 ? _a : info.rootValue, operationName = (_b = info.operation.name) === null || _b === void 0 ? void 0 : _b.value, operation = getDelegatingOperation(info.parentType, info.schema), fieldName = info.fieldName, selectionSet, fieldNodes = info.fieldNodes, context, } = options;
1129
+ const request = createRequest({
1130
+ sourceSchema: info.schema,
1131
+ sourceParentType: info.parentType,
1132
+ sourceFieldName: info.fieldName,
1133
+ fragments: info.fragments,
1134
+ variableDefinitions: info.operation.variableDefinitions,
1135
+ variableValues: info.variableValues,
1136
+ targetRootValue: rootValue,
1137
+ targetOperationName: operationName,
1138
+ targetOperation: operation,
1139
+ targetFieldName: fieldName,
1150
1140
  selectionSet,
1151
1141
  fieldNodes,
1152
- rootValue: rootValue !== null && rootValue !== void 0 ? rootValue : schema.rootValue,
1153
- operationName,
1154
1142
  context,
1143
+ info,
1155
1144
  });
1156
1145
  return delegateRequest({
1157
1146
  ...options,
@@ -1268,4 +1257,4 @@ const createDefaultExecutor = memoize1(function createDefaultExecutor(schema) {
1268
1257
  };
1269
1258
  });
1270
1259
 
1271
- export { Subschema, Transformer, annotateExternalObject, applySchemaTransforms, cloneSubschemaConfig, createDefaultExecutor, createRequest, createRequestFromInfo, defaultMergedResolver, delegateRequest, delegateToSchema, getDelegatingOperation, getSubschema, getUnpathedErrors, isExternalObject, isSubschema, isSubschemaConfig, mergeFields, resolveExternalValue };
1260
+ export { Subschema, Transformer, annotateExternalObject, applySchemaTransforms, cloneSubschemaConfig, createDefaultExecutor, createRequest, defaultMergedResolver, delegateRequest, delegateToSchema, getDelegatingOperation, getSubschema, getUnpathedErrors, isExternalObject, isSubschema, isSubschemaConfig, mergeFields, resolveExternalValue };
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "8.5.3",
3
+ "version": "8.6.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/batch-execute": "^8.3.2",
11
- "@graphql-tools/schema": "^8.3.2",
12
- "@graphql-tools/utils": "^8.6.2",
10
+ "@graphql-tools/batch-execute": "8.4.0",
11
+ "@graphql-tools/schema": "8.3.4",
12
+ "@graphql-tools/utils": "8.6.4",
13
13
  "dataloader": "2.0.0",
14
- "graphql-executor": "0.0.18",
14
+ "graphql-executor": "0.0.21",
15
15
  "tslib": "~2.3.0",
16
16
  "value-or-promise": "1.0.11"
17
17
  },
package/types.d.ts CHANGED
@@ -48,16 +48,6 @@ export interface IDelegateToSchemaOptions<TContext = Record<string, any>, TArgs
48
48
  export interface IDelegateRequestOptions<TContext = Record<string, any>, TArgs = Record<string, any>> extends IDelegateToSchemaOptions<TContext, TArgs> {
49
49
  request: ExecutionRequest;
50
50
  }
51
- export interface ICreateRequestFromInfo {
52
- info: GraphQLResolveInfo;
53
- rootValue?: any;
54
- operationName?: string;
55
- operation?: OperationTypeNode;
56
- fieldName?: string;
57
- selectionSet?: SelectionSetNode;
58
- fieldNodes?: ReadonlyArray<FieldNode>;
59
- context?: any;
60
- }
61
51
  export interface ICreateRequest {
62
52
  sourceSchema?: GraphQLSchema;
63
53
  sourceParentType?: GraphQLObjectType;