@wundergraph/composition 0.0.1

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 (49) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +3 -0
  3. package/dist/ast/ast.d.ts +84 -0
  4. package/dist/ast/ast.js +183 -0
  5. package/dist/ast/ast.js.map +1 -0
  6. package/dist/ast/utils.d.ts +130 -0
  7. package/dist/ast/utils.js +298 -0
  8. package/dist/ast/utils.js.map +1 -0
  9. package/dist/buildASTSchema/buildASTSchema.d.ts +22 -0
  10. package/dist/buildASTSchema/buildASTSchema.js +59 -0
  11. package/dist/buildASTSchema/buildASTSchema.js.map +1 -0
  12. package/dist/buildASTSchema/extendSchema.d.ts +21 -0
  13. package/dist/buildASTSchema/extendSchema.js +555 -0
  14. package/dist/buildASTSchema/extendSchema.js.map +1 -0
  15. package/dist/errors/errors.d.ts +60 -0
  16. package/dist/errors/errors.js +302 -0
  17. package/dist/errors/errors.js.map +1 -0
  18. package/dist/federation/federation-factory.d.ts +58 -0
  19. package/dist/federation/federation-factory.js +843 -0
  20. package/dist/federation/federation-factory.js.map +1 -0
  21. package/dist/federation/federation-result.d.ts +6 -0
  22. package/dist/federation/federation-result.js +10 -0
  23. package/dist/federation/federation-result.js.map +1 -0
  24. package/dist/federation/subgraph.d.ts +18 -0
  25. package/dist/federation/subgraph.js +305 -0
  26. package/dist/federation/subgraph.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.js +26 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/normalization/normalization-factory.d.ts +54 -0
  31. package/dist/normalization/normalization-factory.js +882 -0
  32. package/dist/normalization/normalization-factory.js.map +1 -0
  33. package/dist/normalization/utils.d.ts +121 -0
  34. package/dist/normalization/utils.js +278 -0
  35. package/dist/normalization/utils.js.map +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -0
  37. package/dist/type-merging/type-merging.d.ts +9 -0
  38. package/dist/type-merging/type-merging.js +112 -0
  39. package/dist/type-merging/type-merging.js.map +1 -0
  40. package/dist/utils/constants.d.ts +6 -0
  41. package/dist/utils/constants.js +157 -0
  42. package/dist/utils/constants.js.map +1 -0
  43. package/dist/utils/string-constants.d.ts +39 -0
  44. package/dist/utils/string-constants.js +43 -0
  45. package/dist/utils/string-constants.js.map +1 -0
  46. package/dist/utils/utils.d.ts +7 -0
  47. package/dist/utils/utils.js +80 -0
  48. package/dist/utils/utils.js.map +1 -0
  49. package/package.json +35 -0
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unexpectedDirectiveLocationError = exports.incompatibleParentKindFatalError = exports.unexpectedParentKindErrorMessage = exports.invalidMultiGraphNodeFatalError = exports.unexpectedKindFatalError = exports.undefinedParentFatalError = exports.invalidKeyDirectiveError = exports.invalidEntityKeyError = exports.invalidNestingErrorMessage = exports.invalidNestingClosureErrorMessage = exports.invalidClosingBraceErrorMessage = exports.invalidOpeningBraceErrorMessage = exports.invalidGraphQLNameErrorMessage = exports.invalidKeyDirectiveArgumentErrorMessage = exports.duplicateDirectiveArgumentDefinitionErrorMessage = exports.unexpectedDirectiveArgumentErrorMessage = exports.undefinedRequiredArgumentsErrorMessage = exports.unexpectedDirectiveArgumentsErrorMessage = exports.invalidDirectiveLocationErrorMessage = exports.invalidDirectiveError = exports.invalidUnionError = exports.invalidRepeatedDirectiveErrorMessage = exports.federationRequiredInputFieldError = exports.federationInvalidParentTypeError = exports.federationUnexpectedNodeKindError = exports.undefinedTypeError = exports.unresolvableFieldError = exports.undefinedEntityKeyErrorMessage = exports.undefinedDirectiveError = exports.shareableFieldDefinitionsError = exports.operationDefinitionError = exports.noDefinedUnionMembersError = exports.noBaseTypeExtensionError = exports.duplicateOperationTypeDefinitionError = exports.duplicateTypeDefinitionError = exports.duplicateValueExtensionError = exports.duplicateUnionMemberError = exports.duplicateInterfaceError = exports.duplicateFieldExtensionError = exports.duplicateEnumValueDefinitionError = exports.duplicateDirectiveDefinitionError = exports.duplicateFieldDefinitionError = exports.invalidSubgraphNamesError = exports.incompatibleExtensionKindsError = exports.incompatibleSharedEnumError = exports.incompatibleArgumentDefaultValueTypeError = exports.incompatibleArgumentDefaultValueError = exports.incompatibleChildTypesError = exports.incompatibleArgumentTypesError = exports.minimumSubgraphRequirementError = void 0;
4
+ exports.subgraphInvalidSyntaxError = exports.invalidRootTypeDefinitionError = exports.invalidOperationTypeDefinitionError = exports.invalidSubgraphNameErrorMessage = exports.subgraphValidationFailureErrorMessage = exports.subgraphValidationError = exports.objectInCompositeKeyWithoutSelectionsErrorMessage = exports.unexpectedTypeNodeKindError = void 0;
5
+ const utils_1 = require("../ast/utils");
6
+ const graphql_1 = require("graphql");
7
+ const utils_2 = require("../utils/utils");
8
+ exports.minimumSubgraphRequirementError = new Error('At least one subgraph is required for federation.');
9
+ function incompatibleArgumentTypesError(argName, parentName, childName, expectedType, actualType) {
10
+ return new Error(`Incompatible types when merging two instances of argument "${argName}" for "${parentName}.${childName}":\n` +
11
+ ` Expected type "${expectedType}" but received "${actualType}"`);
12
+ }
13
+ exports.incompatibleArgumentTypesError = incompatibleArgumentTypesError;
14
+ function incompatibleChildTypesError(parentName, childName, expectedType, actualType) {
15
+ return new Error(`Incompatible types when merging two instances of "${parentName}.${childName}":\n` +
16
+ ` Expected type "${expectedType}" but received "${actualType}"`);
17
+ }
18
+ exports.incompatibleChildTypesError = incompatibleChildTypesError;
19
+ function incompatibleArgumentDefaultValueError(argName, parentName, childName, expectedValue, actualValue) {
20
+ return new Error(`Incompatible default values when merging two instances of argument "${argName} for "${parentName}.${childName}":\n` +
21
+ ` Expected value "${expectedValue}" but received "${actualValue}"`);
22
+ }
23
+ exports.incompatibleArgumentDefaultValueError = incompatibleArgumentDefaultValueError;
24
+ function incompatibleArgumentDefaultValueTypeError(argName, parentName, childName, expectedType, actualType) {
25
+ return new Error(`Incompatible default values when merging two instances of argument "${argName} for "${parentName}.${childName}":\n` +
26
+ ` Expected type "${expectedType}" but received "${actualType}"`);
27
+ }
28
+ exports.incompatibleArgumentDefaultValueTypeError = incompatibleArgumentDefaultValueTypeError;
29
+ function incompatibleSharedEnumError(parentName) {
30
+ return new Error(`Enum "${parentName}" was used as both an input and output but was inconsistently defined across inclusive subgraphs.`);
31
+ }
32
+ exports.incompatibleSharedEnumError = incompatibleSharedEnumError;
33
+ function incompatibleExtensionKindsError(node, existingKind) {
34
+ const name = node.kind === graphql_1.Kind.SCHEMA_EXTENSION ? 'schema' : node.name.value;
35
+ return new Error(`Expected extension "${name}" to be type ${existingKind} but received ${node.kind}.`);
36
+ }
37
+ exports.incompatibleExtensionKindsError = incompatibleExtensionKindsError;
38
+ function invalidSubgraphNamesError(names, invalidNameErrorMessages) {
39
+ let message = 'Subgraphs to be federated must each have a unique, non-empty name.';
40
+ if (names.length > 0) {
41
+ message += '\n The following subgraph names are not unique:\n "' + names.join('", "') + `"`;
42
+ }
43
+ for (const invalidNameErrorMessage of invalidNameErrorMessages) {
44
+ message += `\n ${invalidNameErrorMessage}`;
45
+ }
46
+ return new Error(message);
47
+ }
48
+ exports.invalidSubgraphNamesError = invalidSubgraphNamesError;
49
+ function duplicateFieldDefinitionError(fieldName, typeName) {
50
+ return new Error(`Extension error:\n Field "${fieldName} already exists on type "${typeName}".`);
51
+ }
52
+ exports.duplicateFieldDefinitionError = duplicateFieldDefinitionError;
53
+ function duplicateDirectiveDefinitionError(directiveName) {
54
+ return new Error(`The directive "${directiveName}" has already been defined.`);
55
+ }
56
+ exports.duplicateDirectiveDefinitionError = duplicateDirectiveDefinitionError;
57
+ function duplicateEnumValueDefinitionError(valueName, typeName) {
58
+ return new Error(`Extension error:\n Value "${valueName}" already exists on enum "${typeName}".`);
59
+ }
60
+ exports.duplicateEnumValueDefinitionError = duplicateEnumValueDefinitionError;
61
+ function duplicateFieldExtensionError(typeName, childName) {
62
+ return new Error(`Extension error:\n` +
63
+ ` More than one extension attempts to extend type "${typeName}" with the field "${childName}".`);
64
+ }
65
+ exports.duplicateFieldExtensionError = duplicateFieldExtensionError;
66
+ function duplicateInterfaceError(interfaceName, typeName) {
67
+ return new Error(`Extension error:\n Interface "${interfaceName}" is already implemented by type "${typeName}".`);
68
+ }
69
+ exports.duplicateInterfaceError = duplicateInterfaceError;
70
+ function duplicateUnionMemberError(memberName, typeName) {
71
+ return new Error(`Extension error:\n Member "${memberName}" already exists on union "${typeName}".`);
72
+ }
73
+ exports.duplicateUnionMemberError = duplicateUnionMemberError;
74
+ function duplicateValueExtensionError(parentType, typeName, childName) {
75
+ return new Error(`Extension error:\n` +
76
+ ` More than one extension attempts to extend ${parentType} "${typeName}" with the value "${childName}".`);
77
+ }
78
+ exports.duplicateValueExtensionError = duplicateValueExtensionError;
79
+ function duplicateTypeDefinitionError(type, typeName) {
80
+ return new Error(`The ${type} "${typeName}" can only be defined once.`);
81
+ }
82
+ exports.duplicateTypeDefinitionError = duplicateTypeDefinitionError;
83
+ function duplicateOperationTypeDefinitionError(operationTypeName, newTypeName, oldTypeName) {
84
+ return new Error(`The operation type "${operationTypeName}" cannot be defined as "${newTypeName}" because it has already been defined as "${oldTypeName}".`);
85
+ }
86
+ exports.duplicateOperationTypeDefinitionError = duplicateOperationTypeDefinitionError;
87
+ function noBaseTypeExtensionError(typeName) {
88
+ return new Error(`Extension error:\n Could not extend the type "${typeName}" because no base definition exists.`);
89
+ }
90
+ exports.noBaseTypeExtensionError = noBaseTypeExtensionError;
91
+ function noDefinedUnionMembersError(unionName) {
92
+ return new Error(`The union "${unionName}" must define at least one union member.`);
93
+ }
94
+ exports.noDefinedUnionMembersError = noDefinedUnionMembersError;
95
+ function operationDefinitionError(typeName, operationType, actualType) {
96
+ return new Error(`Expected the response type "${typeName}" for operation "${operationType}" to be type object but received "${actualType}.`);
97
+ }
98
+ exports.operationDefinitionError = operationDefinitionError;
99
+ function shareableFieldDefinitionsError(parent, children) {
100
+ const parentTypeName = parent.node.name.value;
101
+ const errorMessages = [];
102
+ for (const field of parent.fields.values()) {
103
+ const fieldName = field.node.name.value;
104
+ if (!children.has(fieldName)) {
105
+ continue;
106
+ }
107
+ const shareableSubgraphs = [];
108
+ const nonShareableSubgraphs = [];
109
+ for (const [subgraphName, isShareable] of field.subgraphsByShareable) {
110
+ isShareable ? shareableSubgraphs.push(subgraphName) : nonShareableSubgraphs.push(subgraphName);
111
+ }
112
+ if (shareableSubgraphs.length < 1) {
113
+ errorMessages.push(`\n The field "${fieldName}" is defined in the following subgraphs: "${shareableSubgraphs.join('", "')}".` +
114
+ `\n However, it it is not declared "@shareable" in any of them.`);
115
+ }
116
+ else {
117
+ errorMessages.push(`\n The field "${fieldName}" is defined and declared "@shareable" in the following subgraphs:` +
118
+ ` "${shareableSubgraphs.join('", "')}".` +
119
+ `\n However, it is not declared "@shareable" in the following subgraphs: ` +
120
+ `"${nonShareableSubgraphs.join('", "')}".`);
121
+ }
122
+ }
123
+ return new Error(`The object "${parentTypeName}" defines the same fields in multiple subgraphs without the "@shareable" directive:` +
124
+ `${errorMessages.join('\n')}`);
125
+ }
126
+ exports.shareableFieldDefinitionsError = shareableFieldDefinitionsError;
127
+ function undefinedDirectiveError(directiveName, hostPath) {
128
+ return new Error(`The directive "${directiveName}" is declared on "${hostPath}",` +
129
+ ` but the directive is not defined in the schema.`);
130
+ }
131
+ exports.undefinedDirectiveError = undefinedDirectiveError;
132
+ function undefinedEntityKeyErrorMessage(fieldName, objectName) {
133
+ return (` The "fields" argument defines "${fieldName}" as part of a key, but the field "${fieldName}" is not` +
134
+ ` defined on the object "${objectName}".`);
135
+ }
136
+ exports.undefinedEntityKeyErrorMessage = undefinedEntityKeyErrorMessage;
137
+ function unresolvableFieldError(operationField, fieldName, unresolvablePaths, fieldSubgraphs, parentTypeName) {
138
+ const fieldPath = `${parentTypeName}.${fieldName}`;
139
+ return new Error(`The following operation path${unresolvablePaths.length > 1 ? 's are' : ' is'} unresolvable:\n ` +
140
+ unresolvablePaths.join('\n') +
141
+ `\nThis is because:\n` +
142
+ ` The operation "${operationField.path}" is defined in the following subgraphs: "${Array.from(operationField.subgraphs).join('", "')}".\n` +
143
+ ` However, "${fieldPath}" is only defined in the following subgraphs: "${fieldSubgraphs}".\n` +
144
+ ` Consequently, "${fieldPath}" cannot be resolved through the operation "${operationField.path}".\n` +
145
+ `Potential solutions:\n` +
146
+ ` Convert "${parentTypeName}" into an entity using a "@key" directive.\n` +
147
+ ` Add the shareable operation "${operationField.path}" to the following subgraphs: "${fieldSubgraphs}".\n` +
148
+ ` For example (note that V1 fields are shareable by default and do not require a directive):\n` +
149
+ ` type ${operationField.parentTypeName} {\n` +
150
+ ` ...\n` +
151
+ ` ${operationField.name}: ${operationField.responseType} @shareable\n` +
152
+ ` }`);
153
+ }
154
+ exports.unresolvableFieldError = unresolvableFieldError;
155
+ function undefinedTypeError(typeName) {
156
+ return new Error(`The type "${typeName}" was referenced in the schema, but it was never defined.`);
157
+ }
158
+ exports.undefinedTypeError = undefinedTypeError;
159
+ const federationUnexpectedNodeKindError = (parentName, fieldName) => new Error(`Unexpected node kind for field "${parentName}.${fieldName}".`);
160
+ exports.federationUnexpectedNodeKindError = federationUnexpectedNodeKindError;
161
+ const federationInvalidParentTypeError = (parentName, fieldName) => new Error(`Could not find parent type "${parentName}" for field "${fieldName}".`);
162
+ exports.federationInvalidParentTypeError = federationInvalidParentTypeError;
163
+ const federationRequiredInputFieldError = (parentName, fieldName) => new Error(`Input object field "${parentName}.${fieldName}" is required in at least one subgraph; ` +
164
+ `consequently, "${fieldName}" must be defined in all subgraphs that also define "${parentName}".`);
165
+ exports.federationRequiredInputFieldError = federationRequiredInputFieldError;
166
+ function invalidRepeatedDirectiveErrorMessage(directiveName, hostPath) {
167
+ return (`The definition for the directive "${directiveName}" does not define it as repeatable, ` +
168
+ `but the same directive is declared more than once on type "${hostPath}".`);
169
+ }
170
+ exports.invalidRepeatedDirectiveErrorMessage = invalidRepeatedDirectiveErrorMessage;
171
+ function invalidUnionError(unionName) {
172
+ return new Error(`Union "${unionName}" must have at least one member.`);
173
+ }
174
+ exports.invalidUnionError = invalidUnionError;
175
+ function invalidDirectiveError(directiveName, hostPath, errorMessages) {
176
+ return new Error(`The directive "${directiveName}" declared on "${hostPath}" is invalid for the following reason` +
177
+ (errorMessages.length > 1 ? 's:\n' : ':\n') +
178
+ errorMessages.join('\n'));
179
+ }
180
+ exports.invalidDirectiveError = invalidDirectiveError;
181
+ function invalidDirectiveLocationErrorMessage(hostPath, kind, directiveName) {
182
+ return (` "${hostPath}" is type "${kind}", but the directive "${directiveName}" ` +
183
+ `does not define "${(0, utils_1.nodeKindToDirectiveLocation)(kind)}" as a valid location.`);
184
+ }
185
+ exports.invalidDirectiveLocationErrorMessage = invalidDirectiveLocationErrorMessage;
186
+ function unexpectedDirectiveArgumentsErrorMessage(directive, hostPath) {
187
+ const directiveName = directive.name.value;
188
+ const argumentNumber = directive.arguments?.length || 1; // should never be less than 1
189
+ return (` The definition for the directive "${directiveName}" does not define any arguments.\n` +
190
+ ` However, the same directive declared on "${hostPath}" defines ${argumentNumber} argument` +
191
+ (argumentNumber > 1 ? 's.' : '.'));
192
+ }
193
+ exports.unexpectedDirectiveArgumentsErrorMessage = unexpectedDirectiveArgumentsErrorMessage;
194
+ function undefinedRequiredArgumentsErrorMessage(directiveName, hostPath, requiredArguments, missingRequiredArguments = []) {
195
+ return (` The definition for the directive "${directiveName}" defines the following ` +
196
+ requiredArguments.length +
197
+ ` required argument` +
198
+ (requiredArguments.length > 1 ? 's: ' : ': "') +
199
+ requiredArguments.join('", "') + `"` +
200
+ `.\n However, the same directive that is declared on "${hostPath}" does not define` +
201
+ (missingRequiredArguments.length > 0
202
+ ? ` the following required arguments: "${missingRequiredArguments.join('", "')}"`
203
+ : ` any arguments.`));
204
+ }
205
+ exports.undefinedRequiredArgumentsErrorMessage = undefinedRequiredArgumentsErrorMessage;
206
+ function unexpectedDirectiveArgumentErrorMessage(directiveName, argumentName) {
207
+ return ` The definition for the directive "${directiveName}" does not define an argument named "${argumentName}".`;
208
+ }
209
+ exports.unexpectedDirectiveArgumentErrorMessage = unexpectedDirectiveArgumentErrorMessage;
210
+ function duplicateDirectiveArgumentDefinitionErrorMessage(directiveName, hostPath, argumentName) {
211
+ return (` The directive "${directiveName}" that is declared on "${hostPath}" ` +
212
+ `defines the argument named "${argumentName}" more than once.`);
213
+ }
214
+ exports.duplicateDirectiveArgumentDefinitionErrorMessage = duplicateDirectiveArgumentDefinitionErrorMessage;
215
+ function invalidKeyDirectiveArgumentErrorMessage(directiveKind) {
216
+ return ` The required argument named "fields" must be type "String" and not type "${directiveKind}".`;
217
+ }
218
+ exports.invalidKeyDirectiveArgumentErrorMessage = invalidKeyDirectiveArgumentErrorMessage;
219
+ function invalidGraphQLNameErrorMessage(type, name) {
220
+ return ` The ${type} "${name}" is an invalid GraphQL name:\n` +
221
+ ` GraphQL names must match the following regex: /[_a-zA-Z][_a-zA-Z0-9]*/`;
222
+ }
223
+ exports.invalidGraphQLNameErrorMessage = invalidGraphQLNameErrorMessage;
224
+ exports.invalidOpeningBraceErrorMessage = ` Unexpected brace opening:\n Received an opening brace "{" before the parent value was defined.`;
225
+ exports.invalidClosingBraceErrorMessage = ` Unexpected brace closure:\n Received a closing brace "}" before any nested values were defined.`;
226
+ exports.invalidNestingClosureErrorMessage = ` Unexpected brace closure:\n Received a closing brace "}" before its corresponding opening brace "{" was defined.`;
227
+ exports.invalidNestingErrorMessage = ` Invalid nesting:\n A nested key was terminated without a closing brace "}".`;
228
+ function invalidEntityKeyError(parentTypeName, entityKey, errorMessage) {
229
+ return new Error(`The directive "key" declared on the object "${parentTypeName}"` +
230
+ ` with the "fields" argument value of "${entityKey}" is invalid for the following reason:\n` +
231
+ errorMessage);
232
+ }
233
+ exports.invalidEntityKeyError = invalidEntityKeyError;
234
+ function invalidKeyDirectiveError(parentTypeName, errorMessages) {
235
+ return new Error(`One or more "key" directives defined on "${parentTypeName}" are invalid for the following reason` +
236
+ (errorMessages.length > 1 ? 's:\n' : ':\n') + errorMessages.join('\n'));
237
+ }
238
+ exports.invalidKeyDirectiveError = invalidKeyDirectiveError;
239
+ function undefinedParentFatalError(parentTypeName) {
240
+ return new Error(`Fatal: Expected parent type "${parentTypeName}" to be defined.`);
241
+ }
242
+ exports.undefinedParentFatalError = undefinedParentFatalError;
243
+ function unexpectedKindFatalError(typeName) {
244
+ return new Error(`Fatal: Unexpected type for ${typeName}`);
245
+ }
246
+ exports.unexpectedKindFatalError = unexpectedKindFatalError;
247
+ function invalidMultiGraphNodeFatalError(nodeName) {
248
+ return new Error(`Fatal: Expected node "${nodeName}" to exist in the multi graph.`);
249
+ }
250
+ exports.invalidMultiGraphNodeFatalError = invalidMultiGraphNodeFatalError;
251
+ function unexpectedParentKindErrorMessage(parentTypeName, expectedKind, actualKind) {
252
+ return (` Expected "${parentTypeName}" to be type ${expectedKind} but received "${actualKind}".`);
253
+ }
254
+ exports.unexpectedParentKindErrorMessage = unexpectedParentKindErrorMessage;
255
+ function incompatibleParentKindFatalError(parentTypeName, expectedKind, actualKind) {
256
+ return new Error(`Fatal: Expected "${parentTypeName}" to be type ${expectedKind} but received "${actualKind}".`);
257
+ }
258
+ exports.incompatibleParentKindFatalError = incompatibleParentKindFatalError;
259
+ function unexpectedDirectiveLocationError(locationName) {
260
+ return new Error(`Fatal: Unknown directive location "${locationName}".`);
261
+ }
262
+ exports.unexpectedDirectiveLocationError = unexpectedDirectiveLocationError;
263
+ function unexpectedTypeNodeKindError(childPath) {
264
+ return new Error(`Fatal: Expected all constituent types of "${childPath}" to be one of the following: ` +
265
+ `"LIST_TYPE", "NAMED_TYPE", or "NON_NULL_TYPE".`);
266
+ }
267
+ exports.unexpectedTypeNodeKindError = unexpectedTypeNodeKindError;
268
+ function objectInCompositeKeyWithoutSelectionsErrorMessage(fieldName, fieldTypeName) {
269
+ return (` The "fields" argument defines "${fieldName}", which is type "${fieldTypeName}, as part of a key.\n` +
270
+ ` However, "${fieldTypeName}" is an object type; consequently, it must have its own selections to be a valid key.`);
271
+ }
272
+ exports.objectInCompositeKeyWithoutSelectionsErrorMessage = objectInCompositeKeyWithoutSelectionsErrorMessage;
273
+ function subgraphValidationError(subgraphName, errors) {
274
+ return new Error(`The subgraph "${subgraphName}" could not be federated for the following reason`
275
+ + (errors.length > 1 ? 's:\n' : 's:\n') + errors.map((error) => error.message).join('\n'));
276
+ }
277
+ exports.subgraphValidationError = subgraphValidationError;
278
+ exports.subgraphValidationFailureErrorMessage = new Error(` Fatal: Subgraph validation did not return a valid AST.`);
279
+ function invalidSubgraphNameErrorMessage(index, newName) {
280
+ return (`The ${(0, utils_2.numberToOrdinal)(index + 1)} subgraph in the array did not define a name.` +
281
+ ` Consequently, any further errors will temporarily identify this subgraph as "${newName}".`);
282
+ }
283
+ exports.invalidSubgraphNameErrorMessage = invalidSubgraphNameErrorMessage;
284
+ function invalidOperationTypeDefinitionError(existingOperationType, typeName, newOperationType) {
285
+ return new Error(`The schema definition defines the "${existingOperationType}" operation as type "${typeName}".` +
286
+ ` However, "${typeName}" was also used for the "${newOperationType}" operation.\n` +
287
+ ` If explicitly defined, each operation type must be a unique and valid Object type.`);
288
+ }
289
+ exports.invalidOperationTypeDefinitionError = invalidOperationTypeDefinitionError;
290
+ function invalidRootTypeDefinitionError(operationType, typeName, defaultTypeName) {
291
+ return new Error(`The schema definition defines the "${operationType}" operation as type "${typeName}".` +
292
+ ` However, the schema also defines another type named "${defaultTypeName}",` +
293
+ ` which is the default (root) type name for the "${operationType}" operation.\n` +
294
+ `For federation, it is only possible to use the default root types names ("Mutation", "Query", "Subscription") as` +
295
+ ` operation definitions. No other definitions with these default root type names are valid.`);
296
+ }
297
+ exports.invalidRootTypeDefinitionError = invalidRootTypeDefinitionError;
298
+ function subgraphInvalidSyntaxError(error) {
299
+ return new Error(`The subgraph has syntax errors and could not be parsed:\n ${error}`);
300
+ }
301
+ exports.subgraphInvalidSyntaxError = subgraphInvalidSyntaxError;
302
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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K,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1F,CAAC;AACJ,CAAC;AALD,0DAKC;AAEY,QAAA,qCAAqC,GAAU,IAAI,KAAK,CACnE,yDAAyD,CAC1D,CAAC;AAEF,SAAgB,+BAA+B,CAAC,KAAa,EAAE,OAAe;IAC5E,OAAO,CACL,OAAO,IAAA,uBAAe,EAAC,KAAK,GAAG,CAAC,CAAC,+CAA+C;QAChF,iFAAiF,OAAO,IAAI,CAC7F,CAAC;AACJ,CAAC;AALD,0EAKC;AAED,SAAgB,mCAAmC,CACjD,qBAAwC,EAAE,QAAgB,EAAE,gBAAmC;IAE/F,OAAO,IAAI,KAAK,CACd,sCAAsC,qBAAqB,wBAAwB,QAAQ,IAAI;QAC/F,cAAc,QAAQ,4BAA4B,gBAAgB,gBAAgB;QAClF,qFAAqF,CACtF,CAAC;AACJ,CAAC;AARD,kFAQC;AAED,SAAgB,8BAA8B,CAC5C,aAAgC,EAAE,QAAgB,EAAE,eAAuB;IAE3E,OAAO,IAAI,KAAK,CACd,sCAAsC,aAAa,wBAAwB,QAAQ,IAAI;QACvF,yDAAyD,eAAe,IAAI;QAC5E,mDAAmD,aAAa,gBAAgB;QAChF,kHAAkH;QAClH,4FAA4F,CAC7F,CAAC;AACJ,CAAC;AAVD,wEAUC;AAED,SAAgB,0BAA0B,CAAC,KAAY;IACrD,OAAO,IAAI,KAAK,CACd,6DAA6D,KAAK,EAAE,CACrE,CAAC;AACJ,CAAC;AAJD,gEAIC"}
@@ -0,0 +1,58 @@
1
+ import { MultiGraph } from 'graphology';
2
+ import { ConstValueNode, DirectiveDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, ObjectTypeExtensionNode, TypeDefinitionNode, UnionTypeDefinitionNode, ObjectTypeDefinitionNode } from 'graphql';
3
+ import { ConstValueNodeWithValue } from '../ast/ast';
4
+ import { EntityContainer, ExtensionContainer, FieldContainer, InputValueContainer, MergeMethod, ObjectContainer, ObjectExtensionContainer, OperationField, ParentContainer, ParentMap, PotentiallyUnresolvableField } from '../ast/utils';
5
+ import { FederationResult } from './federation-result';
6
+ import { InternalSubgraph, Subgraph } from './subgraph';
7
+ export declare function federateSubgraphs(subgraphs: Subgraph[]): FederationResult;
8
+ export declare class FederationFactory {
9
+ abstractToConcreteTypeNames: Map<string, Set<string>>;
10
+ areFieldsShareable: boolean;
11
+ argumentTypeNameSet: Set<string>;
12
+ parentTypeName: string;
13
+ currentSubgraphName: string;
14
+ childName: string;
15
+ directiveDefinitions: Map<string, DirectiveDefinitionNode>;
16
+ entityMap: Map<string, EntityContainer>;
17
+ errors: Error[];
18
+ extensions: Map<string, ObjectExtensionContainer>;
19
+ graph: MultiGraph;
20
+ graphEdges: Set<string>;
21
+ inputFieldTypeNameSet: Set<string>;
22
+ isCurrentParentEntity: boolean;
23
+ isCurrentParentInterface: boolean;
24
+ isCurrentSubgraphVersionTwo: boolean;
25
+ isCurrentParentExtensionType: boolean;
26
+ isParentRootType: boolean;
27
+ isParentInputObject: boolean;
28
+ operationFieldsByResponseTypeName: Map<string, Map<string, OperationField>>;
29
+ outputFieldTypeNameSet: Set<string>;
30
+ parentMap: ParentMap;
31
+ rootTypeNames: Set<string>;
32
+ sharedOperationDependentResponses: Map<string, PotentiallyUnresolvableField[]>;
33
+ subgraphs: InternalSubgraph[];
34
+ shareableErrorTypeNames: Map<string, Set<string>>;
35
+ constructor(subgraphs: InternalSubgraph[]);
36
+ isObjectRootType(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode): boolean;
37
+ upsertEntity(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode): void;
38
+ populateMultiGraphAndRenameOperations(subgraphs: InternalSubgraph[]): void;
39
+ isParentInterface(parent: ParentContainer): boolean;
40
+ isFieldEntityKey(parent: ParentContainer | ExtensionContainer): boolean;
41
+ getEnumMergeMethod(enumName: string): MergeMethod;
42
+ validateArgumentDefaultValues(argName: string, existingDefaultValue: ConstValueNodeWithValue, newDefaultValue: ConstValueNode): void;
43
+ compareAndValidateArgumentDefaultValues(existingArg: InputValueContainer, newArg: InputValueDefinitionNode): void;
44
+ upsertArgumentsForFieldNode(node: FieldDefinitionNode, existingFieldNode: FieldContainer): void;
45
+ extractArgumentsFromFieldNode(node: FieldDefinitionNode, args: Map<string, InputValueContainer>): void;
46
+ addConcreteTypesForInterface(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InterfaceTypeDefinitionNode): void;
47
+ addConcreteTypesForUnion(node: UnionTypeDefinitionNode): void;
48
+ isFieldShareable(node: FieldDefinitionNode, parent: ParentContainer | ExtensionContainer): boolean;
49
+ addPotentiallyUnresolvableField(parent: ObjectContainer | ObjectExtensionContainer, fieldName: string): void;
50
+ upsertFieldNode(node: FieldDefinitionNode): void;
51
+ upsertValueNode(node: EnumValueDefinitionNode | InputValueDefinitionNode): void;
52
+ upsertParentNode(node: TypeDefinitionNode): void;
53
+ upsertConcreteObjectLikeOperationFieldNode(fieldName: string, fieldTypeName: string, operationFieldPath: string, responseType: string, concreteTypeName?: string, hasAbstractParent?: boolean): void;
54
+ upsertAbstractObjectLikeOperationFieldNode(fieldName: string, fieldTypeName: string, operationFieldPath: string, responseType: string, concreteTypeNames: Set<string>): void;
55
+ validatePotentiallyUnresolvableFields(): void;
56
+ upsertExtensionNode(node: ObjectTypeExtensionNode): void;
57
+ federate(): FederationResult;
58
+ }