Skip to content

Commit b69cce2

Browse files
committed
Merge branch 'milinda/requestScoped-directive' into milinda/queryCache-directive
2 parents ba1f054 + 840f24d commit b69cce2

25 files changed

Lines changed: 273 additions & 200 deletions

File tree

cli/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Binaries are attached to the github release otherwise all images can be found [h
44
All notable changes to this project will be documented in this file.
55
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
66

7+
## [0.125.4](https://github.com/wundergraph/cosmo/compare/wgc@0.125.3...wgc@0.125.4) (2026-06-22)
8+
9+
**Note:** Version bump only for package wgc
10+
711
## [0.125.3](https://github.com/wundergraph/cosmo/compare/wgc@0.125.2...wgc@0.125.3) (2026-06-19)
812

913
**Note:** Version bump only for package wgc

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wgc",
3-
"version": "0.125.3",
3+
"version": "0.125.4",
44
"description": "The official CLI tool to manage the GraphQL Federation Platform Cosmo",
55
"type": "module",
66
"main": "dist/src/index.js",

composition/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Binaries are attached to the github release otherwise all images can be found [h
44
All notable changes to this project will be documented in this file.
55
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
66

7+
# [0.60.0](https://github.com/wundergraph/cosmo/compare/@wundergraph/composition@0.59.2...@wundergraph/composition@0.60.0) (2026-06-22)
8+
9+
### Features
10+
11+
* **composition:** [@openfed](https://github.com/openfed)__cacheInvalidate directive (2/5) ([#2983](https://github.com/wundergraph/cosmo/issues/2983)) ([19bbbe5](https://github.com/wundergraph/cosmo/commit/19bbbe5659011ef4536fe43edbb1ae313bda91e3)) (@SkArchon)
12+
* **composition:** [@openfed](https://github.com/openfed)__entityCache directive (1/5) ([#2980](https://github.com/wundergraph/cosmo/issues/2980)) ([2075164](https://github.com/wundergraph/cosmo/commit/2075164f18ee0cf953effdef2a031c59b3e8d112)) (@SkArchon)
13+
714
## [0.59.2](https://github.com/wundergraph/cosmo/compare/@wundergraph/composition@0.59.1...@wundergraph/composition@0.59.2) (2026-06-19)
815

916
### Bug Fixes

composition/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wundergraph/composition",
3-
"version": "0.59.2",
3+
"version": "0.60.0",
44
"author": {
55
"name": "WunderGraph Maintainers",
66
"email": "info@wundergraph.com"

composition/src/errors/errors.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
type ObjectDefinitionData,
77
} from '../schema-building/types/types';
88
import {
9-
type CacheInvalidateOnNonEntityReturnTypeErrorParams,
9+
type InvalidEntityReturnTypeErrorParams,
1010
type IncompatibleMergedTypesErrorParams,
1111
type IncompatibleParentTypeMergeErrorParams,
1212
type IncompatibleTypeWithProvidesErrorMessageParams,
@@ -2082,29 +2082,21 @@ export function queryCacheOnNonEntityReturnTypeErrorMessage(fieldCoords: string,
20822082
);
20832083
}
20842084

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.`;
20872087
}
20882088

2089-
export function cacheInvalidateOnNonEntityReturnTypeErrorMessage({
2089+
export function invalidEntityReturnTypeErrorMessage({
20902090
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}".`;
20942094
}
20952095

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".`,
21082100
);
21092101
}
21102102

composition/src/errors/types/params.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ export type InvalidArgumentValueErrorParams = {
9595
expectedTypeString: string;
9696
};
9797

98-
export type CacheInvalidateOnNonEntityReturnTypeErrorParams = {
98+
export type InvalidEntityReturnTypeErrorParams = {
9999
fieldCoords: string;
100-
returnType: string;
100+
returnTypeName: string;
101101
};
102102

103103
export type MaxAgeNotPositiveIntegerErrorParams = {
104104
directiveName: DirectiveName;
105-
value: number;
105+
value: number | string | null;
106106
};

composition/src/router-configuration/types.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,21 @@ export type CacheInvalidateConfiguration = {
172172
// Extracted from @openfed__cachePopulate on Mutation/Subscription fields.
173173
// Tells the router to populate the entity cache with the operation's return value.
174174
// maxAgeSeconds overrides the entity's default TTL when provided.
175-
export type CachePopulateConfig = {
175+
export type CachePopulateConfiguration = {
176176
entityTypeName: TypeName;
177177
fieldName: FieldName;
178-
maxAgeSeconds?: number;
179-
operationType: string;
178+
maxAgeSeconds: number;
179+
operationType: OperationTypeNode;
180180
};
181181

182182
export type EntityCachingConfiguration = {
183183
// Attached to the Mutation/Subscription type's ConfigurationData from @openfed__cacheInvalidate.
184184
cacheInvalidateConfigurations: Array<CacheInvalidateConfiguration>;
185+
// Attached to the Mutation/Subscription type's ConfigurationData from @openfed__cachePopulate.
186+
cachePopulateConfigurations: Array<CachePopulateConfiguration>;
185187
// Attached to an entity type's ConfigurationData (e.g. "Product") from @openfed__entityCache.
186188
entityCacheConfigurations: Array<EntityCacheConfiguration>;
187-
// Attached to the Mutation/Subscription type's ConfigurationData from @openfed__cachePopulate.
188-
cachePopulateConfigurations: Array<CachePopulateConfig>;
189+
// Attached to a field's ConfigurationData from @openfed__requestScoped.
189190
requestScopedConfigurations: Array<RequestScopedConfiguration>;
190191
// Attached to the Query type's ConfigurationData from @openfed__queryCache.
191192
queryCacheConfigurations?: Array<QueryCacheConfig>;

composition/src/router-configuration/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ export function getOrInitializeEntityCaching(configurationData: ConfigurationDat
2020
if (!configurationData.entityCaching) {
2121
configurationData.entityCaching = {
2222
cacheInvalidateConfigurations: [],
23-
entityCacheConfigurations: [],
2423
cachePopulateConfigurations: [],
24+
entityCacheConfigurations: [],
2525
requestScopedConfigurations: [],
2626
};
2727
}
28+
2829
return configurationData.entityCaching;
2930
}
3031

0 commit comments

Comments
 (0)