@wundergraph/composition 0.28.2 → 0.28.4
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/dist/ast/utils.d.ts +1 -0
- package/dist/ast/utils.js +5 -1
- package/dist/ast/utils.js.map +1 -1
- package/dist/errors/errors.d.ts +14 -13
- package/dist/errors/errors.js +134 -102
- package/dist/errors/errors.js.map +1 -1
- package/dist/federation/federation-factory.d.ts +3 -2
- package/dist/federation/federation-factory.js +57 -34
- package/dist/federation/federation-factory.js.map +1 -1
- package/dist/federation/utils.d.ts +15 -19
- package/dist/federation/utils.js +13 -1
- package/dist/federation/utils.js.map +1 -1
- package/dist/federation/walkers.js +2 -2
- package/dist/federation/walkers.js.map +1 -1
- package/dist/normalization/normalization-factory.d.ts +15 -8
- package/dist/normalization/normalization-factory.js +68 -20
- package/dist/normalization/normalization-factory.js.map +1 -1
- package/dist/normalization/utils.d.ts +7 -3
- package/dist/normalization/utils.js +125 -76
- package/dist/normalization/utils.js.map +1 -1
- package/dist/normalization/walkers.js +28 -28
- package/dist/normalization/walkers.js.map +1 -1
- package/dist/router-configuration/router-configuration.d.ts +10 -0
- package/dist/router-configuration/router-configuration.js +7 -0
- package/dist/router-configuration/router-configuration.js.map +1 -1
- package/dist/schema-building/utils.d.ts +21 -4
- package/dist/schema-building/utils.js +60 -31
- package/dist/schema-building/utils.js.map +1 -1
- package/dist/subgraph/subgraph.d.ts +4 -2
- package/dist/subgraph/subgraph.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/warnings/warnings.d.ts +7 -1
- package/dist/warnings/warnings.js +35 -1
- package/dist/warnings/warnings.js.map +1 -1
- package/package.json +2 -2
package/dist/ast/utils.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ type ParseResult = {
|
|
|
22
22
|
documentNode?: DocumentNode;
|
|
23
23
|
error?: Error;
|
|
24
24
|
};
|
|
25
|
+
export declare function parse(source: string): DocumentNode;
|
|
25
26
|
export declare function safeParse(value: string): ParseResult;
|
|
26
27
|
export type EnumTypeNode = EnumTypeDefinitionNode | EnumTypeExtensionNode;
|
|
27
28
|
export type InputObjectTypeNode = InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode;
|
package/dist/ast/utils.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.formatDescription = formatDescription;
|
|
|
18
18
|
exports.lexicographicallySortArgumentNodes = lexicographicallySortArgumentNodes;
|
|
19
19
|
exports.lexicographicallySortSelectionSetNode = lexicographicallySortSelectionSetNode;
|
|
20
20
|
exports.lexicographicallySortDocumentNode = lexicographicallySortDocumentNode;
|
|
21
|
+
exports.parse = parse;
|
|
21
22
|
exports.safeParse = safeParse;
|
|
22
23
|
const graphql_1 = require("graphql");
|
|
23
24
|
const string_constants_1 = require("../utils/string-constants");
|
|
@@ -235,9 +236,12 @@ function lexicographicallySortDocumentNode(documentNode) {
|
|
|
235
236
|
}),
|
|
236
237
|
};
|
|
237
238
|
}
|
|
239
|
+
function parse(source) {
|
|
240
|
+
return (0, graphql_1.parse)(source, { noLocation: true });
|
|
241
|
+
}
|
|
238
242
|
function safeParse(value) {
|
|
239
243
|
try {
|
|
240
|
-
const parsedValue =
|
|
244
|
+
const parsedValue = parse(value);
|
|
241
245
|
return { documentNode: parsedValue };
|
|
242
246
|
}
|
|
243
247
|
catch (e) {
|
package/dist/ast/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/ast/utils.ts"],"names":[],"mappings":";;;AAoDA,wDAUC;AACD,sDAUC;AAED,0CAUC;AAED,8CAkBC;AAED,gFAiBC;AAED,4CAKC;AAED,gEAMC;AAED,gDAMC;AAED,sDAKC;AAED,0DAMC;AAED,kEA+CC;AAQD,wCAEC;AAED,kFAWC;AAED,8CAYC;AAED,gFAMC;AAED,sFAcC;AAED,8EAaC;AAOD,8BAOC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":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,YAAY,CAAC;aAC7E,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AAOD,SAAgB,KAAK,CAAC,MAAc;IAClC,OAAO,IAAA,eAAY,EAAC,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,SAAS,CAAC,KAAa;IACrC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;IACvC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,KAAK,EAAE,CAAU,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
package/dist/errors/errors.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ConstDirectiveNode, Kind, OperationTypeNode, SchemaExtensionNode, TypeDefinitionNode, TypeExtensionNode } from 'graphql';
|
|
2
2
|
import { EntityInterfaceFederationData, ImplementationErrors, InvalidArgument, InvalidEntityInterface, InvalidRequiredInputValueData } from '../utils/utils';
|
|
3
|
-
import { RootTypeFieldData } from '../federation/utils';
|
|
4
3
|
import { ObjectDefinitionData } from '../schema-building/type-definition-data';
|
|
5
4
|
import { InvalidRootTypeFieldEventsDirectiveData } from './utils';
|
|
6
5
|
import { UnresolvableFieldData } from '../resolvability-graph/utils';
|
|
6
|
+
import { FieldSetDirective } from '../schema-building/utils';
|
|
7
7
|
export declare const minimumSubgraphRequirementError: Error;
|
|
8
8
|
export declare function incompatibleExtensionError(typeName: string, baseKind: Kind, extensionKind: Kind): Error;
|
|
9
9
|
export declare function incompatibleArgumentTypesError(argName: string, hostPath: string, expectedType: string, actualType: string): Error;
|
|
@@ -27,7 +27,6 @@ export declare function noDefinedUnionMembersError(unionTypeName: string, extens
|
|
|
27
27
|
export declare function operationDefinitionError(typeName: string, operationType: OperationTypeNode, actualType: Kind): Error;
|
|
28
28
|
export declare function invalidFieldShareabilityError(objectData: ObjectDefinitionData, invalidFieldNames: Set<string>): Error;
|
|
29
29
|
export declare function undefinedDirectiveErrorMessage(directiveName: string, hostPath: string): string;
|
|
30
|
-
export declare function unresolvableFieldError(rootTypeFieldData: RootTypeFieldData, fieldName: string, fieldSubgraphs: string[], unresolvablePath: string, parentTypeName: string): Error;
|
|
31
30
|
export declare function undefinedTypeError(typeName: string): Error;
|
|
32
31
|
export declare function invalidRepeatedDirectiveErrorMessage(directiveName: string, hostPath: string): string;
|
|
33
32
|
export declare function invalidRepeatedFederatedDirectiveErrorMessage(directiveName: string, hostPath: string): Error;
|
|
@@ -67,14 +66,12 @@ export declare function duplicateArgumentsError(fieldPath: string, duplicatedArg
|
|
|
67
66
|
export declare function invalidArgumentsError(fieldPath: string, invalidArguments: InvalidArgument[]): Error;
|
|
68
67
|
export declare const noQueryRootTypeError: Error;
|
|
69
68
|
export declare const inaccessibleQueryRootTypeError: Error;
|
|
70
|
-
export declare function unexpectedObjectResponseType(fieldPath: string, actualTypeString: string): Error;
|
|
71
|
-
export declare function noConcreteTypesForAbstractTypeError(typeString: string, abstractTypeName: string): Error;
|
|
72
69
|
export declare function expectedEntityError(typeName: string): Error;
|
|
73
|
-
export declare const inlineFragmentInFieldSetErrorMessage = " Inline fragments are not currently supported within a
|
|
74
|
-
export declare function abstractTypeInKeyFieldSetErrorMessage(fieldSet: string,
|
|
70
|
+
export declare const inlineFragmentInFieldSetErrorMessage = " Inline fragments are not currently supported within a field set argument.";
|
|
71
|
+
export declare function abstractTypeInKeyFieldSetErrorMessage(fieldSet: string, fieldCoordinates: string, abstractTypeName: string, abstractTypeString: string): string;
|
|
75
72
|
export declare function unknownTypeInFieldSetErrorMessage(fieldSet: string, fieldPath: string, responseTypeName: string): string;
|
|
76
|
-
export declare function invalidSelectionSetErrorMessage(fieldSet: string,
|
|
77
|
-
export declare function invalidSelectionSetDefinitionErrorMessage(fieldSet: string,
|
|
73
|
+
export declare function invalidSelectionSetErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, selectionSetTypeName: string, fieldTypeString: string): string;
|
|
74
|
+
export declare function invalidSelectionSetDefinitionErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, selectionSetTypeName: string, fieldTypeString: string): string;
|
|
78
75
|
export declare function undefinedFieldInFieldSetErrorMessage(fieldSet: string, parentTypeName: string, fieldName: string): string;
|
|
79
76
|
export declare function unparsableFieldSetErrorMessage(fieldSet: string, error?: Error): string;
|
|
80
77
|
export declare function unparsableFieldSetSelectionErrorMessage(fieldSet: string, fieldName: string): string;
|
|
@@ -85,12 +82,12 @@ export declare function invalidProvidesOrRequiresDirectivesError(directiveName:
|
|
|
85
82
|
export declare function duplicateFieldInFieldSetErrorMessage(fieldSet: string, fieldPath: string): string;
|
|
86
83
|
export declare function invalidConfigurationDataErrorMessage(typeName: string, fieldName: string, fieldSet: string): string;
|
|
87
84
|
export declare function unknownProvidedObjectErrorMessage(fieldPath: string, responseType: string): string;
|
|
88
|
-
export declare function invalidInlineFragmentTypeErrorMessage(fieldSet: string,
|
|
85
|
+
export declare function invalidInlineFragmentTypeErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, typeConditionName: string, selectionSetTypeName: string): string;
|
|
89
86
|
export declare function inlineFragmentWithoutTypeConditionErrorMessage(fieldSet: string, fieldPath: string): string;
|
|
90
|
-
export declare function unknownInlineFragmentTypeConditionErrorMessage(fieldSet: string,
|
|
91
|
-
export declare function invalidInlineFragmentTypeConditionTypeErrorMessage(fieldSet: string,
|
|
92
|
-
export declare function invalidInlineFragmentTypeConditionErrorMessage(fieldSet: string,
|
|
93
|
-
export declare function invalidSelectionOnUnionErrorMessage(fieldSet: string,
|
|
87
|
+
export declare function unknownInlineFragmentTypeConditionErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, selectionSetTypeName: string, typeConditionName: string): string;
|
|
88
|
+
export declare function invalidInlineFragmentTypeConditionTypeErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, selectionSetTypeName: string, typeConditionName: string, typeConditionTypeString: string): string;
|
|
89
|
+
export declare function invalidInlineFragmentTypeConditionErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, typeConditionName: string, parentTypeString: string, selectionSetTypeName: string): string;
|
|
90
|
+
export declare function invalidSelectionOnUnionErrorMessage(fieldSet: string, fieldCoordinatesPath: Array<string>, selectionSetTypeName: string): string;
|
|
94
91
|
export declare function duplicateOverriddenFieldErrorMessage(fieldPath: string, subgraphNames: string[]): string;
|
|
95
92
|
export declare function duplicateOverriddenFieldsError(errorMessages: string[]): Error;
|
|
96
93
|
export declare function noFieldDefinitionsError(typeString: string, typeName: string): Error;
|
|
@@ -126,6 +123,7 @@ export declare function invalidUnionMemberTypeError(typeName: string, invalidMem
|
|
|
126
123
|
export declare function invalidRootTypeError(typeName: string): Error;
|
|
127
124
|
export declare function invalidSubscriptionFilterLocationError(path: string): Error;
|
|
128
125
|
export declare function invalidSubscriptionFilterDirectiveError(fieldPath: string, errorMessages: string[]): Error;
|
|
126
|
+
export declare function subscriptionFilterNamedTypeErrorMessage(namedTypeName: string): string;
|
|
129
127
|
export declare function subscriptionFilterConditionDepthExceededErrorMessage(inputPath: string): string;
|
|
130
128
|
export declare function subscriptionFilterConditionInvalidInputFieldNumberErrorMessage(inputPath: string, fieldNumber: number): string;
|
|
131
129
|
export declare function subscriptionFilterConditionInvalidInputFieldErrorMessage(inputPath: string, invalidFieldName: string): string;
|
|
@@ -144,3 +142,6 @@ export declare function invalidSubscriptionFieldConditionFieldPathFieldErrorMess
|
|
|
144
142
|
export declare function inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage(inputPath: string, fullConditionFieldPath: string, partialConditionFieldPath: string, fieldPath: string): string;
|
|
145
143
|
export declare function nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage(inputPath: string, fullConditionFieldPath: string, fieldName: string, typeString: string, namedTypeName: string): string;
|
|
146
144
|
export declare function unresolvablePathError({ fieldName, selectionSet }: UnresolvableFieldData, reasons: Array<string>): Error;
|
|
145
|
+
export declare function allExternalFieldsError(typeName: string, subgraphNamesByFieldName: Map<string, Array<string>>): Error;
|
|
146
|
+
export declare function externalInterfaceFieldsError(typeName: string, fieldNames: Array<string>): Error;
|
|
147
|
+
export declare function nonExternalConditionalFieldError(originCoords: string, subgraphName: string, targetCoords: string, fieldSet: string, fieldSetDirective: FieldSetDirective): Error;
|
package/dist/errors/errors.js
CHANGED
|
@@ -23,7 +23,6 @@ exports.noDefinedUnionMembersError = noDefinedUnionMembersError;
|
|
|
23
23
|
exports.operationDefinitionError = operationDefinitionError;
|
|
24
24
|
exports.invalidFieldShareabilityError = invalidFieldShareabilityError;
|
|
25
25
|
exports.undefinedDirectiveErrorMessage = undefinedDirectiveErrorMessage;
|
|
26
|
-
exports.unresolvableFieldError = unresolvableFieldError;
|
|
27
26
|
exports.undefinedTypeError = undefinedTypeError;
|
|
28
27
|
exports.invalidRepeatedDirectiveErrorMessage = invalidRepeatedDirectiveErrorMessage;
|
|
29
28
|
exports.invalidRepeatedFederatedDirectiveErrorMessage = invalidRepeatedFederatedDirectiveErrorMessage;
|
|
@@ -59,8 +58,6 @@ exports.invalidInterfaceImplementationError = invalidInterfaceImplementationErro
|
|
|
59
58
|
exports.invalidRequiredInputValueError = invalidRequiredInputValueError;
|
|
60
59
|
exports.duplicateArgumentsError = duplicateArgumentsError;
|
|
61
60
|
exports.invalidArgumentsError = invalidArgumentsError;
|
|
62
|
-
exports.unexpectedObjectResponseType = unexpectedObjectResponseType;
|
|
63
|
-
exports.noConcreteTypesForAbstractTypeError = noConcreteTypesForAbstractTypeError;
|
|
64
61
|
exports.expectedEntityError = expectedEntityError;
|
|
65
62
|
exports.abstractTypeInKeyFieldSetErrorMessage = abstractTypeInKeyFieldSetErrorMessage;
|
|
66
63
|
exports.unknownTypeInFieldSetErrorMessage = unknownTypeInFieldSetErrorMessage;
|
|
@@ -112,6 +109,7 @@ exports.invalidUnionMemberTypeError = invalidUnionMemberTypeError;
|
|
|
112
109
|
exports.invalidRootTypeError = invalidRootTypeError;
|
|
113
110
|
exports.invalidSubscriptionFilterLocationError = invalidSubscriptionFilterLocationError;
|
|
114
111
|
exports.invalidSubscriptionFilterDirectiveError = invalidSubscriptionFilterDirectiveError;
|
|
112
|
+
exports.subscriptionFilterNamedTypeErrorMessage = subscriptionFilterNamedTypeErrorMessage;
|
|
115
113
|
exports.subscriptionFilterConditionDepthExceededErrorMessage = subscriptionFilterConditionDepthExceededErrorMessage;
|
|
116
114
|
exports.subscriptionFilterConditionInvalidInputFieldNumberErrorMessage = subscriptionFilterConditionInvalidInputFieldNumberErrorMessage;
|
|
117
115
|
exports.subscriptionFilterConditionInvalidInputFieldErrorMessage = subscriptionFilterConditionInvalidInputFieldErrorMessage;
|
|
@@ -130,6 +128,9 @@ exports.invalidSubscriptionFieldConditionFieldPathFieldErrorMessage = invalidSub
|
|
|
130
128
|
exports.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage = inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage;
|
|
131
129
|
exports.nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage = nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage;
|
|
132
130
|
exports.unresolvablePathError = unresolvablePathError;
|
|
131
|
+
exports.allExternalFieldsError = allExternalFieldsError;
|
|
132
|
+
exports.externalInterfaceFieldsError = externalInterfaceFieldsError;
|
|
133
|
+
exports.nonExternalConditionalFieldError = nonExternalConditionalFieldError;
|
|
133
134
|
const utils_1 = require("../ast/utils");
|
|
134
135
|
const graphql_1 = require("graphql");
|
|
135
136
|
const utils_2 = require("../utils/utils");
|
|
@@ -249,33 +250,6 @@ function undefinedDirectiveErrorMessage(directiveName, hostPath) {
|
|
|
249
250
|
return (`The directive "${directiveName}" is declared on "${hostPath}",` +
|
|
250
251
|
` but the directive is not defined in the schema.`);
|
|
251
252
|
}
|
|
252
|
-
function unresolvableFieldError(rootTypeFieldData, fieldName, fieldSubgraphs, unresolvablePath, parentTypeName) {
|
|
253
|
-
const fieldPath = `${parentTypeName}.${fieldName}`;
|
|
254
|
-
return new Error(`The path "${unresolvablePath}" cannot be resolved because:\n` +
|
|
255
|
-
` The root type field "${rootTypeFieldData.path}" is defined in the following subgraph` +
|
|
256
|
-
(rootTypeFieldData.subgraphs.size > 1 ? 's' : '') +
|
|
257
|
-
`: "` +
|
|
258
|
-
[...rootTypeFieldData.subgraphs].join(string_constants_1.QUOTATION_JOIN) +
|
|
259
|
-
`".\n` +
|
|
260
|
-
` However, "${fieldPath}" is only defined in the following subgraph` +
|
|
261
|
-
(fieldSubgraphs.length > 1 ? 's' : '') +
|
|
262
|
-
`: "` +
|
|
263
|
-
fieldSubgraphs +
|
|
264
|
-
`".\n` +
|
|
265
|
-
` Consequently, "${fieldPath}" cannot be resolved through the root type field "${rootTypeFieldData.path}".\n` +
|
|
266
|
-
`Potential solutions:\n` +
|
|
267
|
-
` Convert "${parentTypeName}" into an entity using the "@key" directive.\n` +
|
|
268
|
-
` Add the shareable root type field "${rootTypeFieldData.path}" to ` +
|
|
269
|
-
(fieldSubgraphs.length > 1 ? 'one of the following subgraphs' : 'the following subgraph') +
|
|
270
|
-
`: "` +
|
|
271
|
-
fieldSubgraphs.join(string_constants_1.QUOTATION_JOIN) +
|
|
272
|
-
`".\n` +
|
|
273
|
-
` For example (note that V1 fields are shareable by default and do not require a directive):\n` +
|
|
274
|
-
` type ${rootTypeFieldData.typeName} {\n` +
|
|
275
|
-
` ...\n` +
|
|
276
|
-
` ${rootTypeFieldData.fieldName}: ${rootTypeFieldData.fieldTypeNodeString} @shareable\n` +
|
|
277
|
-
` }`);
|
|
278
|
-
}
|
|
279
253
|
function undefinedTypeError(typeName) {
|
|
280
254
|
return new Error(` The type "${typeName}" was referenced in the schema, but it was never defined.`);
|
|
281
255
|
}
|
|
@@ -538,66 +512,59 @@ exports.noQueryRootTypeError = new Error(`A valid federated graph must have at l
|
|
|
538
512
|
` }`);
|
|
539
513
|
exports.inaccessibleQueryRootTypeError = new Error(`The root query type "Query" must be present in the client schema;` +
|
|
540
514
|
` consequently, it must not be declared @inaccessible.`);
|
|
541
|
-
function unexpectedObjectResponseType(fieldPath, actualTypeString) {
|
|
542
|
-
return new Error(`Expected the path "${fieldPath}" to have the response type` +
|
|
543
|
-
` Enum, Interface, Object, Scalar, or Union but received ${actualTypeString}.`);
|
|
544
|
-
}
|
|
545
|
-
function noConcreteTypesForAbstractTypeError(typeString, abstractTypeName) {
|
|
546
|
-
return new Error(`Expected ${typeString} "${abstractTypeName}" to define at least one ` +
|
|
547
|
-
(typeString === string_constants_1.UNION ? 'member' : 'object that implements the interface') +
|
|
548
|
-
` but received none`);
|
|
549
|
-
}
|
|
550
515
|
function expectedEntityError(typeName) {
|
|
551
516
|
return new Error(`Expected object "${typeName}" to define a "key" directive, but it defines no directives.`);
|
|
552
517
|
}
|
|
553
|
-
exports.inlineFragmentInFieldSetErrorMessage = ` Inline fragments are not currently supported within a
|
|
554
|
-
function abstractTypeInKeyFieldSetErrorMessage(fieldSet,
|
|
555
|
-
return (` The following
|
|
556
|
-
`
|
|
557
|
-
`
|
|
558
|
-
` cannot be included in the
|
|
518
|
+
exports.inlineFragmentInFieldSetErrorMessage = ` Inline fragments are not currently supported within a field set argument.`;
|
|
519
|
+
function abstractTypeInKeyFieldSetErrorMessage(fieldSet, fieldCoordinates, abstractTypeName, abstractTypeString) {
|
|
520
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
521
|
+
` This is because "${fieldCoordinates}" returns "${abstractTypeName}", which is type "${abstractTypeString}".\n` +
|
|
522
|
+
` Fields that return abstract types (interfaces and unions)` +
|
|
523
|
+
` cannot be included in the field set of "@key" directives.`);
|
|
559
524
|
}
|
|
560
525
|
function unknownTypeInFieldSetErrorMessage(fieldSet, fieldPath, responseTypeName) {
|
|
561
|
-
return (` The following
|
|
562
|
-
`
|
|
526
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
527
|
+
` This is because "${fieldPath}" returns the unknown type "${responseTypeName}".`);
|
|
563
528
|
}
|
|
564
|
-
function invalidSelectionSetErrorMessage(fieldSet,
|
|
565
|
-
return (` The following
|
|
566
|
-
`
|
|
567
|
-
|
|
568
|
-
` must define a selection set with at least one field selection.`);
|
|
529
|
+
function invalidSelectionSetErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) {
|
|
530
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
531
|
+
` This is because of the selection set corresponding to the ` +
|
|
532
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) +
|
|
533
|
+
` Composite types such as "${fieldTypeString}" types must define a selection set with at least one field selection.`);
|
|
569
534
|
}
|
|
570
|
-
function invalidSelectionSetDefinitionErrorMessage(fieldSet,
|
|
571
|
-
return (` The following
|
|
572
|
-
`
|
|
573
|
-
|
|
535
|
+
function invalidSelectionSetDefinitionErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) {
|
|
536
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
537
|
+
` This is because of the selection set corresponding to the ` +
|
|
538
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) +
|
|
539
|
+
` Non-composite types such as "${fieldTypeString}" cannot define a selection set.`);
|
|
574
540
|
}
|
|
575
541
|
function undefinedFieldInFieldSetErrorMessage(fieldSet, parentTypeName, fieldName) {
|
|
576
|
-
return (` The following
|
|
577
|
-
`
|
|
542
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
543
|
+
` This is because of the selection set corresponding to the field coordinate "${parentTypeName}.${fieldName}".\n` +
|
|
544
|
+
` The type "${parentTypeName}" does not define a field named "${fieldName}".`);
|
|
578
545
|
}
|
|
579
546
|
function unparsableFieldSetErrorMessage(fieldSet, error) {
|
|
580
|
-
let message = ` The following
|
|
547
|
+
let message = ` The following field set is invalid:\n "${fieldSet}"\n` + ` The field set could not be parsed.`;
|
|
581
548
|
if (error) {
|
|
582
549
|
message += `\n The reason provided was: ` + error.message;
|
|
583
550
|
}
|
|
584
551
|
return message;
|
|
585
552
|
}
|
|
586
553
|
function unparsableFieldSetSelectionErrorMessage(fieldSet, fieldName) {
|
|
587
|
-
return (` The following
|
|
588
|
-
`
|
|
554
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
555
|
+
` This is because the selection set defined on "${fieldName}" could not be parsed.`);
|
|
589
556
|
}
|
|
590
557
|
function undefinedObjectLikeParentError(parentTypeName) {
|
|
591
558
|
return new Error(` Expected an object/interface or object/interface extension named "${parentTypeName}" to exist.`);
|
|
592
559
|
}
|
|
593
560
|
function unexpectedArgumentErrorMessage(fieldSet, fieldPath, argumentName) {
|
|
594
|
-
return (` The following
|
|
595
|
-
`
|
|
561
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
562
|
+
` This is because "${fieldPath}" does not define an argument named "${argumentName}".`);
|
|
596
563
|
}
|
|
597
564
|
function argumentsInKeyFieldSetErrorMessage(fieldSet, fieldPath) {
|
|
598
|
-
return (` The following
|
|
599
|
-
`
|
|
600
|
-
`
|
|
565
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
566
|
+
` This is because "${fieldPath}" defines arguments.\n` +
|
|
567
|
+
` Fields that define arguments cannot be included in the field set of @key directives.`);
|
|
601
568
|
}
|
|
602
569
|
function invalidProvidesOrRequiresDirectivesError(directiveName, errorMessages) {
|
|
603
570
|
return new Error(`The following "${directiveName}" directive` +
|
|
@@ -606,50 +573,80 @@ function invalidProvidesOrRequiresDirectivesError(directiveName, errorMessages)
|
|
|
606
573
|
errorMessages.join(`\n`));
|
|
607
574
|
}
|
|
608
575
|
function duplicateFieldInFieldSetErrorMessage(fieldSet, fieldPath) {
|
|
609
|
-
return (` The following
|
|
610
|
-
`
|
|
576
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
577
|
+
` This is because "${fieldPath}" was included in the field set more than once.`);
|
|
611
578
|
}
|
|
612
579
|
function invalidConfigurationDataErrorMessage(typeName, fieldName, fieldSet) {
|
|
613
580
|
return (` Expected ConfigurationData to exist for type "${typeName}" when adding field "${fieldName}"` +
|
|
614
|
-
` while validating
|
|
581
|
+
` while validating field set "${fieldSet}".`);
|
|
615
582
|
}
|
|
616
583
|
function unknownProvidedObjectErrorMessage(fieldPath, responseType) {
|
|
617
584
|
return (` A @provides directive is declared on "${fieldPath}".\n` +
|
|
618
585
|
` However, the response type "${responseType}" object or object extension definition was not found.`);
|
|
619
586
|
}
|
|
620
|
-
function
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
587
|
+
function getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName, withReturnType = false) {
|
|
588
|
+
/* fieldCoordinatesPath can have length 0 if it's a @requires directive,
|
|
589
|
+
* in which case the first part of the field set refers to the enclosing parent type.
|
|
590
|
+
* */
|
|
591
|
+
if (fieldCoordinatesPath.length < 1) {
|
|
592
|
+
return `enclosing type name "${selectionSetTypeName}".\n`;
|
|
593
|
+
}
|
|
594
|
+
return (`field coordinates "${fieldCoordinatesPath[fieldCoordinatesPath.length - 1]}"` +
|
|
595
|
+
(withReturnType ? ` that returns "${selectionSetTypeName}"` : '') +
|
|
596
|
+
`.\n`);
|
|
597
|
+
}
|
|
598
|
+
function getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, typeString) {
|
|
599
|
+
/* fieldCoordinatesPath can have length 0 if it's a @requires directive,
|
|
600
|
+
* in which case the first part of the field set refers to the enclosing parent type.
|
|
601
|
+
* */
|
|
602
|
+
if (fieldCoordinatesPath.length < 1) {
|
|
603
|
+
return `enclosing type name "${selectionSetTypeName}", which is type "${typeString}".\n`;
|
|
604
|
+
}
|
|
605
|
+
return (`field coordinates "${fieldCoordinatesPath[fieldCoordinatesPath.length - 1]}"` +
|
|
606
|
+
` that returns "${selectionSetTypeName}", which is type "${typeString}".\n`);
|
|
607
|
+
}
|
|
608
|
+
function invalidInlineFragmentTypeErrorMessage(fieldSet, fieldCoordinatesPath, typeConditionName, selectionSetTypeName) {
|
|
609
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
610
|
+
` This is because an inline fragment with the type condition "${typeConditionName}" is defined on the` +
|
|
611
|
+
` selection set corresponding to the ` +
|
|
612
|
+
getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName, true) +
|
|
613
|
+
` However, "${selectionSetTypeName}" is not an abstract (interface or union) type.\n` +
|
|
614
|
+
` Consequently, the only valid type condition at this selection set would be "${selectionSetTypeName}".`);
|
|
625
615
|
}
|
|
626
616
|
function inlineFragmentWithoutTypeConditionErrorMessage(fieldSet, fieldPath) {
|
|
627
|
-
return (` The following
|
|
628
|
-
`
|
|
629
|
-
}
|
|
630
|
-
function unknownInlineFragmentTypeConditionErrorMessage(fieldSet,
|
|
631
|
-
return (` The following
|
|
632
|
-
`
|
|
633
|
-
`
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
`
|
|
639
|
-
`
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
617
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
618
|
+
` This is because "${fieldPath}" defines an inline fragment without a type condition.`);
|
|
619
|
+
}
|
|
620
|
+
function unknownInlineFragmentTypeConditionErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, typeConditionName) {
|
|
621
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
622
|
+
` This is because an inline fragment with the unknown type condition "${typeConditionName}" is defined on the` +
|
|
623
|
+
` selection set corresponding to the ` +
|
|
624
|
+
getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName));
|
|
625
|
+
}
|
|
626
|
+
function invalidInlineFragmentTypeConditionTypeErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, typeConditionName, typeConditionTypeString) {
|
|
627
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
628
|
+
` This is because an inline fragment with the type condition "${typeConditionName}" is defined on the` +
|
|
629
|
+
` selection set corresponding to the ` +
|
|
630
|
+
getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName) +
|
|
631
|
+
` However, "${typeConditionName}" is type "${typeConditionTypeString}" when types "interface" or "object" would` +
|
|
632
|
+
` be expected.`);
|
|
633
|
+
}
|
|
634
|
+
function invalidInlineFragmentTypeConditionErrorMessage(fieldSet, fieldCoordinatesPath, typeConditionName, parentTypeString, selectionSetTypeName) {
|
|
635
|
+
const message = ` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
636
|
+
` This is because an inline fragment with the type condition "${typeConditionName}" is defined on the` +
|
|
637
|
+
` selection set corresponding to the ` +
|
|
638
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, parentTypeString);
|
|
644
639
|
if (parentTypeString === 'interface') {
|
|
645
|
-
return message + `
|
|
640
|
+
return message + ` However, "${typeConditionName}" does not implement "${selectionSetTypeName}"`;
|
|
646
641
|
}
|
|
647
|
-
return message + `
|
|
642
|
+
return message + ` However, "${typeConditionName}" is not a member of "${selectionSetTypeName}".`;
|
|
648
643
|
}
|
|
649
|
-
function invalidSelectionOnUnionErrorMessage(fieldSet,
|
|
650
|
-
return (` The following
|
|
651
|
-
`
|
|
652
|
-
|
|
644
|
+
function invalidSelectionOnUnionErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName) {
|
|
645
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
646
|
+
` This is because of the selection set corresponding to the ` +
|
|
647
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, string_constants_1.UNION) +
|
|
648
|
+
` Union types such as "${selectionSetTypeName}" must define field selections (besides "__typename") on an` +
|
|
649
|
+
` inline fragment whose type condition corresponds to a constituent union member.`);
|
|
653
650
|
}
|
|
654
651
|
function duplicateOverriddenFieldErrorMessage(fieldPath, subgraphNames) {
|
|
655
652
|
return (` The field "${fieldPath}" declares an @override directive in the following subgraphs: "` +
|
|
@@ -657,8 +654,8 @@ function duplicateOverriddenFieldErrorMessage(fieldPath, subgraphNames) {
|
|
|
657
654
|
`".`);
|
|
658
655
|
}
|
|
659
656
|
function duplicateOverriddenFieldsError(errorMessages) {
|
|
660
|
-
return new Error(`The @override directive must only be declared on one single instance of a field.` +
|
|
661
|
-
` However, an @override directive was declared on more than one instance of the following field` +
|
|
657
|
+
return new Error(`The "@override" directive must only be declared on one single instance of a field.` +
|
|
658
|
+
` However, an "@override" directive was declared on more than one instance of the following field` +
|
|
662
659
|
(errorMessages.length > 1 ? 's' : '') +
|
|
663
660
|
`: "` +
|
|
664
661
|
errorMessages.join(string_constants_1.QUOTATION_JOIN) +
|
|
@@ -800,7 +797,7 @@ function invalidKeyFieldSetsEventDrivenErrorMessage(invalidKeyFieldSetsByEntityT
|
|
|
800
797
|
let message = '';
|
|
801
798
|
for (const [typeName, keyFieldSets] of invalidKeyFieldSetsByEntityTypeName) {
|
|
802
799
|
message +=
|
|
803
|
-
` The following "@key"
|
|
800
|
+
` The following "@key" field set` +
|
|
804
801
|
(keyFieldSets.length > 1 ? 's are' : ' is') +
|
|
805
802
|
` defined on the entity "${typeName}" without a "resolvable: false" argument:\n` +
|
|
806
803
|
` "` +
|
|
@@ -821,7 +818,7 @@ function nonExternalKeyFieldNamesEventDrivenErrorMessage(nonExternalKeyFieldName
|
|
|
821
818
|
function nonKeyFieldNamesEventDrivenErrorMessage(nonKeyFieldNameByFieldPath) {
|
|
822
819
|
let message = ` The following field` +
|
|
823
820
|
(nonKeyFieldNameByFieldPath.size > 1 ? 's are' : ' is') +
|
|
824
|
-
` defined despite not composing part of a "@key" directive
|
|
821
|
+
` defined despite not composing part of a "@key" directive field set:\n`;
|
|
825
822
|
for (const [fieldPath, fieldName] of nonKeyFieldNameByFieldPath) {
|
|
826
823
|
message += ` Field "${fieldName}" defined on path "${fieldPath}"\n`;
|
|
827
824
|
}
|
|
@@ -837,7 +834,7 @@ function nonEntityObjectExtensionsEventDrivenErrorMessage(typeNames) {
|
|
|
837
834
|
`"\n`);
|
|
838
835
|
}
|
|
839
836
|
function nonKeyComposingObjectTypeNamesEventDrivenErrorMessage(typeNames) {
|
|
840
|
-
return (` Only object definitions whose fields compose part of a "@key" directive's
|
|
837
|
+
return (` Only object definitions whose fields compose part of a "@key" directive's field set may be defined in an` +
|
|
841
838
|
` Event Driven graph. Consequently, the following object type definition` +
|
|
842
839
|
(typeNames.length > 1 ? 's are' : ' is') +
|
|
843
840
|
` invalid:\n "` +
|
|
@@ -916,6 +913,9 @@ function invalidSubscriptionFilterDirectiveError(fieldPath, errorMessages) {
|
|
|
916
913
|
`:\n` +
|
|
917
914
|
errorMessages.join(`\n`));
|
|
918
915
|
}
|
|
916
|
+
function subscriptionFilterNamedTypeErrorMessage(namedTypeName) {
|
|
917
|
+
return ` Unknown type "${namedTypeName}".`;
|
|
918
|
+
}
|
|
919
919
|
function subscriptionFilterConditionDepthExceededErrorMessage(inputPath) {
|
|
920
920
|
return (` The input path "${inputPath}" exceeds the maximum depth of ${integer_constants_1.MAX_SUBSCRIPTION_FILTER_DEPTH}` +
|
|
921
921
|
` for any one filter condition.\n` +
|
|
@@ -1039,4 +1039,36 @@ function unresolvablePathError({ fieldName, selectionSet }, reasons) {
|
|
|
1039
1039
|
reasons.join(`\n - `);
|
|
1040
1040
|
return new Error(message);
|
|
1041
1041
|
}
|
|
1042
|
+
function allExternalFieldsError(typeName, subgraphNamesByFieldName) {
|
|
1043
|
+
let message = `The object "${typeName}" is invalid because the following field definition` +
|
|
1044
|
+
(subgraphNamesByFieldName.size > 1 ? 's are' : ' is') +
|
|
1045
|
+
` declared @external on all instances of that field:\n`;
|
|
1046
|
+
for (const [fieldName, subgraphNames] of subgraphNamesByFieldName) {
|
|
1047
|
+
message +=
|
|
1048
|
+
` "${fieldName}" in subgraph` +
|
|
1049
|
+
(subgraphNames.length > 1 ? 's' : '') +
|
|
1050
|
+
` "` +
|
|
1051
|
+
subgraphNames.join(string_constants_1.QUOTATION_JOIN) +
|
|
1052
|
+
`"\n`;
|
|
1053
|
+
}
|
|
1054
|
+
message += `At least one instance of a field definition must always be resolvable (and therefore not declared @external).`;
|
|
1055
|
+
return new Error(message);
|
|
1056
|
+
}
|
|
1057
|
+
function externalInterfaceFieldsError(typeName, fieldNames) {
|
|
1058
|
+
return new Error(`The interface "${typeName}" is invalid because the following field definition` +
|
|
1059
|
+
(fieldNames.length > 1 ? 's are' : ' is') +
|
|
1060
|
+
` declared @external:\n "` +
|
|
1061
|
+
fieldNames.join(string_constants_1.QUOTATION_JOIN) +
|
|
1062
|
+
`"\n` +
|
|
1063
|
+
`Interface fields should not be declared @external. This is because interface fields do not resolve directly,` +
|
|
1064
|
+
` but the "@external" directive relates to whether a field instance can be resolved` +
|
|
1065
|
+
` by the subgraph in which it is defined.`);
|
|
1066
|
+
}
|
|
1067
|
+
function nonExternalConditionalFieldError(originCoords, subgraphName, targetCoords, fieldSet, fieldSetDirective) {
|
|
1068
|
+
return new Error(`The field "${originCoords}" in subgraph "${subgraphName}" defines a "@${fieldSetDirective}" directive with the following` +
|
|
1069
|
+
` field set:\n "${fieldSet}".` +
|
|
1070
|
+
`\nHowever, neither the field "${targetCoords}" nor any of its field set ancestors are declared @external.` +
|
|
1071
|
+
`\nConsequently, "${targetCoords}" is already provided by subgraph "${subgraphName}" and should not form part of` +
|
|
1072
|
+
` a "@${fieldSetDirective}" directive field set.`);
|
|
1073
|
+
}
|
|
1042
1074
|
//# sourceMappingURL=errors.js.map
|