common-types
Advanced tools
Comparing version 1.19.1 to 1.20.0
export * from "./fileTypeContent"; | ||
export * from "./network"; | ||
export * from "./other"; | ||
export * from "./stringAliases"; | ||
export * from "./timing"; | ||
export * from "./uuid"; |
/** a number which should represent a percentage value */ | ||
export declare type percentage = number; | ||
export declare type scalar = string | number | boolean; | ||
/** a object which has been serialized to a string in JSON notation */ | ||
export declare type JSONstring = string; | ||
/** foreign key reference */ | ||
@@ -4,0 +7,0 @@ export declare type fk = string; |
@@ -12,3 +12,3 @@ import { datetime } from "../aliases"; | ||
detail: { | ||
state?: string; | ||
state?: "pending" | string; | ||
eventSource?: IAwsEventUrls[]; | ||
@@ -15,0 +15,0 @@ eventName?: IAwsEventName[]; |
export * from "./open-api"; | ||
export * from "./serverless-api-gateway"; | ||
export * from "./serverless-authorizers"; | ||
export * from "./serverless-constants"; | ||
export * from "./serverless-events"; | ||
export * from "./serverless-function"; | ||
export * from "./serverless-global"; | ||
export * from "./serverless-http-api"; | ||
export * from "./serverless-iam"; | ||
export * from "./serverless-logging"; | ||
export * from "./serverless-package"; | ||
export * from "./serverless-provider"; | ||
export * from "./serverless-resources"; | ||
export * from "./serverless-tracing"; | ||
export * from "./serverless-vpc"; | ||
export * from "./serverless"; | ||
export * from "./step-functions"; |
@@ -0,4 +1,6 @@ | ||
import { seconds, sql } from "../aliases"; | ||
import { arn } from "../aws"; | ||
import { ICloudWatchConfigEvent } from "../aws/aws-events"; | ||
import { IDictionary } from "../basics"; | ||
import { IServerlessAuthorizer, IServerlessRequest, IServerlessStatusCode, IServerlessVariable } from "./serverless"; | ||
import { IServerlessHttpAuthorizer, IServerlessRequest, IServerlessStatusCode, IServerlessVariable } from "./serverless"; | ||
import { IHttpApiComplex, IHttpApiSimple } from "./serverless-http-api"; | ||
@@ -45,5 +47,20 @@ export interface IServerlessEvent { | ||
sns?: string | IServerlessEventExistingSNS | IServerlessEventVerboseSNS; | ||
sqs?: IServerlessSQSEvent; | ||
/** Sets a S3 Event as a Lambda trigger. */ | ||
s3?: IServerlessEventS3; | ||
stream?: IServerlessStreamEvent; | ||
/** | ||
* Config for Kafka events | ||
*/ | ||
msk?: IServerlessKafkaEvent; | ||
alexaSkill?: { | ||
appId: string; | ||
enabled: boolean; | ||
}; | ||
alexaSmartHome?: { | ||
appId: string; | ||
enabled: boolean; | ||
}; | ||
iot?: IServerlessIotEvent; | ||
/** | ||
* Allow a cloudwatch event to trigger execution of a lambda function or a step-function | ||
@@ -57,3 +74,87 @@ * | ||
}; | ||
cloudwatchLog?: { | ||
logGroup?: string; | ||
filter?: string; | ||
}; | ||
cognitoUserPool?: { | ||
pool?: any; | ||
trigger?: any; | ||
existing?: boolean; | ||
}; | ||
alb?: { | ||
listenerArn?: arn; | ||
priority?: number; | ||
conditions?: Record<string, string>; | ||
healthcheck?: boolean | { | ||
path?: string; | ||
intervalSeconds?: seconds; | ||
timeoutSeconds?: seconds; | ||
healthyThresholdCount?: number; | ||
unhealthyThresholdCount?: number; | ||
matcher?: Record<string, string>; | ||
}; | ||
}; | ||
eventBridge: { | ||
/** using the default AWS event bus. Example might be "rate(10 minutes)" */ | ||
schedule: string; | ||
/** creating or reusing an existing event-bus */ | ||
eventBus: string; | ||
pattern: Record<"source" | "detail-type" | "detail" | string, any>; | ||
inputTransformer: { | ||
inputPathsMap: Record<string, string>; | ||
inputTemplate: string; | ||
}; | ||
input: Record<string, any>; | ||
inputPath: string; | ||
}; | ||
cloudFront?: { | ||
eventType?: string; | ||
includeBody?: boolean; | ||
pathPattern?: string; | ||
/** a cache policy is defined with either a `name` or `id` but not both */ | ||
cachePolicy?: { | ||
/** Refers to a Cache Policy defined in provider.cloudFront.cachePolicies */ | ||
name: string; | ||
} | { | ||
/** Refers to any external Cache Policy id */ | ||
id: string; | ||
}; | ||
origin?: { | ||
DomainName?: string; | ||
OriginPath?: string; | ||
CustomOrginConfig?: Record<"OriginProtocolPolicy" | string, "match-viewer" | string>; | ||
}; | ||
}; | ||
} | ||
export interface IServerlessIotEvent { | ||
name: string; | ||
description?: string; | ||
enabled?: boolean; | ||
sql: sql; | ||
sqlVersion?: "beta" | string | number; | ||
} | ||
export interface IServerlessKafkaEvent { | ||
/** ARN of MSK Cluster */ | ||
arn?: arn; | ||
/** name of Kafka topic to consume from */ | ||
topic?: string; | ||
/** must be in 1-10000 range */ | ||
batchSize?: number; | ||
startingPosition?: "LATEST" | "TRIM_HORIZON"; | ||
/** true by default, can be used to disable event without deleting resource */ | ||
enabled?: boolean; | ||
} | ||
export interface IServerlessSQSEvent { | ||
arn?: arn; | ||
batchSize?: number; | ||
/** minimum is 0 and the maximum is 300 (seconds) */ | ||
maxiumBatchingWindow?: seconds; | ||
enabled?: boolean; | ||
} | ||
export interface IServerlessStreamEvent { | ||
arn?: arn; | ||
maximumRecordAgeInSeconds?: number; | ||
startingPosition?: "LATEST" | any; | ||
enabled?: boolean; | ||
} | ||
/** used to attach a function to a pre-existing */ | ||
@@ -90,10 +191,18 @@ export interface IServerlessEventExistingSNS { | ||
export interface IServerlessEventHttp { | ||
/** HTTP method for this endpoint */ | ||
method: "get" | "put" | "post" | "delete"; | ||
/** Path for this endpoint */ | ||
path: string; | ||
/** Turn on CORS for this endpoint, but don't forget to return the right header in your response */ | ||
cors?: boolean; | ||
/** | ||
* Requires clients to add API keys values in the `x-api-key` header of their request | ||
*/ | ||
private?: boolean; | ||
/** An AWS API Gateway custom authorizer function */ | ||
authorizer?: IServerlessHttpAuthorizer | IServerlessVariable; | ||
/** configure method request and integration request settings */ | ||
request?: IServerlessRequest; | ||
/** not sure what other values can be set here */ | ||
integration?: "lambda"; | ||
authorizer?: IServerlessAuthorizer | IServerlessVariable; | ||
private?: true; | ||
request?: IServerlessRequest; | ||
statusCodes?: { | ||
@@ -100,0 +209,0 @@ [key: number]: IServerlessStatusCode; |
@@ -86,26 +86,1 @@ import { RestMethod } from "../aws"; | ||
} | ||
/** | ||
* Allows configuration of the CloudWatch logs for your HTTP API | ||
* endpoints. For more info read the | ||
* [**AWS** docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging-variables.html) | ||
* on what variables are available but the default configuration is: | ||
* | ||
* ```typescript | ||
* { | ||
* "requestId": "$context.requestId", | ||
* "ip": "$context.identity.sourceIp", | ||
* "requestTime": "$context.requestTime", | ||
* "httpMethod": "$context.httpMethod", | ||
* "routeKey": "$context.routeKey", | ||
* "status": "$context.status", | ||
* "protocol": "$context.protocol", | ||
* "responseLength": "$context.responseLength" | ||
* } | ||
* ``` | ||
*/ | ||
export interface IHttpApiLogging { | ||
/** | ||
* Change the format of the logs being written to Cloudwatch | ||
*/ | ||
format: string; | ||
} |
import { IDictionary } from "../basics"; | ||
import { IApiGatewayAliasConfig } from "../serverless-plugins/serverless-alias-plugin"; | ||
import { arn } from "../aws"; | ||
import { IServerlessEvent } from "./serverless-events"; | ||
import { IStateMachine } from "./step-functions"; | ||
/** A typing for the serverless framework's "serverless.yml" file */ | ||
@@ -37,3 +34,3 @@ export declare type IServerlessStage = "dev" | "prod" | "test" | "stage"; | ||
} | ||
export declare type AWSRuntime = "nodejs6.10" | "nodejs8.10" | "nodejs10.x" | "nodejs12.x" | "node4" | "java8" | "python2.7" | "python3.6" | "go1.x"; | ||
export declare type AWSRuntime = "nodejs6.10" | "nodejs8.10" | "nodejs10.x" | "nodejs12.x" | "nodejs14.x" | "node4" | "java8" | "python2.7" | "python3.6" | "go1.x"; | ||
export interface IServerlessConfigCustom extends IDictionary { | ||
@@ -49,17 +46,2 @@ stage?: string; | ||
} | ||
export interface IServerlessConfig<T = IServerlessConfigCustom> { | ||
service: string | { | ||
name: string; | ||
}; | ||
custom?: T; | ||
plugins?: string[]; | ||
package?: IServerlessPackage; | ||
provider?: IServerlessProvider; | ||
stepFunctions?: { | ||
stateMachines: IDictionary<IStateMachine>; | ||
activities?: string[]; | ||
}; | ||
functions?: IDictionary<IServerlessFunction>; | ||
layers?: IArnStringReference[] | ICloudformationReference[] | ILayerDefinition; | ||
} | ||
export interface ILayerDefinition { | ||
@@ -78,165 +60,3 @@ [layerName: string]: { | ||
} | ||
export interface IServerlessPackage { | ||
individually?: boolean; | ||
excludeDevDependencies?: boolean; | ||
browser?: boolean; | ||
include?: string[]; | ||
exclude?: string[]; | ||
/** path to the artifact ZIP file */ | ||
artifact?: string; | ||
} | ||
export interface IServerlessProvider { | ||
/** The name of your service. This name will be the prefix for all your functions */ | ||
name: string; | ||
runtime?: AWSRuntime; | ||
/** this refers to the AWS profile in your ~/aws/credentials file */ | ||
profile?: string; | ||
/** Service wide environment variables */ | ||
environment?: string | IDictionary<string>; | ||
/** Set the default stage used. Default is "dev". */ | ||
stage?: string; | ||
/** Set the default region. Default is "us-east-1". */ | ||
region?: string; | ||
/** Set the default RetentionInDays for a CloudWatch LogGroup. */ | ||
logRetentionInDays?: number; | ||
/** Set the default memory size; default is 1024 */ | ||
memorySize?: number; | ||
stackTags?: IDictionary<string>; | ||
stackPolicy?: any; | ||
/** if you are using the serverless-plugin-tracing then you can enable tracing with this flag */ | ||
tracing?: boolean | { | ||
lambda?: boolean; | ||
apiGateway?: boolean; | ||
}; | ||
deploymentBucket?: { | ||
/** overwrite the default deployment bucket */ | ||
name: string; | ||
/** specificies the type of encryption, when using server-side encryption */ | ||
serverSideEncryption?: string; | ||
}; | ||
apiKeys?: Array<string | { | ||
name: string; | ||
value: string; | ||
}>; | ||
usagePlan?: IServerlessUsagePlan; | ||
/** default is EDGE */ | ||
endpointType?: "REGIONAL" | "EDGE"; | ||
apiGateway?: { | ||
restApiId: string; | ||
restApiRootResourceId: string; | ||
restApiResources?: IDictionary; | ||
binaryMediaTypes?: string[]; | ||
}; | ||
iamRoleStatements?: any[]; | ||
versionFunctions?: boolean; | ||
/** | ||
* **aliasStage** | ||
* | ||
* If using the the [serverless-aws-alias](https://github.com/HyperBrain/serverless-aws-alias) | ||
* plugin then you can configure settings here. | ||
*/ | ||
aliasStage?: IApiGatewayAliasConfig; | ||
/** turn on logging for API Gateway */ | ||
logs?: { | ||
restApi: boolean; | ||
}; | ||
} | ||
export interface IServerlessUsagePlan { | ||
quota?: { | ||
limit: number; | ||
offset?: number; | ||
period: "MONTH" | "WEEK" | "DAY"; | ||
}; | ||
throttle?: { | ||
burstLimit?: number; | ||
rateLimit?: number; | ||
}; | ||
} | ||
export interface IServerlessIAMRole { | ||
Effect: "Allow" | "Deny"; | ||
/** A list of scopes (such as "s3:ListBucket" or "states:ListStateMachines") which are being allowed/denied */ | ||
Action: string[]; | ||
/** A list of resources (aka, arn's) which are to receive this role grant */ | ||
Resource: string[]; | ||
} | ||
export declare type ServerlessFunctionMemorySize = 128 | 192 | 256 | 320 | 384 | 448 | 512 | 576 | 640 | 704 | 768 | 832 | 896 | 960 | 1024 | 1088 | 1152 | 1216 | 1280 | 1344 | 1408 | 1472 | 1536 | 1600 | 1664 | 1728 | 1792 | 1856 | 1920 | 1984 | 2048 | 2112 | 2176 | 2240 | 2304 | 2368 | 2432 | 2496 | 2560 | 2624 | 2688 | 2752 | 2816 | 2880 | 2944 | 3008; | ||
/** | ||
* The configuration for your serverless function. | ||
* The only required property is a "handler" property | ||
* pointing to the function definition itself and the | ||
* function to call within the file. | ||
*/ | ||
export interface IServerlessFunction { | ||
/** | ||
* Allows you to set environment variables specific to that | ||
* function. | ||
*/ | ||
environment?: string | IDictionary; | ||
description?: string; | ||
/** | ||
* the handler function in the form of "/path/to/file.HANDLER_FN" where | ||
* HANDLER_FN is typically "handler". | ||
*/ | ||
handler: string; | ||
/** | ||
* A functions X-Ray tracing configuration. | ||
* | ||
* **Pass Through:** | ||
* This is the default setting for all Lambda functions if you have added tracing permissions to your | ||
* function's execution role. This approach means the Lambda function is only traced if X-Ray has been | ||
* enabled on an upstream service, such as AWS Elastic Beanstalk. | ||
* | ||
* **Active:** | ||
* When a Lambda function has this setting, Lambda automatically samples invocation requests, based | ||
* on the sampling algorithm specified by X-Ray. | ||
*/ | ||
tracing?: "Active" | "Passthrough"; | ||
runtime?: AWSRuntime; | ||
/** how many miliseconds before the function times out */ | ||
timeout?: number; | ||
/** | ||
* the allocated "memory" of the virtual machine that will | ||
* run this function ... in reality is not only a proxy for | ||
* memory availability but also computational capability | ||
*/ | ||
memorySize?: ServerlessFunctionMemorySize; | ||
package?: { | ||
artifact?: string; | ||
exclude?: string[]; | ||
include?: string[]; | ||
}; | ||
/** | ||
* Events which may call this function | ||
*/ | ||
events?: IServerlessEvent[]; | ||
/** | ||
* **aliasStage** | ||
* | ||
* If using the the [serverless-aws-alias](https://github.com/HyperBrain/serverless-aws-alias) | ||
* plugin then you can configure settings here. | ||
*/ | ||
aliasStage?: IApiGatewayAliasConfig; | ||
/** | ||
* Add AWS Layers to your function. You can refer to it either as | ||
* an ARN or a via [Cloudformation Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html). A cloudformation reference | ||
* might look something like `{Ref:MyLambdaLayer}` whereas an ARN reference | ||
* is just a standard ARN string. | ||
* | ||
* **Note:** the layer will be accessible at `/opt/*`. If the layer you are using is in | ||
* `node_modules` then it is advisable to add the following to your function definition: | ||
```typescript | ||
const fn: IServerlessFunction = { | ||
environment: { | ||
NODE_PATH: "./:/opt/node_modules" | ||
} | ||
} | ||
``` | ||
* as this will ensure that your layer's NPM modules are included in your path | ||
*/ | ||
layers?: IArnStringReference[] | ICloudformationReference[] | ILayerDefinition; | ||
} | ||
export interface ICloudformationReference { | ||
Ref: string; | ||
} | ||
export declare type IArnStringReference = string; | ||
export interface IServerlessStatusCode { | ||
@@ -257,3 +77,3 @@ pattern: string; | ||
} | ||
export interface IServerlessAuthorizer { | ||
export interface IServerlessHttpAuthorizer { | ||
arn: string; | ||
@@ -260,0 +80,0 @@ claims?: string[]; |
@@ -5,2 +5,5 @@ import { datetime } from "../aliases"; | ||
import { IServerlessEvent } from "./serverless-events"; | ||
export interface IServerlessStepFunctions { | ||
stateMachines: Record<string, IStateMachine>; | ||
} | ||
/** of the format of arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-FUNCTION */ | ||
@@ -7,0 +10,0 @@ export declare type AwsFunctionArn = string; |
export * from "./fileTypeContent"; | ||
export * from "./network"; | ||
export * from "./other"; | ||
export * from "./stringAliases"; | ||
export * from "./timing"; | ||
export * from "./uuid"; |
/** a number which should represent a percentage value */ | ||
export declare type percentage = number; | ||
export declare type scalar = string | number | boolean; | ||
/** a object which has been serialized to a string in JSON notation */ | ||
export declare type JSONstring = string; | ||
/** foreign key reference */ | ||
@@ -4,0 +7,0 @@ export declare type fk = string; |
@@ -12,3 +12,3 @@ import { datetime } from "../aliases"; | ||
detail: { | ||
state?: string; | ||
state?: "pending" | string; | ||
eventSource?: IAwsEventUrls[]; | ||
@@ -15,0 +15,0 @@ eventName?: IAwsEventName[]; |
export * from "./open-api"; | ||
export * from "./serverless-api-gateway"; | ||
export * from "./serverless-authorizers"; | ||
export * from "./serverless-constants"; | ||
export * from "./serverless-events"; | ||
export * from "./serverless-function"; | ||
export * from "./serverless-global"; | ||
export * from "./serverless-http-api"; | ||
export * from "./serverless-iam"; | ||
export * from "./serverless-logging"; | ||
export * from "./serverless-package"; | ||
export * from "./serverless-provider"; | ||
export * from "./serverless-resources"; | ||
export * from "./serverless-tracing"; | ||
export * from "./serverless-vpc"; | ||
export * from "./serverless"; | ||
export * from "./step-functions"; |
@@ -0,4 +1,6 @@ | ||
import { seconds, sql } from "../aliases"; | ||
import { arn } from "../aws"; | ||
import { ICloudWatchConfigEvent } from "../aws/aws-events"; | ||
import { IDictionary } from "../basics"; | ||
import { IServerlessAuthorizer, IServerlessRequest, IServerlessStatusCode, IServerlessVariable } from "./serverless"; | ||
import { IServerlessHttpAuthorizer, IServerlessRequest, IServerlessStatusCode, IServerlessVariable } from "./serverless"; | ||
import { IHttpApiComplex, IHttpApiSimple } from "./serverless-http-api"; | ||
@@ -45,5 +47,20 @@ export interface IServerlessEvent { | ||
sns?: string | IServerlessEventExistingSNS | IServerlessEventVerboseSNS; | ||
sqs?: IServerlessSQSEvent; | ||
/** Sets a S3 Event as a Lambda trigger. */ | ||
s3?: IServerlessEventS3; | ||
stream?: IServerlessStreamEvent; | ||
/** | ||
* Config for Kafka events | ||
*/ | ||
msk?: IServerlessKafkaEvent; | ||
alexaSkill?: { | ||
appId: string; | ||
enabled: boolean; | ||
}; | ||
alexaSmartHome?: { | ||
appId: string; | ||
enabled: boolean; | ||
}; | ||
iot?: IServerlessIotEvent; | ||
/** | ||
* Allow a cloudwatch event to trigger execution of a lambda function or a step-function | ||
@@ -57,3 +74,87 @@ * | ||
}; | ||
cloudwatchLog?: { | ||
logGroup?: string; | ||
filter?: string; | ||
}; | ||
cognitoUserPool?: { | ||
pool?: any; | ||
trigger?: any; | ||
existing?: boolean; | ||
}; | ||
alb?: { | ||
listenerArn?: arn; | ||
priority?: number; | ||
conditions?: Record<string, string>; | ||
healthcheck?: boolean | { | ||
path?: string; | ||
intervalSeconds?: seconds; | ||
timeoutSeconds?: seconds; | ||
healthyThresholdCount?: number; | ||
unhealthyThresholdCount?: number; | ||
matcher?: Record<string, string>; | ||
}; | ||
}; | ||
eventBridge: { | ||
/** using the default AWS event bus. Example might be "rate(10 minutes)" */ | ||
schedule: string; | ||
/** creating or reusing an existing event-bus */ | ||
eventBus: string; | ||
pattern: Record<"source" | "detail-type" | "detail" | string, any>; | ||
inputTransformer: { | ||
inputPathsMap: Record<string, string>; | ||
inputTemplate: string; | ||
}; | ||
input: Record<string, any>; | ||
inputPath: string; | ||
}; | ||
cloudFront?: { | ||
eventType?: string; | ||
includeBody?: boolean; | ||
pathPattern?: string; | ||
/** a cache policy is defined with either a `name` or `id` but not both */ | ||
cachePolicy?: { | ||
/** Refers to a Cache Policy defined in provider.cloudFront.cachePolicies */ | ||
name: string; | ||
} | { | ||
/** Refers to any external Cache Policy id */ | ||
id: string; | ||
}; | ||
origin?: { | ||
DomainName?: string; | ||
OriginPath?: string; | ||
CustomOrginConfig?: Record<"OriginProtocolPolicy" | string, "match-viewer" | string>; | ||
}; | ||
}; | ||
} | ||
export interface IServerlessIotEvent { | ||
name: string; | ||
description?: string; | ||
enabled?: boolean; | ||
sql: sql; | ||
sqlVersion?: "beta" | string | number; | ||
} | ||
export interface IServerlessKafkaEvent { | ||
/** ARN of MSK Cluster */ | ||
arn?: arn; | ||
/** name of Kafka topic to consume from */ | ||
topic?: string; | ||
/** must be in 1-10000 range */ | ||
batchSize?: number; | ||
startingPosition?: "LATEST" | "TRIM_HORIZON"; | ||
/** true by default, can be used to disable event without deleting resource */ | ||
enabled?: boolean; | ||
} | ||
export interface IServerlessSQSEvent { | ||
arn?: arn; | ||
batchSize?: number; | ||
/** minimum is 0 and the maximum is 300 (seconds) */ | ||
maxiumBatchingWindow?: seconds; | ||
enabled?: boolean; | ||
} | ||
export interface IServerlessStreamEvent { | ||
arn?: arn; | ||
maximumRecordAgeInSeconds?: number; | ||
startingPosition?: "LATEST" | any; | ||
enabled?: boolean; | ||
} | ||
/** used to attach a function to a pre-existing */ | ||
@@ -90,10 +191,18 @@ export interface IServerlessEventExistingSNS { | ||
export interface IServerlessEventHttp { | ||
/** HTTP method for this endpoint */ | ||
method: "get" | "put" | "post" | "delete"; | ||
/** Path for this endpoint */ | ||
path: string; | ||
/** Turn on CORS for this endpoint, but don't forget to return the right header in your response */ | ||
cors?: boolean; | ||
/** | ||
* Requires clients to add API keys values in the `x-api-key` header of their request | ||
*/ | ||
private?: boolean; | ||
/** An AWS API Gateway custom authorizer function */ | ||
authorizer?: IServerlessHttpAuthorizer | IServerlessVariable; | ||
/** configure method request and integration request settings */ | ||
request?: IServerlessRequest; | ||
/** not sure what other values can be set here */ | ||
integration?: "lambda"; | ||
authorizer?: IServerlessAuthorizer | IServerlessVariable; | ||
private?: true; | ||
request?: IServerlessRequest; | ||
statusCodes?: { | ||
@@ -100,0 +209,0 @@ [key: number]: IServerlessStatusCode; |
@@ -86,26 +86,1 @@ import { RestMethod } from "../aws"; | ||
} | ||
/** | ||
* Allows configuration of the CloudWatch logs for your HTTP API | ||
* endpoints. For more info read the | ||
* [**AWS** docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging-variables.html) | ||
* on what variables are available but the default configuration is: | ||
* | ||
* ```typescript | ||
* { | ||
* "requestId": "$context.requestId", | ||
* "ip": "$context.identity.sourceIp", | ||
* "requestTime": "$context.requestTime", | ||
* "httpMethod": "$context.httpMethod", | ||
* "routeKey": "$context.routeKey", | ||
* "status": "$context.status", | ||
* "protocol": "$context.protocol", | ||
* "responseLength": "$context.responseLength" | ||
* } | ||
* ``` | ||
*/ | ||
export interface IHttpApiLogging { | ||
/** | ||
* Change the format of the logs being written to Cloudwatch | ||
*/ | ||
format: string; | ||
} |
import { IDictionary } from "../basics"; | ||
import { IApiGatewayAliasConfig } from "../serverless-plugins/serverless-alias-plugin"; | ||
import { arn } from "../aws"; | ||
import { IServerlessEvent } from "./serverless-events"; | ||
import { IStateMachine } from "./step-functions"; | ||
/** A typing for the serverless framework's "serverless.yml" file */ | ||
@@ -37,3 +34,3 @@ export declare type IServerlessStage = "dev" | "prod" | "test" | "stage"; | ||
} | ||
export declare type AWSRuntime = "nodejs6.10" | "nodejs8.10" | "nodejs10.x" | "nodejs12.x" | "node4" | "java8" | "python2.7" | "python3.6" | "go1.x"; | ||
export declare type AWSRuntime = "nodejs6.10" | "nodejs8.10" | "nodejs10.x" | "nodejs12.x" | "nodejs14.x" | "node4" | "java8" | "python2.7" | "python3.6" | "go1.x"; | ||
export interface IServerlessConfigCustom extends IDictionary { | ||
@@ -49,17 +46,2 @@ stage?: string; | ||
} | ||
export interface IServerlessConfig<T = IServerlessConfigCustom> { | ||
service: string | { | ||
name: string; | ||
}; | ||
custom?: T; | ||
plugins?: string[]; | ||
package?: IServerlessPackage; | ||
provider?: IServerlessProvider; | ||
stepFunctions?: { | ||
stateMachines: IDictionary<IStateMachine>; | ||
activities?: string[]; | ||
}; | ||
functions?: IDictionary<IServerlessFunction>; | ||
layers?: IArnStringReference[] | ICloudformationReference[] | ILayerDefinition; | ||
} | ||
export interface ILayerDefinition { | ||
@@ -78,165 +60,3 @@ [layerName: string]: { | ||
} | ||
export interface IServerlessPackage { | ||
individually?: boolean; | ||
excludeDevDependencies?: boolean; | ||
browser?: boolean; | ||
include?: string[]; | ||
exclude?: string[]; | ||
/** path to the artifact ZIP file */ | ||
artifact?: string; | ||
} | ||
export interface IServerlessProvider { | ||
/** The name of your service. This name will be the prefix for all your functions */ | ||
name: string; | ||
runtime?: AWSRuntime; | ||
/** this refers to the AWS profile in your ~/aws/credentials file */ | ||
profile?: string; | ||
/** Service wide environment variables */ | ||
environment?: string | IDictionary<string>; | ||
/** Set the default stage used. Default is "dev". */ | ||
stage?: string; | ||
/** Set the default region. Default is "us-east-1". */ | ||
region?: string; | ||
/** Set the default RetentionInDays for a CloudWatch LogGroup. */ | ||
logRetentionInDays?: number; | ||
/** Set the default memory size; default is 1024 */ | ||
memorySize?: number; | ||
stackTags?: IDictionary<string>; | ||
stackPolicy?: any; | ||
/** if you are using the serverless-plugin-tracing then you can enable tracing with this flag */ | ||
tracing?: boolean | { | ||
lambda?: boolean; | ||
apiGateway?: boolean; | ||
}; | ||
deploymentBucket?: { | ||
/** overwrite the default deployment bucket */ | ||
name: string; | ||
/** specificies the type of encryption, when using server-side encryption */ | ||
serverSideEncryption?: string; | ||
}; | ||
apiKeys?: Array<string | { | ||
name: string; | ||
value: string; | ||
}>; | ||
usagePlan?: IServerlessUsagePlan; | ||
/** default is EDGE */ | ||
endpointType?: "REGIONAL" | "EDGE"; | ||
apiGateway?: { | ||
restApiId: string; | ||
restApiRootResourceId: string; | ||
restApiResources?: IDictionary; | ||
binaryMediaTypes?: string[]; | ||
}; | ||
iamRoleStatements?: any[]; | ||
versionFunctions?: boolean; | ||
/** | ||
* **aliasStage** | ||
* | ||
* If using the the [serverless-aws-alias](https://github.com/HyperBrain/serverless-aws-alias) | ||
* plugin then you can configure settings here. | ||
*/ | ||
aliasStage?: IApiGatewayAliasConfig; | ||
/** turn on logging for API Gateway */ | ||
logs?: { | ||
restApi: boolean; | ||
}; | ||
} | ||
export interface IServerlessUsagePlan { | ||
quota?: { | ||
limit: number; | ||
offset?: number; | ||
period: "MONTH" | "WEEK" | "DAY"; | ||
}; | ||
throttle?: { | ||
burstLimit?: number; | ||
rateLimit?: number; | ||
}; | ||
} | ||
export interface IServerlessIAMRole { | ||
Effect: "Allow" | "Deny"; | ||
/** A list of scopes (such as "s3:ListBucket" or "states:ListStateMachines") which are being allowed/denied */ | ||
Action: string[]; | ||
/** A list of resources (aka, arn's) which are to receive this role grant */ | ||
Resource: string[]; | ||
} | ||
export declare type ServerlessFunctionMemorySize = 128 | 192 | 256 | 320 | 384 | 448 | 512 | 576 | 640 | 704 | 768 | 832 | 896 | 960 | 1024 | 1088 | 1152 | 1216 | 1280 | 1344 | 1408 | 1472 | 1536 | 1600 | 1664 | 1728 | 1792 | 1856 | 1920 | 1984 | 2048 | 2112 | 2176 | 2240 | 2304 | 2368 | 2432 | 2496 | 2560 | 2624 | 2688 | 2752 | 2816 | 2880 | 2944 | 3008; | ||
/** | ||
* The configuration for your serverless function. | ||
* The only required property is a "handler" property | ||
* pointing to the function definition itself and the | ||
* function to call within the file. | ||
*/ | ||
export interface IServerlessFunction { | ||
/** | ||
* Allows you to set environment variables specific to that | ||
* function. | ||
*/ | ||
environment?: string | IDictionary; | ||
description?: string; | ||
/** | ||
* the handler function in the form of "/path/to/file.HANDLER_FN" where | ||
* HANDLER_FN is typically "handler". | ||
*/ | ||
handler: string; | ||
/** | ||
* A functions X-Ray tracing configuration. | ||
* | ||
* **Pass Through:** | ||
* This is the default setting for all Lambda functions if you have added tracing permissions to your | ||
* function's execution role. This approach means the Lambda function is only traced if X-Ray has been | ||
* enabled on an upstream service, such as AWS Elastic Beanstalk. | ||
* | ||
* **Active:** | ||
* When a Lambda function has this setting, Lambda automatically samples invocation requests, based | ||
* on the sampling algorithm specified by X-Ray. | ||
*/ | ||
tracing?: "Active" | "Passthrough"; | ||
runtime?: AWSRuntime; | ||
/** how many miliseconds before the function times out */ | ||
timeout?: number; | ||
/** | ||
* the allocated "memory" of the virtual machine that will | ||
* run this function ... in reality is not only a proxy for | ||
* memory availability but also computational capability | ||
*/ | ||
memorySize?: ServerlessFunctionMemorySize; | ||
package?: { | ||
artifact?: string; | ||
exclude?: string[]; | ||
include?: string[]; | ||
}; | ||
/** | ||
* Events which may call this function | ||
*/ | ||
events?: IServerlessEvent[]; | ||
/** | ||
* **aliasStage** | ||
* | ||
* If using the the [serverless-aws-alias](https://github.com/HyperBrain/serverless-aws-alias) | ||
* plugin then you can configure settings here. | ||
*/ | ||
aliasStage?: IApiGatewayAliasConfig; | ||
/** | ||
* Add AWS Layers to your function. You can refer to it either as | ||
* an ARN or a via [Cloudformation Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html). A cloudformation reference | ||
* might look something like `{Ref:MyLambdaLayer}` whereas an ARN reference | ||
* is just a standard ARN string. | ||
* | ||
* **Note:** the layer will be accessible at `/opt/*`. If the layer you are using is in | ||
* `node_modules` then it is advisable to add the following to your function definition: | ||
```typescript | ||
const fn: IServerlessFunction = { | ||
environment: { | ||
NODE_PATH: "./:/opt/node_modules" | ||
} | ||
} | ||
``` | ||
* as this will ensure that your layer's NPM modules are included in your path | ||
*/ | ||
layers?: IArnStringReference[] | ICloudformationReference[] | ILayerDefinition; | ||
} | ||
export interface ICloudformationReference { | ||
Ref: string; | ||
} | ||
export declare type IArnStringReference = string; | ||
export interface IServerlessStatusCode { | ||
@@ -257,3 +77,3 @@ pattern: string; | ||
} | ||
export interface IServerlessAuthorizer { | ||
export interface IServerlessHttpAuthorizer { | ||
arn: string; | ||
@@ -260,0 +80,0 @@ claims?: string[]; |
@@ -5,2 +5,5 @@ import { datetime } from "../aliases"; | ||
import { IServerlessEvent } from "./serverless-events"; | ||
export interface IServerlessStepFunctions { | ||
stateMachines: Record<string, IStateMachine>; | ||
} | ||
/** of the format of arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-FUNCTION */ | ||
@@ -7,0 +10,0 @@ export declare type AwsFunctionArn = string; |
{ | ||
"name": "common-types", | ||
"version": "1.19.1", | ||
"version": "1.20.0", | ||
"description": "Common types not included in Typescript", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/lifegadget/common-types", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
304218
102
7248