lambda-toolkit 2.0.0-dev.1 → 2.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -557,7 +557,14 @@ class LambdaApi {
|
|
|
557
557
|
/**
|
|
558
558
|
* Creates a new Lambda Api
|
|
559
559
|
*
|
|
560
|
-
* @param {Object}
|
|
560
|
+
* @param {Object} args
|
|
561
|
+
* @param {Object} [args.headers={}] Any headers to be included in all responses. Defaults to none.
|
|
562
|
+
* @param {'camelcase'|'snakecase'} [args.transformRequest=false]
|
|
563
|
+
* Transform the request query string, parameters and body to camelCase or snake_case.
|
|
564
|
+
* Defaults to no transformation.
|
|
565
|
+
* @param {'camelcase'|'snakecase'} [args.transformResponse=false]
|
|
566
|
+
* Transform the response body to camelCase or snake_case
|
|
567
|
+
* Defaults to no transformation.
|
|
561
568
|
*/
|
|
562
569
|
constructor( { headers = {}, transformRequest = false, transformResponse = false } = {} ) {
|
|
563
570
|
Validator.transformRequest( transformRequest );
|
|
@@ -610,10 +617,9 @@ class LambdaApi {
|
|
|
610
617
|
* Register an automatic error code response for given error class (constructor name)
|
|
611
618
|
*
|
|
612
619
|
* @param {Object} args
|
|
613
|
-
* @param {string} args.code The HTTP status code to return
|
|
614
620
|
* @param {class} args.errorType The error class
|
|
621
|
+
* @param {number} args.code The HTTP status code to return
|
|
615
622
|
* @param {string} [args.message=null] Optional message to return for the status code, if not present will default to Error.message
|
|
616
|
-
* @param {message} [args.errorType] And optional message to display
|
|
617
623
|
*/
|
|
618
624
|
addErrorHandler( { errorType, code, message = null } = {} ) {
|
|
619
625
|
Validator.statusCode( code );
|
|
@@ -622,7 +628,7 @@ class LambdaApi {
|
|
|
622
628
|
}
|
|
623
629
|
|
|
624
630
|
/**
|
|
625
|
-
* Init the flow using a given AWS Lambda APIGateway event
|
|
631
|
+
* Init the flow using a given AWS Lambda APIGateway event
|
|
626
632
|
*
|
|
627
633
|
* @param {Object} ApiGatewayPayload The raw API Gateway event
|
|
628
634
|
* @returns {Object} The http response with status, body and headers
|
package/dist/index.mjs
CHANGED
|
@@ -556,7 +556,14 @@ class LambdaApi {
|
|
|
556
556
|
/**
|
|
557
557
|
* Creates a new Lambda Api
|
|
558
558
|
*
|
|
559
|
-
* @param {Object}
|
|
559
|
+
* @param {Object} args
|
|
560
|
+
* @param {Object} [args.headers={}] Any headers to be included in all responses. Defaults to none.
|
|
561
|
+
* @param {'camelcase'|'snakecase'} [args.transformRequest=false]
|
|
562
|
+
* Transform the request query string, parameters and body to camelCase or snake_case.
|
|
563
|
+
* Defaults to no transformation.
|
|
564
|
+
* @param {'camelcase'|'snakecase'} [args.transformResponse=false]
|
|
565
|
+
* Transform the response body to camelCase or snake_case
|
|
566
|
+
* Defaults to no transformation.
|
|
560
567
|
*/
|
|
561
568
|
constructor( { headers = {}, transformRequest = false, transformResponse = false } = {} ) {
|
|
562
569
|
Validator.transformRequest( transformRequest );
|
|
@@ -609,10 +616,9 @@ class LambdaApi {
|
|
|
609
616
|
* Register an automatic error code response for given error class (constructor name)
|
|
610
617
|
*
|
|
611
618
|
* @param {Object} args
|
|
612
|
-
* @param {string} args.code The HTTP status code to return
|
|
613
619
|
* @param {class} args.errorType The error class
|
|
620
|
+
* @param {number} args.code The HTTP status code to return
|
|
614
621
|
* @param {string} [args.message=null] Optional message to return for the status code, if not present will default to Error.message
|
|
615
|
-
* @param {message} [args.errorType] And optional message to display
|
|
616
622
|
*/
|
|
617
623
|
addErrorHandler( { errorType, code, message = null } = {} ) {
|
|
618
624
|
Validator.statusCode( code );
|
|
@@ -621,7 +627,7 @@ class LambdaApi {
|
|
|
621
627
|
}
|
|
622
628
|
|
|
623
629
|
/**
|
|
624
|
-
* Init the flow using a given AWS Lambda APIGateway event
|
|
630
|
+
* Init the flow using a given AWS Lambda APIGateway event
|
|
625
631
|
*
|
|
626
632
|
* @param {Object} ApiGatewayPayload The raw API Gateway event
|
|
627
633
|
* @returns {Object} The http response with status, body and headers
|