A set of type definition and utility to implement AWS Lambda functions.
This is NOT a type definition for AWS Lambda API in aws-sdk-js. It can be found in aws-sdk-scalajs-facade.
exoego/scala-js-nodejs offers type definition and utilities for Node.js API.
ScalaJS 0.6.28+ | ScalaJS 1.x | |
---|---|---|
Scala 2.13 | ✔️ (0.9.0 was final) | ✔️ |
Scala 2.12 | ✔️ (0.9.0 was final) | ✔️ |
Scala 2.11 | N/A | N/A |
Scala 2.10 | N/A | N/A |
- ✔️ Supported
- 🚧 Not supported but planned
Add dependency in build.sbt
.
// For Node.js v12
libraryDependencies += "net.exoego" %%% "aws-lambda-scalajs-facade" % "0.10.0"
Import and code.
import scala.scalajs.js
import net.exoego.facade.aws_lambda._
object MyFirstLambda extends APIGatewayProxyHandler {
@js.annotation.JSName("apply")
override def apply(event: APIGatewayProxyEvent, context: Context, callback: Callback[APIGatewayProxyResult]): Unit = ???
}
object MyFirstAsyncLambda extends AsyncAPIGatewayProxyHandler {
@js.annotation.JSName("apply")
override def apply(event: APIGatewayProxyEvent, context: Context): js.Promise[APIGatewayProxyResult] = ???
}
Below is the available list of the pre-defined handler traits:
- ALB
- ALBHandler
- API Gateway
- APIGatewayProxyHandler
- APIGatewayProxyHandlerV2
- APIGatewayRequestAuthorizerHandler
- APIGatewayRequestAuthorizerWithContextHandler
- APIGatewayTokenAuthorizerHandler
- APIGatewayTokenAuthorizerWithContextHandler
- CustomAuthorizerHandler
- ProxyHandler (alias of APIGatewayProxyHandler)
- CloudFormation
- CloudFormationCustomResourceHandler
- CloudFront
- CloudFrontRequestHandler
- CloudFrontResponseHandler
- CloudWatch
- CloudWatchLogsHandler
- ScheduledHandler
- CodeBuild
- CodeBuildCloudWatchStateHandler
- CodePipeline
- CodePipelineCloudWatchActionHandler
- CodePipelineCloudWatchHandler
- CodePipelineCloudWatchPipelineHandler
- CodePipelineCloudWatchStageHandler
- CodePipelineHandler
- Cognito
- CognitoUserPoolTriggerHandler
- CreateAuthChallengeTriggerHandler
- CustomMessageTriggerHandler
- DefineAuthChallengeTriggerHandler
- PostAuthenticationTriggerHandler
- PostConfirmationTriggerHandler
- PreAuthenticationTriggerHandler
- PreSignUpTriggerHandler
- PreTokenGenerationTriggerHandler
- UserMigrationTriggerHandler
- VerifyAuthChallengeResponseTriggerHandler
- DynamoDB
- DynamoDBStreamHandler
- EventBridge
- EventBridgeHandler
- Firehose
- FirehoseTransformationHandler
- Kinesis
- KinesisStreamHandler
- Lex
- LexHandler
- S3
- S3BatchHandler
- S3Handler
- SES
- SESHandler
- SNS
- SNSHandler
- SQS
- SQSHandler
Each has Async~
variant that returns js.Promise
instead of accepting callback.
This facade leverages @Factory
macro to create highly-optimized factory method without boilerplate.
- Apache License version 2.0
- Basically generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/aws-lambda/index.d.ts which is under MIT License