1+ import type { GatewayExecutor } from '@apollo/server-gateway-interface' ;
12import { isNodeLike } from '@apollo/utils.isnodelike' ;
3+ import {
4+ InMemoryLRUCache ,
5+ PrefixingKeyValueCache ,
6+ type KeyValueCache ,
7+ } from '@apollo/utils.keyvaluecache' ;
28import type { Logger } from '@apollo/utils.logger' ;
9+ import type { WithRequired } from '@apollo/utils.withrequired' ;
310import { makeExecutableSchema } from '@graphql-tools/schema' ;
411import resolvable , { type Resolvable } from '@josephg/resolvable' ;
512import {
13+ GraphQLError ,
614 assertValidSchema ,
15+ print ,
16+ printSchema ,
717 type DocumentNode ,
8- GraphQLError ,
18+ type FormattedExecutionResult ,
919 type GraphQLFieldResolver ,
1020 type GraphQLFormattedError ,
1121 type GraphQLSchema ,
1222 type ParseOptions ,
13- print ,
14- printSchema ,
1523 type TypedQueryDocumentNode ,
1624 type ValidationContext ,
1725 type ValidationRule ,
18- type FormattedExecutionResult ,
1926} from 'graphql' ;
20- import {
21- type KeyValueCache ,
22- InMemoryLRUCache ,
23- PrefixingKeyValueCache ,
24- } from '@apollo/utils.keyvaluecache' ;
2527import loglevel from 'loglevel' ;
2628import Negotiator from 'negotiator' ;
2729import { newCachePolicy } from './cachePolicy.js' ;
@@ -35,45 +37,43 @@ import {
3537 ApolloServerErrorCode ,
3638 ApolloServerValidationErrorCode ,
3739} from './errors/index.js' ;
40+ import type { ApolloServerOptionsWithStaticSchema } from './externalTypes/constructor.js' ;
3841import type {
42+ ExecuteOperationOptions ,
43+ VariableValues ,
44+ } from './externalTypes/graphql.js' ;
45+ import type {
46+ ApolloConfig ,
47+ ApolloServerOptions ,
3948 ApolloServerPlugin ,
4049 BaseContext ,
50+ ContextThunk ,
51+ DocumentStore ,
4152 GraphQLRequest ,
53+ GraphQLRequestContext ,
4254 GraphQLResponse ,
43- GraphQLServerListener ,
4455 GraphQLServerContext ,
56+ GraphQLServerListener ,
57+ HTTPGraphQLHead ,
4558 HTTPGraphQLRequest ,
4659 HTTPGraphQLResponse ,
4760 LandingPage ,
48- ApolloConfig ,
49- ApolloServerOptions ,
50- DocumentStore ,
5161 PersistedQueryOptions ,
52- ContextThunk ,
53- GraphQLRequestContext ,
54- HTTPGraphQLHead ,
5562} from './externalTypes/index.js' ;
5663import { runPotentiallyBatchedHttpQuery } from './httpBatching.js' ;
57- import { type InternalPluginId , pluginIsInternal } from './internalPlugin.js' ;
64+ import type { GraphQLExperimentalIncrementalExecutionResults } from './incrementalDeliveryPolyfill.js' ;
65+ import { pluginIsInternal , type InternalPluginId } from './internalPlugin.js' ;
5866import {
5967 preventCsrf ,
6068 recommendedCsrfPreventionRequestHeaders ,
6169} from './preventCsrf.js' ;
6270import { APQ_CACHE_PREFIX , processGraphQLRequest } from './requestPipeline.js' ;
6371import { newHTTPGraphQLHead , prettyJSONStringify } from './runHttpQuery.js' ;
64- import { SchemaManager } from './utils/schemaManager.js' ;
65- import { isDefined } from './utils/isDefined.js' ;
72+ import { HeaderMap } from './utils/HeaderMap.js' ;
6673import { UnreachableCaseError } from './utils/UnreachableCaseError.js' ;
6774import { computeCoreSchemaHash } from './utils/computeCoreSchemaHash.js' ;
68- import type { WithRequired } from '@apollo/utils.withrequired' ;
69- import type { ApolloServerOptionsWithStaticSchema } from './externalTypes/constructor.js' ;
70- import type { GatewayExecutor } from '@apollo/server-gateway-interface' ;
71- import type { GraphQLExperimentalIncrementalExecutionResults } from './incrementalDeliveryPolyfill.js' ;
72- import { HeaderMap } from './utils/HeaderMap.js' ;
73- import type {
74- ExecuteOperationOptions ,
75- VariableValues ,
76- } from './externalTypes/graphql.js' ;
75+ import { isDefined } from './utils/isDefined.js' ;
76+ import { SchemaManager } from './utils/schemaManager.js' ;
7777
7878const NoIntrospection : ValidationRule = ( context : ValidationContext ) => ( {
7979 Field ( node ) {
@@ -1354,6 +1354,8 @@ export function isImplicitlyInstallablePlugin<TContext extends BaseContext>(
13541354
13551355export const MEDIA_TYPES = {
13561356 APPLICATION_JSON : 'application/json; charset=utf-8' ,
1357+ APPLICATION_JSON_GRAPHQL_CALLBACK :
1358+ 'application/json; callbackSpec=1.0; charset=utf-8' ,
13571359 APPLICATION_GRAPHQL_RESPONSE_JSON :
13581360 'application/graphql-response+json; charset=utf-8' ,
13591361 // We do *not* currently support this content-type; we will once incremental
@@ -1378,6 +1380,7 @@ export function chooseContentTypeForSingleResultResponse(
13781380 } ) . mediaType ( [
13791381 MEDIA_TYPES . APPLICATION_JSON ,
13801382 MEDIA_TYPES . APPLICATION_GRAPHQL_RESPONSE_JSON ,
1383+ MEDIA_TYPES . APPLICATION_JSON_GRAPHQL_CALLBACK ,
13811384 ] ) ;
13821385 if ( preferred ) {
13831386 return preferred ;
0 commit comments