@depup/apollo__server 5.5.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (557) hide show
  1. package/README.md +40 -0
  2. package/changes.json +46 -0
  3. package/dist/cjs/ApolloServer.d.ts +126 -0
  4. package/dist/cjs/ApolloServer.d.ts.map +1 -0
  5. package/dist/cjs/ApolloServer.js +726 -0
  6. package/dist/cjs/ApolloServer.js.map +1 -0
  7. package/dist/cjs/cachePolicy.d.ts +3 -0
  8. package/dist/cjs/cachePolicy.d.ts.map +1 -0
  9. package/dist/cjs/cachePolicy.js +33 -0
  10. package/dist/cjs/cachePolicy.js.map +1 -0
  11. package/dist/cjs/determineApolloConfig.d.ts +4 -0
  12. package/dist/cjs/determineApolloConfig.d.ts.map +1 -0
  13. package/dist/cjs/determineApolloConfig.js +58 -0
  14. package/dist/cjs/determineApolloConfig.js.map +1 -0
  15. package/dist/cjs/errorNormalize.d.ts +12 -0
  16. package/dist/cjs/errorNormalize.d.ts.map +1 -0
  17. package/dist/cjs/errorNormalize.js +71 -0
  18. package/dist/cjs/errorNormalize.js.map +1 -0
  19. package/dist/cjs/errors/index.d.ts +16 -0
  20. package/dist/cjs/errors/index.d.ts.map +1 -0
  21. package/dist/cjs/errors/index.js +28 -0
  22. package/dist/cjs/errors/index.js.map +1 -0
  23. package/dist/cjs/externalTypes/constructor.d.ts +78 -0
  24. package/dist/cjs/externalTypes/constructor.d.ts.map +1 -0
  25. package/dist/cjs/externalTypes/constructor.js +3 -0
  26. package/dist/cjs/externalTypes/constructor.js.map +1 -0
  27. package/dist/cjs/externalTypes/context.d.ts +4 -0
  28. package/dist/cjs/externalTypes/context.d.ts.map +1 -0
  29. package/dist/cjs/externalTypes/context.js +3 -0
  30. package/dist/cjs/externalTypes/context.js.map +1 -0
  31. package/dist/cjs/externalTypes/graphql.d.ts +41 -0
  32. package/dist/cjs/externalTypes/graphql.d.ts.map +1 -0
  33. package/dist/cjs/externalTypes/graphql.js +3 -0
  34. package/dist/cjs/externalTypes/graphql.js.map +1 -0
  35. package/dist/cjs/externalTypes/http.d.ts +22 -0
  36. package/dist/cjs/externalTypes/http.d.ts.map +1 -0
  37. package/dist/cjs/externalTypes/http.js +3 -0
  38. package/dist/cjs/externalTypes/http.js.map +1 -0
  39. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts +28 -0
  40. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts.map +1 -0
  41. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.js +3 -0
  42. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.js.map +1 -0
  43. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts +43 -0
  44. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts.map +1 -0
  45. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.js +3 -0
  46. package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.js.map +1 -0
  47. package/dist/cjs/externalTypes/index.d.ts +9 -0
  48. package/dist/cjs/externalTypes/index.d.ts.map +1 -0
  49. package/dist/cjs/externalTypes/index.js +3 -0
  50. package/dist/cjs/externalTypes/index.js.map +1 -0
  51. package/dist/cjs/externalTypes/plugins.d.ts +75 -0
  52. package/dist/cjs/externalTypes/plugins.d.ts.map +1 -0
  53. package/dist/cjs/externalTypes/plugins.js +3 -0
  54. package/dist/cjs/externalTypes/plugins.js.map +1 -0
  55. package/dist/cjs/externalTypes/requestPipeline.d.ts +50 -0
  56. package/dist/cjs/externalTypes/requestPipeline.d.ts.map +1 -0
  57. package/dist/cjs/externalTypes/requestPipeline.js +3 -0
  58. package/dist/cjs/externalTypes/requestPipeline.js.map +1 -0
  59. package/dist/cjs/generated/packageVersion.d.ts +2 -0
  60. package/dist/cjs/generated/packageVersion.d.ts.map +1 -0
  61. package/dist/cjs/generated/packageVersion.js +5 -0
  62. package/dist/cjs/generated/packageVersion.js.map +1 -0
  63. package/dist/cjs/httpBatching.d.ts +4 -0
  64. package/dist/cjs/httpBatching.d.ts.map +1 -0
  65. package/dist/cjs/httpBatching.js +58 -0
  66. package/dist/cjs/httpBatching.js.map +1 -0
  67. package/dist/cjs/incrementalDeliveryPolyfill.d.ts +82 -0
  68. package/dist/cjs/incrementalDeliveryPolyfill.d.ts.map +1 -0
  69. package/dist/cjs/incrementalDeliveryPolyfill.js +74 -0
  70. package/dist/cjs/incrementalDeliveryPolyfill.js.map +1 -0
  71. package/dist/cjs/index.d.ts +4 -0
  72. package/dist/cjs/index.d.ts.map +1 -0
  73. package/dist/cjs/index.js +23 -0
  74. package/dist/cjs/index.js.map +1 -0
  75. package/dist/cjs/internalErrorClasses.d.ts +28 -0
  76. package/dist/cjs/internalErrorClasses.d.ts.map +1 -0
  77. package/dist/cjs/internalErrorClasses.js +91 -0
  78. package/dist/cjs/internalErrorClasses.js.map +1 -0
  79. package/dist/cjs/internalPlugin.d.ts +9 -0
  80. package/dist/cjs/internalPlugin.d.ts.map +1 -0
  81. package/dist/cjs/internalPlugin.js +11 -0
  82. package/dist/cjs/internalPlugin.js.map +1 -0
  83. package/dist/cjs/package.json +1 -0
  84. package/dist/cjs/plugin/cacheControl/index.d.ts +9 -0
  85. package/dist/cjs/plugin/cacheControl/index.d.ts.map +1 -0
  86. package/dist/cjs/plugin/cacheControl/index.js +223 -0
  87. package/dist/cjs/plugin/cacheControl/index.js.map +1 -0
  88. package/dist/cjs/plugin/disableSuggestions/index.d.ts +3 -0
  89. package/dist/cjs/plugin/disableSuggestions/index.d.ts.map +1 -0
  90. package/dist/cjs/plugin/disableSuggestions/index.js +22 -0
  91. package/dist/cjs/plugin/disableSuggestions/index.js.map +1 -0
  92. package/dist/cjs/plugin/disabled/index.d.ts +7 -0
  93. package/dist/cjs/plugin/disabled/index.d.ts.map +1 -0
  94. package/dist/cjs/plugin/disabled/index.js +30 -0
  95. package/dist/cjs/plugin/disabled/index.js.map +1 -0
  96. package/dist/cjs/plugin/drainHttpServer/index.d.ts +8 -0
  97. package/dist/cjs/plugin/drainHttpServer/index.d.ts.map +1 -0
  98. package/dist/cjs/plugin/drainHttpServer/index.js +19 -0
  99. package/dist/cjs/plugin/drainHttpServer/index.js.map +1 -0
  100. package/dist/cjs/plugin/drainHttpServer/stoppable.d.ts +10 -0
  101. package/dist/cjs/plugin/drainHttpServer/stoppable.d.ts.map +1 -0
  102. package/dist/cjs/plugin/drainHttpServer/stoppable.js +54 -0
  103. package/dist/cjs/plugin/drainHttpServer/stoppable.js.map +1 -0
  104. package/dist/cjs/plugin/inlineTrace/index.d.ts +8 -0
  105. package/dist/cjs/plugin/inlineTrace/index.d.ts.map +1 -0
  106. package/dist/cjs/plugin/inlineTrace/index.js +70 -0
  107. package/dist/cjs/plugin/inlineTrace/index.js.map +1 -0
  108. package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.d.ts +4 -0
  109. package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.d.ts.map +1 -0
  110. package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.js +143 -0
  111. package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.js.map +1 -0
  112. package/dist/cjs/plugin/landingPage/default/index.d.ts +9 -0
  113. package/dist/cjs/plugin/landingPage/default/index.d.ts.map +1 -0
  114. package/dist/cjs/plugin/landingPage/default/index.js +146 -0
  115. package/dist/cjs/plugin/landingPage/default/index.js.map +1 -0
  116. package/dist/cjs/plugin/landingPage/default/types.d.ts +56 -0
  117. package/dist/cjs/plugin/landingPage/default/types.d.ts.map +1 -0
  118. package/dist/cjs/plugin/landingPage/default/types.js +3 -0
  119. package/dist/cjs/plugin/landingPage/default/types.js.map +1 -0
  120. package/dist/cjs/plugin/schemaIsSubgraph.d.ts +3 -0
  121. package/dist/cjs/plugin/schemaIsSubgraph.d.ts.map +1 -0
  122. package/dist/cjs/plugin/schemaIsSubgraph.js +23 -0
  123. package/dist/cjs/plugin/schemaIsSubgraph.js.map +1 -0
  124. package/dist/cjs/plugin/schemaReporting/index.d.ts +10 -0
  125. package/dist/cjs/plugin/schemaReporting/index.d.ts.map +1 -0
  126. package/dist/cjs/plugin/schemaReporting/index.js +104 -0
  127. package/dist/cjs/plugin/schemaReporting/index.js.map +1 -0
  128. package/dist/cjs/plugin/schemaReporting/schemaReporter.d.ts +33 -0
  129. package/dist/cjs/plugin/schemaReporting/schemaReporter.d.ts.map +1 -0
  130. package/dist/cjs/plugin/schemaReporting/schemaReporter.js +147 -0
  131. package/dist/cjs/plugin/schemaReporting/schemaReporter.js.map +1 -0
  132. package/dist/cjs/plugin/subscriptionCallback/index.d.ts +12 -0
  133. package/dist/cjs/plugin/subscriptionCallback/index.d.ts.map +1 -0
  134. package/dist/cjs/plugin/subscriptionCallback/index.js +434 -0
  135. package/dist/cjs/plugin/subscriptionCallback/index.js.map +1 -0
  136. package/dist/cjs/plugin/traceTreeBuilder.d.ts +25 -0
  137. package/dist/cjs/plugin/traceTreeBuilder.d.ts.map +1 -0
  138. package/dist/cjs/plugin/traceTreeBuilder.js +201 -0
  139. package/dist/cjs/plugin/traceTreeBuilder.js.map +1 -0
  140. package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts +3 -0
  141. package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map +1 -0
  142. package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.js +44 -0
  143. package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.js.map +1 -0
  144. package/dist/cjs/plugin/usageReporting/durationHistogram.d.ts +16 -0
  145. package/dist/cjs/plugin/usageReporting/durationHistogram.d.ts.map +1 -0
  146. package/dist/cjs/plugin/usageReporting/durationHistogram.js +68 -0
  147. package/dist/cjs/plugin/usageReporting/durationHistogram.js.map +1 -0
  148. package/dist/cjs/plugin/usageReporting/index.d.ts +3 -0
  149. package/dist/cjs/plugin/usageReporting/index.d.ts.map +1 -0
  150. package/dist/cjs/plugin/usageReporting/index.js +6 -0
  151. package/dist/cjs/plugin/usageReporting/index.js.map +1 -0
  152. package/dist/cjs/plugin/usageReporting/iterateOverTrace.d.ts +7 -0
  153. package/dist/cjs/plugin/usageReporting/iterateOverTrace.d.ts.map +1 -0
  154. package/dist/cjs/plugin/usageReporting/iterateOverTrace.js +81 -0
  155. package/dist/cjs/plugin/usageReporting/iterateOverTrace.js.map +1 -0
  156. package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.d.ts +12 -0
  157. package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.d.ts.map +1 -0
  158. package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.js +33 -0
  159. package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.js.map +1 -0
  160. package/dist/cjs/plugin/usageReporting/options.d.ts +60 -0
  161. package/dist/cjs/plugin/usageReporting/options.d.ts.map +1 -0
  162. package/dist/cjs/plugin/usageReporting/options.js +3 -0
  163. package/dist/cjs/plugin/usageReporting/options.js.map +1 -0
  164. package/dist/cjs/plugin/usageReporting/plugin.d.ts +7 -0
  165. package/dist/cjs/plugin/usageReporting/plugin.d.ts.map +1 -0
  166. package/dist/cjs/plugin/usageReporting/plugin.js +494 -0
  167. package/dist/cjs/plugin/usageReporting/plugin.js.map +1 -0
  168. package/dist/cjs/plugin/usageReporting/stats.d.ts +96 -0
  169. package/dist/cjs/plugin/usageReporting/stats.d.ts.map +1 -0
  170. package/dist/cjs/plugin/usageReporting/stats.js +289 -0
  171. package/dist/cjs/plugin/usageReporting/stats.js.map +1 -0
  172. package/dist/cjs/plugin/usageReporting/traceDetails.d.ts +4 -0
  173. package/dist/cjs/plugin/usageReporting/traceDetails.d.ts.map +1 -0
  174. package/dist/cjs/plugin/usageReporting/traceDetails.js +63 -0
  175. package/dist/cjs/plugin/usageReporting/traceDetails.js.map +1 -0
  176. package/dist/cjs/preventCsrf.d.ts +4 -0
  177. package/dist/cjs/preventCsrf.d.ts.map +1 -0
  178. package/dist/cjs/preventCsrf.js +41 -0
  179. package/dist/cjs/preventCsrf.js.map +1 -0
  180. package/dist/cjs/requestPipeline.d.ts +9 -0
  181. package/dist/cjs/requestPipeline.d.ts.map +1 -0
  182. package/dist/cjs/requestPipeline.js +371 -0
  183. package/dist/cjs/requestPipeline.js.map +1 -0
  184. package/dist/cjs/runHttpQuery.d.ts +15 -0
  185. package/dist/cjs/runHttpQuery.d.ts.map +1 -0
  186. package/dist/cjs/runHttpQuery.js +230 -0
  187. package/dist/cjs/runHttpQuery.js.map +1 -0
  188. package/dist/cjs/standalone/index.d.ts +25 -0
  189. package/dist/cjs/standalone/index.d.ts.map +1 -0
  190. package/dist/cjs/standalone/index.js +97 -0
  191. package/dist/cjs/standalone/index.js.map +1 -0
  192. package/dist/cjs/utils/HeaderMap.d.ts +8 -0
  193. package/dist/cjs/utils/HeaderMap.d.ts.map +1 -0
  194. package/dist/cjs/utils/HeaderMap.js +20 -0
  195. package/dist/cjs/utils/HeaderMap.js.map +1 -0
  196. package/dist/cjs/utils/UnreachableCaseError.d.ts +4 -0
  197. package/dist/cjs/utils/UnreachableCaseError.d.ts.map +1 -0
  198. package/dist/cjs/utils/UnreachableCaseError.js +10 -0
  199. package/dist/cjs/utils/UnreachableCaseError.js.map +1 -0
  200. package/dist/cjs/utils/computeCoreSchemaHash.d.ts +2 -0
  201. package/dist/cjs/utils/computeCoreSchemaHash.d.ts.map +1 -0
  202. package/dist/cjs/utils/computeCoreSchemaHash.js +8 -0
  203. package/dist/cjs/utils/computeCoreSchemaHash.js.map +1 -0
  204. package/dist/cjs/utils/invokeHooks.d.ts +7 -0
  205. package/dist/cjs/utils/invokeHooks.d.ts.map +1 -0
  206. package/dist/cjs/utils/invokeHooks.js +36 -0
  207. package/dist/cjs/utils/invokeHooks.js.map +1 -0
  208. package/dist/cjs/utils/isDefined.d.ts +2 -0
  209. package/dist/cjs/utils/isDefined.d.ts.map +1 -0
  210. package/dist/cjs/utils/isDefined.js +7 -0
  211. package/dist/cjs/utils/isDefined.js.map +1 -0
  212. package/dist/cjs/utils/makeGatewayGraphQLRequestContext.d.ts +5 -0
  213. package/dist/cjs/utils/makeGatewayGraphQLRequestContext.d.ts.map +1 -0
  214. package/dist/cjs/utils/makeGatewayGraphQLRequestContext.js +96 -0
  215. package/dist/cjs/utils/makeGatewayGraphQLRequestContext.js.map +1 -0
  216. package/dist/cjs/utils/resolvable.d.ts +7 -0
  217. package/dist/cjs/utils/resolvable.d.ts.map +1 -0
  218. package/dist/cjs/utils/resolvable.js +14 -0
  219. package/dist/cjs/utils/resolvable.js.map +1 -0
  220. package/dist/cjs/utils/schemaInstrumentation.d.ts +16 -0
  221. package/dist/cjs/utils/schemaInstrumentation.d.ts.map +1 -0
  222. package/dist/cjs/utils/schemaInstrumentation.js +75 -0
  223. package/dist/cjs/utils/schemaInstrumentation.js.map +1 -0
  224. package/dist/cjs/utils/schemaManager.d.ts +31 -0
  225. package/dist/cjs/utils/schemaManager.d.ts.map +1 -0
  226. package/dist/cjs/utils/schemaManager.js +103 -0
  227. package/dist/cjs/utils/schemaManager.js.map +1 -0
  228. package/dist/cjs/utils/urlForHttpServer.d.ts +3 -0
  229. package/dist/cjs/utils/urlForHttpServer.d.ts.map +1 -0
  230. package/dist/cjs/utils/urlForHttpServer.js +15 -0
  231. package/dist/cjs/utils/urlForHttpServer.js.map +1 -0
  232. package/dist/cjs/validationRules/NoIntrospection.d.ts +3 -0
  233. package/dist/cjs/validationRules/NoIntrospection.d.ts.map +1 -0
  234. package/dist/cjs/validationRules/NoIntrospection.js +19 -0
  235. package/dist/cjs/validationRules/NoIntrospection.js.map +1 -0
  236. package/dist/cjs/validationRules/RecursiveSelectionsLimit.d.ts +4 -0
  237. package/dist/cjs/validationRules/RecursiveSelectionsLimit.d.ts.map +1 -0
  238. package/dist/cjs/validationRules/RecursiveSelectionsLimit.js +150 -0
  239. package/dist/cjs/validationRules/RecursiveSelectionsLimit.js.map +1 -0
  240. package/dist/cjs/validationRules/index.d.ts +3 -0
  241. package/dist/cjs/validationRules/index.d.ts.map +1 -0
  242. package/dist/cjs/validationRules/index.js +9 -0
  243. package/dist/cjs/validationRules/index.js.map +1 -0
  244. package/dist/esm/ApolloServer.d.ts +126 -0
  245. package/dist/esm/ApolloServer.d.ts.map +1 -0
  246. package/dist/esm/ApolloServer.js +683 -0
  247. package/dist/esm/ApolloServer.js.map +1 -0
  248. package/dist/esm/cachePolicy.d.ts +3 -0
  249. package/dist/esm/cachePolicy.d.ts.map +1 -0
  250. package/dist/esm/cachePolicy.js +30 -0
  251. package/dist/esm/cachePolicy.js.map +1 -0
  252. package/dist/esm/determineApolloConfig.d.ts +4 -0
  253. package/dist/esm/determineApolloConfig.d.ts.map +1 -0
  254. package/dist/esm/determineApolloConfig.js +55 -0
  255. package/dist/esm/determineApolloConfig.js.map +1 -0
  256. package/dist/esm/errorNormalize.d.ts +12 -0
  257. package/dist/esm/errorNormalize.d.ts.map +1 -0
  258. package/dist/esm/errorNormalize.js +66 -0
  259. package/dist/esm/errorNormalize.js.map +1 -0
  260. package/dist/esm/errors/index.d.ts +16 -0
  261. package/dist/esm/errors/index.d.ts.map +1 -0
  262. package/dist/esm/errors/index.js +24 -0
  263. package/dist/esm/errors/index.js.map +1 -0
  264. package/dist/esm/externalTypes/constructor.d.ts +78 -0
  265. package/dist/esm/externalTypes/constructor.d.ts.map +1 -0
  266. package/dist/esm/externalTypes/constructor.js +2 -0
  267. package/dist/esm/externalTypes/constructor.js.map +1 -0
  268. package/dist/esm/externalTypes/context.d.ts +4 -0
  269. package/dist/esm/externalTypes/context.d.ts.map +1 -0
  270. package/dist/esm/externalTypes/context.js +2 -0
  271. package/dist/esm/externalTypes/context.js.map +1 -0
  272. package/dist/esm/externalTypes/graphql.d.ts +41 -0
  273. package/dist/esm/externalTypes/graphql.d.ts.map +1 -0
  274. package/dist/esm/externalTypes/graphql.js +2 -0
  275. package/dist/esm/externalTypes/graphql.js.map +1 -0
  276. package/dist/esm/externalTypes/http.d.ts +22 -0
  277. package/dist/esm/externalTypes/http.d.ts.map +1 -0
  278. package/dist/esm/externalTypes/http.js +2 -0
  279. package/dist/esm/externalTypes/http.js.map +1 -0
  280. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts +28 -0
  281. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts.map +1 -0
  282. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.js +2 -0
  283. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.js.map +1 -0
  284. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts +43 -0
  285. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts.map +1 -0
  286. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.js +2 -0
  287. package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.js.map +1 -0
  288. package/dist/esm/externalTypes/index.d.ts +9 -0
  289. package/dist/esm/externalTypes/index.d.ts.map +1 -0
  290. package/dist/esm/externalTypes/index.js +2 -0
  291. package/dist/esm/externalTypes/index.js.map +1 -0
  292. package/dist/esm/externalTypes/plugins.d.ts +75 -0
  293. package/dist/esm/externalTypes/plugins.d.ts.map +1 -0
  294. package/dist/esm/externalTypes/plugins.js +2 -0
  295. package/dist/esm/externalTypes/plugins.js.map +1 -0
  296. package/dist/esm/externalTypes/requestPipeline.d.ts +50 -0
  297. package/dist/esm/externalTypes/requestPipeline.d.ts.map +1 -0
  298. package/dist/esm/externalTypes/requestPipeline.js +2 -0
  299. package/dist/esm/externalTypes/requestPipeline.js.map +1 -0
  300. package/dist/esm/generated/packageVersion.d.ts +2 -0
  301. package/dist/esm/generated/packageVersion.d.ts.map +1 -0
  302. package/dist/esm/generated/packageVersion.js +2 -0
  303. package/dist/esm/generated/packageVersion.js.map +1 -0
  304. package/dist/esm/httpBatching.d.ts +4 -0
  305. package/dist/esm/httpBatching.d.ts.map +1 -0
  306. package/dist/esm/httpBatching.js +55 -0
  307. package/dist/esm/httpBatching.js.map +1 -0
  308. package/dist/esm/incrementalDeliveryPolyfill.d.ts +82 -0
  309. package/dist/esm/incrementalDeliveryPolyfill.d.ts.map +1 -0
  310. package/dist/esm/incrementalDeliveryPolyfill.js +38 -0
  311. package/dist/esm/incrementalDeliveryPolyfill.js.map +1 -0
  312. package/dist/esm/index.d.ts +4 -0
  313. package/dist/esm/index.d.ts.map +1 -0
  314. package/dist/esm/index.js +4 -0
  315. package/dist/esm/index.js.map +1 -0
  316. package/dist/esm/internalErrorClasses.d.ts +28 -0
  317. package/dist/esm/internalErrorClasses.d.ts.map +1 -0
  318. package/dist/esm/internalErrorClasses.js +81 -0
  319. package/dist/esm/internalErrorClasses.js.map +1 -0
  320. package/dist/esm/internalPlugin.d.ts +9 -0
  321. package/dist/esm/internalPlugin.d.ts.map +1 -0
  322. package/dist/esm/internalPlugin.js +7 -0
  323. package/dist/esm/internalPlugin.js.map +1 -0
  324. package/dist/esm/package.json +1 -0
  325. package/dist/esm/plugin/cacheControl/index.d.ts +9 -0
  326. package/dist/esm/plugin/cacheControl/index.d.ts.map +1 -0
  327. package/dist/esm/plugin/cacheControl/index.js +220 -0
  328. package/dist/esm/plugin/cacheControl/index.js.map +1 -0
  329. package/dist/esm/plugin/disableSuggestions/index.d.ts +3 -0
  330. package/dist/esm/plugin/disableSuggestions/index.d.ts.map +1 -0
  331. package/dist/esm/plugin/disableSuggestions/index.js +19 -0
  332. package/dist/esm/plugin/disableSuggestions/index.js.map +1 -0
  333. package/dist/esm/plugin/disabled/index.d.ts +7 -0
  334. package/dist/esm/plugin/disabled/index.d.ts.map +1 -0
  335. package/dist/esm/plugin/disabled/index.js +23 -0
  336. package/dist/esm/plugin/disabled/index.js.map +1 -0
  337. package/dist/esm/plugin/drainHttpServer/index.d.ts +8 -0
  338. package/dist/esm/plugin/drainHttpServer/index.d.ts.map +1 -0
  339. package/dist/esm/plugin/drainHttpServer/index.js +16 -0
  340. package/dist/esm/plugin/drainHttpServer/index.js.map +1 -0
  341. package/dist/esm/plugin/drainHttpServer/stoppable.d.ts +10 -0
  342. package/dist/esm/plugin/drainHttpServer/stoppable.d.ts.map +1 -0
  343. package/dist/esm/plugin/drainHttpServer/stoppable.js +47 -0
  344. package/dist/esm/plugin/drainHttpServer/stoppable.js.map +1 -0
  345. package/dist/esm/plugin/inlineTrace/index.d.ts +8 -0
  346. package/dist/esm/plugin/inlineTrace/index.d.ts.map +1 -0
  347. package/dist/esm/plugin/inlineTrace/index.js +67 -0
  348. package/dist/esm/plugin/inlineTrace/index.js.map +1 -0
  349. package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.d.ts +4 -0
  350. package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.d.ts.map +1 -0
  351. package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.js +138 -0
  352. package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.js.map +1 -0
  353. package/dist/esm/plugin/landingPage/default/index.d.ts +9 -0
  354. package/dist/esm/plugin/landingPage/default/index.d.ts.map +1 -0
  355. package/dist/esm/plugin/landingPage/default/index.js +141 -0
  356. package/dist/esm/plugin/landingPage/default/index.js.map +1 -0
  357. package/dist/esm/plugin/landingPage/default/types.d.ts +56 -0
  358. package/dist/esm/plugin/landingPage/default/types.d.ts.map +1 -0
  359. package/dist/esm/plugin/landingPage/default/types.js +2 -0
  360. package/dist/esm/plugin/landingPage/default/types.js.map +1 -0
  361. package/dist/esm/plugin/schemaIsSubgraph.d.ts +3 -0
  362. package/dist/esm/plugin/schemaIsSubgraph.d.ts.map +1 -0
  363. package/dist/esm/plugin/schemaIsSubgraph.js +20 -0
  364. package/dist/esm/plugin/schemaIsSubgraph.js.map +1 -0
  365. package/dist/esm/plugin/schemaReporting/index.d.ts +10 -0
  366. package/dist/esm/plugin/schemaReporting/index.d.ts.map +1 -0
  367. package/dist/esm/plugin/schemaReporting/index.js +98 -0
  368. package/dist/esm/plugin/schemaReporting/index.js.map +1 -0
  369. package/dist/esm/plugin/schemaReporting/schemaReporter.d.ts +33 -0
  370. package/dist/esm/plugin/schemaReporting/schemaReporter.d.ts.map +1 -0
  371. package/dist/esm/plugin/schemaReporting/schemaReporter.js +143 -0
  372. package/dist/esm/plugin/schemaReporting/schemaReporter.js.map +1 -0
  373. package/dist/esm/plugin/subscriptionCallback/index.d.ts +12 -0
  374. package/dist/esm/plugin/subscriptionCallback/index.d.ts.map +1 -0
  375. package/dist/esm/plugin/subscriptionCallback/index.js +428 -0
  376. package/dist/esm/plugin/subscriptionCallback/index.js.map +1 -0
  377. package/dist/esm/plugin/traceTreeBuilder.d.ts +25 -0
  378. package/dist/esm/plugin/traceTreeBuilder.d.ts.map +1 -0
  379. package/dist/esm/plugin/traceTreeBuilder.js +196 -0
  380. package/dist/esm/plugin/traceTreeBuilder.js.map +1 -0
  381. package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts +3 -0
  382. package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map +1 -0
  383. package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.js +41 -0
  384. package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.js.map +1 -0
  385. package/dist/esm/plugin/usageReporting/durationHistogram.d.ts +16 -0
  386. package/dist/esm/plugin/usageReporting/durationHistogram.d.ts.map +1 -0
  387. package/dist/esm/plugin/usageReporting/durationHistogram.js +64 -0
  388. package/dist/esm/plugin/usageReporting/durationHistogram.js.map +1 -0
  389. package/dist/esm/plugin/usageReporting/index.d.ts +3 -0
  390. package/dist/esm/plugin/usageReporting/index.d.ts.map +1 -0
  391. package/dist/esm/plugin/usageReporting/index.js +2 -0
  392. package/dist/esm/plugin/usageReporting/index.js.map +1 -0
  393. package/dist/esm/plugin/usageReporting/iterateOverTrace.d.ts +7 -0
  394. package/dist/esm/plugin/usageReporting/iterateOverTrace.d.ts.map +1 -0
  395. package/dist/esm/plugin/usageReporting/iterateOverTrace.js +78 -0
  396. package/dist/esm/plugin/usageReporting/iterateOverTrace.js.map +1 -0
  397. package/dist/esm/plugin/usageReporting/operationDerivedDataCache.d.ts +12 -0
  398. package/dist/esm/plugin/usageReporting/operationDerivedDataCache.d.ts.map +1 -0
  399. package/dist/esm/plugin/usageReporting/operationDerivedDataCache.js +29 -0
  400. package/dist/esm/plugin/usageReporting/operationDerivedDataCache.js.map +1 -0
  401. package/dist/esm/plugin/usageReporting/options.d.ts +60 -0
  402. package/dist/esm/plugin/usageReporting/options.d.ts.map +1 -0
  403. package/dist/esm/plugin/usageReporting/options.js +2 -0
  404. package/dist/esm/plugin/usageReporting/options.js.map +1 -0
  405. package/dist/esm/plugin/usageReporting/plugin.d.ts +7 -0
  406. package/dist/esm/plugin/usageReporting/plugin.d.ts.map +1 -0
  407. package/dist/esm/plugin/usageReporting/plugin.js +487 -0
  408. package/dist/esm/plugin/usageReporting/plugin.js.map +1 -0
  409. package/dist/esm/plugin/usageReporting/stats.d.ts +96 -0
  410. package/dist/esm/plugin/usageReporting/stats.d.ts.map +1 -0
  411. package/dist/esm/plugin/usageReporting/stats.js +283 -0
  412. package/dist/esm/plugin/usageReporting/stats.js.map +1 -0
  413. package/dist/esm/plugin/usageReporting/traceDetails.d.ts +4 -0
  414. package/dist/esm/plugin/usageReporting/traceDetails.d.ts.map +1 -0
  415. package/dist/esm/plugin/usageReporting/traceDetails.js +60 -0
  416. package/dist/esm/plugin/usageReporting/traceDetails.js.map +1 -0
  417. package/dist/esm/preventCsrf.d.ts +4 -0
  418. package/dist/esm/preventCsrf.d.ts.map +1 -0
  419. package/dist/esm/preventCsrf.js +34 -0
  420. package/dist/esm/preventCsrf.js.map +1 -0
  421. package/dist/esm/requestPipeline.d.ts +9 -0
  422. package/dist/esm/requestPipeline.d.ts.map +1 -0
  423. package/dist/esm/requestPipeline.js +364 -0
  424. package/dist/esm/requestPipeline.js.map +1 -0
  425. package/dist/esm/runHttpQuery.d.ts +15 -0
  426. package/dist/esm/runHttpQuery.d.ts.map +1 -0
  427. package/dist/esm/runHttpQuery.js +221 -0
  428. package/dist/esm/runHttpQuery.js.map +1 -0
  429. package/dist/esm/standalone/index.d.ts +25 -0
  430. package/dist/esm/standalone/index.d.ts.map +1 -0
  431. package/dist/esm/standalone/index.js +91 -0
  432. package/dist/esm/standalone/index.js.map +1 -0
  433. package/dist/esm/utils/HeaderMap.d.ts +8 -0
  434. package/dist/esm/utils/HeaderMap.d.ts.map +1 -0
  435. package/dist/esm/utils/HeaderMap.js +16 -0
  436. package/dist/esm/utils/HeaderMap.js.map +1 -0
  437. package/dist/esm/utils/UnreachableCaseError.d.ts +4 -0
  438. package/dist/esm/utils/UnreachableCaseError.d.ts.map +1 -0
  439. package/dist/esm/utils/UnreachableCaseError.js +6 -0
  440. package/dist/esm/utils/UnreachableCaseError.js.map +1 -0
  441. package/dist/esm/utils/computeCoreSchemaHash.d.ts +2 -0
  442. package/dist/esm/utils/computeCoreSchemaHash.d.ts.map +1 -0
  443. package/dist/esm/utils/computeCoreSchemaHash.js +5 -0
  444. package/dist/esm/utils/computeCoreSchemaHash.js.map +1 -0
  445. package/dist/esm/utils/invokeHooks.d.ts +7 -0
  446. package/dist/esm/utils/invokeHooks.d.ts.map +1 -0
  447. package/dist/esm/utils/invokeHooks.js +31 -0
  448. package/dist/esm/utils/invokeHooks.js.map +1 -0
  449. package/dist/esm/utils/isDefined.d.ts +2 -0
  450. package/dist/esm/utils/isDefined.d.ts.map +1 -0
  451. package/dist/esm/utils/isDefined.js +4 -0
  452. package/dist/esm/utils/isDefined.js.map +1 -0
  453. package/dist/esm/utils/makeGatewayGraphQLRequestContext.d.ts +5 -0
  454. package/dist/esm/utils/makeGatewayGraphQLRequestContext.d.ts.map +1 -0
  455. package/dist/esm/utils/makeGatewayGraphQLRequestContext.js +93 -0
  456. package/dist/esm/utils/makeGatewayGraphQLRequestContext.js.map +1 -0
  457. package/dist/esm/utils/resolvable.d.ts +7 -0
  458. package/dist/esm/utils/resolvable.d.ts.map +1 -0
  459. package/dist/esm/utils/resolvable.js +12 -0
  460. package/dist/esm/utils/resolvable.js.map +1 -0
  461. package/dist/esm/utils/schemaInstrumentation.d.ts +16 -0
  462. package/dist/esm/utils/schemaInstrumentation.d.ts.map +1 -0
  463. package/dist/esm/utils/schemaInstrumentation.js +69 -0
  464. package/dist/esm/utils/schemaInstrumentation.js.map +1 -0
  465. package/dist/esm/utils/schemaManager.d.ts +31 -0
  466. package/dist/esm/utils/schemaManager.d.ts.map +1 -0
  467. package/dist/esm/utils/schemaManager.js +99 -0
  468. package/dist/esm/utils/schemaManager.js.map +1 -0
  469. package/dist/esm/utils/urlForHttpServer.d.ts +3 -0
  470. package/dist/esm/utils/urlForHttpServer.d.ts.map +1 -0
  471. package/dist/esm/utils/urlForHttpServer.js +12 -0
  472. package/dist/esm/utils/urlForHttpServer.js.map +1 -0
  473. package/dist/esm/validationRules/NoIntrospection.d.ts +3 -0
  474. package/dist/esm/validationRules/NoIntrospection.d.ts.map +1 -0
  475. package/dist/esm/validationRules/NoIntrospection.js +15 -0
  476. package/dist/esm/validationRules/NoIntrospection.js.map +1 -0
  477. package/dist/esm/validationRules/RecursiveSelectionsLimit.d.ts +4 -0
  478. package/dist/esm/validationRules/RecursiveSelectionsLimit.d.ts.map +1 -0
  479. package/dist/esm/validationRules/RecursiveSelectionsLimit.js +146 -0
  480. package/dist/esm/validationRules/RecursiveSelectionsLimit.js.map +1 -0
  481. package/dist/esm/validationRules/index.d.ts +3 -0
  482. package/dist/esm/validationRules/index.d.ts.map +1 -0
  483. package/dist/esm/validationRules/index.js +3 -0
  484. package/dist/esm/validationRules/index.js.map +1 -0
  485. package/errors/package.json +8 -0
  486. package/package.json +208 -0
  487. package/plugin/cacheControl/package.json +8 -0
  488. package/plugin/disableSuggestions/package.json +8 -0
  489. package/plugin/disabled/package.json +8 -0
  490. package/plugin/drainHttpServer/package.json +8 -0
  491. package/plugin/inlineTrace/package.json +8 -0
  492. package/plugin/landingPage/default/package.json +8 -0
  493. package/plugin/schemaReporting/package.json +8 -0
  494. package/plugin/subscriptionCallback/package.json +8 -0
  495. package/plugin/usageReporting/package.json +8 -0
  496. package/src/ApolloServer.ts +1456 -0
  497. package/src/cachePolicy.ts +33 -0
  498. package/src/determineApolloConfig.ts +95 -0
  499. package/src/errorNormalize.ts +114 -0
  500. package/src/errors/index.ts +33 -0
  501. package/src/externalTypes/constructor.ts +174 -0
  502. package/src/externalTypes/context.ts +18 -0
  503. package/src/externalTypes/graphql.ts +81 -0
  504. package/src/externalTypes/http.ts +44 -0
  505. package/src/externalTypes/incrementalDeliveryPolyfillAlpha2.ts +63 -0
  506. package/src/externalTypes/incrementalDeliveryPolyfillAlpha9.ts +82 -0
  507. package/src/externalTypes/index.ts +73 -0
  508. package/src/externalTypes/plugins.ts +222 -0
  509. package/src/externalTypes/requestPipeline.ts +123 -0
  510. package/src/generated/packageVersion.ts +1 -0
  511. package/src/httpBatching.ts +105 -0
  512. package/src/incrementalDeliveryPolyfill.ts +253 -0
  513. package/src/index.ts +4 -0
  514. package/src/internalErrorClasses.ts +123 -0
  515. package/src/internalPlugin.ts +42 -0
  516. package/src/plugin/cacheControl/index.ts +453 -0
  517. package/src/plugin/disableSuggestions/index.ts +23 -0
  518. package/src/plugin/disabled/index.ts +41 -0
  519. package/src/plugin/drainHttpServer/index.ts +42 -0
  520. package/src/plugin/drainHttpServer/stoppable.ts +109 -0
  521. package/src/plugin/inlineTrace/index.ts +156 -0
  522. package/src/plugin/landingPage/default/getEmbeddedHTML.ts +204 -0
  523. package/src/plugin/landingPage/default/index.ts +219 -0
  524. package/src/plugin/landingPage/default/types.ts +198 -0
  525. package/src/plugin/schemaIsSubgraph.ts +41 -0
  526. package/src/plugin/schemaReporting/generated/operations.d.ts +18359 -0
  527. package/src/plugin/schemaReporting/index.ts +198 -0
  528. package/src/plugin/schemaReporting/schemaReporter.ts +207 -0
  529. package/src/plugin/subscriptionCallback/index.ts +724 -0
  530. package/src/plugin/traceTreeBuilder.ts +356 -0
  531. package/src/plugin/usageReporting/defaultSendOperationsAsTrace.ts +74 -0
  532. package/src/plugin/usageReporting/durationHistogram.ts +87 -0
  533. package/src/plugin/usageReporting/index.ts +9 -0
  534. package/src/plugin/usageReporting/iterateOverTrace.ts +140 -0
  535. package/src/plugin/usageReporting/operationDerivedDataCache.ts +61 -0
  536. package/src/plugin/usageReporting/options.ts +414 -0
  537. package/src/plugin/usageReporting/plugin.ts +871 -0
  538. package/src/plugin/usageReporting/stats.ts +492 -0
  539. package/src/plugin/usageReporting/traceDetails.ts +96 -0
  540. package/src/preventCsrf.ts +99 -0
  541. package/src/requestPipeline.ts +821 -0
  542. package/src/runHttpQuery.ts +408 -0
  543. package/src/standalone/index.ts +155 -0
  544. package/src/utils/HeaderMap.ts +22 -0
  545. package/src/utils/UnreachableCaseError.ts +10 -0
  546. package/src/utils/computeCoreSchemaHash.ts +9 -0
  547. package/src/utils/invokeHooks.ts +53 -0
  548. package/src/utils/isDefined.ts +3 -0
  549. package/src/utils/makeGatewayGraphQLRequestContext.ts +197 -0
  550. package/src/utils/resolvable.ts +30 -0
  551. package/src/utils/schemaInstrumentation.ts +132 -0
  552. package/src/utils/schemaManager.ts +212 -0
  553. package/src/utils/urlForHttpServer.ts +21 -0
  554. package/src/validationRules/NoIntrospection.ts +27 -0
  555. package/src/validationRules/RecursiveSelectionsLimit.ts +198 -0
  556. package/src/validationRules/index.ts +5 -0
  557. package/standalone/package.json +8 -0
@@ -0,0 +1,683 @@
1
+ import { isNodeLike } from '@apollo/utils.isnodelike';
2
+ import { InMemoryLRUCache, PrefixingKeyValueCache, } from '@apollo/utils.keyvaluecache';
3
+ import { makeExecutableSchema } from '@graphql-tools/schema';
4
+ import resolvable from './utils/resolvable.js';
5
+ import { GraphQLError, assertValidSchema, print, printSchema, } from 'graphql';
6
+ import loglevel from 'loglevel';
7
+ import Negotiator from 'negotiator';
8
+ import { newCachePolicy } from './cachePolicy.js';
9
+ import { determineApolloConfig } from './determineApolloConfig.js';
10
+ import { ensureError, ensureGraphQLError, normalizeAndFormatErrors, } from './errorNormalize.js';
11
+ import { ApolloServerErrorCode } from './errors/index.js';
12
+ import { runPotentiallyBatchedHttpQuery } from './httpBatching.js';
13
+ import { pluginIsInternal } from './internalPlugin.js';
14
+ import { preventCsrf, recommendedCsrfPreventionRequestHeaders, } from './preventCsrf.js';
15
+ import { APQ_CACHE_PREFIX, processGraphQLRequest } from './requestPipeline.js';
16
+ import { newHTTPGraphQLHead, prettyJSONStringify } from './runHttpQuery.js';
17
+ import { HeaderMap } from './utils/HeaderMap.js';
18
+ import { UnreachableCaseError } from './utils/UnreachableCaseError.js';
19
+ import { computeCoreSchemaHash } from './utils/computeCoreSchemaHash.js';
20
+ import { isDefined } from './utils/isDefined.js';
21
+ import { SchemaManager } from './utils/schemaManager.js';
22
+ import { NoIntrospection, createMaxRecursiveSelectionsRule, DEFAULT_MAX_RECURSIVE_SELECTIONS, } from './validationRules/index.js';
23
+ function defaultLogger() {
24
+ const loglevelLogger = loglevel.getLogger('apollo-server');
25
+ loglevelLogger.setLevel(loglevel.levels.INFO);
26
+ return loglevelLogger;
27
+ }
28
+ export class ApolloServer {
29
+ internals;
30
+ cache;
31
+ logger;
32
+ constructor(config) {
33
+ const nodeEnv = config.nodeEnv ?? process.env.NODE_ENV ?? '';
34
+ this.logger = config.logger ?? defaultLogger();
35
+ const apolloConfig = determineApolloConfig(config.apollo, this.logger);
36
+ const isDev = nodeEnv !== 'production';
37
+ if (config.cache &&
38
+ config.cache !== 'bounded' &&
39
+ PrefixingKeyValueCache.prefixesAreUnnecessaryForIsolation(config.cache)) {
40
+ throw new Error('You cannot pass a cache returned from ' +
41
+ '`PrefixingKeyValueCache.cacheDangerouslyDoesNotNeedPrefixesForIsolation`' +
42
+ 'to `new ApolloServer({ cache })`, because Apollo Server may use it for ' +
43
+ 'multiple features whose cache keys must be distinct from each other.');
44
+ }
45
+ const state = config.gateway
46
+ ?
47
+ {
48
+ phase: 'initialized',
49
+ schemaManager: new SchemaManager({
50
+ gateway: config.gateway,
51
+ apolloConfig,
52
+ schemaDerivedDataProvider: (schema) => ApolloServer.generateSchemaDerivedData(schema, config.documentStore),
53
+ logger: this.logger,
54
+ }),
55
+ }
56
+ :
57
+ {
58
+ phase: 'initialized',
59
+ schemaManager: new SchemaManager({
60
+ apiSchema: ApolloServer.constructSchema(config),
61
+ schemaDerivedDataProvider: (schema) => ApolloServer.generateSchemaDerivedData(schema, config.documentStore),
62
+ logger: this.logger,
63
+ }),
64
+ };
65
+ const introspectionEnabled = config.introspection ?? isDev;
66
+ const hideSchemaDetailsFromClientErrors = config.hideSchemaDetailsFromClientErrors ?? false;
67
+ this.cache =
68
+ config.cache === undefined || config.cache === 'bounded'
69
+ ? new InMemoryLRUCache()
70
+ : config.cache;
71
+ const maxRecursiveSelectionsRule = config.maxRecursiveSelections === true
72
+ ? [createMaxRecursiveSelectionsRule(DEFAULT_MAX_RECURSIVE_SELECTIONS)]
73
+ : typeof config.maxRecursiveSelections === 'number'
74
+ ? [createMaxRecursiveSelectionsRule(config.maxRecursiveSelections)]
75
+ : [];
76
+ const validationRules = [
77
+ ...(introspectionEnabled ? [] : [NoIntrospection]),
78
+ ...maxRecursiveSelectionsRule,
79
+ ];
80
+ let laterValidationRules;
81
+ if (maxRecursiveSelectionsRule.length > 0) {
82
+ laterValidationRules = config.validationRules;
83
+ }
84
+ else {
85
+ validationRules.push(...(config.validationRules ?? []));
86
+ }
87
+ this.internals = {
88
+ formatError: config.formatError,
89
+ rootValue: config.rootValue,
90
+ validationRules,
91
+ laterValidationRules,
92
+ hideSchemaDetailsFromClientErrors,
93
+ dangerouslyDisableValidation: config.dangerouslyDisableValidation ?? false,
94
+ validationOptions: config.validationOptions ?? {},
95
+ fieldResolver: config.fieldResolver,
96
+ includeStacktraceInErrorResponses: config.includeStacktraceInErrorResponses ??
97
+ (nodeEnv !== 'production' && nodeEnv !== 'test'),
98
+ persistedQueries: config.persistedQueries === false
99
+ ? undefined
100
+ : {
101
+ ...config.persistedQueries,
102
+ cache: new PrefixingKeyValueCache(config.persistedQueries?.cache ?? this.cache, APQ_CACHE_PREFIX),
103
+ },
104
+ nodeEnv,
105
+ allowBatchedHttpRequests: config.allowBatchedHttpRequests ?? false,
106
+ apolloConfig,
107
+ plugins: config.plugins ?? [],
108
+ parseOptions: config.parseOptions ?? {},
109
+ executionOptions: config.executionOptions ?? {},
110
+ state,
111
+ stopOnTerminationSignals: config.stopOnTerminationSignals,
112
+ gatewayExecutor: null,
113
+ csrfPreventionRequestHeaders: config.csrfPrevention === true || config.csrfPrevention === undefined
114
+ ? recommendedCsrfPreventionRequestHeaders
115
+ : config.csrfPrevention === false
116
+ ? null
117
+ : (config.csrfPrevention.requestHeaders ??
118
+ recommendedCsrfPreventionRequestHeaders),
119
+ status400ForVariableCoercionErrors: config.status400ForVariableCoercionErrors ?? true,
120
+ __testing_incrementalExecutionResults: config.__testing_incrementalExecutionResults,
121
+ stringifyResult: config.stringifyResult ?? prettyJSONStringify,
122
+ legacyExperimentalExecuteIncrementally: config.legacyExperimentalExecuteIncrementally,
123
+ };
124
+ this.warnAgainstDeprecatedConfigOptions(config);
125
+ }
126
+ warnAgainstDeprecatedConfigOptions(config) {
127
+ if ('status400ForVariableCoercionErrors' in config) {
128
+ if (config.status400ForVariableCoercionErrors === true) {
129
+ this.logger.warn('The `status400ForVariableCoercionErrors: true` configuration option is now the default behavior and has no effect in Apollo Server v5. You can safely remove this option from your configuration.');
130
+ }
131
+ else {
132
+ this.logger.warn('The `status400ForVariableCoercionErrors: false` configuration option is deprecated and will be removed in Apollo Server v6. Apollo recommends removing any dependency on this behavior.');
133
+ }
134
+ }
135
+ }
136
+ async start() {
137
+ return await this._start(false);
138
+ }
139
+ startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests() {
140
+ this._start(true).catch((e) => this.logStartupError(e));
141
+ }
142
+ async _start(startedInBackground) {
143
+ if (this.internals.state.phase !== 'initialized') {
144
+ throw new Error(`You should only call 'start()' or ` +
145
+ `'startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests()' ` +
146
+ `once on your ApolloServer.`);
147
+ }
148
+ const schemaManager = this.internals.state.schemaManager;
149
+ const barrier = resolvable();
150
+ this.internals.state = {
151
+ phase: 'starting',
152
+ barrier,
153
+ schemaManager,
154
+ startedInBackground,
155
+ };
156
+ try {
157
+ await this.addDefaultPlugins();
158
+ const toDispose = [];
159
+ const executor = await schemaManager.start();
160
+ if (executor) {
161
+ this.internals.gatewayExecutor = executor;
162
+ }
163
+ toDispose.push(async () => {
164
+ await schemaManager.stop();
165
+ });
166
+ const schemaDerivedData = schemaManager.getSchemaDerivedData();
167
+ const service = {
168
+ logger: this.logger,
169
+ cache: this.cache,
170
+ schema: schemaDerivedData.schema,
171
+ apollo: this.internals.apolloConfig,
172
+ startedInBackground,
173
+ };
174
+ const taggedServerListeners = (await Promise.all(this.internals.plugins.map(async (plugin) => ({
175
+ serverListener: plugin.serverWillStart && (await plugin.serverWillStart(service)),
176
+ installedImplicitly: isImplicitlyInstallablePlugin(plugin) &&
177
+ plugin.__internal_installed_implicitly__,
178
+ })))).filter((maybeTaggedServerListener) => typeof maybeTaggedServerListener.serverListener === 'object');
179
+ taggedServerListeners.forEach(({ serverListener: { schemaDidLoadOrUpdate } }) => {
180
+ if (schemaDidLoadOrUpdate) {
181
+ schemaManager.onSchemaLoadOrUpdate(schemaDidLoadOrUpdate);
182
+ }
183
+ });
184
+ const serverWillStops = taggedServerListeners
185
+ .map((l) => l.serverListener.serverWillStop)
186
+ .filter(isDefined);
187
+ if (serverWillStops.length) {
188
+ toDispose.push(async () => {
189
+ await Promise.all(serverWillStops.map((serverWillStop) => serverWillStop()));
190
+ });
191
+ }
192
+ const drainServerCallbacks = taggedServerListeners
193
+ .map((l) => l.serverListener.drainServer)
194
+ .filter(isDefined);
195
+ const drainServers = drainServerCallbacks.length
196
+ ? async () => {
197
+ await Promise.all(drainServerCallbacks.map((drainServer) => drainServer()));
198
+ }
199
+ : null;
200
+ let taggedServerListenersWithRenderLandingPage = taggedServerListeners.filter((l) => l.serverListener.renderLandingPage);
201
+ if (taggedServerListenersWithRenderLandingPage.length > 1) {
202
+ taggedServerListenersWithRenderLandingPage =
203
+ taggedServerListenersWithRenderLandingPage.filter((l) => !l.installedImplicitly);
204
+ }
205
+ let landingPage = null;
206
+ if (taggedServerListenersWithRenderLandingPage.length > 1) {
207
+ throw Error('Only one plugin can implement renderLandingPage.');
208
+ }
209
+ else if (taggedServerListenersWithRenderLandingPage.length) {
210
+ landingPage =
211
+ await taggedServerListenersWithRenderLandingPage[0].serverListener
212
+ .renderLandingPage();
213
+ }
214
+ const toDisposeLast = this.maybeRegisterTerminationSignalHandlers(['SIGINT', 'SIGTERM'], startedInBackground);
215
+ this.internals.state = {
216
+ phase: 'started',
217
+ schemaManager,
218
+ drainServers,
219
+ landingPage,
220
+ toDispose,
221
+ toDisposeLast,
222
+ };
223
+ }
224
+ catch (maybeError) {
225
+ const error = ensureError(maybeError);
226
+ try {
227
+ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.startupDidFail?.({ error })));
228
+ }
229
+ catch (pluginError) {
230
+ this.logger.error(`startupDidFail hook threw: ${pluginError}`);
231
+ }
232
+ this.internals.state = {
233
+ phase: 'failed to start',
234
+ error,
235
+ };
236
+ throw error;
237
+ }
238
+ finally {
239
+ barrier.resolve();
240
+ }
241
+ }
242
+ maybeRegisterTerminationSignalHandlers(signals, startedInBackground) {
243
+ const toDisposeLast = [];
244
+ if (this.internals.stopOnTerminationSignals === false ||
245
+ (this.internals.stopOnTerminationSignals === undefined &&
246
+ !(isNodeLike &&
247
+ this.internals.nodeEnv !== 'test' &&
248
+ !startedInBackground))) {
249
+ return toDisposeLast;
250
+ }
251
+ let receivedSignal = false;
252
+ const signalHandler = async (signal) => {
253
+ if (receivedSignal) {
254
+ return;
255
+ }
256
+ receivedSignal = true;
257
+ try {
258
+ await this.stop();
259
+ }
260
+ catch (e) {
261
+ this.logger.error(`stop() threw during ${signal} shutdown`);
262
+ this.logger.error(e);
263
+ process.exit(1);
264
+ }
265
+ process.kill(process.pid, signal);
266
+ };
267
+ signals.forEach((signal) => {
268
+ process.on(signal, signalHandler);
269
+ toDisposeLast.push(async () => {
270
+ process.removeListener(signal, signalHandler);
271
+ });
272
+ });
273
+ return toDisposeLast;
274
+ }
275
+ async _ensureStarted() {
276
+ while (true) {
277
+ switch (this.internals.state.phase) {
278
+ case 'initialized':
279
+ throw new Error('You need to call `server.start()` before using your Apollo Server.');
280
+ case 'starting':
281
+ await this.internals.state.barrier;
282
+ break;
283
+ case 'failed to start':
284
+ this.logStartupError(this.internals.state.error);
285
+ throw new Error('This data graph is missing a valid configuration. More details may be available in the server logs.');
286
+ case 'started':
287
+ case 'draining':
288
+ return this.internals.state;
289
+ case 'stopping':
290
+ case 'stopped':
291
+ this.logger.warn('A GraphQL operation was received during server shutdown. The ' +
292
+ 'operation will fail. Consider draining the HTTP server on shutdown; ' +
293
+ 'see https://go.apollo.dev/s/drain for details.');
294
+ throw new Error(`Cannot execute GraphQL operations ${this.internals.state.phase === 'stopping'
295
+ ? 'while the server is stopping'
296
+ : 'after the server has stopped'}.'`);
297
+ default:
298
+ throw new UnreachableCaseError(this.internals.state);
299
+ }
300
+ }
301
+ }
302
+ assertStarted(expressionForError) {
303
+ if (this.internals.state.phase !== 'started' &&
304
+ this.internals.state.phase !== 'draining' &&
305
+ !(this.internals.state.phase === 'starting' &&
306
+ this.internals.state.startedInBackground)) {
307
+ throw new Error('You must `await server.start()` before calling `' +
308
+ expressionForError +
309
+ '`');
310
+ }
311
+ }
312
+ logStartupError(err) {
313
+ this.logger.error('An error occurred during Apollo Server startup. All GraphQL requests ' +
314
+ 'will now fail. The startup error was: ' +
315
+ (err?.message || err));
316
+ }
317
+ static constructSchema(config) {
318
+ if (config.schema) {
319
+ return config.schema;
320
+ }
321
+ const { typeDefs, resolvers } = config;
322
+ const augmentedTypeDefs = Array.isArray(typeDefs) ? typeDefs : [typeDefs];
323
+ return makeExecutableSchema({
324
+ typeDefs: augmentedTypeDefs,
325
+ resolvers,
326
+ });
327
+ }
328
+ static generateSchemaDerivedData(schema, providedDocumentStore) {
329
+ assertValidSchema(schema);
330
+ return {
331
+ schema,
332
+ documentStore: providedDocumentStore === undefined
333
+ ? new InMemoryLRUCache()
334
+ : providedDocumentStore,
335
+ documentStoreKeyPrefix: providedDocumentStore
336
+ ? `${computeCoreSchemaHash(printSchema(schema))}:`
337
+ : '',
338
+ };
339
+ }
340
+ async stop() {
341
+ switch (this.internals.state.phase) {
342
+ case 'initialized':
343
+ case 'starting':
344
+ case 'failed to start':
345
+ throw Error('apolloServer.stop() should only be called after `await apolloServer.start()` has succeeded');
346
+ case 'stopped':
347
+ if (this.internals.state.stopError) {
348
+ throw this.internals.state.stopError;
349
+ }
350
+ return;
351
+ case 'stopping':
352
+ case 'draining': {
353
+ await this.internals.state.barrier;
354
+ const state = this.internals.state;
355
+ if (state.phase !== 'stopped') {
356
+ throw Error(`Surprising post-stopping state ${state.phase}`);
357
+ }
358
+ if (state.stopError) {
359
+ throw state.stopError;
360
+ }
361
+ return;
362
+ }
363
+ case 'started':
364
+ break;
365
+ default:
366
+ throw new UnreachableCaseError(this.internals.state);
367
+ }
368
+ const barrier = resolvable();
369
+ const { schemaManager, drainServers, landingPage, toDispose, toDisposeLast, } = this.internals.state;
370
+ this.internals.state = {
371
+ phase: 'draining',
372
+ barrier,
373
+ schemaManager,
374
+ landingPage,
375
+ };
376
+ try {
377
+ await drainServers?.();
378
+ this.internals.state = { phase: 'stopping', barrier };
379
+ await Promise.all([...toDispose].map((dispose) => dispose()));
380
+ await Promise.all([...toDisposeLast].map((dispose) => dispose()));
381
+ }
382
+ catch (stopError) {
383
+ this.internals.state = {
384
+ phase: 'stopped',
385
+ stopError: stopError,
386
+ };
387
+ barrier.resolve();
388
+ throw stopError;
389
+ }
390
+ this.internals.state = { phase: 'stopped', stopError: null };
391
+ }
392
+ async addDefaultPlugins() {
393
+ const { plugins, apolloConfig, nodeEnv, hideSchemaDetailsFromClientErrors, } = this.internals;
394
+ const isDev = nodeEnv !== 'production';
395
+ const alreadyHavePluginWithInternalId = (id) => plugins.some((p) => pluginIsInternal(p) && p.__internal_plugin_id__ === id);
396
+ const pluginsByInternalID = new Map();
397
+ for (const p of plugins) {
398
+ if (pluginIsInternal(p)) {
399
+ const id = p.__internal_plugin_id__;
400
+ if (!pluginsByInternalID.has(id)) {
401
+ pluginsByInternalID.set(id, {
402
+ sawDisabled: false,
403
+ sawNonDisabled: false,
404
+ });
405
+ }
406
+ const seen = pluginsByInternalID.get(id);
407
+ if (p.__is_disabled_plugin__) {
408
+ seen.sawDisabled = true;
409
+ }
410
+ else {
411
+ seen.sawNonDisabled = true;
412
+ }
413
+ if (seen.sawDisabled && seen.sawNonDisabled) {
414
+ throw new Error(`You have tried to install both ApolloServerPlugin${id} and ` +
415
+ `ApolloServerPlugin${id}Disabled in your server. Please choose ` +
416
+ `whether or not you want to disable the feature and install the ` +
417
+ `appropriate plugin for your use case.`);
418
+ }
419
+ }
420
+ }
421
+ {
422
+ if (!alreadyHavePluginWithInternalId('CacheControl')) {
423
+ const { ApolloServerPluginCacheControl } = await import('./plugin/cacheControl/index.js');
424
+ plugins.push(ApolloServerPluginCacheControl());
425
+ }
426
+ }
427
+ {
428
+ const alreadyHavePlugin = alreadyHavePluginWithInternalId('UsageReporting');
429
+ if (!alreadyHavePlugin && apolloConfig.key) {
430
+ if (apolloConfig.graphRef) {
431
+ const { ApolloServerPluginUsageReporting } = await import('./plugin/usageReporting/index.js');
432
+ plugins.unshift(ApolloServerPluginUsageReporting({
433
+ __onlyIfSchemaIsNotSubgraph: true,
434
+ }));
435
+ }
436
+ else {
437
+ this.logger.warn('You have specified an Apollo key but have not specified a graph ref; usage ' +
438
+ 'reporting is disabled. To enable usage reporting, set the `APOLLO_GRAPH_REF` ' +
439
+ 'environment variable to `your-graph-id@your-graph-variant`. To disable this ' +
440
+ 'warning, install `ApolloServerPluginUsageReportingDisabled`.');
441
+ }
442
+ }
443
+ }
444
+ {
445
+ const alreadyHavePlugin = alreadyHavePluginWithInternalId('SchemaReporting');
446
+ const enabledViaEnvVar = process.env.APOLLO_SCHEMA_REPORTING === 'true';
447
+ if (!alreadyHavePlugin && enabledViaEnvVar) {
448
+ if (apolloConfig.key) {
449
+ const { ApolloServerPluginSchemaReporting } = await import('./plugin/schemaReporting/index.js');
450
+ plugins.push(ApolloServerPluginSchemaReporting());
451
+ }
452
+ else {
453
+ throw new Error("You've enabled schema reporting by setting the APOLLO_SCHEMA_REPORTING " +
454
+ 'environment variable to true, but you also need to provide your ' +
455
+ 'Apollo API key, via the APOLLO_KEY environment ' +
456
+ 'variable or via `new ApolloServer({apollo: {key})');
457
+ }
458
+ }
459
+ }
460
+ {
461
+ const alreadyHavePlugin = alreadyHavePluginWithInternalId('InlineTrace');
462
+ if (!alreadyHavePlugin) {
463
+ const { ApolloServerPluginInlineTrace } = await import('./plugin/inlineTrace/index.js');
464
+ plugins.push(ApolloServerPluginInlineTrace({ __onlyIfSchemaIsSubgraph: true }));
465
+ }
466
+ }
467
+ const alreadyHavePlugin = alreadyHavePluginWithInternalId('LandingPageDisabled');
468
+ if (!alreadyHavePlugin) {
469
+ const { ApolloServerPluginLandingPageLocalDefault, ApolloServerPluginLandingPageProductionDefault, } = await import('./plugin/landingPage/default/index.js');
470
+ const plugin = isDev
471
+ ? ApolloServerPluginLandingPageLocalDefault()
472
+ : ApolloServerPluginLandingPageProductionDefault();
473
+ if (!isImplicitlyInstallablePlugin(plugin)) {
474
+ throw Error('default landing page plugin should be implicitly installable?');
475
+ }
476
+ plugin.__internal_installed_implicitly__ = true;
477
+ plugins.push(plugin);
478
+ }
479
+ {
480
+ const alreadyHavePlugin = alreadyHavePluginWithInternalId('DisableSuggestions');
481
+ if (hideSchemaDetailsFromClientErrors && !alreadyHavePlugin) {
482
+ const { ApolloServerPluginDisableSuggestions } = await import('./plugin/disableSuggestions/index.js');
483
+ plugins.push(ApolloServerPluginDisableSuggestions());
484
+ }
485
+ }
486
+ }
487
+ addPlugin(plugin) {
488
+ if (this.internals.state.phase !== 'initialized') {
489
+ throw new Error("Can't add plugins after the server has started");
490
+ }
491
+ this.internals.plugins.push(plugin);
492
+ }
493
+ async executeHTTPGraphQLRequest({ httpGraphQLRequest, context, }) {
494
+ try {
495
+ let runningServerState;
496
+ try {
497
+ runningServerState = await this._ensureStarted();
498
+ }
499
+ catch (error) {
500
+ return await this.errorResponse(error, httpGraphQLRequest);
501
+ }
502
+ if (runningServerState.landingPage &&
503
+ this.prefersHTML(httpGraphQLRequest)) {
504
+ let renderedHtml;
505
+ if (typeof runningServerState.landingPage.html === 'string') {
506
+ renderedHtml = runningServerState.landingPage.html;
507
+ }
508
+ else {
509
+ try {
510
+ renderedHtml = await runningServerState.landingPage.html();
511
+ }
512
+ catch (maybeError) {
513
+ const error = ensureError(maybeError);
514
+ this.logger.error(`Landing page \`html\` function threw: ${error}`);
515
+ return await this.errorResponse(error, httpGraphQLRequest);
516
+ }
517
+ }
518
+ return {
519
+ headers: new HeaderMap([['content-type', 'text/html']]),
520
+ body: {
521
+ kind: 'complete',
522
+ string: renderedHtml,
523
+ },
524
+ };
525
+ }
526
+ if (this.internals.csrfPreventionRequestHeaders) {
527
+ preventCsrf(httpGraphQLRequest.headers, this.internals.csrfPreventionRequestHeaders);
528
+ }
529
+ let contextValue;
530
+ try {
531
+ contextValue = await context();
532
+ }
533
+ catch (maybeError) {
534
+ const error = ensureError(maybeError);
535
+ try {
536
+ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.contextCreationDidFail?.({
537
+ error,
538
+ })));
539
+ }
540
+ catch (pluginError) {
541
+ this.logger.error(`contextCreationDidFail hook threw: ${pluginError}`);
542
+ }
543
+ return await this.errorResponse(ensureGraphQLError(error, 'Context creation failed: '), httpGraphQLRequest);
544
+ }
545
+ return await runPotentiallyBatchedHttpQuery(this, httpGraphQLRequest, contextValue, runningServerState.schemaManager.getSchemaDerivedData(), this.internals);
546
+ }
547
+ catch (maybeError_) {
548
+ const maybeError = maybeError_;
549
+ if (maybeError instanceof GraphQLError &&
550
+ maybeError.extensions.code === ApolloServerErrorCode.BAD_REQUEST) {
551
+ try {
552
+ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.invalidRequestWasReceived?.({ error: maybeError })));
553
+ }
554
+ catch (pluginError) {
555
+ this.logger.error(`invalidRequestWasReceived hook threw: ${pluginError}`);
556
+ }
557
+ }
558
+ return await this.errorResponse(maybeError, httpGraphQLRequest);
559
+ }
560
+ }
561
+ async errorResponse(error, requestHead) {
562
+ const { formattedErrors, httpFromErrors } = normalizeAndFormatErrors([error], {
563
+ includeStacktraceInErrorResponses: this.internals.includeStacktraceInErrorResponses,
564
+ formatError: this.internals.formatError,
565
+ });
566
+ return {
567
+ status: httpFromErrors.status ?? 500,
568
+ headers: new HeaderMap([
569
+ ...httpFromErrors.headers,
570
+ [
571
+ 'content-type',
572
+ chooseContentTypeForSingleResultResponse(requestHead) ??
573
+ MEDIA_TYPES.APPLICATION_JSON,
574
+ ],
575
+ ]),
576
+ body: {
577
+ kind: 'complete',
578
+ string: await this.internals.stringifyResult({
579
+ errors: formattedErrors,
580
+ }),
581
+ },
582
+ };
583
+ }
584
+ prefersHTML(request) {
585
+ const acceptHeader = request.headers.get('accept');
586
+ return (request.method === 'GET' &&
587
+ !!acceptHeader &&
588
+ new Negotiator({
589
+ headers: { accept: acceptHeader },
590
+ }).mediaType([
591
+ MEDIA_TYPES.APPLICATION_JSON,
592
+ MEDIA_TYPES.APPLICATION_GRAPHQL_RESPONSE_JSON,
593
+ MEDIA_TYPES.MULTIPART_MIXED_EXPERIMENTAL_ALPHA_2,
594
+ MEDIA_TYPES.MULTIPART_MIXED_EXPERIMENTAL_ALPHA_9,
595
+ MEDIA_TYPES.MULTIPART_MIXED_NO_DEFER_SPEC,
596
+ MEDIA_TYPES.TEXT_HTML,
597
+ ]) === MEDIA_TYPES.TEXT_HTML);
598
+ }
599
+ async executeOperation(request, options = {}) {
600
+ if (this.internals.state.phase === 'initialized') {
601
+ await this.start();
602
+ }
603
+ const schemaDerivedData = (await this._ensureStarted()).schemaManager.getSchemaDerivedData();
604
+ const graphQLRequest = {
605
+ ...request,
606
+ query: request.query && typeof request.query !== 'string'
607
+ ? print(request.query)
608
+ : request.query,
609
+ };
610
+ const response = await internalExecuteOperation({
611
+ server: this,
612
+ graphQLRequest,
613
+ internals: this.internals,
614
+ schemaDerivedData,
615
+ sharedResponseHTTPGraphQLHead: null,
616
+ }, options);
617
+ return response;
618
+ }
619
+ }
620
+ export async function internalExecuteOperation({ server, graphQLRequest, internals, schemaDerivedData, sharedResponseHTTPGraphQLHead, }, options) {
621
+ const requestContext = {
622
+ logger: server.logger,
623
+ cache: server.cache,
624
+ schema: schemaDerivedData.schema,
625
+ request: graphQLRequest,
626
+ response: {
627
+ http: sharedResponseHTTPGraphQLHead ?? newHTTPGraphQLHead(),
628
+ },
629
+ contextValue: cloneObject(options?.contextValue ?? {}),
630
+ metrics: {},
631
+ overallCachePolicy: newCachePolicy(),
632
+ requestIsBatched: sharedResponseHTTPGraphQLHead !== null,
633
+ };
634
+ try {
635
+ return await processGraphQLRequest(schemaDerivedData, server, internals, requestContext);
636
+ }
637
+ catch (maybeError) {
638
+ const error = ensureError(maybeError);
639
+ await Promise.all(internals.plugins.map(async (plugin) => plugin.unexpectedErrorProcessingRequest?.({
640
+ requestContext,
641
+ error,
642
+ })));
643
+ server.logger.error(`Unexpected error processing request: ${error}`);
644
+ throw new Error('Internal server error');
645
+ }
646
+ }
647
+ export function isImplicitlyInstallablePlugin(p) {
648
+ return '__internal_installed_implicitly__' in p;
649
+ }
650
+ export const MEDIA_TYPES = {
651
+ APPLICATION_JSON: 'application/json; charset=utf-8',
652
+ APPLICATION_JSON_GRAPHQL_CALLBACK: 'application/json; callbackSpec=1.0; charset=utf-8',
653
+ APPLICATION_GRAPHQL_RESPONSE_JSON: 'application/graphql-response+json; charset=utf-8',
654
+ MULTIPART_MIXED_NO_DEFER_SPEC: 'multipart/mixed',
655
+ MULTIPART_MIXED_EXPERIMENTAL_ALPHA_2: 'multipart/mixed; deferSpec=20220824',
656
+ MULTIPART_MIXED_EXPERIMENTAL_ALPHA_9: 'multipart/mixed; incrementalSpec=v0.2',
657
+ TEXT_HTML: 'text/html',
658
+ };
659
+ export function chooseContentTypeForSingleResultResponse(head) {
660
+ const acceptHeader = head.headers.get('accept');
661
+ if (!acceptHeader) {
662
+ return MEDIA_TYPES.APPLICATION_JSON;
663
+ }
664
+ else {
665
+ const preferred = new Negotiator({
666
+ headers: { accept: head.headers.get('accept') },
667
+ }).mediaType([
668
+ MEDIA_TYPES.APPLICATION_JSON,
669
+ MEDIA_TYPES.APPLICATION_GRAPHQL_RESPONSE_JSON,
670
+ MEDIA_TYPES.APPLICATION_JSON_GRAPHQL_CALLBACK,
671
+ ]);
672
+ if (preferred) {
673
+ return preferred;
674
+ }
675
+ else {
676
+ return null;
677
+ }
678
+ }
679
+ }
680
+ function cloneObject(object) {
681
+ return Object.assign(Object.create(Object.getPrototypeOf(object)), object);
682
+ }
683
+ //# sourceMappingURL=ApolloServer.js.map