@wundergraph/composition 0.18.3 → 0.18.5

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.
Files changed (54) hide show
  1. package/dist/ast/utils.d.ts +2 -9
  2. package/dist/ast/utils.js +2 -73
  3. package/dist/ast/utils.js.map +1 -1
  4. package/dist/errors/errors.d.ts +13 -19
  5. package/dist/errors/errors.js +50 -67
  6. package/dist/errors/errors.js.map +1 -1
  7. package/dist/federation/federation-factory.d.ts +17 -46
  8. package/dist/federation/federation-factory.js +391 -1002
  9. package/dist/federation/federation-factory.js.map +1 -1
  10. package/dist/federation/utils.d.ts +1 -115
  11. package/dist/federation/utils.js +0 -29
  12. package/dist/federation/utils.js.map +1 -1
  13. package/dist/federation/walkers.d.ts +3 -0
  14. package/dist/federation/walkers.js +120 -0
  15. package/dist/federation/walkers.js.map +1 -0
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/normalization/normalization-factory.d.ts +26 -18
  20. package/dist/normalization/normalization-factory.js +139 -141
  21. package/dist/normalization/normalization-factory.js.map +1 -1
  22. package/dist/normalization/utils.js +53 -54
  23. package/dist/normalization/utils.js.map +1 -1
  24. package/dist/normalization/walkers.js +156 -128
  25. package/dist/normalization/walkers.js.map +1 -1
  26. package/dist/router-configuration/router-configuration.d.ts +0 -1
  27. package/dist/schema-building/ast.d.ts +17 -5
  28. package/dist/schema-building/ast.js +32 -17
  29. package/dist/schema-building/ast.js.map +1 -1
  30. package/dist/schema-building/type-definition-data.d.ts +51 -25
  31. package/dist/schema-building/type-extension-data.d.ts +11 -7
  32. package/dist/schema-building/type-merging.d.ts +2 -4
  33. package/dist/schema-building/type-merging.js +8 -27
  34. package/dist/schema-building/type-merging.js.map +1 -1
  35. package/dist/schema-building/utils.d.ts +41 -18
  36. package/dist/schema-building/utils.js +855 -111
  37. package/dist/schema-building/utils.js.map +1 -1
  38. package/dist/subgraph/subgraph.d.ts +8 -10
  39. package/dist/subgraph/subgraph.js +1 -237
  40. package/dist/subgraph/subgraph.js.map +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/utils/constants.d.ts +7 -1
  43. package/dist/utils/constants.js +24 -19
  44. package/dist/utils/constants.js.map +1 -1
  45. package/dist/utils/string-constants.d.ts +10 -4
  46. package/dist/utils/string-constants.js +20 -6
  47. package/dist/utils/string-constants.js.map +1 -1
  48. package/dist/utils/utils.d.ts +4 -4
  49. package/dist/utils/utils.js +10 -4
  50. package/dist/utils/utils.js.map +1 -1
  51. package/package.json +4 -3
  52. package/dist/ast/ast.d.ts +0 -97
  53. package/dist/ast/ast.js +0 -168
  54. package/dist/ast/ast.js.map +0 -1
@@ -1,13 +1,9 @@
1
- import { ArgumentNode, DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, FieldDefinitionNode, FieldNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, NamedTypeNode, NameNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, SchemaDefinitionNode, SchemaExtensionNode, SelectionSetNode, StringValueNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql';
2
- import { MutableEnumValueDefinitionNode, MutableFieldDefinitionNode, MutableInputValueDefinitionNode, MutableTypeDefinitionNode, ObjectLikeTypeNode } from './ast';
3
- import { DirectiveContainer, NodeContainer } from '../federation/utils';
1
+ import { ArgumentNode, DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, FieldNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, NamedTypeNode, NameNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, SchemaDefinitionNode, SchemaExtensionNode, SelectionSetNode, StringValueNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql';
2
+ import { ObjectLikeTypeNode } from '../schema-building/ast';
4
3
  export declare function isObjectLikeNodeEntity(node: ObjectLikeTypeNode): boolean;
5
4
  export declare function isNodeInterfaceObject(node: ObjectTypeDefinitionNode): boolean;
6
5
  export declare function isNodeExtension(node: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode): boolean;
7
6
  export declare function extractInterfaces(node: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode, interfaces: Set<string>, errors?: Error[]): Set<string>;
8
- export declare function isNodeShareable(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | FieldDefinitionNode): boolean;
9
- export declare function isNodeExternal(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | FieldDefinitionNode): boolean;
10
- export declare function isNodeOverridden(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | FieldDefinitionNode): boolean;
11
7
  export declare function areBaseAndExtensionKindsCompatible(baseKind: Kind, extensionKind: Kind, typeName: string): boolean;
12
8
  export declare function stringToNameNode(value: string): NameNode;
13
9
  export declare function stringArrayToNameNodeArray(values: string[]): NameNode[];
@@ -18,12 +14,9 @@ export declare function nodeKindToDirectiveLocation(kind: Kind): string;
18
14
  export declare const operationTypeNodeToDefaultType: Map<OperationTypeNode, string>;
19
15
  export declare function isKindAbstract(kind: Kind): boolean;
20
16
  export declare function extractExecutableDirectiveLocations(nodes: readonly NameNode[] | NameNode[], set: Set<string>): Set<string>;
21
- export declare function mergeExecutableDirectiveLocations(nodes: readonly NameNode[] | NameNode[], directiveContainer: DirectiveContainer): Set<string>;
22
- export declare function pushPersistedDirectivesAndGetNode<T extends NodeContainer>(container: T): T['node'];
23
17
  export declare function addConcreteTypesForImplementedInterfaces(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InterfaceTypeDefinitionNode, abstractToConcreteTypeNames: Map<string, Set<string>>): void;
24
18
  export declare function addConcreteTypesForUnion(node: UnionTypeDefinitionNode | UnionTypeExtensionNode, abstractToConcreteTypeNames: Map<string, Set<string>>): void;
25
19
  export declare function formatDescription(description?: StringValueNode): StringValueNode | undefined;
26
- export declare function setLongestDescriptionForNode(existingNode: MutableFieldDefinitionNode | MutableEnumValueDefinitionNode | MutableInputValueDefinitionNode | MutableTypeDefinitionNode, newDescription?: StringValueNode): void;
27
20
  export declare function lexicographicallySortArgumentNodes(fieldNode: FieldNode): ArgumentNode[] | undefined;
28
21
  export declare function lexicographicallySortSelectionSetNode(selectionSetNode: SelectionSetNode): SelectionSetNode;
29
22
  export declare function lexicographicallySortDocumentNode(documentNode: DocumentNode): DocumentNode;
package/dist/ast/utils.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safeParse = exports.lexicographicallySortDocumentNode = exports.lexicographicallySortSelectionSetNode = exports.lexicographicallySortArgumentNodes = exports.setLongestDescriptionForNode = exports.formatDescription = exports.addConcreteTypesForUnion = exports.addConcreteTypesForImplementedInterfaces = exports.pushPersistedDirectivesAndGetNode = exports.mergeExecutableDirectiveLocations = exports.extractExecutableDirectiveLocations = exports.isKindAbstract = exports.operationTypeNodeToDefaultType = exports.nodeKindToDirectiveLocation = exports.setToNamedTypeNodeArray = exports.stringToNamedTypeNode = exports.setToNameNodeArray = exports.stringArrayToNameNodeArray = exports.stringToNameNode = exports.areBaseAndExtensionKindsCompatible = exports.isNodeOverridden = exports.isNodeExternal = exports.isNodeShareable = exports.extractInterfaces = exports.isNodeExtension = exports.isNodeInterfaceObject = exports.isObjectLikeNodeEntity = void 0;
3
+ exports.safeParse = exports.lexicographicallySortDocumentNode = exports.lexicographicallySortSelectionSetNode = exports.lexicographicallySortArgumentNodes = exports.formatDescription = exports.addConcreteTypesForUnion = exports.addConcreteTypesForImplementedInterfaces = exports.extractExecutableDirectiveLocations = exports.isKindAbstract = exports.operationTypeNodeToDefaultType = exports.nodeKindToDirectiveLocation = exports.setToNamedTypeNodeArray = exports.stringToNamedTypeNode = exports.setToNameNodeArray = exports.stringArrayToNameNodeArray = exports.stringToNameNode = exports.areBaseAndExtensionKindsCompatible = exports.extractInterfaces = exports.isNodeExtension = exports.isNodeInterfaceObject = exports.isObjectLikeNodeEntity = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  const string_constants_1 = require("../utils/string-constants");
6
6
  const errors_1 = require("../errors/errors");
7
- const utils_1 = require("../federation/utils");
8
7
  function isObjectLikeNodeEntity(node) {
9
8
  if (!node.directives?.length) {
10
9
  return false;
@@ -57,42 +56,6 @@ function extractInterfaces(node, interfaces, errors) {
57
56
  return interfaces;
58
57
  }
59
58
  exports.extractInterfaces = extractInterfaces;
60
- function isNodeShareable(node) {
61
- if (!node.directives) {
62
- return false;
63
- }
64
- for (const directive of node.directives) {
65
- if (directive.name.value === string_constants_1.SHAREABLE) {
66
- return true;
67
- }
68
- }
69
- return false;
70
- }
71
- exports.isNodeShareable = isNodeShareable;
72
- function isNodeExternal(node) {
73
- if (!node.directives) {
74
- return false;
75
- }
76
- for (const directive of node.directives) {
77
- if (directive.name.value === string_constants_1.EXTERNAL) {
78
- return true;
79
- }
80
- }
81
- return false;
82
- }
83
- exports.isNodeExternal = isNodeExternal;
84
- function isNodeOverridden(node) {
85
- if (!node.directives) {
86
- return false;
87
- }
88
- for (const directive of node.directives) {
89
- if (directive.name.value === string_constants_1.OVERRIDE) {
90
- return true;
91
- }
92
- }
93
- return false;
94
- }
95
- exports.isNodeOverridden = isNodeOverridden;
96
59
  function areBaseAndExtensionKindsCompatible(baseKind, extensionKind, typeName) {
97
60
  switch (baseKind) {
98
61
  case graphql_1.Kind.ENUM_TYPE_DEFINITION:
@@ -211,38 +174,13 @@ exports.isKindAbstract = isKindAbstract;
211
174
  function extractExecutableDirectiveLocations(nodes, set) {
212
175
  for (const node of nodes) {
213
176
  const name = node.value;
214
- if (utils_1.EXECUTABLE_DIRECTIVE_LOCATIONS.has(name)) {
177
+ if (string_constants_1.EXECUTABLE_DIRECTIVE_LOCATIONS.has(name)) {
215
178
  set.add(name);
216
179
  }
217
180
  }
218
181
  return set;
219
182
  }
220
183
  exports.extractExecutableDirectiveLocations = extractExecutableDirectiveLocations;
221
- function mergeExecutableDirectiveLocations(nodes, directiveContainer) {
222
- const mergedSet = new Set();
223
- for (const node of nodes) {
224
- const name = node.value;
225
- if (directiveContainer.executableLocations.has(name)) {
226
- mergedSet.add(name);
227
- }
228
- }
229
- directiveContainer.executableLocations = mergedSet;
230
- return mergedSet;
231
- }
232
- exports.mergeExecutableDirectiveLocations = mergeExecutableDirectiveLocations;
233
- function pushPersistedDirectivesAndGetNode(container) {
234
- const persistedDirectives = [...container.directives.tags.values()];
235
- const deprecatedDirective = container.directives.deprecated.directive;
236
- if (deprecatedDirective) {
237
- persistedDirectives.push(deprecatedDirective);
238
- }
239
- for (const directives of container.directives.directives.values()) {
240
- persistedDirectives.push(...directives);
241
- }
242
- container.node.directives = persistedDirectives;
243
- return container.node;
244
- }
245
- exports.pushPersistedDirectivesAndGetNode = pushPersistedDirectivesAndGetNode;
246
184
  function addConcreteTypesForImplementedInterfaces(node, abstractToConcreteTypeNames) {
247
185
  if (!node.interfaces || node.interfaces.length < 1) {
248
186
  return;
@@ -291,15 +229,6 @@ function formatDescription(description) {
291
229
  return { ...description, value: value, block: true };
292
230
  }
293
231
  exports.formatDescription = formatDescription;
294
- function setLongestDescriptionForNode(existingNode, newDescription) {
295
- if (!newDescription) {
296
- return;
297
- }
298
- if (!existingNode.description || newDescription.value.length > existingNode.description.value.length) {
299
- existingNode.description = { ...newDescription, block: true };
300
- }
301
- }
302
- exports.setLongestDescriptionForNode = setLongestDescriptionForNode;
303
232
  function lexicographicallySortArgumentNodes(fieldNode) {
304
233
  if (!fieldNode.arguments) {
305
234
  return fieldNode.arguments;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/ast/utils.ts"],"names":[],"m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phql';
2
- import { EntityInterfaceFederationData, ImplementationErrorsMap, InvalidArgument, InvalidEntityInterface, InvalidRequiredArgument } from '../utils/utils';
3
- import { ObjectContainer, RootTypeFieldData } from '../federation/utils';
2
+ import { EntityInterfaceFederationData, ImplementationErrors, InvalidArgument, InvalidEntityInterface, InvalidRequiredInputValueData } from '../utils/utils';
3
+ import { RootTypeFieldData } from '../federation/utils';
4
+ import { ObjectDefinitionData } from '../schema-building/type-definition-data';
4
5
  export declare const minimumSubgraphRequirementError: Error;
5
6
  export declare function incompatibleExtensionError(typeName: string, baseKind: Kind, extensionKind: Kind): Error;
6
- export declare function incompatibleArgumentTypesError(argName: string, parentName: string, childName: string, expectedType: string, actualType: string): Error;
7
- export declare function incompatibleChildTypesError(parentName: string, childName: string, expectedType: string, actualType: string): Error;
8
- export declare function incompatibleArgumentDefaultValueError(argName: string, parentName: string, childName: string, expectedValue: string | boolean, actualValue: string | boolean): Error;
9
- export declare function incompatibleArgumentDefaultValueTypeError(argName: string, parentName: string, childName: string, expectedType: Kind, actualType: Kind): Error;
7
+ export declare function incompatibleArgumentTypesError(argName: string, hostPath: string, expectedType: string, actualType: string): Error;
8
+ export declare function incompatibleInputValueDefaultValueTypeError(prefix: string, path: string, typeString: string, defaultValue: string): Error;
9
+ export declare function incompatibleChildTypesError(childPath: string, expectedType: string, actualType: string): Error;
10
+ export declare function incompatibleInputValueDefaultValuesError(prefix: string, path: string, subgraphNames: string[], expectedDefaultValue: string, actualDefaultValue: string): Error;
10
11
  export declare function incompatibleSharedEnumError(parentName: string): Error;
11
12
  export declare function incompatibleExtensionKindsError(node: TypeDefinitionNode | TypeExtensionNode | SchemaExtensionNode, existingKind: Kind): Error;
12
13
  export declare function invalidSubgraphNamesError(names: string[], invalidNameErrorMessages: string[]): Error;
13
14
  export declare function duplicateFieldDefinitionError(fieldName: string, typeName: string): Error;
14
15
  export declare function duplicateDirectiveDefinitionError(directiveName: string): Error;
15
16
  export declare function duplicateEnumValueDefinitionError(valueName: string, typeName: string): Error;
16
- export declare function duplicateFieldExtensionError(typeName: string, childName: string): Error;
17
17
  export declare function duplicateInterfaceExtensionError(interfaceName: string, typeName: string): Error;
18
18
  export declare function duplicateInterfaceError(interfaceName: string, typeName: string): Error;
19
19
  export declare function duplicateUnionMemberExtensionError(memberName: string, typeName: string): Error;
@@ -23,19 +23,14 @@ export declare function duplicateOperationTypeDefinitionError(operationTypeName:
23
23
  export declare function noBaseTypeExtensionError(typeName: string): Error;
24
24
  export declare function noDefinedUnionMembersError(unionTypeName: string, extension?: boolean): Error;
25
25
  export declare function operationDefinitionError(typeName: string, operationType: OperationTypeNode, actualType: Kind): Error;
26
- export declare function shareableFieldDefinitionsError(parent: ObjectContainer, children: Set<string>): Error;
26
+ export declare function invalidFieldShareabilityError(objectData: ObjectDefinitionData, invalidFieldNames: Set<string>): Error;
27
27
  export declare function undefinedDirectiveErrorMessage(directiveName: string, hostPath: string): string;
28
- export declare function undefinedEntityKeyErrorMessage(fieldName: string, objectName: string): string;
29
28
  export declare function unresolvableFieldError(rootTypeFieldData: RootTypeFieldData, fieldName: string, fieldSubgraphs: string[], unresolvablePath: string, parentTypeName: string): Error;
30
29
  export declare function undefinedTypeError(typeName: string): Error;
31
- export declare const federationUnexpectedNodeKindError: (parentName: string, fieldName: string) => Error;
32
- export declare const federationInvalidParentTypeError: (parentName: string, fieldName: string) => Error;
33
30
  export declare const federationRequiredInputFieldError: (parentName: string, fieldName: string) => Error;
34
31
  export declare function invalidRepeatedDirectiveErrorMessage(directiveName: string, hostPath: string): string;
35
- export declare function invalidUnionError(unionName: string): Error;
32
+ export declare function invalidRepeatedFederatedDirectiveErrorMessage(directiveName: string, hostPath: string): Error;
36
33
  export declare function duplicateUnionMemberError(memberTypeName: string, unionTypeName: string): Error;
37
- export declare const invalidDeprecatedDirectiveError: Error;
38
- export declare const invalidTagDirectiveError: Error;
39
34
  export declare function invalidDirectiveError(directiveName: string, hostPath: string, errorMessages: string[]): Error;
40
35
  export declare function invalidDirectiveLocationErrorMessage(hostPath: string, kind: Kind, directiveName: string): string;
41
36
  export declare function unexpectedDirectiveArgumentsErrorMessage(directive: ConstDirectiveNode, hostPath: string): string;
@@ -45,13 +40,12 @@ export declare function duplicateDirectiveArgumentDefinitionErrorMessage(directi
45
40
  export declare function invalidDirectiveArgumentTypeErrorMessage(required: boolean, argumentName: string, expectedKind: Kind, actualKind: Kind): string;
46
41
  export declare function invalidKeyDirectiveArgumentErrorMessage(directiveKind: Kind): string;
47
42
  export declare function invalidKeyDirectivesError(parentTypeName: string, errorMessages: string[]): Error;
43
+ export declare function maximumTypeNestingExceededFatalError(path: string, maximumTypeNesting: number): Error;
48
44
  export declare function unexpectedKindFatalError(typeName: string): Error;
49
45
  export declare function incompatibleParentKindFatalError(parentTypeName: string, expectedKind: Kind, actualKind: Kind): Error;
50
46
  export declare function fieldTypeMergeFatalError(fieldName: string): Error;
51
- export declare function argumentTypeMergeFatalError(argumentName: string, fieldName: string): Error;
52
- export declare function unexpectedArgumentKindFatalError(argumentName: string, fieldName: string): Error;
53
47
  export declare function unexpectedDirectiveLocationError(locationName: string): Error;
54
- export declare function unexpectedTypeNodeKindFatalError(childPath: string): Error;
48
+ export declare function unexpectedTypeNodeKindFatalError(typePath: string): Error;
55
49
  export declare function invalidKeyFatalError<K>(key: K, mapName: string): Error;
56
50
  export declare function invalidConfigurationResultFatalError(fieldPath: string): Error;
57
51
  export declare function unexpectedParentKindErrorMessage(parentTypeName: string, expectedTypeString: string, actualTypeString: string): string;
@@ -61,8 +55,8 @@ export declare function invalidSubgraphNameErrorMessage(index: number, newName:
61
55
  export declare function invalidOperationTypeDefinitionError(existingOperationType: OperationTypeNode, typeName: string, newOperationType: OperationTypeNode): Error;
62
56
  export declare function invalidRootTypeDefinitionError(operationType: OperationTypeNode, typeName: string, defaultTypeName: string): Error;
63
57
  export declare function subgraphInvalidSyntaxError(error?: Error): Error;
64
- export declare function unimplementedInterfaceFieldsError(parentTypeName: string, parentTypeString: string, implementationErrorsMap: ImplementationErrorsMap): Error;
65
- export declare function invalidRequiredArgumentsError(typeString: string, path: string, errors: InvalidRequiredArgument[]): Error;
58
+ export declare function unimplementedInterfaceFieldsError(parentTypeName: string, parentTypeString: string, implementationErrorsByInterfaceTypeName: Map<string, ImplementationErrors>): Error;
59
+ export declare function invalidRequiredInputValueError(typeString: string, path: string, errors: InvalidRequiredInputValueData[], isArgument?: boolean): Error;
66
60
  export declare function duplicateArgumentsError(fieldPath: string, duplicatedArguments: string[]): Error;
67
61
  export declare function invalidArgumentsError(fieldPath: string, invalidArguments: InvalidArgument[]): Error;
68
62
  export declare const noQueryRootTypeError: Error;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unexpectedDirectiveLocationError = exports.unexpectedArgumentKindFatalError = exports.argumentTypeMergeFatalError = exports.fieldTypeMergeFatalError = exports.incompatibleParentKindFatalError = exports.unexpectedKindFatalError = exports.invalidKeyDirectivesError = exports.invalidKeyDirectiveArgumentErrorMessage = exports.invalidDirectiveArgumentTypeErrorMessage = exports.duplicateDirectiveArgumentDefinitionErrorMessage = exports.unexpectedDirectiveArgumentErrorMessage = exports.undefinedRequiredArgumentsErrorMessage = exports.unexpectedDirectiveArgumentsErrorMessage = exports.invalidDirectiveLocationErrorMessage = exports.invalidDirectiveError = exports.invalidTagDirectiveError = exports.invalidDeprecatedDirectiveError = exports.duplicateUnionMemberError = exports.invalidUnionError = exports.invalidRepeatedDirectiveErrorMessage = exports.federationRequiredInputFieldError = exports.federationInvalidParentTypeError = exports.federationUnexpectedNodeKindError = exports.undefinedTypeError = exports.unresolvableFieldError = exports.undefinedEntityKeyErrorMessage = exports.undefinedDirectiveErrorMessage = exports.shareableFieldDefinitionsError = exports.operationDefinitionError = exports.noDefinedUnionMembersError = exports.noBaseTypeExtensionError = exports.duplicateOperationTypeDefinitionError = exports.duplicateTypeDefinitionError = exports.duplicateValueExtensionError = exports.duplicateUnionMemberExtensionError = exports.duplicateInterfaceError = exports.duplicateInterfaceExtensionError = exports.duplicateFieldExtensionError = exports.duplicateEnumValueDefinitionError = exports.duplicateDirectiveDefinitionError = exports.duplicateFieldDefinitionError = exports.invalidSubgraphNamesError = exports.incompatibleExtensionKindsError = exports.incompatibleSharedEnumError = exports.incompatibleArgumentDefaultValueTypeError = exports.incompatibleArgumentDefaultValueError = exports.incompatibleChildTypesError = exports.incompatibleArgumentTypesError = exports.incompatibleExtensionError = exports.minimumSubgraphRequirementError = void 0;
4
- exports.orScopesLimitError = exports.undefinedEntityInterfaceImplementationsError = exports.equivalentSourceAndTargetOverrideErrorMessage = exports.allFieldDefinitionsAreInaccessibleError = exports.noFieldDefinitionsError = exports.duplicateOverriddenFieldsError = exports.duplicateOverriddenFieldErrorMessage = exports.invalidSelectionOnUnionErrorMessage = exports.invalidInlineFragmentTypeConditionErrorMessage = exports.invalidInlineFragmentTypeConditionTypeErrorMessage = exports.unknownInlineFragmentTypeConditionErrorMessage = exports.inlineFragmentWithoutTypeConditionErrorMessage = exports.invalidInlineFragmentTypeErrorMessage = exports.unknownProvidesEntityErrorMessage = exports.duplicateFieldInFieldSetErrorMessage = exports.invalidProvidesOrRequiresDirectivesError = exports.argumentsInKeyFieldSetErrorMessage = exports.unexpectedArgumentErrorMessage = exports.undefinedObjectLikeParentError = exports.unparsableFieldSetSelectionErrorMessage = exports.unparsableFieldSetErrorMessage = exports.undefinedFieldInFieldSetErrorMessage = exports.invalidSelectionSetDefinitionErrorMessage = exports.invalidSelectionSetErrorMessage = exports.unknownTypeInFieldSetErrorMessage = exports.abstractTypeInKeyFieldSetErrorMessage = exports.inlineFragmentInFieldSetErrorMessage = exports.expectedEntityError = exports.noConcreteTypesForAbstractTypeError = exports.unexpectedObjectResponseType = exports.noQueryRootTypeError = exports.invalidArgumentsError = exports.duplicateArgumentsError = exports.invalidRequiredArgumentsError = exports.unimplementedInterfaceFieldsError = exports.subgraphInvalidSyntaxError = exports.invalidRootTypeDefinitionError = exports.invalidOperationTypeDefinitionError = exports.invalidSubgraphNameErrorMessage = exports.subgraphValidationFailureError = exports.subgraphValidationError = exports.unexpectedParentKindErrorMessage = exports.invalidConfigurationResultFatalError = exports.invalidKeyFatalError = exports.unexpectedTypeNodeKindFatalError = void 0;
3
+ exports.invalidSubgraphNameErrorMessage = exports.subgraphValidationFailureError = exports.subgraphValidationError = exports.unexpectedParentKindErrorMessage = exports.invalidConfigurationResultFatalError = exports.invalidKeyFatalError = exports.unexpectedTypeNodeKindFatalError = exports.unexpectedDirectiveLocationError = exports.fieldTypeMergeFatalError = exports.incompatibleParentKindFatalError = exports.unexpectedKindFatalError = exports.maximumTypeNestingExceededFatalError = exports.invalidKeyDirectivesError = exports.invalidKeyDirectiveArgumentErrorMessage = exports.invalidDirectiveArgumentTypeErrorMessage = exports.duplicateDirectiveArgumentDefinitionErrorMessage = exports.unexpectedDirectiveArgumentErrorMessage = exports.undefinedRequiredArgumentsErrorMessage = exports.unexpectedDirectiveArgumentsErrorMessage = exports.invalidDirectiveLocationErrorMessage = exports.invalidDirectiveError = exports.duplicateUnionMemberError = exports.invalidRepeatedFederatedDirectiveErrorMessage = exports.invalidRepeatedDirectiveErrorMessage = exports.federationRequiredInputFieldError = exports.undefinedTypeError = exports.unresolvableFieldError = exports.undefinedDirectiveErrorMessage = exports.invalidFieldShareabilityError = exports.operationDefinitionError = exports.noDefinedUnionMembersError = exports.noBaseTypeExtensionError = exports.duplicateOperationTypeDefinitionError = exports.duplicateTypeDefinitionError = exports.duplicateValueExtensionError = exports.duplicateUnionMemberExtensionError = exports.duplicateInterfaceError = exports.duplicateInterfaceExtensionError = exports.duplicateEnumValueDefinitionError = exports.duplicateDirectiveDefinitionError = exports.duplicateFieldDefinitionError = exports.invalidSubgraphNamesError = exports.incompatibleExtensionKindsError = exports.incompatibleSharedEnumError = exports.incompatibleInputValueDefaultValuesError = exports.incompatibleChildTypesError = exports.incompatibleInputValueDefaultValueTypeError = exports.incompatibleArgumentTypesError = exports.incompatibleExtensionError = exports.minimumSubgraphRequirementError = void 0;
4
+ exports.orScopesLimitError = exports.undefinedEntityInterfaceImplementationsError = exports.equivalentSourceAndTargetOverrideErrorMessage = exports.allFieldDefinitionsAreInaccessibleError = exports.noFieldDefinitionsError = exports.duplicateOverriddenFieldsError = exports.duplicateOverriddenFieldErrorMessage = exports.invalidSelectionOnUnionErrorMessage = exports.invalidInlineFragmentTypeConditionErrorMessage = exports.invalidInlineFragmentTypeConditionTypeErrorMessage = exports.unknownInlineFragmentTypeConditionErrorMessage = exports.inlineFragmentWithoutTypeConditionErrorMessage = exports.invalidInlineFragmentTypeErrorMessage = exports.unknownProvidesEntityErrorMessage = exports.duplicateFieldInFieldSetErrorMessage = exports.invalidProvidesOrRequiresDirectivesError = exports.argumentsInKeyFieldSetErrorMessage = exports.unexpectedArgumentErrorMessage = exports.undefinedObjectLikeParentError = exports.unparsableFieldSetSelectionErrorMessage = exports.unparsableFieldSetErrorMessage = exports.undefinedFieldInFieldSetErrorMessage = exports.invalidSelectionSetDefinitionErrorMessage = exports.invalidSelectionSetErrorMessage = exports.unknownTypeInFieldSetErrorMessage = exports.abstractTypeInKeyFieldSetErrorMessage = exports.inlineFragmentInFieldSetErrorMessage = exports.expectedEntityError = exports.noConcreteTypesForAbstractTypeError = exports.unexpectedObjectResponseType = exports.noQueryRootTypeError = exports.invalidArgumentsError = exports.duplicateArgumentsError = exports.invalidRequiredInputValueError = exports.unimplementedInterfaceFieldsError = exports.subgraphInvalidSyntaxError = exports.invalidRootTypeDefinitionError = exports.invalidOperationTypeDefinitionError = void 0;
5
5
  const utils_1 = require("../ast/utils");
6
6
  const graphql_1 = require("graphql");
7
7
  const utils_2 = require("../utils/utils");
@@ -12,26 +12,31 @@ function incompatibleExtensionError(typeName, baseKind, extensionKind) {
12
12
  `"${typeName}" is type "${baseKind}", but an extension of the same name is type "${extensionKind}.`);
13
13
  }
14
14
  exports.incompatibleExtensionError = incompatibleExtensionError;
15
- function incompatibleArgumentTypesError(argName, parentName, childName, expectedType, actualType) {
16
- return new Error(`Incompatible types when merging two instances of argument "${argName}" for "${parentName}.${childName}":\n` +
15
+ function incompatibleArgumentTypesError(argName, hostPath, expectedType, actualType) {
16
+ return new Error(`Incompatible types when merging two instances of argument "${argName}" on path "${hostPath}":\n` +
17
17
  ` Expected type "${expectedType}" but received "${actualType}"`);
18
18
  }
19
19
  exports.incompatibleArgumentTypesError = incompatibleArgumentTypesError;
20
- function incompatibleChildTypesError(parentName, childName, expectedType, actualType) {
21
- return new Error(`Incompatible types when merging two instances of "${parentName}.${childName}":\n` +
20
+ function incompatibleInputValueDefaultValueTypeError(prefix, path, typeString, defaultValue) {
21
+ return new Error(`The ${prefix} of type "${typeString}" defined on path "${path}" is` +
22
+ ` incompatible with the default value of "${defaultValue}".`);
23
+ }
24
+ exports.incompatibleInputValueDefaultValueTypeError = incompatibleInputValueDefaultValueTypeError;
25
+ function incompatibleChildTypesError(childPath, expectedType, actualType) {
26
+ return new Error(`Incompatible types when merging two instances of "${childPath}":\n` +
22
27
  ` Expected type "${expectedType}" but received "${actualType}"`);
23
28
  }
24
29
  exports.incompatibleChildTypesError = incompatibleChildTypesError;
25
- function incompatibleArgumentDefaultValueError(argName, parentName, childName, expectedValue, actualValue) {
26
- return new Error(`Incompatible default values when merging two instances of argument "${argName} for "${parentName}.${childName}":\n` +
27
- ` Expected value "${expectedValue}" but received "${actualValue}"`);
28
- }
29
- exports.incompatibleArgumentDefaultValueError = incompatibleArgumentDefaultValueError;
30
- function incompatibleArgumentDefaultValueTypeError(argName, parentName, childName, expectedType, actualType) {
31
- return new Error(`Incompatible default values when merging two instances of argument "${argName} for "${parentName}.${childName}":\n` +
32
- ` Expected type "${expectedType}" but received "${actualType}"`);
30
+ function incompatibleInputValueDefaultValuesError(prefix, path, subgraphNames, expectedDefaultValue, actualDefaultValue) {
31
+ return new Error(`Expected the ${prefix} defined on path "${path}" to define the default value "${expectedDefaultValue}".\n"` +
32
+ `However, the default value "${actualDefaultValue}" is defined in the following subgraph` +
33
+ (subgraphNames.length > 1 ? 's' : '') +
34
+ `:\n "` +
35
+ subgraphNames.join(string_constants_1.QUOTATION_JOIN) +
36
+ `"\n` +
37
+ 'If an instance defines a default value, that default value must be consistently defined across all subgraphs.');
33
38
  }
34
- exports.incompatibleArgumentDefaultValueTypeError = incompatibleArgumentDefaultValueTypeError;
39
+ exports.incompatibleInputValueDefaultValuesError = incompatibleInputValueDefaultValuesError;
35
40
  function incompatibleSharedEnumError(parentName) {
36
41
  return new Error(`Enum "${parentName}" was used as both an input and output but was inconsistently defined across inclusive subgraphs.`);
37
42
  }
@@ -65,11 +70,6 @@ function duplicateEnumValueDefinitionError(valueName, typeName) {
65
70
  return new Error(`Extension error:\n Value "${valueName}" already exists on enum "${typeName}".`);
66
71
  }
67
72
  exports.duplicateEnumValueDefinitionError = duplicateEnumValueDefinitionError;
68
- function duplicateFieldExtensionError(typeName, childName) {
69
- return new Error(`Extension error:\n` +
70
- ` More than one extension attempts to extend type "${typeName}" with the field "${childName}".`);
71
- }
72
- exports.duplicateFieldExtensionError = duplicateFieldExtensionError;
73
73
  function duplicateInterfaceExtensionError(interfaceName, typeName) {
74
74
  return new Error(`Extension error:\n Interface "${interfaceName}" is already implemented by type "${typeName}".`);
75
75
  }
@@ -107,47 +107,41 @@ function operationDefinitionError(typeName, operationType, actualType) {
107
107
  return new Error(`Expected the response type "${typeName}" for operation "${operationType}" to be type object but received "${actualType}.`);
108
108
  }
109
109
  exports.operationDefinitionError = operationDefinitionError;
110
- function shareableFieldDefinitionsError(parent, children) {
111
- const parentTypeName = parent.node.name.value;
110
+ function invalidFieldShareabilityError(objectData, invalidFieldNames) {
111
+ const parentTypeName = objectData.name;
112
112
  const errorMessages = [];
113
- for (const field of parent.fields.values()) {
114
- const fieldName = field.node.name.value;
115
- if (!children.has(fieldName)) {
113
+ for (const [fieldName, fieldData] of objectData.fieldDataByFieldName) {
114
+ if (!invalidFieldNames.has(fieldName)) {
116
115
  continue;
117
116
  }
118
117
  const shareableSubgraphs = [];
119
118
  const nonShareableSubgraphs = [];
120
- for (const [subgraphName, isShareable] of field.subgraphsByShareable) {
119
+ for (const [subgraphName, isShareable] of fieldData.isShareableBySubgraphName) {
121
120
  isShareable ? shareableSubgraphs.push(subgraphName) : nonShareableSubgraphs.push(subgraphName);
122
121
  }
123
122
  if (shareableSubgraphs.length < 1) {
124
- errorMessages.push(`\n The field "${fieldName}" is defined in the following subgraphs: "${[...field.subgraphNames].join('", "')}".` + `\n However, it is not declared "@shareable" in any of them.`);
123
+ errorMessages.push(`\n The field "${fieldName}" is defined in the following subgraphs: "${[...fieldData.subgraphNames].join('", "')}".` + `\n However, it is not declared "@shareable" in any of them.`);
125
124
  }
126
125
  else {
127
126
  errorMessages.push(`\n The field "${fieldName}" is defined and declared "@shareable" in the following subgraph` +
128
127
  (shareableSubgraphs.length > 1 ? 's' : '') +
129
128
  `: "` +
130
- shareableSubgraphs.join('", "') +
129
+ shareableSubgraphs.join(string_constants_1.QUOTATION_JOIN) +
131
130
  `".` +
132
131
  `\n However, it is not declared "@shareable" in the following subgraph` +
133
132
  (nonShareableSubgraphs.length > 1 ? 's' : '') +
134
- `: "${nonShareableSubgraphs.join('", "')}".`);
133
+ `: "${nonShareableSubgraphs.join(string_constants_1.QUOTATION_JOIN)}".`);
135
134
  }
136
135
  }
137
136
  return new Error(`The object "${parentTypeName}" defines the same fields in multiple subgraphs without the "@shareable" directive:` +
138
137
  `${errorMessages.join('\n')}`);
139
138
  }
140
- exports.shareableFieldDefinitionsError = shareableFieldDefinitionsError;
139
+ exports.invalidFieldShareabilityError = invalidFieldShareabilityError;
141
140
  function undefinedDirectiveErrorMessage(directiveName, hostPath) {
142
141
  return (`The directive "${directiveName}" is declared on "${hostPath}",` +
143
142
  ` but the directive is not defined in the schema.`);
144
143
  }
145
144
  exports.undefinedDirectiveErrorMessage = undefinedDirectiveErrorMessage;
146
- function undefinedEntityKeyErrorMessage(fieldName, objectName) {
147
- return (` The "fields" argument defines "${fieldName}" as part of a key, but the field "${fieldName}" is not` +
148
- ` defined on the object "${objectName}".`);
149
- }
150
- exports.undefinedEntityKeyErrorMessage = undefinedEntityKeyErrorMessage;
151
145
  function unresolvableFieldError(rootTypeFieldData, fieldName, fieldSubgraphs, unresolvablePath, parentTypeName) {
152
146
  const fieldPath = `${parentTypeName}.${fieldName}`;
153
147
  return new Error(`The path "${unresolvablePath}" cannot be resolved because:\n` +
@@ -180,10 +174,6 @@ function undefinedTypeError(typeName) {
180
174
  return new Error(`The type "${typeName}" was referenced in the schema, but it was never defined.`);
181
175
  }
182
176
  exports.undefinedTypeError = undefinedTypeError;
183
- const federationUnexpectedNodeKindError = (parentName, fieldName) => new Error(`Unexpected node kind for field "${parentName}.${fieldName}".`);
184
- exports.federationUnexpectedNodeKindError = federationUnexpectedNodeKindError;
185
- const federationInvalidParentTypeError = (parentName, fieldName) => new Error(`Could not find parent type "${parentName}" for field "${fieldName}".`);
186
- exports.federationInvalidParentTypeError = federationInvalidParentTypeError;
187
177
  const federationRequiredInputFieldError = (parentName, fieldName) => new Error(`Input object field "${parentName}.${fieldName}" is required in at least one subgraph; ` +
188
178
  `consequently, "${fieldName}" must be defined in all subgraphs that also define "${parentName}".`);
189
179
  exports.federationRequiredInputFieldError = federationRequiredInputFieldError;
@@ -192,20 +182,15 @@ function invalidRepeatedDirectiveErrorMessage(directiveName, hostPath) {
192
182
  `but the same directive is declared more than once on type "${hostPath}".`);
193
183
  }
194
184
  exports.invalidRepeatedDirectiveErrorMessage = invalidRepeatedDirectiveErrorMessage;
195
- function invalidUnionError(unionName) {
196
- return new Error(`Union "${unionName}" must have at least one member.`);
185
+ function invalidRepeatedFederatedDirectiveErrorMessage(directiveName, hostPath) {
186
+ return new Error(`The definition for the directive "${directiveName}" does not define it as repeatable,` +
187
+ ` but the directive has been declared on more than one instance of the type "${hostPath}".`);
197
188
  }
198
- exports.invalidUnionError = invalidUnionError;
189
+ exports.invalidRepeatedFederatedDirectiveErrorMessage = invalidRepeatedFederatedDirectiveErrorMessage;
199
190
  function duplicateUnionMemberError(memberTypeName, unionTypeName) {
200
191
  return new Error(`Member "${memberTypeName}" must only be defined on union "${unionTypeName}" once.`);
201
192
  }
202
193
  exports.duplicateUnionMemberError = duplicateUnionMemberError;
203
- exports.invalidDeprecatedDirectiveError = new Error(`
204
- Expected the @deprecated directive to have a single optional argument "reason" of the type "String!"
205
- `);
206
- exports.invalidTagDirectiveError = new Error(`
207
- Expected the @tag directive to have a single required argument "name" of the type "String!"
208
- `);
209
194
  function invalidDirectiveError(directiveName, hostPath, errorMessages) {
210
195
  return new Error(`The directive "${directiveName}" declared on "${hostPath}" is invalid for the following reason` +
211
196
  (errorMessages.length > 1 ? 's:\n' : ':\n') +
@@ -264,6 +249,12 @@ function invalidKeyDirectivesError(parentTypeName, errorMessages) {
264
249
  errorMessages.join('\n'));
265
250
  }
266
251
  exports.invalidKeyDirectivesError = invalidKeyDirectivesError;
252
+ // Cannot use the constant for maximum type nesting or there will be a cyclical import
253
+ function maximumTypeNestingExceededFatalError(path, maximumTypeNesting) {
254
+ return new Error(`Fatal: The type defined at path "${path}" has more than ${maximumTypeNesting} layers of nesting,` +
255
+ ` or there is a cyclical error.`);
256
+ }
257
+ exports.maximumTypeNestingExceededFatalError = maximumTypeNestingExceededFatalError;
267
258
  function unexpectedKindFatalError(typeName) {
268
259
  return new Error(`Fatal: Unexpected type for "${typeName}"`);
269
260
  }
@@ -278,21 +269,12 @@ function fieldTypeMergeFatalError(fieldName) {
278
269
  ` without producing a type error object.`);
279
270
  }
280
271
  exports.fieldTypeMergeFatalError = fieldTypeMergeFatalError;
281
- function argumentTypeMergeFatalError(argumentName, fieldName) {
282
- return new Error(`Fatal: Unsuccessfully merged the cross-subgraph types of argument "${argumentName}" on field "${fieldName}"` +
283
- ` without producing a type error object.`);
284
- }
285
- exports.argumentTypeMergeFatalError = argumentTypeMergeFatalError;
286
- function unexpectedArgumentKindFatalError(argumentName, fieldName) {
287
- return new Error(`Fatal: Unexpected type for argument "${argumentName}" on field "${fieldName}".`);
288
- }
289
- exports.unexpectedArgumentKindFatalError = unexpectedArgumentKindFatalError;
290
272
  function unexpectedDirectiveLocationError(locationName) {
291
273
  return new Error(`Fatal: Unknown directive location "${locationName}".`);
292
274
  }
293
275
  exports.unexpectedDirectiveLocationError = unexpectedDirectiveLocationError;
294
- function unexpectedTypeNodeKindFatalError(childPath) {
295
- return new Error(`Fatal: Expected all constituent types of "${childPath}" to be one of the following: ` +
276
+ function unexpectedTypeNodeKindFatalError(typePath) {
277
+ return new Error(`Fatal: Expected all constituent types at path "${typePath}" to be one of the following: ` +
296
278
  `"LIST_TYPE", "NAMED_TYPE", or "NON_NULL_TYPE".`);
297
279
  }
298
280
  exports.unexpectedTypeNodeKindFatalError = unexpectedTypeNodeKindFatalError;
@@ -343,9 +325,9 @@ function subgraphInvalidSyntaxError(error) {
343
325
  return new Error(message);
344
326
  }
345
327
  exports.subgraphInvalidSyntaxError = subgraphInvalidSyntaxError;
346
- function unimplementedInterfaceFieldsError(parentTypeName, parentTypeString, implementationErrorsMap) {
328
+ function unimplementedInterfaceFieldsError(parentTypeName, parentTypeString, implementationErrorsByInterfaceTypeName) {
347
329
  const messages = [];
348
- for (const [interfaceName, implementationErrors] of implementationErrorsMap) {
330
+ for (const [interfaceName, implementationErrors] of implementationErrorsByInterfaceTypeName) {
349
331
  let message = ` The implementation of interface "${interfaceName}" by "${parentTypeName}"` + ` is invalid because:\n`;
350
332
  const unimplementedFieldsLength = implementationErrors.unimplementedFields.length;
351
333
  if (unimplementedFieldsLength) {
@@ -399,26 +381,27 @@ function unimplementedInterfaceFieldsError(parentTypeName, parentTypeString, imp
399
381
  messages.join('\n'));
400
382
  }
401
383
  exports.unimplementedInterfaceFieldsError = unimplementedInterfaceFieldsError;
402
- function invalidRequiredArgumentsError(typeString, path, errors) {
384
+ function invalidRequiredInputValueError(typeString, path, errors, isArgument = true) {
385
+ const inputValueTypeString = isArgument ? string_constants_1.ARGUMENT : string_constants_1.INPUT_FIELD;
403
386
  let message = `The ${typeString} "${path}" could not be federated because:\n`;
404
387
  for (const error of errors) {
405
388
  message +=
406
- ` The argument "${error.argumentName}" is required in the following subgraph` +
389
+ ` The ${inputValueTypeString} "${error.inputValueName}" is required in the following subgraph` +
407
390
  (error.requiredSubgraphs.length > 1 ? 's' : '') +
408
391
  ': "' +
409
392
  error.requiredSubgraphs.join(`", "`) +
410
393
  `"\n` +
411
- ` However, the argument "${error.argumentName}" is not defined in the following subgraph` +
394
+ ` However, the ${inputValueTypeString} "${error.inputValueName}" is not defined in the following subgraph` +
412
395
  (error.missingSubgraphs.length > 1 ? 's' : '') +
413
396
  ': "' +
414
397
  error.missingSubgraphs.join(`", "`) +
415
398
  `"\n` +
416
- ` If an argument is required on a ${typeString} in any one subgraph, it must be at least defined as optional` +
417
- ` on all other definitions of that ${typeString} in all other subgraphs.\n`;
399
+ ` If an ${inputValueTypeString} is required on a ${typeString} in any one subgraph, it must be at least defined` +
400
+ ` as optional on all other definitions of that ${typeString} in all other subgraphs.\n`;
418
401
  }
419
402
  return new Error(message);
420
403
  }
421
- exports.invalidRequiredArgumentsError = invalidRequiredArgumentsError;
404
+ exports.invalidRequiredInputValueError = invalidRequiredInputValueError;
422
405
  function duplicateArgumentsError(fieldPath, duplicatedArguments) {
423
406
  return new Error(`The field "${fieldPath}" is invalid because:\n` +
424
407
  ` The following argument` +