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