@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,33 @@
|
|
|
1
|
+
import type { CacheHint, CachePolicy } from '@apollo/cache-control-types';
|
|
2
|
+
|
|
3
|
+
export function newCachePolicy(): CachePolicy {
|
|
4
|
+
return {
|
|
5
|
+
maxAge: undefined,
|
|
6
|
+
scope: undefined,
|
|
7
|
+
restrict(hint: CacheHint) {
|
|
8
|
+
if (
|
|
9
|
+
hint.maxAge !== undefined &&
|
|
10
|
+
(this.maxAge === undefined || hint.maxAge < this.maxAge)
|
|
11
|
+
) {
|
|
12
|
+
this.maxAge = hint.maxAge;
|
|
13
|
+
}
|
|
14
|
+
if (hint.scope !== undefined && this.scope !== 'PRIVATE') {
|
|
15
|
+
this.scope = hint.scope;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
replace(hint: CacheHint) {
|
|
19
|
+
if (hint.maxAge !== undefined) {
|
|
20
|
+
this.maxAge = hint.maxAge;
|
|
21
|
+
}
|
|
22
|
+
if (hint.scope !== undefined) {
|
|
23
|
+
this.scope = hint.scope;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
policyIfCacheable() {
|
|
27
|
+
if (this.maxAge === undefined || this.maxAge === 0) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return { maxAge: this.maxAge, scope: this.scope ?? 'PUBLIC' };
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createHash } from '@apollo/utils.createhash';
|
|
2
|
+
import type { ApolloConfig, ApolloConfigInput } from './externalTypes/index.js';
|
|
3
|
+
import type { Logger } from '@apollo/utils.logger';
|
|
4
|
+
|
|
5
|
+
// This function combines the `apollo` constructor argument and some environment
|
|
6
|
+
// variables to come up with a full ApolloConfig.
|
|
7
|
+
export function determineApolloConfig(
|
|
8
|
+
input: ApolloConfigInput | undefined,
|
|
9
|
+
logger: Logger,
|
|
10
|
+
): ApolloConfig {
|
|
11
|
+
const apolloConfig: ApolloConfig = {};
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
APOLLO_KEY,
|
|
15
|
+
APOLLO_GRAPH_REF,
|
|
16
|
+
APOLLO_GRAPH_ID,
|
|
17
|
+
APOLLO_GRAPH_VARIANT,
|
|
18
|
+
} = process.env;
|
|
19
|
+
|
|
20
|
+
// Determine key.
|
|
21
|
+
if (input?.key) {
|
|
22
|
+
apolloConfig.key = input.key.trim();
|
|
23
|
+
} else if (APOLLO_KEY) {
|
|
24
|
+
apolloConfig.key = APOLLO_KEY.trim();
|
|
25
|
+
}
|
|
26
|
+
if ((input?.key ?? APOLLO_KEY) !== apolloConfig.key) {
|
|
27
|
+
logger.warn(
|
|
28
|
+
'The provided API key has unexpected leading or trailing whitespace. ' +
|
|
29
|
+
'Apollo Server will trim the key value before use.',
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Assert API key is a valid header value, since it's going to be used as one
|
|
34
|
+
// throughout.
|
|
35
|
+
if (apolloConfig.key) {
|
|
36
|
+
assertValidHeaderValue(apolloConfig.key);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Determine key hash.
|
|
40
|
+
if (apolloConfig.key) {
|
|
41
|
+
apolloConfig.keyHash = createHash('sha512')
|
|
42
|
+
.update(apolloConfig.key)
|
|
43
|
+
.digest('hex');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Determine graph ref, if provided together.
|
|
47
|
+
if (input?.graphRef) {
|
|
48
|
+
apolloConfig.graphRef = input.graphRef;
|
|
49
|
+
} else if (APOLLO_GRAPH_REF) {
|
|
50
|
+
apolloConfig.graphRef = APOLLO_GRAPH_REF;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// See if graph ID and variant were provided separately.
|
|
54
|
+
const graphId = input?.graphId ?? APOLLO_GRAPH_ID;
|
|
55
|
+
const graphVariant = input?.graphVariant ?? APOLLO_GRAPH_VARIANT;
|
|
56
|
+
|
|
57
|
+
if (apolloConfig.graphRef) {
|
|
58
|
+
if (graphId) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
'Cannot specify both graph ref and graph ID. Please use ' +
|
|
61
|
+
'`apollo.graphRef` or `APOLLO_GRAPH_REF` without also setting the graph ID.',
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
if (graphVariant) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
'Cannot specify both graph ref and graph variant. Please use ' +
|
|
67
|
+
'`apollo.graphRef` or `APOLLO_GRAPH_REF` without also setting the graph variant.',
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
} else if (graphId) {
|
|
71
|
+
// Graph ref is not specified, but the ID is. We can construct the ref
|
|
72
|
+
// from the ID and variant. Note that after this, we stop tracking the ID
|
|
73
|
+
// and variant, because Apollo Server 3 does not assume that all graph refs
|
|
74
|
+
// can be decomposed into ID and variant (except in the op reg plugin).
|
|
75
|
+
apolloConfig.graphRef = graphVariant
|
|
76
|
+
? `${graphId}@${graphVariant}`
|
|
77
|
+
: graphId;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return apolloConfig;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function assertValidHeaderValue(value: string) {
|
|
84
|
+
// Ref: node-fetch@2.x `Headers` validation
|
|
85
|
+
// https://github.com/node-fetch/node-fetch/blob/9b9d45881e5ca68757077726b3c0ecf8fdca1f29/src/headers.js#L18
|
|
86
|
+
const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/g;
|
|
87
|
+
if (invalidHeaderCharRegex.test(value)) {
|
|
88
|
+
const invalidChars = value.match(invalidHeaderCharRegex)!;
|
|
89
|
+
throw new Error(
|
|
90
|
+
`The API key provided to Apollo Server contains characters which are invalid as HTTP header values. The following characters found in the key are invalid: ${invalidChars.join(
|
|
91
|
+
', ',
|
|
92
|
+
)}. Valid header values may only contain ASCII visible characters. If you think there is an issue with your key, please contact Apollo support.`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// The functions in this file are not part of Apollo Server's external API.
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
GraphQLError,
|
|
5
|
+
type GraphQLErrorExtensions,
|
|
6
|
+
type GraphQLFormattedError,
|
|
7
|
+
} from 'graphql';
|
|
8
|
+
import { ApolloServerErrorCode } from './errors/index.js';
|
|
9
|
+
import type { HTTPGraphQLHead } from './externalTypes/http.js';
|
|
10
|
+
import { mergeHTTPGraphQLHead, newHTTPGraphQLHead } from './runHttpQuery.js';
|
|
11
|
+
import { HeaderMap } from './utils/HeaderMap.js';
|
|
12
|
+
|
|
13
|
+
// This function accepts any value that were thrown and convert it to GraphQLFormattedError.
|
|
14
|
+
// It also add default extensions.code and copy stack trace onto an extension if requested.
|
|
15
|
+
// Additionally, it returns an `HTTPGraphQLHead` created from combining the values of any
|
|
16
|
+
// `HTTPGraphqlHead` objects found on `extensions.http` (the behavior when multiple errors
|
|
17
|
+
// set a status code or set the same header should be treated as undefined); these extensions
|
|
18
|
+
// are removed from the formatted error.
|
|
19
|
+
//
|
|
20
|
+
// This function should not throw.
|
|
21
|
+
export function normalizeAndFormatErrors(
|
|
22
|
+
errors: ReadonlyArray<unknown>,
|
|
23
|
+
options: {
|
|
24
|
+
formatError?: (
|
|
25
|
+
formattedError: GraphQLFormattedError,
|
|
26
|
+
error: unknown,
|
|
27
|
+
) => GraphQLFormattedError;
|
|
28
|
+
includeStacktraceInErrorResponses?: boolean;
|
|
29
|
+
} = {},
|
|
30
|
+
): {
|
|
31
|
+
formattedErrors: Array<GraphQLFormattedError>;
|
|
32
|
+
httpFromErrors: HTTPGraphQLHead;
|
|
33
|
+
} {
|
|
34
|
+
const formatError = options.formatError ?? ((error) => error);
|
|
35
|
+
const httpFromErrors = newHTTPGraphQLHead();
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
httpFromErrors,
|
|
39
|
+
formattedErrors: errors.map((error) => {
|
|
40
|
+
try {
|
|
41
|
+
return formatError(enrichError(error), error);
|
|
42
|
+
} catch (formattingError) {
|
|
43
|
+
if (options.includeStacktraceInErrorResponses) {
|
|
44
|
+
// includeStacktraceInErrorResponses is used in development
|
|
45
|
+
// so it will be helpful to show errors thrown by formatError hooks in that mode
|
|
46
|
+
return enrichError(formattingError);
|
|
47
|
+
} else {
|
|
48
|
+
// obscure error
|
|
49
|
+
return {
|
|
50
|
+
message: 'Internal server error',
|
|
51
|
+
extensions: { code: ApolloServerErrorCode.INTERNAL_SERVER_ERROR },
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function enrichError(maybeError: unknown): GraphQLFormattedError {
|
|
59
|
+
const graphqlError = ensureGraphQLError(maybeError);
|
|
60
|
+
|
|
61
|
+
const extensions: GraphQLErrorExtensions = {
|
|
62
|
+
...graphqlError.extensions,
|
|
63
|
+
code:
|
|
64
|
+
graphqlError.extensions.code ??
|
|
65
|
+
ApolloServerErrorCode.INTERNAL_SERVER_ERROR,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (isPartialHTTPGraphQLHead(extensions.http)) {
|
|
69
|
+
mergeHTTPGraphQLHead(httpFromErrors, {
|
|
70
|
+
headers: new HeaderMap(),
|
|
71
|
+
...extensions.http,
|
|
72
|
+
});
|
|
73
|
+
delete extensions.http;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (options.includeStacktraceInErrorResponses) {
|
|
77
|
+
// Note that if ensureGraphQLError created graphqlError from an
|
|
78
|
+
// originalError, graphqlError.stack will be the same as
|
|
79
|
+
// originalError.stack due to some special code in the GraphQLError
|
|
80
|
+
// constructor.
|
|
81
|
+
extensions.stacktrace = graphqlError.stack?.split('\n');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return { ...graphqlError.toJSON(), extensions };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function ensureError(maybeError: unknown): Error {
|
|
89
|
+
return maybeError instanceof Error
|
|
90
|
+
? maybeError
|
|
91
|
+
: new GraphQLError('Unexpected error value: ' + String(maybeError));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function ensureGraphQLError(
|
|
95
|
+
maybeError: unknown,
|
|
96
|
+
messagePrefixIfNotGraphQLError: string = '',
|
|
97
|
+
): GraphQLError {
|
|
98
|
+
const error: Error = ensureError(maybeError);
|
|
99
|
+
|
|
100
|
+
return error instanceof GraphQLError
|
|
101
|
+
? error
|
|
102
|
+
: new GraphQLError(messagePrefixIfNotGraphQLError + error.message, {
|
|
103
|
+
originalError: error,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isPartialHTTPGraphQLHead(x: unknown): x is Partial<HTTPGraphQLHead> {
|
|
108
|
+
return (
|
|
109
|
+
!!x &&
|
|
110
|
+
typeof x === 'object' &&
|
|
111
|
+
(!('status' in x) || typeof (x as any).status === 'number') &&
|
|
112
|
+
(!('headers' in x) || (x as any).headers instanceof Map)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
|
|
3
|
+
export enum ApolloServerErrorCode {
|
|
4
|
+
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
|
|
5
|
+
GRAPHQL_PARSE_FAILED = 'GRAPHQL_PARSE_FAILED',
|
|
6
|
+
GRAPHQL_VALIDATION_FAILED = 'GRAPHQL_VALIDATION_FAILED',
|
|
7
|
+
PERSISTED_QUERY_NOT_FOUND = 'PERSISTED_QUERY_NOT_FOUND',
|
|
8
|
+
PERSISTED_QUERY_NOT_SUPPORTED = 'PERSISTED_QUERY_NOT_SUPPORTED',
|
|
9
|
+
BAD_USER_INPUT = 'BAD_USER_INPUT',
|
|
10
|
+
OPERATION_RESOLUTION_FAILURE = 'OPERATION_RESOLUTION_FAILURE',
|
|
11
|
+
BAD_REQUEST = 'BAD_REQUEST',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum ApolloServerValidationErrorCode {
|
|
15
|
+
INTROSPECTION_DISABLED = 'INTROSPECTION_DISABLED',
|
|
16
|
+
MAX_RECURSIVE_SELECTIONS_EXCEEDED = 'MAX_RECURSIVE_SELECTIONS_EXCEEDED',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* unwrapResolverError is a useful helper function for `formatError` hooks.
|
|
21
|
+
* Errors thrown in resolvers are wrapped by graphql-js in a GraphQLError that
|
|
22
|
+
* adds context such as the `path` to the field in the operation. If you'd like
|
|
23
|
+
* to look directly at the original error thrown in the resolver (with whatever
|
|
24
|
+
* data is on that error object, but without fields like `path`), you can use
|
|
25
|
+
* this function. Note that other GraphQLErrors that contain `originalError`
|
|
26
|
+
* (like parse errors) are not unwrapped by this function.
|
|
27
|
+
*/
|
|
28
|
+
export function unwrapResolverError(error: unknown): unknown {
|
|
29
|
+
if (error instanceof GraphQLError && error.path && error.originalError) {
|
|
30
|
+
return error.originalError;
|
|
31
|
+
}
|
|
32
|
+
return error;
|
|
33
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file consists of types used to define the arguments to the ApolloServer
|
|
3
|
+
* constructor. The top-level and likely most interesting type exported from
|
|
4
|
+
* here is `ApolloServerOptions` which is used to define the input object to the
|
|
5
|
+
* `ApolloServer` constructor.
|
|
6
|
+
*/
|
|
7
|
+
import type { Logger } from '@apollo/utils.logger';
|
|
8
|
+
import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
|
9
|
+
import type {
|
|
10
|
+
DocumentNode,
|
|
11
|
+
ExecutionArgs,
|
|
12
|
+
FormattedExecutionResult,
|
|
13
|
+
GraphQLFieldResolver,
|
|
14
|
+
GraphQLFormattedError,
|
|
15
|
+
GraphQLSchema,
|
|
16
|
+
ParseOptions,
|
|
17
|
+
ValidationRule,
|
|
18
|
+
} from 'graphql';
|
|
19
|
+
import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
|
|
20
|
+
import type { GatewayInterface } from '@apollo/server-gateway-interface';
|
|
21
|
+
import type { ApolloServerPlugin } from './plugins.js';
|
|
22
|
+
import type {
|
|
23
|
+
BaseContext,
|
|
24
|
+
LegacyExperimentalExecuteIncrementally,
|
|
25
|
+
} from './index.js';
|
|
26
|
+
import type {
|
|
27
|
+
GraphQLExperimentalIncrementalExecutionResultsAlpha2,
|
|
28
|
+
GraphQLExperimentalIncrementalExecutionResultsAlpha9,
|
|
29
|
+
} from '../incrementalDeliveryPolyfill.js';
|
|
30
|
+
import type { ValidationOptions } from '../ApolloServer.js';
|
|
31
|
+
|
|
32
|
+
export type DocumentStore = KeyValueCache<DocumentNode>;
|
|
33
|
+
|
|
34
|
+
// Configuration for how Apollo Server talks to the Apollo registry, as passed
|
|
35
|
+
// to the ApolloServer constructor. Each field can also be provided as an
|
|
36
|
+
// environment variable.
|
|
37
|
+
export interface ApolloConfigInput {
|
|
38
|
+
// Your Apollo API key. Environment variable: APOLLO_KEY.
|
|
39
|
+
key?: string;
|
|
40
|
+
// The graph ref for your graph, eg `my-graph@my-variant` or `my-graph` to use
|
|
41
|
+
// your graph's default variant. Environment variable: APOLLO_GRAPH_REF. For
|
|
42
|
+
// backwards compatibility, may alternatively specify the ref as graphId and
|
|
43
|
+
// graphVariant separately.
|
|
44
|
+
graphRef?: string;
|
|
45
|
+
// The graph ID of your graph, eg `my-graph`. Environment variable:
|
|
46
|
+
// APOLLO_GRAPH_ID.
|
|
47
|
+
graphId?: string;
|
|
48
|
+
// Your graph's variant name, eg `my-variant`. Environment variable:
|
|
49
|
+
// APOLLO_GRAPH_VARIANT.
|
|
50
|
+
graphVariant?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// some defaults filled in from the ApolloConfigInput passed to the constructor.
|
|
54
|
+
export interface ApolloConfig {
|
|
55
|
+
key?: string;
|
|
56
|
+
keyHash?: string;
|
|
57
|
+
graphRef?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface PersistedQueryOptions {
|
|
61
|
+
cache?: KeyValueCache<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Specified in **seconds**, this time-to-live (TTL) value limits the lifespan
|
|
64
|
+
* of how long the persisted query should be cached. To specify a desired
|
|
65
|
+
* lifespan of "infinite", set this to `null`, in which case the eviction will
|
|
66
|
+
* be determined by the cache's eviction policy, but the record will never
|
|
67
|
+
* simply expire.
|
|
68
|
+
*/
|
|
69
|
+
ttl?: number | null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface CSRFPreventionOptions {
|
|
73
|
+
// CSRF prevention works by only processing operations from requests whose
|
|
74
|
+
// structure indicates that if they were sent by a web browser, then the
|
|
75
|
+
// browser would have had to send a preflight OPTIONS request already. We do
|
|
76
|
+
// this by specifying some headers that a browser will never automatically set
|
|
77
|
+
// and which will trigger the browser to preflight. Apollo Server will reject
|
|
78
|
+
// any operation that does not set at least one of these headers *and* does
|
|
79
|
+
// not set a content-type (to a header whose parsed type is not
|
|
80
|
+
// application/x-www-form-urlencoded, multipart/form-data, or text/plain). If
|
|
81
|
+
// CSRF prevention is enabled (eg, with `csrfPrevention: true`) this list
|
|
82
|
+
// defaults to ['x-apollo-operation-name', 'apollo-require-preflight']. This
|
|
83
|
+
// will allow POST operations from any client and GET operations from Apollo
|
|
84
|
+
// Client Web, Apollo iOS, and Apollo Kotlin.
|
|
85
|
+
requestHeaders?: string[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface ApolloServerOptionsBase<TContext extends BaseContext> {
|
|
89
|
+
formatError?: (
|
|
90
|
+
formattedError: GraphQLFormattedError,
|
|
91
|
+
error: unknown,
|
|
92
|
+
) => GraphQLFormattedError;
|
|
93
|
+
rootValue?: ((parsedQuery: DocumentNode) => unknown) | unknown;
|
|
94
|
+
validationRules?: Array<ValidationRule>;
|
|
95
|
+
fieldResolver?: GraphQLFieldResolver<any, TContext>;
|
|
96
|
+
cache?: KeyValueCache<string> | 'bounded';
|
|
97
|
+
includeStacktraceInErrorResponses?: boolean;
|
|
98
|
+
logger?: Logger;
|
|
99
|
+
allowBatchedHttpRequests?: boolean;
|
|
100
|
+
stringifyResult?: (
|
|
101
|
+
value: FormattedExecutionResult,
|
|
102
|
+
) => string | Promise<string>;
|
|
103
|
+
introspection?: boolean;
|
|
104
|
+
maxRecursiveSelections?: boolean | number;
|
|
105
|
+
hideSchemaDetailsFromClientErrors?: boolean;
|
|
106
|
+
plugins?: ApolloServerPlugin<TContext>[];
|
|
107
|
+
persistedQueries?: PersistedQueryOptions | false;
|
|
108
|
+
stopOnTerminationSignals?: boolean;
|
|
109
|
+
apollo?: ApolloConfigInput;
|
|
110
|
+
nodeEnv?: string;
|
|
111
|
+
documentStore?: DocumentStore | null;
|
|
112
|
+
dangerouslyDisableValidation?: boolean;
|
|
113
|
+
validationOptions?: ValidationOptions;
|
|
114
|
+
csrfPrevention?: CSRFPreventionOptions | boolean;
|
|
115
|
+
|
|
116
|
+
// Used for parsing operations; unlike in AS3, this is not also used for
|
|
117
|
+
// parsing the schema.
|
|
118
|
+
parseOptions?: ParseOptions;
|
|
119
|
+
|
|
120
|
+
executionOptions?: ExecutionArgs['options'];
|
|
121
|
+
|
|
122
|
+
// TODO(AS6): remove this option. Configuration to `true` is default behavior
|
|
123
|
+
// and configuration to `false` is deprecated. If you depend on `false`
|
|
124
|
+
// behavior, we recommend migrating away from that at your earliest
|
|
125
|
+
// convenience since it won't be supported in the next major version.
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated `true` is now the default behavior in AS5. `false` will not be
|
|
128
|
+
* supported in AS6 since this option will be removed.
|
|
129
|
+
*/
|
|
130
|
+
status400ForVariableCoercionErrors?: boolean;
|
|
131
|
+
|
|
132
|
+
legacyExperimentalExecuteIncrementally?: LegacyExperimentalExecuteIncrementally;
|
|
133
|
+
|
|
134
|
+
// For testing only.
|
|
135
|
+
__testing_incrementalExecutionResults?:
|
|
136
|
+
| GraphQLExperimentalIncrementalExecutionResultsAlpha2
|
|
137
|
+
| GraphQLExperimentalIncrementalExecutionResultsAlpha9;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ApolloServerOptionsWithGateway<TContext extends BaseContext>
|
|
141
|
+
extends ApolloServerOptionsBase<TContext> {
|
|
142
|
+
gateway: GatewayInterface;
|
|
143
|
+
schema?: undefined;
|
|
144
|
+
typeDefs?: undefined;
|
|
145
|
+
resolvers?: undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface ApolloServerOptionsWithSchema<TContext extends BaseContext>
|
|
149
|
+
extends ApolloServerOptionsBase<TContext> {
|
|
150
|
+
schema: GraphQLSchema;
|
|
151
|
+
gateway?: undefined;
|
|
152
|
+
typeDefs?: undefined;
|
|
153
|
+
resolvers?: undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface ApolloServerOptionsWithTypeDefs<TContext extends BaseContext>
|
|
157
|
+
extends ApolloServerOptionsBase<TContext> {
|
|
158
|
+
// These two options are always only passed directly through to
|
|
159
|
+
// makeExecutableSchema. (If you don't want to use makeExecutableSchema, pass
|
|
160
|
+
// `schema` instead.)
|
|
161
|
+
typeDefs: IExecutableSchemaDefinition<TContext>['typeDefs'];
|
|
162
|
+
resolvers?: IExecutableSchemaDefinition<TContext>['resolvers'];
|
|
163
|
+
gateway?: undefined;
|
|
164
|
+
schema?: undefined;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Used internally in ApolloServer.ts but not publicly exported.
|
|
168
|
+
export type ApolloServerOptionsWithStaticSchema<TContext extends BaseContext> =
|
|
169
|
+
| ApolloServerOptionsWithSchema<TContext>
|
|
170
|
+
| ApolloServerOptionsWithTypeDefs<TContext>;
|
|
171
|
+
|
|
172
|
+
export type ApolloServerOptions<TContext extends BaseContext> =
|
|
173
|
+
| ApolloServerOptionsWithGateway<TContext>
|
|
174
|
+
| ApolloServerOptionsWithStaticSchema<TContext>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The default `contextValue` is an empty object. Generics related to the
|
|
2
|
+
// context type of `ApolloServer` should `extends BasedContext` as we do
|
|
3
|
+
// throughout this repository.
|
|
4
|
+
export type BaseContext = {};
|
|
5
|
+
|
|
6
|
+
// Integration authors should use this type for typing their own user-provided
|
|
7
|
+
// context function. See `@as-integrations/express5` for a usage example.
|
|
8
|
+
export type ContextFunction<
|
|
9
|
+
TIntegrationSpecificArgs extends any[],
|
|
10
|
+
TContext extends BaseContext = BaseContext,
|
|
11
|
+
> = (...integrationContext: TIntegrationSpecificArgs) => Promise<TContext>;
|
|
12
|
+
|
|
13
|
+
// This is used in `executeHTTPGraphQLRequest` so that that function can apply
|
|
14
|
+
// consistent error handling if it throws. Web framework integrations typically
|
|
15
|
+
// pass a function which passes integration-specific parameters to a
|
|
16
|
+
// user-provided `ContextFunction`.
|
|
17
|
+
export type ContextThunk<TContext extends BaseContext = BaseContext> =
|
|
18
|
+
() => Promise<TContext>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file exports types related specifically to GraphQL execution, most
|
|
3
|
+
* notably `GraphQLRequest` and `GraphQLResponse`, used most heavily by
|
|
4
|
+
* `executeHTTPGraphQLRequest` and `executeOperation`. The
|
|
5
|
+
* `responseForOperation` plugin hook also returns a `GraphQLResponse`.
|
|
6
|
+
*/
|
|
7
|
+
import type {
|
|
8
|
+
ExecutionArgs,
|
|
9
|
+
ExecutionResult,
|
|
10
|
+
FormattedExecutionResult,
|
|
11
|
+
} from 'graphql';
|
|
12
|
+
import type { BaseContext } from './context.js';
|
|
13
|
+
import type { HTTPGraphQLHead, HTTPGraphQLRequest } from './http.js';
|
|
14
|
+
import type { WithRequired } from '@apollo/utils.withrequired';
|
|
15
|
+
import type {
|
|
16
|
+
GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha2,
|
|
17
|
+
GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha2,
|
|
18
|
+
} from './incrementalDeliveryPolyfillAlpha2.js';
|
|
19
|
+
import type {
|
|
20
|
+
GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha9,
|
|
21
|
+
GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha9,
|
|
22
|
+
} from './incrementalDeliveryPolyfillAlpha9.js';
|
|
23
|
+
import { type GraphQLExperimentalIncrementalExecutionResultsAlpha2 } from '../incrementalDeliveryPolyfill.js';
|
|
24
|
+
|
|
25
|
+
export interface GraphQLRequest<
|
|
26
|
+
TVariables extends VariableValues = VariableValues,
|
|
27
|
+
> {
|
|
28
|
+
query?: string;
|
|
29
|
+
operationName?: string;
|
|
30
|
+
variables?: TVariables;
|
|
31
|
+
extensions?: Record<string, any>;
|
|
32
|
+
http?: HTTPGraphQLRequest;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type VariableValues = { [name: string]: any };
|
|
36
|
+
|
|
37
|
+
// A GraphQL response can either be a single result, or an initial result
|
|
38
|
+
// followed by a stream of subsequent results. The latter occurs when the
|
|
39
|
+
// GraphQL operation uses incremental delivery directives such as `@defer` or
|
|
40
|
+
// `@stream`. Note that incremental delivery currently requires using a
|
|
41
|
+
// pre-release of graphql-js v17.
|
|
42
|
+
export type GraphQLResponseBody<TData = Record<string, unknown>> =
|
|
43
|
+
| {
|
|
44
|
+
kind: 'single';
|
|
45
|
+
singleResult: FormattedExecutionResult<TData>;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
kind: 'incremental';
|
|
49
|
+
initialResult: GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha2;
|
|
50
|
+
subsequentResults: AsyncIterable<GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha2>;
|
|
51
|
+
}
|
|
52
|
+
| {
|
|
53
|
+
kind: 'incremental';
|
|
54
|
+
initialResult: GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha9;
|
|
55
|
+
subsequentResults: AsyncIterable<GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha9>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type GraphQLInProgressResponse<TData = Record<string, unknown>> = {
|
|
59
|
+
http: HTTPGraphQLHead;
|
|
60
|
+
body?: GraphQLResponseBody<TData>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type GraphQLResponse<TData = Record<string, unknown>> = WithRequired<
|
|
64
|
+
GraphQLInProgressResponse<TData>,
|
|
65
|
+
'body'
|
|
66
|
+
>;
|
|
67
|
+
export interface ExecuteOperationOptions<TContext extends BaseContext> {
|
|
68
|
+
contextValue?: TContext;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type PromiseOrValue<T> = Promise<T> | T;
|
|
72
|
+
|
|
73
|
+
export type LegacyExperimentalExecuteIncrementally<
|
|
74
|
+
TData = Record<string, unknown>,
|
|
75
|
+
TExtensions = Record<string, unknown>,
|
|
76
|
+
> = (
|
|
77
|
+
args: ExecutionArgs,
|
|
78
|
+
) => PromiseOrValue<
|
|
79
|
+
| ExecutionResult<TData, TExtensions>
|
|
80
|
+
| GraphQLExperimentalIncrementalExecutionResultsAlpha2<TData, TExtensions>
|
|
81
|
+
>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file exports types related to GraphQL execution with respect to HTTP.
|
|
3
|
+
* These types define the inputs and outputs for `executeHTTPGraphQLRequest` and
|
|
4
|
+
* are most interesting for integration authors.
|
|
5
|
+
*/
|
|
6
|
+
import type { HeaderMap } from '../utils/HeaderMap.js';
|
|
7
|
+
|
|
8
|
+
export interface HTTPGraphQLRequest {
|
|
9
|
+
// capitalized (GET, POST, etc)
|
|
10
|
+
method: string;
|
|
11
|
+
// lowercase header name, multiple headers joined with ', ' like Headers.get
|
|
12
|
+
// does
|
|
13
|
+
headers: HeaderMap;
|
|
14
|
+
/**
|
|
15
|
+
* The part of the URL after the question mark (not including the #fragment),
|
|
16
|
+
* or the empty string if there is no question mark. Including the question
|
|
17
|
+
* mark in this string is allowed but not required. Do not %-decode this
|
|
18
|
+
* string. You can get this from a standard Node request with
|
|
19
|
+
* `url.parse(request.url).search ?? ''`.
|
|
20
|
+
*/
|
|
21
|
+
search: string;
|
|
22
|
+
// read by your body-parser or whatever. we poke at it to make it into
|
|
23
|
+
// the right real type.
|
|
24
|
+
body: unknown;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface HTTPGraphQLHead {
|
|
28
|
+
status?: number;
|
|
29
|
+
headers: HeaderMap;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Here we use `string`s for the response body since the response can be either
|
|
34
|
+
* HTML (for the landing page - see `executeHTTPGraphQLRequest`) or JSON (for a
|
|
35
|
+
* GraphQL response). Based on `headers` and `method` on the request, we know
|
|
36
|
+
* how to correctly interpret the response body.
|
|
37
|
+
*/
|
|
38
|
+
export type HTTPGraphQLResponseBody =
|
|
39
|
+
| { kind: 'complete'; string: string }
|
|
40
|
+
| { kind: 'chunked'; asyncIterator: AsyncIterableIterator<string> };
|
|
41
|
+
|
|
42
|
+
export type HTTPGraphQLResponse = HTTPGraphQLHead & {
|
|
43
|
+
body: HTTPGraphQLResponseBody;
|
|
44
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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 GraphQLExperimentalFormattedInitialIncrementalExecutionResultAlpha2<
|
|
15
|
+
TData = ObjMap<unknown>,
|
|
16
|
+
TExtensions = ObjMap<unknown>,
|
|
17
|
+
> extends FormattedExecutionResult<TData, TExtensions> {
|
|
18
|
+
hasNext: boolean;
|
|
19
|
+
incremental?: ReadonlyArray<
|
|
20
|
+
GraphQLExperimentalFormattedIncrementalResultAlpha2<TData, TExtensions>
|
|
21
|
+
>;
|
|
22
|
+
extensions?: TExtensions;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GraphQLExperimentalFormattedSubsequentIncrementalExecutionResultAlpha2<
|
|
26
|
+
TData = ObjMap<unknown>,
|
|
27
|
+
TExtensions = ObjMap<unknown>,
|
|
28
|
+
> {
|
|
29
|
+
hasNext: boolean;
|
|
30
|
+
incremental?: ReadonlyArray<
|
|
31
|
+
GraphQLExperimentalFormattedIncrementalResultAlpha2<TData, TExtensions>
|
|
32
|
+
>;
|
|
33
|
+
extensions?: TExtensions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type GraphQLExperimentalFormattedIncrementalResultAlpha2<
|
|
37
|
+
TData = ObjMap<unknown>,
|
|
38
|
+
TExtensions = ObjMap<unknown>,
|
|
39
|
+
> =
|
|
40
|
+
| GraphQLExperimentalFormattedIncrementalDeferResultAlpha2<TData, TExtensions>
|
|
41
|
+
| GraphQLExperimentalFormattedIncrementalStreamResultAlpha2<
|
|
42
|
+
TData,
|
|
43
|
+
TExtensions
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
export interface GraphQLExperimentalFormattedIncrementalDeferResultAlpha2<
|
|
47
|
+
TData = ObjMap<unknown>,
|
|
48
|
+
TExtensions = ObjMap<unknown>,
|
|
49
|
+
> extends FormattedExecutionResult<TData, TExtensions> {
|
|
50
|
+
path?: ReadonlyArray<string | number>;
|
|
51
|
+
label?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface GraphQLExperimentalFormattedIncrementalStreamResultAlpha2<
|
|
55
|
+
TData = Array<unknown>,
|
|
56
|
+
TExtensions = ObjMap<unknown>,
|
|
57
|
+
> {
|
|
58
|
+
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
59
|
+
items?: TData | null;
|
|
60
|
+
path?: ReadonlyArray<string | number>;
|
|
61
|
+
label?: string;
|
|
62
|
+
extensions?: TExtensions;
|
|
63
|
+
}
|