@@ -143,17 +143,29 @@ class ExternalContentImplementation extends Implementation {
143143 processors = { } ,
144144 maxSizeBytes = DEFAULT_MAX_SIZE_BYTES ,
145145 batchDelayMs,
146+ graphQLInputType,
147+ graphQLReturnType,
148+ serialize,
149+ deserialize,
150+ mimetype,
151+ fileExt,
152+ schemaDoc,
153+ graphQLAdminFragment = '' ,
146154 } = { } , meta ) {
147- super ( path , { ...arguments [ 1 ] , maxSizeBytes } , meta )
155+ // Compute processor config
156+ const byFormat = { ...DEFAULT_PROCESSORS , ...processors }
157+ const cfg = byFormat [ format ]
158+ if ( ! cfg ) {
159+ throw new Error ( `ExternalContent: unknown format "${ format } " for ${ path } ` )
160+ }
148161
149- const {
150- graphQLInputType,
151- graphQLReturnType,
152- serialize,
153- deserialize,
154- mimetype,
155- fileExt,
156- } = arguments [ 1 ]
162+ // Resolve final values using defaults from processor config
163+ const finalGraphQLInputType = graphQLInputType || cfg . graphQLInputType
164+ const finalGraphQLReturnType = graphQLReturnType || cfg . graphQLReturnType
165+ const finalSerialize = serialize || cfg . serialize
166+ const finalDeserialize = deserialize || cfg . deserialize
167+ const finalMimetype = mimetype || cfg . mimetype
168+ const finalFileExt = fileExt || cfg . fileExt
157169
158170 if ( ! adapter ) {
159171 throw new Error ( `ExternalContent: "adapter" is required for ${ path } ` )
@@ -164,29 +176,49 @@ class ExternalContentImplementation extends Implementation {
164176 throw new Error ( `ExternalContent: adapter is not properly configured for ${ path } . Check FILE_FIELD_ADAPTER and storage configuration.` )
165177 }
166178
167- const byFormat = { ...DEFAULT_PROCESSORS , ...processors }
168- const cfg = byFormat [ format ]
169- if ( ! cfg ) {
170- throw new Error ( `ExternalContent: unknown format "${ format } " for ${ path } ` )
171- }
179+ // Pass resolved values to parent class (don't spread arguments[1] to avoid passing undefined graphQLReturnType)
180+ super ( path , {
181+ adapter,
182+ format,
183+ processors,
184+ maxSizeBytes,
185+ batchDelayMs,
186+ graphQLInputType : finalGraphQLInputType ,
187+ graphQLReturnType : finalGraphQLReturnType ,
188+ serialize : finalSerialize ,
189+ deserialize : finalDeserialize ,
190+ mimetype : finalMimetype ,
191+ fileExt : finalFileExt ,
192+ schemaDoc,
193+ graphQLAdminFragment,
194+ } , meta )
172195
173196 this . adapter = adapter
174197 this . format = format
175198 this . maxSizeBytes = maxSizeBytes
176199 this . batchDelayMs = batchDelayMs
177- this . serialize = serialize || cfg . serialize
178- this . deserialize = deserialize || cfg . deserialize
179- this . graphQLInputType = graphQLInputType || cfg . graphQLInputType
180- this . graphQLReturnType = graphQLReturnType || cfg . graphQLReturnType
181- this . mimetype = mimetype || cfg . mimetype
182- this . fileExt = fileExt || cfg . fileExt
200+ this . serialize = finalSerialize
201+ this . deserialize = finalDeserialize
202+ this . graphQLInputType = finalGraphQLInputType
203+ this . graphQLReturnType = finalGraphQLReturnType
204+ this . mimetype = finalMimetype
205+ this . fileExt = finalFileExt
206+ this . graphQLAdminFragment = graphQLAdminFragment
183207 }
184208
185209 // GQL Output
186210 gqlOutputFields ( ) {
187211 return [ `${ this . path } : ${ this . graphQLReturnType } ` ]
188212 }
189213
214+ // Admin
215+ extendAdminMeta ( meta ) {
216+ return {
217+ graphQLAdminFragment : this . graphQLAdminFragment ,
218+ ...meta ,
219+ }
220+ }
221+
190222 /**
191223 * Resolves the field value for GraphQL output by reading the file content from storage.
192224 *
0 commit comments