-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: restrict props with type checking (#18)
- Loading branch information
1 parent
2ed1494
commit 38573da
Showing
4 changed files
with
31 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import { Architecture, Runtime, Tracing } from 'aws-cdk-lib/aws-lambda'; | ||
import { NodejsFunctionProps } from 'aws-cdk-lib/aws-lambda-nodejs'; | ||
|
||
export interface AllowedLambdaConfig { | ||
runtime: Runtime[]; | ||
architecture: Architecture[]; | ||
tracing: Tracing[]; | ||
retryAttempts: number[]; | ||
import { allowedConfig } from './config'; | ||
|
||
export interface RestrictedLambdaConfig { | ||
retryAttempts: typeof allowedConfig.retryAttempts[number]; | ||
tracing: typeof allowedConfig.tracing[number]; | ||
runtime: typeof allowedConfig.runtime[number]; //currently this doesnt restrict the runtime to nodejs | ||
architecture: typeof allowedConfig.architecture[number]; //currently this doesnt restrict the architecture | ||
} | ||
|
||
export interface RequiredLambdaConfig extends Partial<NodejsFunctionProps> { | ||
functionName: string; | ||
entry: string; | ||
} | ||
|
||
export interface AleiosLambdaProps extends RequiredLambdaConfig { | ||
runtime?: RestrictedLambdaConfig['runtime']; | ||
architecture?: RestrictedLambdaConfig['architecture']; | ||
tracing?: RestrictedLambdaConfig['tracing']; | ||
retryAttempts?: RestrictedLambdaConfig['retryAttempts']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters