UNPKG

lambda-live-debugger

Version:

Debug Lambda functions locally like it is running in the cloud

118 lines (117 loc) 3.95 kB
import { LambdaResource } from '../types/resourcesDiscovery.js'; import { IFramework } from './iFrameworks.js'; import { AwsConfiguration } from '../types/awsConfiguration.js'; import { LldConfigBase } from '../types/lldConfig.js'; import { type BundlingOptions } from 'aws-cdk-lib/aws-lambda-nodejs'; /** * Support for AWS CDK framework */ export declare class CdkFramework implements IFramework { /** * Framework name */ get name(): string; /** * Can this class handle the current project * @returns */ canHandle(): Promise<boolean>; /** * Get Lambda functions * @param config Configuration * @returns Lambda functions */ getLambdas(config: LldConfigBase): Promise<LambdaResource[]>; /** * Getz Lambda functions from the CloudFormation template metadata * @param stackName * @param awsConfiguration * @returns */ protected getLambdaCdkPathFromTemplateMetadata(stackName: string, awsConfiguration: AwsConfiguration): Promise<Array<{ logicalId: string; cdkPath: string; }>>; /** * Get Lambdas data from CDK by compiling and running the CDK code * @param cdkConfigPath * @param config * @returns */ protected getLambdasDataFromCdkByCompilingAndRunning(cdkConfigPath: string, config: LldConfigBase): Promise<{ cdkPath: string; stackName: string; packageJsonPath: string | undefined; codePath: string; handler: string | undefined; bundling: BundlingOptions; }[]>; /** * Run CDK code in a node thread worker and return the Lambda functions * @param param0 * @returns */ protected runCdkCodeAndReturnLambdas({ config, awsCdkLibPath, compileCodeFile, }: { config: LldConfigBase; awsCdkLibPath: string | undefined; compileCodeFile: string; }): Promise<{ cdkPath: string; stackName: string; codePath?: string; code: { path?: string; }; handler: string; packageJsonPath: string; bundling: BundlingOptions; }[]>; /** * Get CDK context * @param cdkConfigPath * @param config * @returns */ protected getCdkContext(cdkConfigPath: string, config: LldConfigBase): Promise<{}>; /** * Get CDK entry file * @param cdkConfigPath * @returns */ getCdkEntryFile(cdkConfigPath: string): Promise<string>; /** * Attempts to get the region from a number of sources and falls back to us-east-1 if no region can be found, * as is done in the AWS CLI. * * The order of priority is the following: * * 1. Environment variables specifying region, with both an AWS prefix and AMAZON prefix * to maintain backwards compatibility, and without `DEFAULT` in the name because * Lambda and CodeBuild set the $AWS_REGION variable. * 2. Regions listed in the Shared Ini Files - First checking for the profile provided * and then checking for the default profile. * 3. xxx * 4. us-east-1 * * Code from aws-cdk-cli/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth /awscli-compatible.ts */ protected getRegion(maybeProfile?: string): Promise<string | undefined>; /** * Looks up the region of the provided profile. If no region is present, * it will attempt to lookup the default region. * @param profile The profile to use to lookup the region * @returns The region for the profile or default profile, if present. Otherwise returns undefined. * * Code from aws-cdk-cli/packages/@aws-cdk/tmp-toolkit-helpers/src/api/aws-auth */ private getRegionFromIni; /** * Get region from ini file * @param profile * @param data * @returns */ private getRegionFromIniFile; } export declare const cdkFramework: CdkFramework;