@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.
- package/README.md +40 -0
- package/changes.json +46 -0
- package/dist/cjs/ApolloServer.d.ts +126 -0
- package/dist/cjs/ApolloServer.d.ts.map +1 -0
- package/dist/cjs/ApolloServer.js +726 -0
- package/dist/cjs/ApolloServer.js.map +1 -0
- package/dist/cjs/cachePolicy.d.ts +3 -0
- package/dist/cjs/cachePolicy.d.ts.map +1 -0
- package/dist/cjs/cachePolicy.js +33 -0
- package/dist/cjs/cachePolicy.js.map +1 -0
- package/dist/cjs/determineApolloConfig.d.ts +4 -0
- package/dist/cjs/determineApolloConfig.d.ts.map +1 -0
- package/dist/cjs/determineApolloConfig.js +58 -0
- package/dist/cjs/determineApolloConfig.js.map +1 -0
- package/dist/cjs/errorNormalize.d.ts +12 -0
- package/dist/cjs/errorNormalize.d.ts.map +1 -0
- package/dist/cjs/errorNormalize.js +71 -0
- package/dist/cjs/errorNormalize.js.map +1 -0
- package/dist/cjs/errors/index.d.ts +16 -0
- package/dist/cjs/errors/index.d.ts.map +1 -0
- package/dist/cjs/errors/index.js +28 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/externalTypes/constructor.d.ts +78 -0
- package/dist/cjs/externalTypes/constructor.d.ts.map +1 -0
- package/dist/cjs/externalTypes/constructor.js +3 -0
- package/dist/cjs/externalTypes/constructor.js.map +1 -0
- package/dist/cjs/externalTypes/context.d.ts +4 -0
- package/dist/cjs/externalTypes/context.d.ts.map +1 -0
- package/dist/cjs/externalTypes/context.js +3 -0
- package/dist/cjs/externalTypes/context.js.map +1 -0
- package/dist/cjs/externalTypes/graphql.d.ts +41 -0
- package/dist/cjs/externalTypes/graphql.d.ts.map +1 -0
- package/dist/cjs/externalTypes/graphql.js +3 -0
- package/dist/cjs/externalTypes/graphql.js.map +1 -0
- package/dist/cjs/externalTypes/http.d.ts +22 -0
- package/dist/cjs/externalTypes/http.d.ts.map +1 -0
- package/dist/cjs/externalTypes/http.js +3 -0
- package/dist/cjs/externalTypes/http.js.map +1 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts +28 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts.map +1 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.js +3 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha2.js.map +1 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts +43 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts.map +1 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.js +3 -0
- package/dist/cjs/externalTypes/incrementalDeliveryPolyfillAlpha9.js.map +1 -0
- package/dist/cjs/externalTypes/index.d.ts +9 -0
- package/dist/cjs/externalTypes/index.d.ts.map +1 -0
- package/dist/cjs/externalTypes/index.js +3 -0
- package/dist/cjs/externalTypes/index.js.map +1 -0
- package/dist/cjs/externalTypes/plugins.d.ts +75 -0
- package/dist/cjs/externalTypes/plugins.d.ts.map +1 -0
- package/dist/cjs/externalTypes/plugins.js +3 -0
- package/dist/cjs/externalTypes/plugins.js.map +1 -0
- package/dist/cjs/externalTypes/requestPipeline.d.ts +50 -0
- package/dist/cjs/externalTypes/requestPipeline.d.ts.map +1 -0
- package/dist/cjs/externalTypes/requestPipeline.js +3 -0
- package/dist/cjs/externalTypes/requestPipeline.js.map +1 -0
- package/dist/cjs/generated/packageVersion.d.ts +2 -0
- package/dist/cjs/generated/packageVersion.d.ts.map +1 -0
- package/dist/cjs/generated/packageVersion.js +5 -0
- package/dist/cjs/generated/packageVersion.js.map +1 -0
- package/dist/cjs/httpBatching.d.ts +4 -0
- package/dist/cjs/httpBatching.d.ts.map +1 -0
- package/dist/cjs/httpBatching.js +58 -0
- package/dist/cjs/httpBatching.js.map +1 -0
- package/dist/cjs/incrementalDeliveryPolyfill.d.ts +82 -0
- package/dist/cjs/incrementalDeliveryPolyfill.d.ts.map +1 -0
- package/dist/cjs/incrementalDeliveryPolyfill.js +74 -0
- package/dist/cjs/incrementalDeliveryPolyfill.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internalErrorClasses.d.ts +28 -0
- package/dist/cjs/internalErrorClasses.d.ts.map +1 -0
- package/dist/cjs/internalErrorClasses.js +91 -0
- package/dist/cjs/internalErrorClasses.js.map +1 -0
- package/dist/cjs/internalPlugin.d.ts +9 -0
- package/dist/cjs/internalPlugin.d.ts.map +1 -0
- package/dist/cjs/internalPlugin.js +11 -0
- package/dist/cjs/internalPlugin.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/plugin/cacheControl/index.d.ts +9 -0
- package/dist/cjs/plugin/cacheControl/index.d.ts.map +1 -0
- package/dist/cjs/plugin/cacheControl/index.js +223 -0
- package/dist/cjs/plugin/cacheControl/index.js.map +1 -0
- package/dist/cjs/plugin/disableSuggestions/index.d.ts +3 -0
- package/dist/cjs/plugin/disableSuggestions/index.d.ts.map +1 -0
- package/dist/cjs/plugin/disableSuggestions/index.js +22 -0
- package/dist/cjs/plugin/disableSuggestions/index.js.map +1 -0
- package/dist/cjs/plugin/disabled/index.d.ts +7 -0
- package/dist/cjs/plugin/disabled/index.d.ts.map +1 -0
- package/dist/cjs/plugin/disabled/index.js +30 -0
- package/dist/cjs/plugin/disabled/index.js.map +1 -0
- package/dist/cjs/plugin/drainHttpServer/index.d.ts +8 -0
- package/dist/cjs/plugin/drainHttpServer/index.d.ts.map +1 -0
- package/dist/cjs/plugin/drainHttpServer/index.js +19 -0
- package/dist/cjs/plugin/drainHttpServer/index.js.map +1 -0
- package/dist/cjs/plugin/drainHttpServer/stoppable.d.ts +10 -0
- package/dist/cjs/plugin/drainHttpServer/stoppable.d.ts.map +1 -0
- package/dist/cjs/plugin/drainHttpServer/stoppable.js +54 -0
- package/dist/cjs/plugin/drainHttpServer/stoppable.js.map +1 -0
- package/dist/cjs/plugin/inlineTrace/index.d.ts +8 -0
- package/dist/cjs/plugin/inlineTrace/index.d.ts.map +1 -0
- package/dist/cjs/plugin/inlineTrace/index.js +70 -0
- package/dist/cjs/plugin/inlineTrace/index.js.map +1 -0
- package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.d.ts +4 -0
- package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.d.ts.map +1 -0
- package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.js +143 -0
- package/dist/cjs/plugin/landingPage/default/getEmbeddedHTML.js.map +1 -0
- package/dist/cjs/plugin/landingPage/default/index.d.ts +9 -0
- package/dist/cjs/plugin/landingPage/default/index.d.ts.map +1 -0
- package/dist/cjs/plugin/landingPage/default/index.js +146 -0
- package/dist/cjs/plugin/landingPage/default/index.js.map +1 -0
- package/dist/cjs/plugin/landingPage/default/types.d.ts +56 -0
- package/dist/cjs/plugin/landingPage/default/types.d.ts.map +1 -0
- package/dist/cjs/plugin/landingPage/default/types.js +3 -0
- package/dist/cjs/plugin/landingPage/default/types.js.map +1 -0
- package/dist/cjs/plugin/schemaIsSubgraph.d.ts +3 -0
- package/dist/cjs/plugin/schemaIsSubgraph.d.ts.map +1 -0
- package/dist/cjs/plugin/schemaIsSubgraph.js +23 -0
- package/dist/cjs/plugin/schemaIsSubgraph.js.map +1 -0
- package/dist/cjs/plugin/schemaReporting/index.d.ts +10 -0
- package/dist/cjs/plugin/schemaReporting/index.d.ts.map +1 -0
- package/dist/cjs/plugin/schemaReporting/index.js +104 -0
- package/dist/cjs/plugin/schemaReporting/index.js.map +1 -0
- package/dist/cjs/plugin/schemaReporting/schemaReporter.d.ts +33 -0
- package/dist/cjs/plugin/schemaReporting/schemaReporter.d.ts.map +1 -0
- package/dist/cjs/plugin/schemaReporting/schemaReporter.js +147 -0
- package/dist/cjs/plugin/schemaReporting/schemaReporter.js.map +1 -0
- package/dist/cjs/plugin/subscriptionCallback/index.d.ts +12 -0
- package/dist/cjs/plugin/subscriptionCallback/index.d.ts.map +1 -0
- package/dist/cjs/plugin/subscriptionCallback/index.js +434 -0
- package/dist/cjs/plugin/subscriptionCallback/index.js.map +1 -0
- package/dist/cjs/plugin/traceTreeBuilder.d.ts +25 -0
- package/dist/cjs/plugin/traceTreeBuilder.d.ts.map +1 -0
- package/dist/cjs/plugin/traceTreeBuilder.js +201 -0
- package/dist/cjs/plugin/traceTreeBuilder.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts +3 -0
- package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.js +44 -0
- package/dist/cjs/plugin/usageReporting/defaultSendOperationsAsTrace.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/durationHistogram.d.ts +16 -0
- package/dist/cjs/plugin/usageReporting/durationHistogram.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/durationHistogram.js +68 -0
- package/dist/cjs/plugin/usageReporting/durationHistogram.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/index.d.ts +3 -0
- package/dist/cjs/plugin/usageReporting/index.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/index.js +6 -0
- package/dist/cjs/plugin/usageReporting/index.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/iterateOverTrace.d.ts +7 -0
- package/dist/cjs/plugin/usageReporting/iterateOverTrace.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/iterateOverTrace.js +81 -0
- package/dist/cjs/plugin/usageReporting/iterateOverTrace.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.d.ts +12 -0
- package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.js +33 -0
- package/dist/cjs/plugin/usageReporting/operationDerivedDataCache.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/options.d.ts +60 -0
- package/dist/cjs/plugin/usageReporting/options.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/options.js +3 -0
- package/dist/cjs/plugin/usageReporting/options.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/plugin.d.ts +7 -0
- package/dist/cjs/plugin/usageReporting/plugin.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/plugin.js +494 -0
- package/dist/cjs/plugin/usageReporting/plugin.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/stats.d.ts +96 -0
- package/dist/cjs/plugin/usageReporting/stats.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/stats.js +289 -0
- package/dist/cjs/plugin/usageReporting/stats.js.map +1 -0
- package/dist/cjs/plugin/usageReporting/traceDetails.d.ts +4 -0
- package/dist/cjs/plugin/usageReporting/traceDetails.d.ts.map +1 -0
- package/dist/cjs/plugin/usageReporting/traceDetails.js +63 -0
- package/dist/cjs/plugin/usageReporting/traceDetails.js.map +1 -0
- package/dist/cjs/preventCsrf.d.ts +4 -0
- package/dist/cjs/preventCsrf.d.ts.map +1 -0
- package/dist/cjs/preventCsrf.js +41 -0
- package/dist/cjs/preventCsrf.js.map +1 -0
- package/dist/cjs/requestPipeline.d.ts +9 -0
- package/dist/cjs/requestPipeline.d.ts.map +1 -0
- package/dist/cjs/requestPipeline.js +371 -0
- package/dist/cjs/requestPipeline.js.map +1 -0
- package/dist/cjs/runHttpQuery.d.ts +15 -0
- package/dist/cjs/runHttpQuery.d.ts.map +1 -0
- package/dist/cjs/runHttpQuery.js +230 -0
- package/dist/cjs/runHttpQuery.js.map +1 -0
- package/dist/cjs/standalone/index.d.ts +25 -0
- package/dist/cjs/standalone/index.d.ts.map +1 -0
- package/dist/cjs/standalone/index.js +97 -0
- package/dist/cjs/standalone/index.js.map +1 -0
- package/dist/cjs/utils/HeaderMap.d.ts +8 -0
- package/dist/cjs/utils/HeaderMap.d.ts.map +1 -0
- package/dist/cjs/utils/HeaderMap.js +20 -0
- package/dist/cjs/utils/HeaderMap.js.map +1 -0
- package/dist/cjs/utils/UnreachableCaseError.d.ts +4 -0
- package/dist/cjs/utils/UnreachableCaseError.d.ts.map +1 -0
- package/dist/cjs/utils/UnreachableCaseError.js +10 -0
- package/dist/cjs/utils/UnreachableCaseError.js.map +1 -0
- package/dist/cjs/utils/computeCoreSchemaHash.d.ts +2 -0
- package/dist/cjs/utils/computeCoreSchemaHash.d.ts.map +1 -0
- package/dist/cjs/utils/computeCoreSchemaHash.js +8 -0
- package/dist/cjs/utils/computeCoreSchemaHash.js.map +1 -0
- package/dist/cjs/utils/invokeHooks.d.ts +7 -0
- package/dist/cjs/utils/invokeHooks.d.ts.map +1 -0
- package/dist/cjs/utils/invokeHooks.js +36 -0
- package/dist/cjs/utils/invokeHooks.js.map +1 -0
- package/dist/cjs/utils/isDefined.d.ts +2 -0
- package/dist/cjs/utils/isDefined.d.ts.map +1 -0
- package/dist/cjs/utils/isDefined.js +7 -0
- package/dist/cjs/utils/isDefined.js.map +1 -0
- package/dist/cjs/utils/makeGatewayGraphQLRequestContext.d.ts +5 -0
- package/dist/cjs/utils/makeGatewayGraphQLRequestContext.d.ts.map +1 -0
- package/dist/cjs/utils/makeGatewayGraphQLRequestContext.js +96 -0
- package/dist/cjs/utils/makeGatewayGraphQLRequestContext.js.map +1 -0
- package/dist/cjs/utils/resolvable.d.ts +7 -0
- package/dist/cjs/utils/resolvable.d.ts.map +1 -0
- package/dist/cjs/utils/resolvable.js +14 -0
- package/dist/cjs/utils/resolvable.js.map +1 -0
- package/dist/cjs/utils/schemaInstrumentation.d.ts +16 -0
- package/dist/cjs/utils/schemaInstrumentation.d.ts.map +1 -0
- package/dist/cjs/utils/schemaInstrumentation.js +75 -0
- package/dist/cjs/utils/schemaInstrumentation.js.map +1 -0
- package/dist/cjs/utils/schemaManager.d.ts +31 -0
- package/dist/cjs/utils/schemaManager.d.ts.map +1 -0
- package/dist/cjs/utils/schemaManager.js +103 -0
- package/dist/cjs/utils/schemaManager.js.map +1 -0
- package/dist/cjs/utils/urlForHttpServer.d.ts +3 -0
- package/dist/cjs/utils/urlForHttpServer.d.ts.map +1 -0
- package/dist/cjs/utils/urlForHttpServer.js +15 -0
- package/dist/cjs/utils/urlForHttpServer.js.map +1 -0
- package/dist/cjs/validationRules/NoIntrospection.d.ts +3 -0
- package/dist/cjs/validationRules/NoIntrospection.d.ts.map +1 -0
- package/dist/cjs/validationRules/NoIntrospection.js +19 -0
- package/dist/cjs/validationRules/NoIntrospection.js.map +1 -0
- package/dist/cjs/validationRules/RecursiveSelectionsLimit.d.ts +4 -0
- package/dist/cjs/validationRules/RecursiveSelectionsLimit.d.ts.map +1 -0
- package/dist/cjs/validationRules/RecursiveSelectionsLimit.js +150 -0
- package/dist/cjs/validationRules/RecursiveSelectionsLimit.js.map +1 -0
- package/dist/cjs/validationRules/index.d.ts +3 -0
- package/dist/cjs/validationRules/index.d.ts.map +1 -0
- package/dist/cjs/validationRules/index.js +9 -0
- package/dist/cjs/validationRules/index.js.map +1 -0
- package/dist/esm/ApolloServer.d.ts +126 -0
- package/dist/esm/ApolloServer.d.ts.map +1 -0
- package/dist/esm/ApolloServer.js +683 -0
- package/dist/esm/ApolloServer.js.map +1 -0
- package/dist/esm/cachePolicy.d.ts +3 -0
- package/dist/esm/cachePolicy.d.ts.map +1 -0
- package/dist/esm/cachePolicy.js +30 -0
- package/dist/esm/cachePolicy.js.map +1 -0
- package/dist/esm/determineApolloConfig.d.ts +4 -0
- package/dist/esm/determineApolloConfig.d.ts.map +1 -0
- package/dist/esm/determineApolloConfig.js +55 -0
- package/dist/esm/determineApolloConfig.js.map +1 -0
- package/dist/esm/errorNormalize.d.ts +12 -0
- package/dist/esm/errorNormalize.d.ts.map +1 -0
- package/dist/esm/errorNormalize.js +66 -0
- package/dist/esm/errorNormalize.js.map +1 -0
- package/dist/esm/errors/index.d.ts +16 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/errors/index.js +24 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/externalTypes/constructor.d.ts +78 -0
- package/dist/esm/externalTypes/constructor.d.ts.map +1 -0
- package/dist/esm/externalTypes/constructor.js +2 -0
- package/dist/esm/externalTypes/constructor.js.map +1 -0
- package/dist/esm/externalTypes/context.d.ts +4 -0
- package/dist/esm/externalTypes/context.d.ts.map +1 -0
- package/dist/esm/externalTypes/context.js +2 -0
- package/dist/esm/externalTypes/context.js.map +1 -0
- package/dist/esm/externalTypes/graphql.d.ts +41 -0
- package/dist/esm/externalTypes/graphql.d.ts.map +1 -0
- package/dist/esm/externalTypes/graphql.js +2 -0
- package/dist/esm/externalTypes/graphql.js.map +1 -0
- package/dist/esm/externalTypes/http.d.ts +22 -0
- package/dist/esm/externalTypes/http.d.ts.map +1 -0
- package/dist/esm/externalTypes/http.js +2 -0
- package/dist/esm/externalTypes/http.js.map +1 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts +28 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.d.ts.map +1 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.js +2 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha2.js.map +1 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts +43 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.d.ts.map +1 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.js +2 -0
- package/dist/esm/externalTypes/incrementalDeliveryPolyfillAlpha9.js.map +1 -0
- package/dist/esm/externalTypes/index.d.ts +9 -0
- package/dist/esm/externalTypes/index.d.ts.map +1 -0
- package/dist/esm/externalTypes/index.js +2 -0
- package/dist/esm/externalTypes/index.js.map +1 -0
- package/dist/esm/externalTypes/plugins.d.ts +75 -0
- package/dist/esm/externalTypes/plugins.d.ts.map +1 -0
- package/dist/esm/externalTypes/plugins.js +2 -0
- package/dist/esm/externalTypes/plugins.js.map +1 -0
- package/dist/esm/externalTypes/requestPipeline.d.ts +50 -0
- package/dist/esm/externalTypes/requestPipeline.d.ts.map +1 -0
- package/dist/esm/externalTypes/requestPipeline.js +2 -0
- package/dist/esm/externalTypes/requestPipeline.js.map +1 -0
- package/dist/esm/generated/packageVersion.d.ts +2 -0
- package/dist/esm/generated/packageVersion.d.ts.map +1 -0
- package/dist/esm/generated/packageVersion.js +2 -0
- package/dist/esm/generated/packageVersion.js.map +1 -0
- package/dist/esm/httpBatching.d.ts +4 -0
- package/dist/esm/httpBatching.d.ts.map +1 -0
- package/dist/esm/httpBatching.js +55 -0
- package/dist/esm/httpBatching.js.map +1 -0
- package/dist/esm/incrementalDeliveryPolyfill.d.ts +82 -0
- package/dist/esm/incrementalDeliveryPolyfill.d.ts.map +1 -0
- package/dist/esm/incrementalDeliveryPolyfill.js +38 -0
- package/dist/esm/incrementalDeliveryPolyfill.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internalErrorClasses.d.ts +28 -0
- package/dist/esm/internalErrorClasses.d.ts.map +1 -0
- package/dist/esm/internalErrorClasses.js +81 -0
- package/dist/esm/internalErrorClasses.js.map +1 -0
- package/dist/esm/internalPlugin.d.ts +9 -0
- package/dist/esm/internalPlugin.d.ts.map +1 -0
- package/dist/esm/internalPlugin.js +7 -0
- package/dist/esm/internalPlugin.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/plugin/cacheControl/index.d.ts +9 -0
- package/dist/esm/plugin/cacheControl/index.d.ts.map +1 -0
- package/dist/esm/plugin/cacheControl/index.js +220 -0
- package/dist/esm/plugin/cacheControl/index.js.map +1 -0
- package/dist/esm/plugin/disableSuggestions/index.d.ts +3 -0
- package/dist/esm/plugin/disableSuggestions/index.d.ts.map +1 -0
- package/dist/esm/plugin/disableSuggestions/index.js +19 -0
- package/dist/esm/plugin/disableSuggestions/index.js.map +1 -0
- package/dist/esm/plugin/disabled/index.d.ts +7 -0
- package/dist/esm/plugin/disabled/index.d.ts.map +1 -0
- package/dist/esm/plugin/disabled/index.js +23 -0
- package/dist/esm/plugin/disabled/index.js.map +1 -0
- package/dist/esm/plugin/drainHttpServer/index.d.ts +8 -0
- package/dist/esm/plugin/drainHttpServer/index.d.ts.map +1 -0
- package/dist/esm/plugin/drainHttpServer/index.js +16 -0
- package/dist/esm/plugin/drainHttpServer/index.js.map +1 -0
- package/dist/esm/plugin/drainHttpServer/stoppable.d.ts +10 -0
- package/dist/esm/plugin/drainHttpServer/stoppable.d.ts.map +1 -0
- package/dist/esm/plugin/drainHttpServer/stoppable.js +47 -0
- package/dist/esm/plugin/drainHttpServer/stoppable.js.map +1 -0
- package/dist/esm/plugin/inlineTrace/index.d.ts +8 -0
- package/dist/esm/plugin/inlineTrace/index.d.ts.map +1 -0
- package/dist/esm/plugin/inlineTrace/index.js +67 -0
- package/dist/esm/plugin/inlineTrace/index.js.map +1 -0
- package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.d.ts +4 -0
- package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.d.ts.map +1 -0
- package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.js +138 -0
- package/dist/esm/plugin/landingPage/default/getEmbeddedHTML.js.map +1 -0
- package/dist/esm/plugin/landingPage/default/index.d.ts +9 -0
- package/dist/esm/plugin/landingPage/default/index.d.ts.map +1 -0
- package/dist/esm/plugin/landingPage/default/index.js +141 -0
- package/dist/esm/plugin/landingPage/default/index.js.map +1 -0
- package/dist/esm/plugin/landingPage/default/types.d.ts +56 -0
- package/dist/esm/plugin/landingPage/default/types.d.ts.map +1 -0
- package/dist/esm/plugin/landingPage/default/types.js +2 -0
- package/dist/esm/plugin/landingPage/default/types.js.map +1 -0
- package/dist/esm/plugin/schemaIsSubgraph.d.ts +3 -0
- package/dist/esm/plugin/schemaIsSubgraph.d.ts.map +1 -0
- package/dist/esm/plugin/schemaIsSubgraph.js +20 -0
- package/dist/esm/plugin/schemaIsSubgraph.js.map +1 -0
- package/dist/esm/plugin/schemaReporting/index.d.ts +10 -0
- package/dist/esm/plugin/schemaReporting/index.d.ts.map +1 -0
- package/dist/esm/plugin/schemaReporting/index.js +98 -0
- package/dist/esm/plugin/schemaReporting/index.js.map +1 -0
- package/dist/esm/plugin/schemaReporting/schemaReporter.d.ts +33 -0
- package/dist/esm/plugin/schemaReporting/schemaReporter.d.ts.map +1 -0
- package/dist/esm/plugin/schemaReporting/schemaReporter.js +143 -0
- package/dist/esm/plugin/schemaReporting/schemaReporter.js.map +1 -0
- package/dist/esm/plugin/subscriptionCallback/index.d.ts +12 -0
- package/dist/esm/plugin/subscriptionCallback/index.d.ts.map +1 -0
- package/dist/esm/plugin/subscriptionCallback/index.js +428 -0
- package/dist/esm/plugin/subscriptionCallback/index.js.map +1 -0
- package/dist/esm/plugin/traceTreeBuilder.d.ts +25 -0
- package/dist/esm/plugin/traceTreeBuilder.d.ts.map +1 -0
- package/dist/esm/plugin/traceTreeBuilder.js +196 -0
- package/dist/esm/plugin/traceTreeBuilder.js.map +1 -0
- package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts +3 -0
- package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.js +41 -0
- package/dist/esm/plugin/usageReporting/defaultSendOperationsAsTrace.js.map +1 -0
- package/dist/esm/plugin/usageReporting/durationHistogram.d.ts +16 -0
- package/dist/esm/plugin/usageReporting/durationHistogram.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/durationHistogram.js +64 -0
- package/dist/esm/plugin/usageReporting/durationHistogram.js.map +1 -0
- package/dist/esm/plugin/usageReporting/index.d.ts +3 -0
- package/dist/esm/plugin/usageReporting/index.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/index.js +2 -0
- package/dist/esm/plugin/usageReporting/index.js.map +1 -0
- package/dist/esm/plugin/usageReporting/iterateOverTrace.d.ts +7 -0
- package/dist/esm/plugin/usageReporting/iterateOverTrace.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/iterateOverTrace.js +78 -0
- package/dist/esm/plugin/usageReporting/iterateOverTrace.js.map +1 -0
- package/dist/esm/plugin/usageReporting/operationDerivedDataCache.d.ts +12 -0
- package/dist/esm/plugin/usageReporting/operationDerivedDataCache.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/operationDerivedDataCache.js +29 -0
- package/dist/esm/plugin/usageReporting/operationDerivedDataCache.js.map +1 -0
- package/dist/esm/plugin/usageReporting/options.d.ts +60 -0
- package/dist/esm/plugin/usageReporting/options.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/options.js +2 -0
- package/dist/esm/plugin/usageReporting/options.js.map +1 -0
- package/dist/esm/plugin/usageReporting/plugin.d.ts +7 -0
- package/dist/esm/plugin/usageReporting/plugin.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/plugin.js +487 -0
- package/dist/esm/plugin/usageReporting/plugin.js.map +1 -0
- package/dist/esm/plugin/usageReporting/stats.d.ts +96 -0
- package/dist/esm/plugin/usageReporting/stats.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/stats.js +283 -0
- package/dist/esm/plugin/usageReporting/stats.js.map +1 -0
- package/dist/esm/plugin/usageReporting/traceDetails.d.ts +4 -0
- package/dist/esm/plugin/usageReporting/traceDetails.d.ts.map +1 -0
- package/dist/esm/plugin/usageReporting/traceDetails.js +60 -0
- package/dist/esm/plugin/usageReporting/traceDetails.js.map +1 -0
- package/dist/esm/preventCsrf.d.ts +4 -0
- package/dist/esm/preventCsrf.d.ts.map +1 -0
- package/dist/esm/preventCsrf.js +34 -0
- package/dist/esm/preventCsrf.js.map +1 -0
- package/dist/esm/requestPipeline.d.ts +9 -0
- package/dist/esm/requestPipeline.d.ts.map +1 -0
- package/dist/esm/requestPipeline.js +364 -0
- package/dist/esm/requestPipeline.js.map +1 -0
- package/dist/esm/runHttpQuery.d.ts +15 -0
- package/dist/esm/runHttpQuery.d.ts.map +1 -0
- package/dist/esm/runHttpQuery.js +221 -0
- package/dist/esm/runHttpQuery.js.map +1 -0
- package/dist/esm/standalone/index.d.ts +25 -0
- package/dist/esm/standalone/index.d.ts.map +1 -0
- package/dist/esm/standalone/index.js +91 -0
- package/dist/esm/standalone/index.js.map +1 -0
- package/dist/esm/utils/HeaderMap.d.ts +8 -0
- package/dist/esm/utils/HeaderMap.d.ts.map +1 -0
- package/dist/esm/utils/HeaderMap.js +16 -0
- package/dist/esm/utils/HeaderMap.js.map +1 -0
- package/dist/esm/utils/UnreachableCaseError.d.ts +4 -0
- package/dist/esm/utils/UnreachableCaseError.d.ts.map +1 -0
- package/dist/esm/utils/UnreachableCaseError.js +6 -0
- package/dist/esm/utils/UnreachableCaseError.js.map +1 -0
- package/dist/esm/utils/computeCoreSchemaHash.d.ts +2 -0
- package/dist/esm/utils/computeCoreSchemaHash.d.ts.map +1 -0
- package/dist/esm/utils/computeCoreSchemaHash.js +5 -0
- package/dist/esm/utils/computeCoreSchemaHash.js.map +1 -0
- package/dist/esm/utils/invokeHooks.d.ts +7 -0
- package/dist/esm/utils/invokeHooks.d.ts.map +1 -0
- package/dist/esm/utils/invokeHooks.js +31 -0
- package/dist/esm/utils/invokeHooks.js.map +1 -0
- package/dist/esm/utils/isDefined.d.ts +2 -0
- package/dist/esm/utils/isDefined.d.ts.map +1 -0
- package/dist/esm/utils/isDefined.js +4 -0
- package/dist/esm/utils/isDefined.js.map +1 -0
- package/dist/esm/utils/makeGatewayGraphQLRequestContext.d.ts +5 -0
- package/dist/esm/utils/makeGatewayGraphQLRequestContext.d.ts.map +1 -0
- package/dist/esm/utils/makeGatewayGraphQLRequestContext.js +93 -0
- package/dist/esm/utils/makeGatewayGraphQLRequestContext.js.map +1 -0
- package/dist/esm/utils/resolvable.d.ts +7 -0
- package/dist/esm/utils/resolvable.d.ts.map +1 -0
- package/dist/esm/utils/resolvable.js +12 -0
- package/dist/esm/utils/resolvable.js.map +1 -0
- package/dist/esm/utils/schemaInstrumentation.d.ts +16 -0
- package/dist/esm/utils/schemaInstrumentation.d.ts.map +1 -0
- package/dist/esm/utils/schemaInstrumentation.js +69 -0
- package/dist/esm/utils/schemaInstrumentation.js.map +1 -0
- package/dist/esm/utils/schemaManager.d.ts +31 -0
- package/dist/esm/utils/schemaManager.d.ts.map +1 -0
- package/dist/esm/utils/schemaManager.js +99 -0
- package/dist/esm/utils/schemaManager.js.map +1 -0
- package/dist/esm/utils/urlForHttpServer.d.ts +3 -0
- package/dist/esm/utils/urlForHttpServer.d.ts.map +1 -0
- package/dist/esm/utils/urlForHttpServer.js +12 -0
- package/dist/esm/utils/urlForHttpServer.js.map +1 -0
- package/dist/esm/validationRules/NoIntrospection.d.ts +3 -0
- package/dist/esm/validationRules/NoIntrospection.d.ts.map +1 -0
- package/dist/esm/validationRules/NoIntrospection.js +15 -0
- package/dist/esm/validationRules/NoIntrospection.js.map +1 -0
- package/dist/esm/validationRules/RecursiveSelectionsLimit.d.ts +4 -0
- package/dist/esm/validationRules/RecursiveSelectionsLimit.d.ts.map +1 -0
- package/dist/esm/validationRules/RecursiveSelectionsLimit.js +146 -0
- package/dist/esm/validationRules/RecursiveSelectionsLimit.js.map +1 -0
- package/dist/esm/validationRules/index.d.ts +3 -0
- package/dist/esm/validationRules/index.d.ts.map +1 -0
- package/dist/esm/validationRules/index.js +3 -0
- package/dist/esm/validationRules/index.js.map +1 -0
- package/errors/package.json +8 -0
- package/package.json +208 -0
- package/plugin/cacheControl/package.json +8 -0
- package/plugin/disableSuggestions/package.json +8 -0
- package/plugin/disabled/package.json +8 -0
- package/plugin/drainHttpServer/package.json +8 -0
- package/plugin/inlineTrace/package.json +8 -0
- package/plugin/landingPage/default/package.json +8 -0
- package/plugin/schemaReporting/package.json +8 -0
- package/plugin/subscriptionCallback/package.json +8 -0
- package/plugin/usageReporting/package.json +8 -0
- package/src/ApolloServer.ts +1456 -0
- package/src/cachePolicy.ts +33 -0
- package/src/determineApolloConfig.ts +95 -0
- package/src/errorNormalize.ts +114 -0
- package/src/errors/index.ts +33 -0
- package/src/externalTypes/constructor.ts +174 -0
- package/src/externalTypes/context.ts +18 -0
- package/src/externalTypes/graphql.ts +81 -0
- package/src/externalTypes/http.ts +44 -0
- package/src/externalTypes/incrementalDeliveryPolyfillAlpha2.ts +63 -0
- package/src/externalTypes/incrementalDeliveryPolyfillAlpha9.ts +82 -0
- package/src/externalTypes/index.ts +73 -0
- package/src/externalTypes/plugins.ts +222 -0
- package/src/externalTypes/requestPipeline.ts +123 -0
- package/src/generated/packageVersion.ts +1 -0
- package/src/httpBatching.ts +105 -0
- package/src/incrementalDeliveryPolyfill.ts +253 -0
- package/src/index.ts +4 -0
- package/src/internalErrorClasses.ts +123 -0
- package/src/internalPlugin.ts +42 -0
- package/src/plugin/cacheControl/index.ts +453 -0
- package/src/plugin/disableSuggestions/index.ts +23 -0
- package/src/plugin/disabled/index.ts +41 -0
- package/src/plugin/drainHttpServer/index.ts +42 -0
- package/src/plugin/drainHttpServer/stoppable.ts +109 -0
- package/src/plugin/inlineTrace/index.ts +156 -0
- package/src/plugin/landingPage/default/getEmbeddedHTML.ts +204 -0
- package/src/plugin/landingPage/default/index.ts +219 -0
- package/src/plugin/landingPage/default/types.ts +198 -0
- package/src/plugin/schemaIsSubgraph.ts +41 -0
- package/src/plugin/schemaReporting/generated/operations.d.ts +18359 -0
- package/src/plugin/schemaReporting/index.ts +198 -0
- package/src/plugin/schemaReporting/schemaReporter.ts +207 -0
- package/src/plugin/subscriptionCallback/index.ts +724 -0
- package/src/plugin/traceTreeBuilder.ts +356 -0
- package/src/plugin/usageReporting/defaultSendOperationsAsTrace.ts +74 -0
- package/src/plugin/usageReporting/durationHistogram.ts +87 -0
- package/src/plugin/usageReporting/index.ts +9 -0
- package/src/plugin/usageReporting/iterateOverTrace.ts +140 -0
- package/src/plugin/usageReporting/operationDerivedDataCache.ts +61 -0
- package/src/plugin/usageReporting/options.ts +414 -0
- package/src/plugin/usageReporting/plugin.ts +871 -0
- package/src/plugin/usageReporting/stats.ts +492 -0
- package/src/plugin/usageReporting/traceDetails.ts +96 -0
- package/src/preventCsrf.ts +99 -0
- package/src/requestPipeline.ts +821 -0
- package/src/runHttpQuery.ts +408 -0
- package/src/standalone/index.ts +155 -0
- package/src/utils/HeaderMap.ts +22 -0
- package/src/utils/UnreachableCaseError.ts +10 -0
- package/src/utils/computeCoreSchemaHash.ts +9 -0
- package/src/utils/invokeHooks.ts +53 -0
- package/src/utils/isDefined.ts +3 -0
- package/src/utils/makeGatewayGraphQLRequestContext.ts +197 -0
- package/src/utils/resolvable.ts +30 -0
- package/src/utils/schemaInstrumentation.ts +132 -0
- package/src/utils/schemaManager.ts +212 -0
- package/src/utils/urlForHttpServer.ts +21 -0
- package/src/validationRules/NoIntrospection.ts +27 -0
- package/src/validationRules/RecursiveSelectionsLimit.ts +198 -0
- package/src/validationRules/index.ts +5 -0
- package/standalone/package.json +8 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { FormattedExecutionResult, GraphQLFormattedError } from 'graphql';
|
|
2
|
+
|
|
3
|
+
// This file defines types used in our public interface that will be imported
|
|
4
|
+
// from `graphql-js` once graphql 17 is released. It is possible that these
|
|
5
|
+
// types will change slightly before the final v17 is released, in which case
|
|
6
|
+
// the relevant parts of our API may change incompatibly in a minor version of
|
|
7
|
+
// AS5; this should not affect any users who aren't explicitly installing
|
|
8
|
+
// pre-releases of graphql 17.
|
|
9
|
+
|
|
10
|
+
interface ObjMap<T> {
|
|
11
|
+
[key: string]: T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha9<
|
|
15
|
+
TData = ObjMap<unknown>,
|
|
16
|
+
TExtensions = ObjMap<unknown>,
|
|
17
|
+
> extends FormattedExecutionResult<TData, TExtensions> {
|
|
18
|
+
data: TData;
|
|
19
|
+
pending: ReadonlyArray<GraphQLExperimentalPendingResultAlpha9>;
|
|
20
|
+
hasNext: boolean;
|
|
21
|
+
extensions?: TExtensions;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha9<
|
|
25
|
+
TData = ObjMap<unknown>,
|
|
26
|
+
TExtensions = ObjMap<unknown>,
|
|
27
|
+
> {
|
|
28
|
+
hasNext: boolean;
|
|
29
|
+
pending?: ReadonlyArray<GraphQLExperimentalPendingResultAlpha9>;
|
|
30
|
+
incremental?: ReadonlyArray<
|
|
31
|
+
GraphQLExperimentalFormattedIncrementalResultAlpha9<TData, TExtensions>
|
|
32
|
+
>;
|
|
33
|
+
completed?: ReadonlyArray<GraphQLExperimentalFormattedCompletedResultAlpha9>;
|
|
34
|
+
extensions?: TExtensions;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type GraphQLExperimentalFormattedIncrementalResultAlpha9<
|
|
38
|
+
TData = ObjMap<unknown>,
|
|
39
|
+
TExtensions = ObjMap<unknown>,
|
|
40
|
+
> =
|
|
41
|
+
| GraphQLExperimentalFormattedIncrementalDeferResultAlpha9<TData, TExtensions>
|
|
42
|
+
| GraphQLExperimentalFormattedIncrementalStreamResultAlpha9<
|
|
43
|
+
TData,
|
|
44
|
+
TExtensions
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
export interface GraphQLExperimentalFormattedIncrementalDeferResultAlpha9<
|
|
48
|
+
TData = ObjMap<unknown>,
|
|
49
|
+
TExtensions = ObjMap<unknown>,
|
|
50
|
+
> {
|
|
51
|
+
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
52
|
+
data: TData;
|
|
53
|
+
id: string;
|
|
54
|
+
subPath?: ReadonlyArray<string | number>;
|
|
55
|
+
extensions?: TExtensions;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GraphQLExperimentalFormattedIncrementalStreamResultAlpha9<
|
|
59
|
+
TData = Array<unknown>,
|
|
60
|
+
TExtensions = ObjMap<unknown>,
|
|
61
|
+
> {
|
|
62
|
+
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
63
|
+
items: TData;
|
|
64
|
+
id: string;
|
|
65
|
+
subPath?: ReadonlyArray<string | number>;
|
|
66
|
+
extensions?: TExtensions;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GraphQLExperimentalPendingResultAlpha9 {
|
|
70
|
+
id: string;
|
|
71
|
+
path: ReadonlyArray<string | number>;
|
|
72
|
+
label?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Deviation. The type implemented in alpha.9 is wrong. The type below is the
|
|
76
|
+
// correct type implementation. We may or may not need to provide a patch.
|
|
77
|
+
//
|
|
78
|
+
// This has been fixed by https://github.com/graphql/graphql-js/pull/4481
|
|
79
|
+
export interface GraphQLExperimentalFormattedCompletedResultAlpha9 {
|
|
80
|
+
id: string;
|
|
81
|
+
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file represents the external type definitions needed by end users,
|
|
3
|
+
* integration implementors, and plugin implementors. Everything from this file
|
|
4
|
+
* is re-exported by the root (via * export), so add exports to this file with
|
|
5
|
+
* intention (it's public API).
|
|
6
|
+
*/
|
|
7
|
+
export type { BaseContext, ContextFunction, ContextThunk } from './context.js';
|
|
8
|
+
export type {
|
|
9
|
+
GraphQLRequest,
|
|
10
|
+
GraphQLResponse,
|
|
11
|
+
LegacyExperimentalExecuteIncrementally,
|
|
12
|
+
} from './graphql.js';
|
|
13
|
+
export type {
|
|
14
|
+
HTTPGraphQLRequest,
|
|
15
|
+
HTTPGraphQLResponse,
|
|
16
|
+
HTTPGraphQLHead,
|
|
17
|
+
} from './http.js';
|
|
18
|
+
export type {
|
|
19
|
+
ApolloServerPlugin,
|
|
20
|
+
GraphQLFieldResolverParams,
|
|
21
|
+
GraphQLRequestExecutionListener,
|
|
22
|
+
GraphQLRequestListener,
|
|
23
|
+
GraphQLRequestListenerDidResolveField,
|
|
24
|
+
GraphQLRequestListenerExecutionDidEnd,
|
|
25
|
+
GraphQLRequestListenerParsingDidEnd,
|
|
26
|
+
GraphQLRequestListenerValidationDidEnd,
|
|
27
|
+
GraphQLSchemaContext,
|
|
28
|
+
GraphQLServerListener,
|
|
29
|
+
GraphQLServerContext,
|
|
30
|
+
LandingPage,
|
|
31
|
+
} from './plugins.js';
|
|
32
|
+
export type {
|
|
33
|
+
GraphQLRequestContext,
|
|
34
|
+
GraphQLRequestMetrics,
|
|
35
|
+
GraphQLRequestContextDidEncounterErrors,
|
|
36
|
+
GraphQLRequestContextDidResolveOperation,
|
|
37
|
+
GraphQLRequestContextDidResolveSource,
|
|
38
|
+
GraphQLRequestContextExecutionDidStart,
|
|
39
|
+
GraphQLRequestContextParsingDidStart,
|
|
40
|
+
GraphQLRequestContextResponseForOperation,
|
|
41
|
+
GraphQLRequestContextValidationDidStart,
|
|
42
|
+
GraphQLRequestContextWillSendResponse,
|
|
43
|
+
} from './requestPipeline.js';
|
|
44
|
+
export type {
|
|
45
|
+
DocumentStore,
|
|
46
|
+
ApolloConfigInput,
|
|
47
|
+
ApolloConfig,
|
|
48
|
+
PersistedQueryOptions,
|
|
49
|
+
CSRFPreventionOptions,
|
|
50
|
+
ApolloServerOptionsWithSchema,
|
|
51
|
+
ApolloServerOptionsWithTypeDefs,
|
|
52
|
+
ApolloServerOptionsWithStaticSchema,
|
|
53
|
+
ApolloServerOptionsWithGateway,
|
|
54
|
+
ApolloServerOptions,
|
|
55
|
+
} from './constructor.js';
|
|
56
|
+
|
|
57
|
+
export type {
|
|
58
|
+
GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha2,
|
|
59
|
+
GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha2,
|
|
60
|
+
GraphQLExperimentalFormattedIncrementalResultAlpha2,
|
|
61
|
+
GraphQLExperimentalFormattedIncrementalDeferResultAlpha2,
|
|
62
|
+
GraphQLExperimentalFormattedIncrementalStreamResultAlpha2,
|
|
63
|
+
} from './incrementalDeliveryPolyfillAlpha2.js';
|
|
64
|
+
|
|
65
|
+
export type {
|
|
66
|
+
GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha9,
|
|
67
|
+
GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha9,
|
|
68
|
+
GraphQLExperimentalFormattedIncrementalStreamResultAlpha9,
|
|
69
|
+
GraphQLExperimentalFormattedIncrementalDeferResultAlpha9,
|
|
70
|
+
GraphQLExperimentalFormattedCompletedResultAlpha9,
|
|
71
|
+
GraphQLExperimentalFormattedIncrementalResultAlpha9,
|
|
72
|
+
GraphQLExperimentalPendingResultAlpha9,
|
|
73
|
+
} from './incrementalDeliveryPolyfillAlpha9.js';
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types defined in this file are useful to plugin authors. In particular,
|
|
3
|
+
* defining a plugin as an `ApolloServerPlugin` will provide typings for all of
|
|
4
|
+
* the hooks that are available to a plugin.
|
|
5
|
+
*/
|
|
6
|
+
import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
|
|
7
|
+
import type { Logger } from '@apollo/utils.logger';
|
|
8
|
+
import type { GraphQLError, GraphQLResolveInfo, GraphQLSchema } from 'graphql';
|
|
9
|
+
import type { ApolloConfig } from './constructor.js';
|
|
10
|
+
import type { BaseContext } from './context.js';
|
|
11
|
+
import type { GraphQLResponse } from './graphql.js';
|
|
12
|
+
import type { GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha2 } from './incrementalDeliveryPolyfillAlpha2.js';
|
|
13
|
+
import type {
|
|
14
|
+
GraphQLRequestContext,
|
|
15
|
+
GraphQLRequestContextDidEncounterErrors,
|
|
16
|
+
GraphQLRequestContextDidEncounterSubsequentErrors,
|
|
17
|
+
GraphQLRequestContextDidResolveOperation,
|
|
18
|
+
GraphQLRequestContextDidResolveSource,
|
|
19
|
+
GraphQLRequestContextExecutionDidStart,
|
|
20
|
+
GraphQLRequestContextParsingDidStart,
|
|
21
|
+
GraphQLRequestContextResponseForOperation,
|
|
22
|
+
GraphQLRequestContextValidationDidStart,
|
|
23
|
+
GraphQLRequestContextWillSendResponse,
|
|
24
|
+
GraphQLRequestContextWillSendSubsequentPayload,
|
|
25
|
+
} from './requestPipeline.js';
|
|
26
|
+
import type { GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha9 } from './incrementalDeliveryPolyfillAlpha9.js';
|
|
27
|
+
|
|
28
|
+
export interface GraphQLServerContext {
|
|
29
|
+
readonly logger: Logger;
|
|
30
|
+
readonly cache: KeyValueCache<string>;
|
|
31
|
+
|
|
32
|
+
schema: GraphQLSchema;
|
|
33
|
+
apollo: ApolloConfig;
|
|
34
|
+
startedInBackground: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface GraphQLSchemaContext {
|
|
38
|
+
apiSchema: GraphQLSchema;
|
|
39
|
+
coreSupergraphSdl?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ApolloServerPlugin<
|
|
43
|
+
in TContext extends BaseContext = BaseContext,
|
|
44
|
+
> {
|
|
45
|
+
// Called once on server startup, after the schema has been loaded.
|
|
46
|
+
serverWillStart?(
|
|
47
|
+
service: GraphQLServerContext,
|
|
48
|
+
): Promise<GraphQLServerListener | void>;
|
|
49
|
+
|
|
50
|
+
// Called once per request, before parsing or validation of the request has
|
|
51
|
+
// occurred. This hook can return an object of more fine-grained hooks (see
|
|
52
|
+
// `GraphQLRequestListener`) which pertain to the lifecycle of the request.
|
|
53
|
+
requestDidStart?(
|
|
54
|
+
requestContext: GraphQLRequestContext<TContext>,
|
|
55
|
+
): Promise<GraphQLRequestListener<TContext> | void>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* "Unexpected" errors do not include more common errors like validation,
|
|
59
|
+
* parsing, or graphql execution errors. Rather, an unexpected error might
|
|
60
|
+
* occur when a plugin hook throws unexpectedly or a bug in Apollo Server is
|
|
61
|
+
* encountered. Notably, when errors like this occur, the error is masked to
|
|
62
|
+
* the client.
|
|
63
|
+
*/
|
|
64
|
+
unexpectedErrorProcessingRequest?({
|
|
65
|
+
requestContext,
|
|
66
|
+
error,
|
|
67
|
+
}: {
|
|
68
|
+
requestContext: GraphQLRequestContext<TContext>;
|
|
69
|
+
error: Error;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
// Called specifically when the user-provided `context` function throws an
|
|
72
|
+
// error.
|
|
73
|
+
contextCreationDidFail?({ error }: { error: Error }): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* This hook is called any time a "Bad Request" error is thrown during request
|
|
76
|
+
* execution. This includes CSRF prevention and malformed requests (e.g.
|
|
77
|
+
* incorrect headers, invalid JSON body, or invalid search params for GET),
|
|
78
|
+
* but does not include malformed GraphQL.
|
|
79
|
+
*/
|
|
80
|
+
invalidRequestWasReceived?({ error }: { error: Error }): Promise<void>;
|
|
81
|
+
// Called on startup fail. This can occur if the schema fails to load or if a
|
|
82
|
+
// `serverWillStart` or `renderLandingPage` hook throws.
|
|
83
|
+
startupDidFail?({ error }: { error: Error }): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface GraphQLServerListener {
|
|
87
|
+
// Called on server startup after a successful schema load and on successful
|
|
88
|
+
// schema updates when running in `gateway` mode.
|
|
89
|
+
schemaDidLoadOrUpdate?(schemaContext: GraphQLSchemaContext): void;
|
|
90
|
+
|
|
91
|
+
// When your server is stopped (by calling `stop()` or via the
|
|
92
|
+
// `SIGINT`/`SIGTERM` handlers), Apollo Server first awaits all `drainServer`
|
|
93
|
+
// hooks in parallel. GraphQL operations can still execute while `drainServer`
|
|
94
|
+
// is in progress. A typical use is to stop listening for new connections and
|
|
95
|
+
// wait until all current connections are idle. The built-in
|
|
96
|
+
// ApolloServerPluginDrainHttpServer implements this method.
|
|
97
|
+
drainServer?(): Promise<void>;
|
|
98
|
+
|
|
99
|
+
// When your server is stopped (by calling `stop()` or via the
|
|
100
|
+
// `SIGINT`/`SIGTERM` handlers) then (after the `drainServer` phase finishes)
|
|
101
|
+
// Apollo Server transitions into a state where no new operations will run and
|
|
102
|
+
// then awaits all `drainServer` hooks in parallel. A typical use is to flush
|
|
103
|
+
// outstanding observability data.
|
|
104
|
+
serverWillStop?(): Promise<void>;
|
|
105
|
+
|
|
106
|
+
// At most one plugin's serverWillStart may return a GraphQLServerListener
|
|
107
|
+
// with this method. If one does, it is called once on server startup and the
|
|
108
|
+
// page it returns is served to clients with `accept: text/html` headers. This
|
|
109
|
+
// is an intentionally simple API; if you want to do something fancy to serve
|
|
110
|
+
// a landing page, you probably should just define a handler in your web
|
|
111
|
+
// framework.
|
|
112
|
+
renderLandingPage?(): Promise<LandingPage>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// The page served to clients with `accept: text/html` headers.
|
|
116
|
+
export interface LandingPage {
|
|
117
|
+
html: string | (() => Promise<string>);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type GraphQLRequestListenerParsingDidEnd = (
|
|
121
|
+
err?: Error,
|
|
122
|
+
) => Promise<void>;
|
|
123
|
+
export type GraphQLRequestListenerValidationDidEnd = (
|
|
124
|
+
err?: ReadonlyArray<Error>,
|
|
125
|
+
) => Promise<void>;
|
|
126
|
+
export type GraphQLRequestListenerExecutionDidEnd = (
|
|
127
|
+
err?: Error,
|
|
128
|
+
) => Promise<void>;
|
|
129
|
+
export type GraphQLRequestListenerDidResolveField = (
|
|
130
|
+
error: Error | null,
|
|
131
|
+
result?: any,
|
|
132
|
+
) => void;
|
|
133
|
+
|
|
134
|
+
export interface GraphQLRequestListener<TContext extends BaseContext> {
|
|
135
|
+
didResolveSource?(
|
|
136
|
+
requestContext: GraphQLRequestContextDidResolveSource<TContext>,
|
|
137
|
+
): Promise<void>;
|
|
138
|
+
|
|
139
|
+
parsingDidStart?(
|
|
140
|
+
requestContext: GraphQLRequestContextParsingDidStart<TContext>,
|
|
141
|
+
): Promise<GraphQLRequestListenerParsingDidEnd | void>;
|
|
142
|
+
|
|
143
|
+
validationDidStart?(
|
|
144
|
+
requestContext: GraphQLRequestContextValidationDidStart<TContext>,
|
|
145
|
+
): Promise<GraphQLRequestListenerValidationDidEnd | void>;
|
|
146
|
+
|
|
147
|
+
didResolveOperation?(
|
|
148
|
+
requestContext: GraphQLRequestContextDidResolveOperation<TContext>,
|
|
149
|
+
): Promise<void>;
|
|
150
|
+
|
|
151
|
+
didEncounterErrors?(
|
|
152
|
+
requestContext: GraphQLRequestContextDidEncounterErrors<TContext>,
|
|
153
|
+
): Promise<void>;
|
|
154
|
+
|
|
155
|
+
// If this hook is defined, it is invoked immediately before GraphQL execution
|
|
156
|
+
// would take place. If its return value resolves to a non-null
|
|
157
|
+
// GraphQLResponse, that result is used instead of executing the query.
|
|
158
|
+
// Hooks from different plugins are invoked in series and the first non-null
|
|
159
|
+
// response is used.
|
|
160
|
+
responseForOperation?(
|
|
161
|
+
requestContext: GraphQLRequestContextResponseForOperation<TContext>,
|
|
162
|
+
): Promise<GraphQLResponse | null>;
|
|
163
|
+
|
|
164
|
+
// Note that in the case of incremental delivery, the end hook gets called
|
|
165
|
+
// when the initial response is ready to go: further execution can still occur.
|
|
166
|
+
executionDidStart?(
|
|
167
|
+
requestContext: GraphQLRequestContextExecutionDidStart<TContext>,
|
|
168
|
+
): Promise<GraphQLRequestExecutionListener<TContext> | void>;
|
|
169
|
+
|
|
170
|
+
// Note that in the case of incremental delivery, this is called when the
|
|
171
|
+
// initial response is ready to go.
|
|
172
|
+
willSendResponse?(
|
|
173
|
+
requestContext: GraphQLRequestContextWillSendResponse<TContext>,
|
|
174
|
+
): Promise<void>;
|
|
175
|
+
|
|
176
|
+
didEncounterSubsequentErrors?(
|
|
177
|
+
requestContext: GraphQLRequestContextDidEncounterSubsequentErrors<TContext>,
|
|
178
|
+
errors: ReadonlyArray<GraphQLError>,
|
|
179
|
+
): Promise<void>;
|
|
180
|
+
|
|
181
|
+
// You can use hasNext to tell if this is the end or not.
|
|
182
|
+
willSendSubsequentPayload?(
|
|
183
|
+
requestContext: GraphQLRequestContextWillSendSubsequentPayload<TContext>,
|
|
184
|
+
payload:
|
|
185
|
+
| GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha2
|
|
186
|
+
| GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha9,
|
|
187
|
+
): Promise<void>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* This is an object form of the parameters received by typical
|
|
192
|
+
* `graphql-js` resolvers. The function type is `GraphQLFieldResolver`
|
|
193
|
+
* and normally uses positional parameters. In order to facilitate better
|
|
194
|
+
* ergonomics in the Apollo Server plugin API, these have been converted to
|
|
195
|
+
* named properties on the object using their names from the upstream
|
|
196
|
+
* `GraphQLFieldResolver` type signature. Ergonomic wins, in this case,
|
|
197
|
+
* include not needing to have three unused variables in scope just because
|
|
198
|
+
* there was a need to access the `info` property in a wrapped plugin.
|
|
199
|
+
*/
|
|
200
|
+
export type GraphQLFieldResolverParams<
|
|
201
|
+
TSource,
|
|
202
|
+
TContext,
|
|
203
|
+
TArgs = { [argName: string]: any },
|
|
204
|
+
> = {
|
|
205
|
+
source: TSource;
|
|
206
|
+
args: TArgs;
|
|
207
|
+
contextValue: TContext;
|
|
208
|
+
info: GraphQLResolveInfo;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export interface GraphQLRequestExecutionListener<TContext extends BaseContext> {
|
|
212
|
+
executionDidEnd?: GraphQLRequestListenerExecutionDidEnd;
|
|
213
|
+
// willResolveField is not async because we've observed that it already has
|
|
214
|
+
// quite a performance impact on execution even without involving the Promise
|
|
215
|
+
// queue. If we can come up with ways to alleviate the burden (eg having an
|
|
216
|
+
// uninstrumented schema and an instrumented schema and only using the
|
|
217
|
+
// instrumented schema for a subset of operations that need detailed
|
|
218
|
+
// performance traces) we could be happier supporting async willResolveField.
|
|
219
|
+
willResolveField?(
|
|
220
|
+
fieldResolverParams: GraphQLFieldResolverParams<any, TContext>,
|
|
221
|
+
): GraphQLRequestListenerDidResolveField | void;
|
|
222
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// This file defines the GraphQLRequestContext type which is an argument to most
|
|
2
|
+
// plugin hooks, as well as a variety of variants on it which assert that
|
|
3
|
+
// particular sub-fields are set by a particular point in the request pipeline.
|
|
4
|
+
|
|
5
|
+
import type { WithRequired } from '@apollo/utils.withrequired';
|
|
6
|
+
import type { Trace } from '@apollo/usage-reporting-protobuf';
|
|
7
|
+
import type { BaseContext } from './context.js';
|
|
8
|
+
import type {
|
|
9
|
+
GraphQLInProgressResponse,
|
|
10
|
+
GraphQLRequest,
|
|
11
|
+
GraphQLResponse,
|
|
12
|
+
} from './graphql.js';
|
|
13
|
+
import type { Logger } from '@apollo/utils.logger';
|
|
14
|
+
import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
|
|
15
|
+
import type {
|
|
16
|
+
DocumentNode,
|
|
17
|
+
GraphQLError,
|
|
18
|
+
GraphQLSchema,
|
|
19
|
+
OperationDefinitionNode,
|
|
20
|
+
} from 'graphql';
|
|
21
|
+
import type { CachePolicy } from '@apollo/cache-control-types';
|
|
22
|
+
import type { NonFtv1ErrorPath } from '@apollo/server-gateway-interface';
|
|
23
|
+
|
|
24
|
+
export interface GraphQLRequestMetrics {
|
|
25
|
+
// It would be more accurate to call this fieldLevelInstrumentation (it is
|
|
26
|
+
// true if the hook of that name returns truthy) but for backwards
|
|
27
|
+
// compatibility we keep this name (this field is read by `@apollo/gateway` to
|
|
28
|
+
// decide whether or not to send the apollo-federation-include-trace header).
|
|
29
|
+
captureTraces?: boolean;
|
|
30
|
+
persistedQueryHit?: boolean;
|
|
31
|
+
persistedQueryRegister?: boolean;
|
|
32
|
+
responseCacheHit?: boolean;
|
|
33
|
+
forbiddenOperation?: boolean;
|
|
34
|
+
registeredOperation?: boolean;
|
|
35
|
+
startHrTime?: [number, number];
|
|
36
|
+
queryPlanTrace?: Trace.QueryPlanNode;
|
|
37
|
+
nonFtv1ErrorPaths?: NonFtv1ErrorPath[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface GraphQLRequestContext<TContext extends BaseContext> {
|
|
41
|
+
readonly logger: Logger;
|
|
42
|
+
readonly cache: KeyValueCache<string>;
|
|
43
|
+
|
|
44
|
+
readonly request: GraphQLRequest;
|
|
45
|
+
readonly response: GraphQLInProgressResponse;
|
|
46
|
+
|
|
47
|
+
readonly schema: GraphQLSchema;
|
|
48
|
+
|
|
49
|
+
readonly contextValue: TContext;
|
|
50
|
+
|
|
51
|
+
readonly queryHash?: string;
|
|
52
|
+
|
|
53
|
+
readonly document?: DocumentNode;
|
|
54
|
+
readonly source?: string;
|
|
55
|
+
|
|
56
|
+
// `operationName` is set based on the operation AST, so it is defined even if
|
|
57
|
+
// no `request.operationName` was passed in. It will be set to `null` for an
|
|
58
|
+
// anonymous operation, or if `requestName.operationName` was passed in but
|
|
59
|
+
// doesn't resolve to an operation in the document.
|
|
60
|
+
readonly operationName?: string | null;
|
|
61
|
+
readonly operation?: OperationDefinitionNode;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Unformatted errors which have occurred during the request. Note that these
|
|
65
|
+
* are present earlier in the request pipeline and differ from **formatted**
|
|
66
|
+
* errors which are the result of running the user-configurable `formatError`
|
|
67
|
+
* transformation function over specific errors; these can eventually be found
|
|
68
|
+
* in `response.result.errors`.
|
|
69
|
+
*/
|
|
70
|
+
readonly errors?: ReadonlyArray<GraphQLError>;
|
|
71
|
+
|
|
72
|
+
readonly metrics: GraphQLRequestMetrics;
|
|
73
|
+
|
|
74
|
+
readonly overallCachePolicy: CachePolicy;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* True if this request is part of a potentially multi-operation batch. Note
|
|
78
|
+
* that if this is true, `response.http` will be shared with the other
|
|
79
|
+
* operations in the batch.
|
|
80
|
+
*/
|
|
81
|
+
readonly requestIsBatched: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type GraphQLRequestContextDidResolveSource<
|
|
85
|
+
TContext extends BaseContext,
|
|
86
|
+
> = WithRequired<GraphQLRequestContext<TContext>, 'source' | 'queryHash'>;
|
|
87
|
+
export type GraphQLRequestContextParsingDidStart<TContext extends BaseContext> =
|
|
88
|
+
GraphQLRequestContextDidResolveSource<TContext>;
|
|
89
|
+
export type GraphQLRequestContextValidationDidStart<
|
|
90
|
+
TContext extends BaseContext,
|
|
91
|
+
> = GraphQLRequestContextParsingDidStart<TContext> &
|
|
92
|
+
WithRequired<GraphQLRequestContext<TContext>, 'document'>;
|
|
93
|
+
export type GraphQLRequestContextDidResolveOperation<
|
|
94
|
+
TContext extends BaseContext,
|
|
95
|
+
> = GraphQLRequestContextValidationDidStart<TContext> &
|
|
96
|
+
WithRequired<GraphQLRequestContext<TContext>, 'operationName'>;
|
|
97
|
+
export type GraphQLRequestContextDidEncounterErrors<
|
|
98
|
+
TContext extends BaseContext,
|
|
99
|
+
> = WithRequired<GraphQLRequestContext<TContext>, 'errors'>;
|
|
100
|
+
export type GraphQLRequestContextResponseForOperation<
|
|
101
|
+
TContext extends BaseContext,
|
|
102
|
+
> = WithRequired<
|
|
103
|
+
GraphQLRequestContext<TContext>,
|
|
104
|
+
'source' | 'document' | 'operation' | 'operationName'
|
|
105
|
+
>;
|
|
106
|
+
export type GraphQLRequestContextExecutionDidStart<
|
|
107
|
+
TContext extends BaseContext,
|
|
108
|
+
> = GraphQLRequestContextParsingDidStart<TContext> &
|
|
109
|
+
WithRequired<
|
|
110
|
+
GraphQLRequestContext<TContext>,
|
|
111
|
+
'document' | 'operation' | 'operationName'
|
|
112
|
+
>;
|
|
113
|
+
export type GraphQLRequestContextWillSendResponse<
|
|
114
|
+
TContext extends BaseContext,
|
|
115
|
+
> = GraphQLRequestContextDidResolveSource<TContext> & {
|
|
116
|
+
readonly response: GraphQLResponse;
|
|
117
|
+
};
|
|
118
|
+
export type GraphQLRequestContextDidEncounterSubsequentErrors<
|
|
119
|
+
TContext extends BaseContext,
|
|
120
|
+
> = GraphQLRequestContextWillSendResponse<TContext>;
|
|
121
|
+
export type GraphQLRequestContextWillSendSubsequentPayload<
|
|
122
|
+
TContext extends BaseContext,
|
|
123
|
+
> = GraphQLRequestContextWillSendResponse<TContext>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const packageVersion = "5.5.0";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BaseContext,
|
|
3
|
+
HTTPGraphQLRequest,
|
|
4
|
+
HTTPGraphQLResponse,
|
|
5
|
+
} from './externalTypes/index.js';
|
|
6
|
+
import type {
|
|
7
|
+
ApolloServer,
|
|
8
|
+
ApolloServerInternals,
|
|
9
|
+
SchemaDerivedData,
|
|
10
|
+
} from './ApolloServer';
|
|
11
|
+
import { newHTTPGraphQLHead, runHttpQuery } from './runHttpQuery.js';
|
|
12
|
+
import { BadRequestError } from './internalErrorClasses.js';
|
|
13
|
+
|
|
14
|
+
async function runBatchedHttpQuery<TContext extends BaseContext>({
|
|
15
|
+
server,
|
|
16
|
+
batchRequest,
|
|
17
|
+
body,
|
|
18
|
+
contextValue,
|
|
19
|
+
schemaDerivedData,
|
|
20
|
+
internals,
|
|
21
|
+
}: {
|
|
22
|
+
server: ApolloServer<TContext>;
|
|
23
|
+
batchRequest: HTTPGraphQLRequest;
|
|
24
|
+
body: unknown[];
|
|
25
|
+
contextValue: TContext;
|
|
26
|
+
schemaDerivedData: SchemaDerivedData;
|
|
27
|
+
internals: ApolloServerInternals<TContext>;
|
|
28
|
+
}): Promise<HTTPGraphQLResponse> {
|
|
29
|
+
if (body.length === 0) {
|
|
30
|
+
throw new BadRequestError('No operations found in request.');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// This single HTTPGraphQLHead is shared across all the operations in the
|
|
34
|
+
// batch. This means that any changes to response headers or status code from
|
|
35
|
+
// one operation can be immediately seen by other operations. Plugins that set
|
|
36
|
+
// response headers or status code can then choose to combine the data they
|
|
37
|
+
// are setting with data that may already be there from another operation as
|
|
38
|
+
// they choose.
|
|
39
|
+
const sharedResponseHTTPGraphQLHead = newHTTPGraphQLHead();
|
|
40
|
+
const responseBodies = await Promise.all(
|
|
41
|
+
body.map(async (bodyPiece: unknown) => {
|
|
42
|
+
const singleRequest: HTTPGraphQLRequest = {
|
|
43
|
+
...batchRequest,
|
|
44
|
+
body: bodyPiece,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const response = await runHttpQuery({
|
|
48
|
+
server,
|
|
49
|
+
httpRequest: singleRequest,
|
|
50
|
+
contextValue,
|
|
51
|
+
schemaDerivedData,
|
|
52
|
+
internals,
|
|
53
|
+
sharedResponseHTTPGraphQLHead,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (response.body.kind === 'chunked') {
|
|
57
|
+
throw Error(
|
|
58
|
+
'Incremental delivery is not implemented for batch requests',
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return response.body.string;
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
return {
|
|
65
|
+
...sharedResponseHTTPGraphQLHead,
|
|
66
|
+
body: { kind: 'complete', string: `[${responseBodies.join(',')}]` },
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function runPotentiallyBatchedHttpQuery<
|
|
71
|
+
TContext extends BaseContext,
|
|
72
|
+
>(
|
|
73
|
+
server: ApolloServer<TContext>,
|
|
74
|
+
httpGraphQLRequest: HTTPGraphQLRequest,
|
|
75
|
+
contextValue: TContext,
|
|
76
|
+
schemaDerivedData: SchemaDerivedData,
|
|
77
|
+
internals: ApolloServerInternals<TContext>,
|
|
78
|
+
): Promise<HTTPGraphQLResponse> {
|
|
79
|
+
if (
|
|
80
|
+
!(
|
|
81
|
+
httpGraphQLRequest.method === 'POST' &&
|
|
82
|
+
Array.isArray(httpGraphQLRequest.body)
|
|
83
|
+
)
|
|
84
|
+
) {
|
|
85
|
+
return await runHttpQuery({
|
|
86
|
+
server,
|
|
87
|
+
httpRequest: httpGraphQLRequest,
|
|
88
|
+
contextValue,
|
|
89
|
+
schemaDerivedData,
|
|
90
|
+
internals,
|
|
91
|
+
sharedResponseHTTPGraphQLHead: null,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (internals.allowBatchedHttpRequests) {
|
|
95
|
+
return await runBatchedHttpQuery({
|
|
96
|
+
server,
|
|
97
|
+
batchRequest: httpGraphQLRequest,
|
|
98
|
+
body: httpGraphQLRequest.body as unknown[],
|
|
99
|
+
contextValue,
|
|
100
|
+
schemaDerivedData,
|
|
101
|
+
internals,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
throw new BadRequestError('Operation batching disabled.');
|
|
105
|
+
}
|