@wundergraph/composition 0.28.1 → 0.28.3
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 +13 -13
- package/dist/errors/errors.js +130 -102
- package/dist/errors/errors.js.map +1 -1
- package/dist/federation/federation-factory.d.ts +3 -2
- package/dist/federation/federation-factory.js +46 -33
- 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 +5 -5
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;
|
|
@@ -144,3 +141,6 @@ export declare function invalidSubscriptionFieldConditionFieldPathFieldErrorMess
|
|
|
144
141
|
export declare function inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage(inputPath: string, fullConditionFieldPath: string, partialConditionFieldPath: string, fieldPath: string): string;
|
|
145
142
|
export declare function nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage(inputPath: string, fullConditionFieldPath: string, fieldName: string, typeString: string, namedTypeName: string): string;
|
|
146
143
|
export declare function unresolvablePathError({ fieldName, selectionSet }: UnresolvableFieldData, reasons: Array<string>): Error;
|
|
144
|
+
export declare function allExternalFieldsError(typeName: string, subgraphNamesByFieldName: Map<string, Array<string>>): Error;
|
|
145
|
+
export declare function externalInterfaceFieldsError(typeName: string, fieldNames: Array<string>): Error;
|
|
146
|
+
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;
|
|
@@ -130,6 +127,9 @@ exports.invalidSubscriptionFieldConditionFieldPathFieldErrorMessage = invalidSub
|
|
|
130
127
|
exports.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage = inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage;
|
|
131
128
|
exports.nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage = nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage;
|
|
132
129
|
exports.unresolvablePathError = unresolvablePathError;
|
|
130
|
+
exports.allExternalFieldsError = allExternalFieldsError;
|
|
131
|
+
exports.externalInterfaceFieldsError = externalInterfaceFieldsError;
|
|
132
|
+
exports.nonExternalConditionalFieldError = nonExternalConditionalFieldError;
|
|
133
133
|
const utils_1 = require("../ast/utils");
|
|
134
134
|
const graphql_1 = require("graphql");
|
|
135
135
|
const utils_2 = require("../utils/utils");
|
|
@@ -249,33 +249,6 @@ function undefinedDirectiveErrorMessage(directiveName, hostPath) {
|
|
|
249
249
|
return (`The directive "${directiveName}" is declared on "${hostPath}",` +
|
|
250
250
|
` but the directive is not defined in the schema.`);
|
|
251
251
|
}
|
|
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
252
|
function undefinedTypeError(typeName) {
|
|
280
253
|
return new Error(` The type "${typeName}" was referenced in the schema, but it was never defined.`);
|
|
281
254
|
}
|
|
@@ -538,66 +511,59 @@ exports.noQueryRootTypeError = new Error(`A valid federated graph must have at l
|
|
|
538
511
|
` }`);
|
|
539
512
|
exports.inaccessibleQueryRootTypeError = new Error(`The root query type "Query" must be present in the client schema;` +
|
|
540
513
|
` 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
514
|
function expectedEntityError(typeName) {
|
|
551
515
|
return new Error(`Expected object "${typeName}" to define a "key" directive, but it defines no directives.`);
|
|
552
516
|
}
|
|
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
|
|
517
|
+
exports.inlineFragmentInFieldSetErrorMessage = ` Inline fragments are not currently supported within a field set argument.`;
|
|
518
|
+
function abstractTypeInKeyFieldSetErrorMessage(fieldSet, fieldCoordinates, abstractTypeName, abstractTypeString) {
|
|
519
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
520
|
+
` This is because "${fieldCoordinates}" returns "${abstractTypeName}", which is type "${abstractTypeString}".\n` +
|
|
521
|
+
` Fields that return abstract types (interfaces and unions)` +
|
|
522
|
+
` cannot be included in the field set of "@key" directives.`);
|
|
559
523
|
}
|
|
560
524
|
function unknownTypeInFieldSetErrorMessage(fieldSet, fieldPath, responseTypeName) {
|
|
561
|
-
return (` The following
|
|
562
|
-
`
|
|
525
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
526
|
+
` This is because "${fieldPath}" returns the unknown type "${responseTypeName}".`);
|
|
563
527
|
}
|
|
564
|
-
function invalidSelectionSetErrorMessage(fieldSet,
|
|
565
|
-
return (` The following
|
|
566
|
-
`
|
|
567
|
-
|
|
568
|
-
` must define a selection set with at least one field selection.`);
|
|
528
|
+
function invalidSelectionSetErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) {
|
|
529
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
530
|
+
` This is because of the selection set corresponding to the ` +
|
|
531
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) +
|
|
532
|
+
` Composite types such as "${fieldTypeString}" types must define a selection set with at least one field selection.`);
|
|
569
533
|
}
|
|
570
|
-
function invalidSelectionSetDefinitionErrorMessage(fieldSet,
|
|
571
|
-
return (` The following
|
|
572
|
-
`
|
|
573
|
-
|
|
534
|
+
function invalidSelectionSetDefinitionErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) {
|
|
535
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
536
|
+
` This is because of the selection set corresponding to the ` +
|
|
537
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, fieldTypeString) +
|
|
538
|
+
` Non-composite types such as "${fieldTypeString}" cannot define a selection set.`);
|
|
574
539
|
}
|
|
575
540
|
function undefinedFieldInFieldSetErrorMessage(fieldSet, parentTypeName, fieldName) {
|
|
576
|
-
return (` The following
|
|
577
|
-
`
|
|
541
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
542
|
+
` This is because of the selection set corresponding to the field coordinate "${parentTypeName}.${fieldName}".\n` +
|
|
543
|
+
` The type "${parentTypeName}" does not define a field named "${fieldName}".`);
|
|
578
544
|
}
|
|
579
545
|
function unparsableFieldSetErrorMessage(fieldSet, error) {
|
|
580
|
-
let message = ` The following
|
|
546
|
+
let message = ` The following field set is invalid:\n "${fieldSet}"\n` + ` The field set could not be parsed.`;
|
|
581
547
|
if (error) {
|
|
582
548
|
message += `\n The reason provided was: ` + error.message;
|
|
583
549
|
}
|
|
584
550
|
return message;
|
|
585
551
|
}
|
|
586
552
|
function unparsableFieldSetSelectionErrorMessage(fieldSet, fieldName) {
|
|
587
|
-
return (` The following
|
|
588
|
-
`
|
|
553
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
554
|
+
` This is because the selection set defined on "${fieldName}" could not be parsed.`);
|
|
589
555
|
}
|
|
590
556
|
function undefinedObjectLikeParentError(parentTypeName) {
|
|
591
557
|
return new Error(` Expected an object/interface or object/interface extension named "${parentTypeName}" to exist.`);
|
|
592
558
|
}
|
|
593
559
|
function unexpectedArgumentErrorMessage(fieldSet, fieldPath, argumentName) {
|
|
594
|
-
return (` The following
|
|
595
|
-
`
|
|
560
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
561
|
+
` This is because "${fieldPath}" does not define an argument named "${argumentName}".`);
|
|
596
562
|
}
|
|
597
563
|
function argumentsInKeyFieldSetErrorMessage(fieldSet, fieldPath) {
|
|
598
|
-
return (` The following
|
|
599
|
-
`
|
|
600
|
-
`
|
|
564
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
565
|
+
` This is because "${fieldPath}" defines arguments.\n` +
|
|
566
|
+
` Fields that define arguments cannot be included in the field set of @key directives.`);
|
|
601
567
|
}
|
|
602
568
|
function invalidProvidesOrRequiresDirectivesError(directiveName, errorMessages) {
|
|
603
569
|
return new Error(`The following "${directiveName}" directive` +
|
|
@@ -606,50 +572,80 @@ function invalidProvidesOrRequiresDirectivesError(directiveName, errorMessages)
|
|
|
606
572
|
errorMessages.join(`\n`));
|
|
607
573
|
}
|
|
608
574
|
function duplicateFieldInFieldSetErrorMessage(fieldSet, fieldPath) {
|
|
609
|
-
return (` The following
|
|
610
|
-
`
|
|
575
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
576
|
+
` This is because "${fieldPath}" was included in the field set more than once.`);
|
|
611
577
|
}
|
|
612
578
|
function invalidConfigurationDataErrorMessage(typeName, fieldName, fieldSet) {
|
|
613
579
|
return (` Expected ConfigurationData to exist for type "${typeName}" when adding field "${fieldName}"` +
|
|
614
|
-
` while validating
|
|
580
|
+
` while validating field set "${fieldSet}".`);
|
|
615
581
|
}
|
|
616
582
|
function unknownProvidedObjectErrorMessage(fieldPath, responseType) {
|
|
617
583
|
return (` A @provides directive is declared on "${fieldPath}".\n` +
|
|
618
584
|
` However, the response type "${responseType}" object or object extension definition was not found.`);
|
|
619
585
|
}
|
|
620
|
-
function
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
586
|
+
function getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName, withReturnType = false) {
|
|
587
|
+
/* fieldCoordinatesPath can have length 0 if it's a @requires directive,
|
|
588
|
+
* in which case the first part of the field set refers to the enclosing parent type.
|
|
589
|
+
* */
|
|
590
|
+
if (fieldCoordinatesPath.length < 1) {
|
|
591
|
+
return `enclosing type name "${selectionSetTypeName}".\n`;
|
|
592
|
+
}
|
|
593
|
+
return (`field coordinates "${fieldCoordinatesPath[fieldCoordinatesPath.length - 1]}"` +
|
|
594
|
+
(withReturnType ? ` that returns "${selectionSetTypeName}"` : '') +
|
|
595
|
+
`.\n`);
|
|
596
|
+
}
|
|
597
|
+
function getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, typeString) {
|
|
598
|
+
/* fieldCoordinatesPath can have length 0 if it's a @requires directive,
|
|
599
|
+
* in which case the first part of the field set refers to the enclosing parent type.
|
|
600
|
+
* */
|
|
601
|
+
if (fieldCoordinatesPath.length < 1) {
|
|
602
|
+
return `enclosing type name "${selectionSetTypeName}", which is type "${typeString}".\n`;
|
|
603
|
+
}
|
|
604
|
+
return (`field coordinates "${fieldCoordinatesPath[fieldCoordinatesPath.length - 1]}"` +
|
|
605
|
+
` that returns "${selectionSetTypeName}", which is type "${typeString}".\n`);
|
|
606
|
+
}
|
|
607
|
+
function invalidInlineFragmentTypeErrorMessage(fieldSet, fieldCoordinatesPath, typeConditionName, selectionSetTypeName) {
|
|
608
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
609
|
+
` This is because an inline fragment with the type condition "${typeConditionName}" is defined on the` +
|
|
610
|
+
` selection set corresponding to the ` +
|
|
611
|
+
getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName, true) +
|
|
612
|
+
` However, "${selectionSetTypeName}" is not an abstract (interface or union) type.\n` +
|
|
613
|
+
` Consequently, the only valid type condition at this selection set would be "${selectionSetTypeName}".`);
|
|
625
614
|
}
|
|
626
615
|
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
|
-
|
|
616
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
617
|
+
` This is because "${fieldPath}" defines an inline fragment without a type condition.`);
|
|
618
|
+
}
|
|
619
|
+
function unknownInlineFragmentTypeConditionErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, typeConditionName) {
|
|
620
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
621
|
+
` This is because an inline fragment with the unknown type condition "${typeConditionName}" is defined on the` +
|
|
622
|
+
` selection set corresponding to the ` +
|
|
623
|
+
getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName));
|
|
624
|
+
}
|
|
625
|
+
function invalidInlineFragmentTypeConditionTypeErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName, typeConditionName, typeConditionTypeString) {
|
|
626
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
627
|
+
` This is because an inline fragment with the type condition "${typeConditionName}" is defined on the` +
|
|
628
|
+
` selection set corresponding to the ` +
|
|
629
|
+
getSelectionSetLocation(fieldCoordinatesPath, selectionSetTypeName) +
|
|
630
|
+
` However, "${typeConditionName}" is type "${typeConditionTypeString}" when types "interface" or "object" would` +
|
|
631
|
+
` be expected.`);
|
|
632
|
+
}
|
|
633
|
+
function invalidInlineFragmentTypeConditionErrorMessage(fieldSet, fieldCoordinatesPath, typeConditionName, parentTypeString, selectionSetTypeName) {
|
|
634
|
+
const message = ` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
635
|
+
` This is because an inline fragment with the type condition "${typeConditionName}" is defined on the` +
|
|
636
|
+
` selection set corresponding to the ` +
|
|
637
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, parentTypeString);
|
|
644
638
|
if (parentTypeString === 'interface') {
|
|
645
|
-
return message + `
|
|
639
|
+
return message + ` However, "${typeConditionName}" does not implement "${selectionSetTypeName}"`;
|
|
646
640
|
}
|
|
647
|
-
return message + `
|
|
641
|
+
return message + ` However, "${typeConditionName}" is not a member of "${selectionSetTypeName}".`;
|
|
648
642
|
}
|
|
649
|
-
function invalidSelectionOnUnionErrorMessage(fieldSet,
|
|
650
|
-
return (` The following
|
|
651
|
-
`
|
|
652
|
-
|
|
643
|
+
function invalidSelectionOnUnionErrorMessage(fieldSet, fieldCoordinatesPath, selectionSetTypeName) {
|
|
644
|
+
return (` The following field set is invalid:\n "${fieldSet}"\n` +
|
|
645
|
+
` This is because of the selection set corresponding to the ` +
|
|
646
|
+
getSelectionSetLocationWithTypeString(fieldCoordinatesPath, selectionSetTypeName, string_constants_1.UNION) +
|
|
647
|
+
` Union types such as "${selectionSetTypeName}" must define field selections (besides "__typename") on an` +
|
|
648
|
+
` inline fragment whose type condition corresponds to a constituent union member.`);
|
|
653
649
|
}
|
|
654
650
|
function duplicateOverriddenFieldErrorMessage(fieldPath, subgraphNames) {
|
|
655
651
|
return (` The field "${fieldPath}" declares an @override directive in the following subgraphs: "` +
|
|
@@ -657,8 +653,8 @@ function duplicateOverriddenFieldErrorMessage(fieldPath, subgraphNames) {
|
|
|
657
653
|
`".`);
|
|
658
654
|
}
|
|
659
655
|
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` +
|
|
656
|
+
return new Error(`The "@override" directive must only be declared on one single instance of a field.` +
|
|
657
|
+
` However, an "@override" directive was declared on more than one instance of the following field` +
|
|
662
658
|
(errorMessages.length > 1 ? 's' : '') +
|
|
663
659
|
`: "` +
|
|
664
660
|
errorMessages.join(string_constants_1.QUOTATION_JOIN) +
|
|
@@ -800,7 +796,7 @@ function invalidKeyFieldSetsEventDrivenErrorMessage(invalidKeyFieldSetsByEntityT
|
|
|
800
796
|
let message = '';
|
|
801
797
|
for (const [typeName, keyFieldSets] of invalidKeyFieldSetsByEntityTypeName) {
|
|
802
798
|
message +=
|
|
803
|
-
` The following "@key"
|
|
799
|
+
` The following "@key" field set` +
|
|
804
800
|
(keyFieldSets.length > 1 ? 's are' : ' is') +
|
|
805
801
|
` defined on the entity "${typeName}" without a "resolvable: false" argument:\n` +
|
|
806
802
|
` "` +
|
|
@@ -821,7 +817,7 @@ function nonExternalKeyFieldNamesEventDrivenErrorMessage(nonExternalKeyFieldName
|
|
|
821
817
|
function nonKeyFieldNamesEventDrivenErrorMessage(nonKeyFieldNameByFieldPath) {
|
|
822
818
|
let message = ` The following field` +
|
|
823
819
|
(nonKeyFieldNameByFieldPath.size > 1 ? 's are' : ' is') +
|
|
824
|
-
` defined despite not composing part of a "@key" directive
|
|
820
|
+
` defined despite not composing part of a "@key" directive field set:\n`;
|
|
825
821
|
for (const [fieldPath, fieldName] of nonKeyFieldNameByFieldPath) {
|
|
826
822
|
message += ` Field "${fieldName}" defined on path "${fieldPath}"\n`;
|
|
827
823
|
}
|
|
@@ -837,7 +833,7 @@ function nonEntityObjectExtensionsEventDrivenErrorMessage(typeNames) {
|
|
|
837
833
|
`"\n`);
|
|
838
834
|
}
|
|
839
835
|
function nonKeyComposingObjectTypeNamesEventDrivenErrorMessage(typeNames) {
|
|
840
|
-
return (` Only object definitions whose fields compose part of a "@key" directive's
|
|
836
|
+
return (` Only object definitions whose fields compose part of a "@key" directive's field set may be defined in an` +
|
|
841
837
|
` Event Driven graph. Consequently, the following object type definition` +
|
|
842
838
|
(typeNames.length > 1 ? 's are' : ' is') +
|
|
843
839
|
` invalid:\n "` +
|
|
@@ -1039,4 +1035,36 @@ function unresolvablePathError({ fieldName, selectionSet }, reasons) {
|
|
|
1039
1035
|
reasons.join(`\n - `);
|
|
1040
1036
|
return new Error(message);
|
|
1041
1037
|
}
|
|
1038
|
+
function allExternalFieldsError(typeName, subgraphNamesByFieldName) {
|
|
1039
|
+
let message = `The object "${typeName}" is invalid because the following field definition` +
|
|
1040
|
+
(subgraphNamesByFieldName.size > 1 ? 's are' : ' is') +
|
|
1041
|
+
` declared @external on all instances of that field:\n`;
|
|
1042
|
+
for (const [fieldName, subgraphNames] of subgraphNamesByFieldName) {
|
|
1043
|
+
message +=
|
|
1044
|
+
` "${fieldName}" in subgraph` +
|
|
1045
|
+
(subgraphNames.length > 1 ? 's' : '') +
|
|
1046
|
+
` "` +
|
|
1047
|
+
subgraphNames.join(string_constants_1.QUOTATION_JOIN) +
|
|
1048
|
+
`"\n`;
|
|
1049
|
+
}
|
|
1050
|
+
message += `At least one instance of a field definition must always be resolvable (and therefore not declared @external).`;
|
|
1051
|
+
return new Error(message);
|
|
1052
|
+
}
|
|
1053
|
+
function externalInterfaceFieldsError(typeName, fieldNames) {
|
|
1054
|
+
return new Error(`The interface "${typeName}" is invalid because the following field definition` +
|
|
1055
|
+
(fieldNames.length > 1 ? 's are' : ' is') +
|
|
1056
|
+
` declared @external:\n "` +
|
|
1057
|
+
fieldNames.join(string_constants_1.QUOTATION_JOIN) +
|
|
1058
|
+
`"\n` +
|
|
1059
|
+
`Interface fields should not be declared @external. This is because interface fields do not resolve directly,` +
|
|
1060
|
+
` but the "@external" directive relates to whether a field instance can be resolved` +
|
|
1061
|
+
` by the subgraph in which it is defined.`);
|
|
1062
|
+
}
|
|
1063
|
+
function nonExternalConditionalFieldError(originCoords, subgraphName, targetCoords, fieldSet, fieldSetDirective) {
|
|
1064
|
+
return new Error(`The field "${originCoords}" in subgraph "${subgraphName}" defines a "@${fieldSetDirective}" directive with the following` +
|
|
1065
|
+
` field set:\n "${fieldSet}".` +
|
|
1066
|
+
`\nHowever, neither the field "${targetCoords}" nor any of its field set ancestors are declared @external.` +
|
|
1067
|
+
`\nConsequently, "${targetCoords}" is already provided by subgraph "${subgraphName}" and should not form part of` +
|
|
1068
|
+
` a "@${fieldSetDirective}" directive field set.`);
|
|
1069
|
+
}
|
|
1042
1070
|
//# sourceMappingURL=errors.js.map
|