Skip to content

Commit

Permalink
fix(serverless): update config properties
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Feb 8, 2021
1 parent 27ccf29 commit aa1a7f1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 7 deletions.
29 changes: 22 additions & 7 deletions types/serverless/plugins/aws/provider/awsProvider.d.ts
Expand Up @@ -6,8 +6,12 @@ declare namespace Aws {
*/
interface Serverless {
service: Service | string;
frameworkVersion: string;
configValidationMode?: string;
useDotenv?: boolean;
frameworkVersion?: string;
enableLocalInstallationFallback?: boolean;
unresolvedVariablesNotificationMode?: 'warn' | 'error';
disabledDeprecations?: string[];
configValidationMode?: 'warn' | 'error' | 'off';
provider: Provider;
package?: Package;
functions?: Functions;
Expand All @@ -22,6 +26,7 @@ declare namespace Aws {

interface Service {
name: string;
/** @deprecated in favor of `kmsKeyArn` at the provider level */
awsKmsKeyArn?: string;
}

Expand Down Expand Up @@ -64,6 +69,7 @@ declare namespace Aws {
tags?: Tags;
tracing?: Tracing;
logs?: Logs;
kmsKeyArn?: string;
}

interface Tags {
Expand Down Expand Up @@ -218,21 +224,21 @@ declare namespace Aws {

interface Tracing {
apiGateway: boolean;
lambda?: boolean;
lambda?: true | 'Active' | 'PassThrough';
}

interface RestApiLogs {
accessLogging?: boolean;
format?: string;
executionLogging?: boolean;
level?: string;
level?: 'INFO' | 'ERROR';
fullExecutionData?: boolean;
role?: string;
roleManagedExternally?: boolean;
}

interface WebsocketLogs {
level?: string;
level?: 'INFO' | 'ERROR';
}

interface HttpApiLogs {
Expand Down Expand Up @@ -265,7 +271,7 @@ declare namespace Aws {
resultTtlInSeconds?: number | string;
identitySource?: string;
identityValidationExpression?: string;
type?: string;
type?: 'token' | 'request';
}

interface HttpCors {
Expand Down Expand Up @@ -512,6 +518,11 @@ declare namespace Aws {
cloudFront?: CloudFront;
}

interface FileSystemConfig {
arn: string;
localMountPath: string;
}

interface AwsFunction {
name?: string;
description?: string;
Expand All @@ -522,17 +533,21 @@ declare namespace Aws {
timeout?: number | string;
role?: string;
onError?: string;
/** @deprecated in favor of `kmsKeyArn` */
awsKmsKeyArn?: string;
kmsKeyArn?: string;
environment?: Environment;
tags?: Tags;
vpc?: string | Vpc;
package?: Package;
layers?: Array<string | Record<string, string>>;
tracing?: string;
tracing?: 'Active' | 'PassThrough';
condition?: string;
dependsOn?: string[];
fileSystemConfig?: FileSystemConfig;
destinations?: Destinations;
events?: Event[];
disableLogs?: boolean;
}

interface AwsFunctionHandler extends AwsFunction {
Expand Down
29 changes: 29 additions & 0 deletions types/serverless/serverless-tests.ts
Expand Up @@ -644,6 +644,35 @@ const awsServerless: Aws.Serverless = {
awsServerless.provider.vpc = 'serverless reference';
awsServerless.functions![0].vpc = 'serverless reference';

const bunchOfConfigs: Aws.Serverless[] = [
{
service: 'users',
provider: { name: 'aws' },
functions: {}
},
{
service: 'users',
useDotenv: true,
provider: { name: 'aws' },
functions: {}
},
{
service: 'users',
configValidationMode: 'off',
unresolvedVariablesNotificationMode: 'error',
provider: { name: 'aws' },
functions: {}
},
{
service: 'users',
disabledDeprecations: [
'*'
],
provider: { name: 'aws' },
functions: {}
}
]

// Test Aws Class
const aws = new Aws(serverless, options);

Expand Down

0 comments on commit aa1a7f1

Please sign in to comment.