@@ -216,7 +216,6 @@ import {
216216 type EntityKeyMappingConfig ,
217217 type FieldMappingConfig ,
218218 type QueryCacheConfig ,
219- type RequestScopedConfiguration ,
220219} from '../../router-configuration/types' ;
221220import { printTypeNode } from '@graphql-tools/merge' ;
222221import {
@@ -227,7 +226,6 @@ import {
227226 fieldAlreadyProvidedWarning ,
228227 invalidExternalFieldWarning ,
229228 nonExternalConditionalFieldWarning ,
230- requestScopedSingleFieldWarning ,
231229 singleSubgraphInputFieldOneOfWarning ,
232230 unimplementedInterfaceOutputTypeWarning ,
233231 queryCacheReturnEntityMissingEntityCacheWarning ,
@@ -387,7 +385,6 @@ import {
387385 LITERAL_OPEN_BRACE ,
388386 LITERAL_SPACE ,
389387 OPENFED_QUERY_CACHE ,
390- OPENFED_REQUEST_SCOPED ,
391388} from '../../utils/string-constants' ;
392389import { MAX_INT32 } from '../../utils/integer-constants' ;
393390import {
@@ -421,7 +418,6 @@ import {
421418 type UpsertInputObjectResult ,
422419 type ValidateDirectiveParams ,
423420 type QueryCacheDirectiveNode ,
424- type RequestScopedDirectiveNode ,
425421} from './types/types' ;
426422import {
427423 getOrInitializeEntityCaching ,
@@ -540,7 +536,6 @@ export class NormalizationFactory {
540536 referencedDirectiveNames = new Set < DirectiveName > ( ) ;
541537 referencedTypeNames = new Set < TypeName > ( ) ;
542538 renamedParentTypeName = '' ;
543- requestScopedFieldCoordsByL1Key = new Map < string , Array < string > > ( ) ;
544539 schemaData : SchemaData ;
545540 subgraphName : SubgraphName ;
546541 unvalidatedExternalFieldCoords = new Set < string > ( ) ;
@@ -4071,7 +4066,7 @@ export class NormalizationFactory {
40714066
40724067 /* validateDirectives() (run earlier in normalize()) has already guaranteed each argument's type —
40734068 * Int for maxAge/negativeCacheTTL, Boolean for the flags — so the generic ConstDirectiveNode is
4074- * narrowed once to the precise typed node, mirroring RequestScopedDirectiveNode/ ComposeDirectiveNode.
4069+ * narrowed once to the precise typed node, mirroring ComposeDirectiveNode.
40754070 * Optional arguments may be absent (definition defaults are not materialized onto the usage AST),
40764071 * so the config starts at the directive's documented defaults and each present argument overrides it.
40774072 */
@@ -4314,7 +4309,7 @@ export class NormalizationFactory {
43144309 }
43154310 // validateDirectives() has already guaranteed the argument types (Int maxAge, Boolean flags), so the
43164311 // generic ConstDirectiveNode is narrowed once to the precise typed node — mirroring
4317- // EntityCacheDirectiveNode/RequestScopedDirectiveNode . Optional args may be absent (definition defaults
4312+ // EntityCacheDirectiveNode. Optional args may be absent (definition defaults
43184313 // are not materialized onto the usage AST), so each defaults here and present args override.
43194314 const queryCacheDirective = fieldData . directivesByName . get ( OPENFED_QUERY_CACHE ) ! [ 0 ] as QueryCacheDirectiveNode ;
43204315 let maxAgeSeconds = 0 ;
@@ -5204,38 +5199,6 @@ export class NormalizationFactory {
52045199 return [ ] ;
52055200 }
52065201
5207- // Attaches a single field annotated with @openfed__requestScoped to its type's configurationData. A field
5208- // is both a reader and writer of the coordinate L1 — no receiver/provider. Fields with the same `key` share
5209- // the same L1 entry: whichever is resolved first populates it, subsequent ones inject from it.
5210- extractRequestScopedConfig ( fieldData : FieldData ) {
5211- const directives = fieldData . directivesByName . get ( OPENFED_REQUEST_SCOPED ) ;
5212- if ( ! directives ) {
5213- return ;
5214- }
5215- // validateDirectives() (run earlier in normalize()) has already guaranteed a single, non-repeated
5216- // @openfed__requestScoped with a required String `key`, so the generic ConstDirectiveNode can be
5217- // narrowed to the precise typed node — mirroring handleComposeDirective()/ComposeDirectiveNode.
5218- const directive = directives [ 0 ] as RequestScopedDirectiveNode ;
5219- const keyArg = directive . arguments . find ( ( arg ) => arg . name . value === KEY ) ;
5220- if ( ! keyArg ) {
5221- return ;
5222- }
5223-
5224- const config : RequestScopedConfiguration = {
5225- fieldName : fieldData . name ,
5226- typeName : fieldData . renamedParentTypeName ,
5227- l1Key : `${ this . subgraphName } .${ keyArg . value . value } ` ,
5228- } ;
5229- const configurationData = getValueOrDefault ( this . configurationDataByTypeName , fieldData . renamedParentTypeName , ( ) =>
5230- newConfigurationData ( false , fieldData . renamedParentTypeName ) ,
5231- ) ;
5232- getOrInitializeEntityCaching ( configurationData ) . requestScopedConfigurations . push ( config ) ;
5233- // Track field coords per L1 key so the single-field warning can be emitted after the walk completes.
5234- getValueOrDefault ( this . requestScopedFieldCoordsByL1Key , config . l1Key , ( ) => [ ] ) . push (
5235- `${ config . typeName } .${ config . fieldName } ` ,
5236- ) ;
5237- }
5238-
52395202 addFieldNamesToConfigurationData ( fieldDataByFieldName : Map < string , FieldData > , configurationData : ConfigurationData ) {
52405203 const externalFieldNames = new Set < string > ( ) ;
52415204 for ( const [ fieldName , fieldData ] of fieldDataByFieldName ) {
@@ -5426,7 +5389,6 @@ export class NormalizationFactory {
54265389 for ( const [ fieldName , fieldData ] of parentData . fieldDataByName ) {
54275390 if ( isObject ) {
54285391 this . handleFieldCacheDirectives ( fieldData ) ;
5429- this . extractRequestScopedConfig ( fieldData ) ;
54305392
54315393 // @openfed__queryCache extraction and @openfed__is placement validation. Key field sets and
54325394 // entity-cache configs are already finalized at this point in normalize() (populated by
@@ -5540,21 +5502,6 @@ export class NormalizationFactory {
55405502 }
55415503 }
55425504 }
5543- // @openfed__requestScoped is meaningless unless >= 2 fields share a key (there'd be no second reader to
5544- // benefit), so warn for any key used on only one field across the subgraph. extractRequestScopedConfig()
5545- // populated requestScopedFieldCoordsByL1Key during the type walk above.
5546- for ( const [ l1Key , fieldCoordsList ] of this . requestScopedFieldCoordsByL1Key ) {
5547- if ( fieldCoordsList . length === 1 ) {
5548- this . warnings . push (
5549- requestScopedSingleFieldWarning ( {
5550- subgraphName : this . subgraphName ,
5551- // l1Key is `${this.subgraphName}.${key}`, so strip the prefix to recover the original key.
5552- key : l1Key . slice ( this . subgraphName . length + 1 ) ,
5553- fieldCoords : fieldCoordsList [ 0 ] ,
5554- } ) ,
5555- ) ;
5556- }
5557- }
55585505 this . isSubgraphEventDrivenGraph = this . edfsDirectiveReferences . size > 0 ;
55595506 // this is where @provides and @requires configurations are added to the ConfigurationData
55605507 this . addValidConditionalFieldSetConfigurations ( ) ;
0 commit comments