@types/aws-lambda
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -17,4 +17,5 @@ // Type definitions for AWS Lambda | ||
// Danilo Raisi <https://github.com/daniloraisi> | ||
// Simon Buchan <https://github.com/simonbuchan> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.2 | ||
// TypeScript Version: 2.3 | ||
@@ -49,3 +50,3 @@ // API Gateway "event" request context | ||
// API Gateway "event" | ||
export interface APIGatewayEvent { | ||
export interface APIGatewayProxyEvent { | ||
body: string | null; | ||
@@ -62,2 +63,3 @@ headers: { [name: string]: string }; | ||
} | ||
export type APIGatewayEvent = APIGatewayProxyEvent; // Old name | ||
@@ -197,5 +199,6 @@ // API Gateway CustomAuthorizer "event" | ||
export interface S3CreateEvent { | ||
export interface S3Event { | ||
Records: S3EventRecord[]; | ||
} | ||
export type S3CreateEvent = S3Event; // old name | ||
@@ -206,3 +209,3 @@ /** | ||
*/ | ||
export interface CognitoUserPoolEvent { | ||
export interface CognitoUserPoolTriggerEvent { | ||
version: number; | ||
@@ -267,2 +270,3 @@ triggerSource: | ||
} | ||
export type CognitoUserPoolEvent = CognitoUserPoolTriggerEvent; | ||
@@ -423,3 +427,3 @@ /** | ||
export interface ProxyResult { | ||
export interface APIGatewayProxyResult { | ||
statusCode: number; | ||
@@ -432,2 +436,3 @@ headers?: { | ||
} | ||
export type ProxyResult = APIGatewayProxyResult; // Old name | ||
@@ -438,3 +443,3 @@ /** | ||
*/ | ||
export interface AuthResponse { | ||
export interface CustomAuthorizerResult { | ||
principalId: string; | ||
@@ -444,2 +449,3 @@ policyDocument: PolicyDocument; | ||
} | ||
export type AuthResponse = CustomAuthorizerResult; | ||
@@ -505,2 +511,11 @@ /** | ||
// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses.html#lambda-generating-http-responses-object | ||
export interface CloudFrontResultResponse { | ||
status: string; | ||
statusDescription?: string; | ||
headers?: CloudFrontHeaders; | ||
bodyEncoding?: 'text' | 'base64'; | ||
body?: string; | ||
} | ||
export interface CloudFrontResponseEvent { | ||
@@ -515,2 +530,4 @@ Records: Array<{ | ||
export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse; | ||
export interface CloudFrontRequestEvent { | ||
@@ -524,2 +541,4 @@ Records: Array<{ | ||
export type CloudFrontResponseResult = undefined | null | CloudFrontResultResponse; | ||
/** | ||
@@ -533,5 +552,3 @@ * AWS Lambda handler function. | ||
*/ | ||
export type Handler = (event: any, context: Context, callback?: Callback) => Promise<void> | void; | ||
export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => Promise<void> | void; | ||
export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Context, callback?: CustomAuthorizerCallback) => Promise<void> | void; | ||
export type Handler<TEvent = any, TResult = any> = (event: TEvent, context: Context, callback: Callback<TResult>) => void; | ||
@@ -545,6 +562,56 @@ /** | ||
*/ | ||
export type Callback = (error?: Error | null, result?: object | boolean | number | string) => void; | ||
export type ProxyCallback = (error?: Error | null, result?: ProxyResult) => void; | ||
export type CustomAuthorizerCallback = (error?: Error | null, result?: AuthResponse) => void; | ||
export type Callback<TResult = any> = (error?: Error | null, result?: TResult) => void; | ||
// Begin defining Handler and Callback types for each API trigger type. | ||
// Ordered by https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html | ||
// though that list is incomplete. | ||
export type S3Handler = Handler<S3Event, void>; | ||
export type DynamoDBStreamHandler = Handler<DynamoDBStreamEvent, void>; | ||
export type SNSHandler = Handler<SNSEvent, void>; | ||
// No SESHandler: SES event source is delivered as SNS notifications | ||
// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-ses | ||
// Result type is weird: docs and samples say to return the mutated event, but it only requires an object | ||
// with a "response" field, the type of which is specific to the event.triggerType. Leave as any for now. | ||
export type CognitoUserPoolTriggerHandler = Handler<CognitoUserPoolTriggerEvent>; | ||
// TODO: Different event/handler types for each event trigger so we can type the result? | ||
// TODO: CognitoSync | ||
export type CloudFormationCustomResourceHandler = Handler<CloudFormationCustomResourceEvent, void>; | ||
// TODO: CloudWatchEvents | ||
export type CloudWatchLogsHandler = Handler<CloudWatchLogsEvent, void>; | ||
// TODO: CodeCommit | ||
export type ScheduledHandler = Handler<ScheduledEvent, void>; | ||
// TODO: AWS Config | ||
// TODO: Alexa | ||
export type APIGatewayProxyHandler = Handler<APIGatewayProxyEvent, APIGatewayProxyResult>; | ||
export type APIGatewayProxyCallback = Callback<APIGatewayProxyResult>; | ||
export type ProxyHandler = APIGatewayProxyHandler; // Old name | ||
export type ProxyCallback = APIGatewayProxyCallback; // Old name | ||
// TODO: IoT | ||
export type CloudFrontRequestHandler = Handler<CloudFrontRequestEvent, CloudFrontRequestResult>; | ||
export type CloudFrontRequestCallback = Callback<CloudFrontRequestResult>; | ||
export type CloudFrontResponseHandler = Handler<CloudFrontResponseEvent, CloudFrontResponseResult>; | ||
export type CloudFrontResponseCallback = Callback<CloudFrontResponseResult>; | ||
// TODO: Kinesis (should be very close to DynamoDB stream?) | ||
export type CustomAuthorizerHandler = Handler<CustomAuthorizerEvent, CustomAuthorizerResult>; | ||
export type CustomAuthorizerCallback = Callback<CustomAuthorizerResult>; | ||
export as namespace AWSLambda; |
{ | ||
"name": "@types/aws-lambda", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"description": "TypeScript definitions for AWS Lambda", | ||
@@ -74,2 +74,7 @@ "license": "MIT", | ||
"githubUsername": "daniloraisi" | ||
}, | ||
{ | ||
"name": "Simon Buchan", | ||
"url": "https://github.com/simonbuchan", | ||
"githubUsername": "simonbuchan" | ||
} | ||
@@ -84,4 +89,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "6723aebe78a33fb57dfe117429ffc6732d8224f8493f2faa3f1711f2a728fa0e", | ||
"typeScriptVersion": "2.2" | ||
"typesPublisherContentHash": "238a1ca8ff80fb55ea64ab8d6eca9fcb40c195328c5b6155251840e9843bfd26", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Tue, 30 Jan 2018 20:01:15 GMT | ||
* Last updated: Tue, 13 Feb 2018 20:54:39 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: AWSLambda | ||
# Credits | ||
These definitions were written by James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>, Yoriki Yamaguchi <https://github.com/y13i>, wwwy3y3 <https://github.com/wwwy3y3>, Ishaan Malhi <https://github.com/OrthoDex>, Michael Marner <https://github.com/MichaelMarner>, Daniel Cottone <https://github.com/daniel-cottone>, Kostya Misura <https://github.com/kostya-misura>, Markus Tacker <https://github.com/coderbyheart>, Palmi Valgeirsson <https://github.com/palmithor>, Danilo Raisi <https://github.com/daniloraisi>. | ||
These definitions were written by James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>, Yoriki Yamaguchi <https://github.com/y13i>, wwwy3y3 <https://github.com/wwwy3y3>, Ishaan Malhi <https://github.com/OrthoDex>, Michael Marner <https://github.com/MichaelMarner>, Daniel Cottone <https://github.com/daniel-cottone>, Kostya Misura <https://github.com/kostya-misura>, Markus Tacker <https://github.com/coderbyheart>, Palmi Valgeirsson <https://github.com/palmithor>, Danilo Raisi <https://github.com/daniloraisi>, Simon Buchan <https://github.com/simonbuchan>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23885
529