import { VercelRequest, VercelResponse } from "@vercel/node"; import { HandlerEvent, HandlerResponse } from "@netlify/functions"; import { Writable } from "node:stream"; //#region src/node/feedback/adapters/vercel.d.ts declare function handleVercelFeedback(req: VercelRequest, res: VercelResponse): Promise; //#endregion //#region src/node/feedback/adapters/netlify.d.ts declare function handleNetlifyFeedback(event: HandlerEvent, env?: Record): Promise; //#endregion //#region src/node/feedback/adapters/web.d.ts declare function handleWebFeedback(request: Request, env?: Record): Promise; //#endregion //#region ../../node_modules/.pnpm/@types+aws-lambda@8.10.161/node_modules/@types/aws-lambda/common/api-gateway.d.ts // Default authorizer type, prefer using a specific type with the "...WithAuthorizer..." variant types. // Note that this doesn't have to be a context from a custom lambda outhorizer, AWS also has a cognito // authorizer type and could add more, so the property won't always be a string. type APIGatewayEventDefaultAuthorizerContext = undefined | null | { [name: string]: any; }; // The requestContext property of both request authorizer and proxy integration events. interface APIGatewayEventRequestContextWithAuthorizer { accountId: string; apiId: string; // This one is a bit confusing: it is not actually present in authorizer calls // and proxy calls without an authorizer. We model this by allowing undefined in the type, // since it ends up the same and avoids breaking users that are testing the property. // This lets us allow parameterizing the authorizer for proxy events that know what authorizer // context values they have. authorizer: TAuthorizerContext; connectedAt?: number | undefined; connectionId?: string | undefined; domainName?: string | undefined; domainPrefix?: string | undefined; eventType?: string | undefined; extendedRequestId?: string | undefined; protocol: string; httpMethod: string; identity: APIGatewayEventIdentity; messageDirection?: string | undefined; messageId?: string | null | undefined; path: string; stage: string; requestId: string; requestTime?: string | undefined; requestTimeEpoch: number; resourceId: string; resourcePath: string; routeKey?: string | undefined; } interface APIGatewayEventClientCertificate { clientCertPem: string; serialNumber: string; subjectDN: string; issuerDN: string; validity: { notAfter: string; notBefore: string; }; } interface APIGatewayEventIdentity { accessKey: string | null; accountId: string | null; apiKey: string | null; apiKeyId: string | null; caller: string | null; clientCert: APIGatewayEventClientCertificate | null; cognitoAuthenticationProvider: string | null; cognitoAuthenticationType: string | null; cognitoIdentityId: string | null; cognitoIdentityPoolId: string | null; principalOrgId: string | null; sourceIp: string; user: string | null; userAgent: string | null; userArn: string | null; vpcId?: string | undefined; vpceId?: string | undefined; } //#endregion //#region ../../node_modules/.pnpm/@types+aws-lambda@8.10.161/node_modules/@types/aws-lambda/handler.d.ts /** * {@link Handler} context parameter. * See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html AWS documentation}. */ interface Context { callbackWaitsForEmptyEventLoop: boolean; functionName: string; functionVersion: string; invokedFunctionArn: string; memoryLimitInMB: string; awsRequestId: string; logGroupName: string; logStreamName: string; identity?: CognitoIdentity | undefined; clientContext?: ClientContext | undefined; tenantId?: string | undefined; getRemainingTimeInMillis(): number; // Functions for compatibility with earlier Node.js Runtime v0.10.42 // No longer documented, so they are deprecated, but they still work // as of the 12.x runtime, so they are not removed from the types. /** @deprecated Use handler callback or promise result */ done(error?: Error, result?: any): void; /** @deprecated Use handler callback with first argument or reject a promise result */ fail(error: Error | string): void; /** @deprecated Use handler callback with second argument or resolve a promise result */ succeed(messageOrObject: any): void; // Unclear what behavior this is supposed to have, I couldn't find any still extant reference, // and it behaves like the above, ignoring the object parameter. /** @deprecated Use handler callback or promise result */ succeed(message: string, object: any): void; } interface CognitoIdentity { cognitoIdentityId: string; cognitoIdentityPoolId: string; } interface ClientContext { client: ClientContextClient; custom?: any; env: ClientContextEnv; } interface ClientContextClient { installationId: string; appTitle: string; appVersionName: string; appVersionCode: string; appPackageName: string; } interface ClientContextEnv { platformVersion: string; platform: string; make: string; model: string; locale: string; } /** * Interface for using response streaming from AWS Lambda. * To indicate to the runtime that Lambda should stream your function’s responses, you must wrap your function handler with the `awslambda.streamifyResponse()` decorator. * * The `streamifyResponse` decorator accepts the following additional parameter, `responseStream`, besides the default node handler parameters, `event`, and `context`. * The new `responseStream` object provides a stream object that your function can write data to. Data written to this stream is sent immediately to the client. You can optionally set the Content-Type header of the response to pass additional metadata to your client about the contents of the stream. * * {@link https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/ AWS blog post} * {@link https://docs.aws.amazon.com/lambda/latest/dg/config-rs-write-functions.html AWS documentation} * * @example Writing to the response stream * import 'aws-lambda'; * * export const handler = awslambda.streamifyResponse( * async (event, responseStream, context) => { * responseStream.setContentType("text/plain"); * responseStream.write("Hello, world!"); * responseStream.end(); * } * ); * * @example Using pipeline * import 'aws-lambda'; * import { Readable } from 'stream'; * import { pipeline } from 'stream/promises'; * import zlib from 'zlib'; * * export const handler = awslambda.streamifyResponse( * async (event, responseStream, context) => { * // As an example, convert event to a readable stream. * const requestStream = Readable.from(Buffer.from(JSON.stringify(event))); * * await pipeline(requestStream, zlib.createGzip(), responseStream); * } * ); */ type StreamifyHandler = (event: TEvent, responseStream: awslambda.HttpResponseStream, context: Context) => TResult | Promise; declare global { namespace awslambda { class HttpResponseStream extends Writable { static from(writable: Writable, metadata: Record): HttpResponseStream; setContentType: (contentType: string) => void; } /** * Decorator for using response streaming from AWS Lambda. * To indicate to the runtime that Lambda should stream your function’s responses, you must wrap your function handler with the `awslambda.streamifyResponse()` decorator. * * The `streamifyResponse` decorator accepts the following additional parameter, `responseStream`, besides the default node handler parameters, `event`, and `context`. * The new `responseStream` object provides a stream object that your function can write data to. Data written to this stream is sent immediately to the client. You can optionally set the Content-Type header of the response to pass additional metadata to your client about the contents of the stream. * * {@link https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/ AWS blog post} * {@link https://docs.aws.amazon.com/lambda/latest/dg/config-rs-write-functions.html AWS documentation} * * @example Writing to the response stream * import 'aws-lambda'; * * export const handler = awslambda.streamifyResponse( * async (event, responseStream, context) => { * responseStream.setContentType("text/plain"); * responseStream.write("Hello, world!"); * responseStream.end(); * } * ); * * @example Using pipeline * import 'aws-lambda'; * import { Readable } from 'stream'; * import { pipeline } from 'stream/promises'; * import zlib from 'zlib'; * * export const handler = awslambda.streamifyResponse( * async (event, responseStream, context) => { * // As an example, convert event to a readable stream. * const requestStream = Readable.from(Buffer.from(JSON.stringify(event))); * * await pipeline(requestStream, zlib.createGzip(), responseStream); * } * ); */ function streamifyResponse(handler: StreamifyHandler): StreamifyHandler; } } //#endregion //#region ../../node_modules/.pnpm/@types+aws-lambda@8.10.161/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts /** * Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 1.0 * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html */ type APIGatewayProxyEvent = APIGatewayProxyEventBase; interface APIGatewayProxyEventHeaders { [name: string]: string | undefined; } interface APIGatewayProxyEventMultiValueHeaders { [name: string]: string[] | undefined; } interface APIGatewayProxyEventPathParameters { [name: string]: string | undefined; } interface APIGatewayProxyEventQueryStringParameters { [name: string]: string | undefined; } interface APIGatewayProxyEventMultiValueQueryStringParameters { [name: string]: string[] | undefined; } interface APIGatewayProxyEventStageVariables { [name: string]: string | undefined; } interface APIGatewayProxyEventBase { body: string | null; headers: APIGatewayProxyEventHeaders; multiValueHeaders: APIGatewayProxyEventMultiValueHeaders; httpMethod: string; isBase64Encoded: boolean; path: string; pathParameters: APIGatewayProxyEventPathParameters | null; queryStringParameters: APIGatewayProxyEventQueryStringParameters | null; multiValueQueryStringParameters: APIGatewayProxyEventMultiValueQueryStringParameters | null; stageVariables: APIGatewayProxyEventStageVariables | null; requestContext: APIGatewayEventRequestContextWithAuthorizer; resource: string; } /** * Works with Lambda Proxy Integration for Rest API or HTTP API integration Payload Format version 1.0 * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html */ interface APIGatewayProxyResult { statusCode: number; headers?: { [header: string]: boolean | number | string; } | undefined; multiValueHeaders?: { [header: string]: Array; } | undefined; body: string; isBase64Encoded?: boolean | undefined; } //#endregion //#region src/node/feedback/adapters/aws.d.ts declare function handleAwsFeedback(event: APIGatewayProxyEvent, env?: Record): Promise; //#endregion export { handleVercelFeedback as i, handleWebFeedback as n, handleNetlifyFeedback as r, handleAwsFeedback as t };