|
6 | 6 | type ObjectDefinitionData, |
7 | 7 | } from '../schema-building/types/types'; |
8 | 8 | import { |
9 | | - type CacheInvalidateOnNonEntityReturnTypeErrorParams, |
| 9 | + type InvalidEntityReturnTypeErrorParams, |
10 | 10 | type IncompatibleMergedTypesErrorParams, |
11 | 11 | type IncompatibleParentTypeMergeErrorParams, |
12 | 12 | type IncompatibleTypeWithProvidesErrorMessageParams, |
@@ -2082,29 +2082,21 @@ export function queryCacheOnNonEntityReturnTypeErrorMessage(fieldCoords: string, |
2082 | 2082 | ); |
2083 | 2083 | } |
2084 | 2084 |
|
2085 | | -export function cacheInvalidateOnNonMutationSubscriptionFieldErrorMessage(fieldCoords: string): string { |
2086 | | - return `Coordinates "${fieldCoords}" are not a Mutation or Subscription root field.`; |
| 2085 | +export function invalidMutationOrSubscriptionFieldCoordsErrorMessage(fieldCoords: string): string { |
| 2086 | + return `Field coordinates "${fieldCoords}" are not a Mutation or Subscription root field.`; |
2087 | 2087 | } |
2088 | 2088 |
|
2089 | | -export function cacheInvalidateOnNonEntityReturnTypeErrorMessage({ |
| 2089 | +export function invalidEntityReturnTypeErrorMessage({ |
2090 | 2090 | fieldCoords, |
2091 | | - returnType, |
2092 | | -}: CacheInvalidateOnNonEntityReturnTypeErrorParams): string { |
2093 | | - return `Coordinates "${fieldCoords}" return non-entity type "${returnType}".`; |
| 2091 | + returnTypeName, |
| 2092 | +}: InvalidEntityReturnTypeErrorParams): string { |
| 2093 | + return `Field coordinates "${fieldCoords}" return non-entity type "${returnTypeName}".`; |
2094 | 2094 | } |
2095 | 2095 |
|
2096 | | -export function cachePopulateOnNonMutationSubscriptionFieldErrorMessage(fieldCoords: string): string { |
2097 | | - return `@openfed__cachePopulate is only valid on Mutation or Subscription fields, found on "${fieldCoords}".`; |
2098 | | -} |
2099 | | - |
2100 | | -export function cachePopulateOnNonEntityReturnTypeErrorMessage(returnType: string): string { |
2101 | | - return `@openfed__cachePopulate returns non-entity type "${returnType}".`; |
2102 | | -} |
2103 | | - |
2104 | | -export function cacheInvalidateAndPopulateMutualExclusionErrorMessage(fieldCoords: string): string { |
2105 | | - return ( |
2106 | | - `Field "${fieldCoords}" has both @openfed__cacheInvalidate and @openfed__cachePopulate.` + |
2107 | | - ` A field must use one or the other, not both.` |
| 2096 | +export function invalidMutuallyExclusiveCacheDirectivesError(fieldCoords: string): Error { |
| 2097 | + return new Error( |
| 2098 | + `Field coordinates "${fieldCoords}" define both mutually exclusive directives "@openfed__cacheInvalidate"` + |
| 2099 | + ` and "@openfed__cachePopulate".`, |
2108 | 2100 | ); |
2109 | 2101 | } |
2110 | 2102 |
|
|
0 commit comments