From 16830bb2177285efe5409639b3a507a4685f63ed Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Tue, 9 Feb 2021 08:25:58 +1300 Subject: [PATCH] fix(serverless): update config properties --- .../plugins/aws/provider/awsProvider.d.ts | 29 +++++++++++---- types/serverless/serverless-tests.ts | 37 +++++++++++++++++-- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/types/serverless/plugins/aws/provider/awsProvider.d.ts b/types/serverless/plugins/aws/provider/awsProvider.d.ts index 3e9fe56e3ed79c2..3fe2da8cb32180e 100644 --- a/types/serverless/plugins/aws/provider/awsProvider.d.ts +++ b/types/serverless/plugins/aws/provider/awsProvider.d.ts @@ -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; @@ -22,6 +26,7 @@ declare namespace Aws { interface Service { name: string; + /** @deprecated in favor of `kmsKeyArn` at the provider level */ awsKmsKeyArn?: string; } @@ -64,6 +69,7 @@ declare namespace Aws { tags?: Tags; tracing?: Tracing; logs?: Logs; + kmsKeyArn?: string; } interface Tags { @@ -93,7 +99,7 @@ declare namespace Aws { [key: string]: string; }; websocketApiId?: any; - apiKeySourceType?: string; + apiKeySourceType?: 'HEADER' | 'AUTHORIZER' | 'header' | 'authorizer'; minimumCompressionSize?: number | string; description?: string; binaryMediaTypes?: string[]; @@ -218,21 +224,21 @@ declare namespace Aws { interface Tracing { apiGateway: boolean; - lambda?: boolean; + lambda?: 'Active' | 'PassThrough' | boolean; } 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 { @@ -512,6 +518,11 @@ declare namespace Aws { cloudFront?: CloudFront; } + interface FileSystemConfig { + arn: string; + localMountPath: string; + } + interface AwsFunction { name?: string; description?: string; @@ -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>; - tracing?: string; + tracing?: 'Active' | 'PassThrough' | boolean; condition?: string; dependsOn?: string[]; + fileSystemConfig?: FileSystemConfig; destinations?: Destinations; events?: Event[]; + disableLogs?: boolean; } interface AwsFunctionHandler extends AwsFunction { diff --git a/types/serverless/serverless-tests.ts b/types/serverless/serverless-tests.ts index c1ca16ea8082a44..adfc673c87e7082 100644 --- a/types/serverless/serverless-tests.ts +++ b/types/serverless/serverless-tests.ts @@ -166,7 +166,7 @@ const awsServerless: Aws.Serverless = { testrestapiresource: 'testrestapiresource' }, websocketApiId: 'testwebsocketApiId', - apiKeySourceType: 'testapiKeySourceType', + apiKeySourceType: 'HEADER', minimumCompressionSize: 1, description: 'testdescription', binaryMediaTypes: ['testbinaryMediaTypes'] @@ -308,13 +308,13 @@ const awsServerless: Aws.Serverless = { accessLogging: false, format: 'testformat', executionLogging: false, - level: 'testlevel', + level: 'ERROR', fullExecutionData: false, role: 'testrole', roleManagedExternally: false, }, websocket: { - level: 'testlevel' + level: 'INFO' }, httpApi: { format: 'testformat' @@ -363,7 +363,7 @@ const awsServerless: Aws.Serverless = { individually: true }, layers: ['testlayers'], - tracing: 'testtracing', + tracing: 'PassThrough', condition: 'testcondition', dependsOn: ['testdependson'], destinations: { @@ -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);