Options
All
  • Public
  • Public/Protected
  • All
Menu

@jetkit/cdk

Index

Helper Type aliases

ApiHandler

ApiHandler: (event: ApiEvent, context: Context) => ApiResponse

Type of an API request handler.

Type declaration

Other Type aliases

ApiResponse

ApiResponse: Promise<APIGatewayProxyResultV2>

Valid reponse types from a ApiHandler.

GeneratedFunction

GeneratedFunction: JetKitLambdaFunction

MetadataTarget

MetadataTarget: PossibleLambdaHandlers | MetadataTargetConstructor

Variables

Const DB_CLUSTER_ENV

DB_CLUSTER_ENV: "DB_CLUSTER_ARN" = "DB_CLUSTER_ARN"

Const DB_NAME_ENV

DB_NAME_ENV: "DB_NAME" = "DB_NAME"

Const DB_SECRET_ENV

DB_SECRET_ENV: "DB_SECRET_ARN" = "DB_SECRET_ARN"

Const DB_URL_ENV

DB_URL_ENV: "DATABASE_URL" = "DATABASE_URL"

Helper Functions

Const apiViewHandler

  • Helper function to generate a lambda handler for an ApiViewBase class. It should be exported as handler. This is the default handler name used when generating the lambda function. You may change it but be sure the exported name matches the IApiMetadata.handler parameter.

    example
    export const handler = apiViewHandler(__filename, MyApiView)
    

    Parameters

    • filename: string

      Should be __filename. Tells Lambda where to find your entrypoint

    • apiView: typeof ApiViewBase

      A subclass of ApiViewBase

    Returns ApiHandler

    Lambda entrypoint handler to dispatch to the appropriate view method

Metadata Decorator Functions

ApiView

  • ApiView(opts: ApiViewOpts): <T>(constructor: T) => T
  • Define API view class routing properties.

    Saves metadata on the class for generation of CDK resources.

    Parameters

    • opts: ApiViewOpts

    Returns <T>(constructor: T) => T

      • <T>(constructor: T): T
      • Type parameters

        Parameters

        • constructor: T

        Returns T

Lambda

  • Lambda<HandlerT>(props: Partial<IRouteProps> | IScheduledProps): (wrapped: HandlerT) => HandlerT
  • Defines a Lambda function.

    Saves metadata on the function for generation of CDK resources.

    N.B. in order for the Lambda entry handler to locate your function it must be named and exported or you can manually provide the name of the exported handler in props.handler.

    Type parameters

    • HandlerT: PossibleLambdaHandlers = PossibleLambdaHandlers

    Parameters

    • props: Partial<IRouteProps> | IScheduledProps

      configure optional API route and any other lambda function properties including memory allocation and environment variables.

    Returns (wrapped: HandlerT) => HandlerT

      • (wrapped: HandlerT): HandlerT
      • Parameters

        • wrapped: HandlerT

        Returns HandlerT

SubRoute

  • SubRoute(__namedParameters: ISubRouteProps): (target: ApiViewBase, propertyKey: string, descriptor: RoutePropertyDescriptor) => void
  • Add a route to an Api view. Use this on class methods that are inside an @ApiView class.

    Saves metadata on the method for generation of CDK resources.

    Parameters

    Returns (target: ApiViewBase, propertyKey: string, descriptor: RoutePropertyDescriptor) => void

      • (target: ApiViewBase, propertyKey: string, descriptor: RoutePropertyDescriptor): void
      • Parameters

        • target: ApiViewBase
        • propertyKey: string
        • descriptor: RoutePropertyDescriptor

        Returns void

Other Functions

topSongsHandler

  • topSongsHandler(event: ApiEvent): Promise<string>
  • internal

    Parameters

    Returns Promise<string>

Generated using TypeDoc