UNPKG

@h4ad/serverless-adapter

Version:

Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.

73 lines (70 loc) 2.18 kB
import { IncomingMessage, ServerResponse } from 'http'; import { BaseContext, ApolloServer } from '@apollo/server'; import { S as ServerlessRequest } from '../../request-DI51fiy-.js'; import { F as FrameworkContract } from '../../framework.contract-td-lRvq6.js'; import 'node:http'; import '../../headers-DjfGHDmI.js'; /** * The default context of Apollo Server when you integrate and don't pass any context. * * @breadcrumb Frameworks / ApolloServerFramework * @public */ interface DefaultServerlessApolloServerContext extends BaseContext { /** * The request reference */ request: IncomingMessage; /** * The response reference */ response: ServerResponse; } /** * The arguments used to create a Context inside {@link ApolloServerOptions} * * @breadcrumb Frameworks / ApolloServerFramework * @public */ type ApolloServerContextArguments = { /** * The request reference */ request: IncomingMessage; /** * The response reference */ response: ServerResponse; }; /** * The options to customize {@link ApolloServerFramework} * * @breadcrumb Frameworks / ApolloServerFramework * @public */ interface ApolloServerOptions<TContext extends BaseContext> { /** * Define a function to create the context of Apollo Server * * @param options - Default options passed by library */ context?: (options: ApolloServerContextArguments) => Promise<TContext>; } /** * The framework that forwards requests to Apollo Server * * @breadcrumb Frameworks / ApolloServerFramework * @public */ declare class ApolloServerFramework<TContext extends BaseContext> implements FrameworkContract<ApolloServer<TContext>> { protected readonly options?: ApolloServerOptions<TContext> | undefined; /** * Construtor padrão */ constructor(options?: ApolloServerOptions<TContext> | undefined); /** * {@inheritDoc} */ sendRequest(app: ApolloServer<TContext>, request: ServerlessRequest, response: ServerResponse): void; } export { type ApolloServerContextArguments, ApolloServerFramework, type ApolloServerOptions, type DefaultServerlessApolloServerContext };