[aws-lambda] Include CloudFrontRequest in CloudFrontRequestResult union type (#23882)

A request is a valid callback result type. See example: https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html#lambda-edge-authoring-functions-example-ab-testing
This commit is contained in:
David
2018-02-26 19:59:10 +00:00
committed by Andy
parent b19f7209eb
commit c9749a4f65
2 changed files with 11 additions and 2 deletions

View File

@@ -631,7 +631,15 @@ let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.API
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
apiGtwProxyHandler = proxyHandler;
let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { };
let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => {
cb();
cb(null);
cb(new Error(''));
cb(null, { clientIp: str, method: str, uri: str, querystring: str, headers: { } });
cb(null, { status: str });
// $ExpectError
cb(null, { });
};
let cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { };

View File

@@ -15,6 +15,7 @@
// Palmi Valgeirsson <https://github.com/palmithor>
// Danilo Raisi <https://github.com/daniloraisi>
// Simon Buchan <https://github.com/simonbuchan>
// David Hayden <https://github.com/Haydabase>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -516,7 +517,7 @@ export interface CloudFrontResponseEvent {
}>;
}
export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse;
export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse | CloudFrontRequest;
export interface CloudFrontRequestEvent {
Records: Array<{