diff --git a/.gitignore b/.gitignore index 5dbe6d3..ac6b55e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ open-source # Generated ouputs console-manifest.json dist -.coverage +source/**/coverage coverage.xml *pycache* npm-debug.log diff --git a/CHANGELOG.md b/CHANGELOG.md index 442e963..0500709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.3.3] - 2023-10 + +### Changed +- Updated Lambda Function runtime to Python 3.11 and Node.js 18 +- Tags for Application in AppRegistry + +### Fixed +- Upgrade @babel/traverse to mitigate CVE-2023-45133 +- Upgrade urllib3 to mitigate CVE-2023-45803 + ## [3.3.2] - 2023-10 ### Added diff --git a/NOTICE.txt b/NOTICE.txt index 3e7f77d..c99eacb 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -55,98 +55,98 @@ ts-node under MIT typescript under Apache-2.0 pip packages: -winston MIT -decode-uri-component MIT -jest MIT -ts-jest MIT -ts-node MIT -typescript Apache-2.0 -aws-sdk-client-mock MIT -Jinja2 3.0.3 BSD License -MarkupSafe 2.1.3 BSD License -PTable 0.9.2 BSD License -PyYAML 6.0 MIT License -Werkzeug 2.2.3 BSD License -astroid 2.15.5 GNU Lesser General Public License v2 (LGPLv2) -attrs 21.4.0 MIT License -aws-lambda-typing 2.17.0 MIT License -aws-lambda-powertools 2.14.1 MIT License -aws-sam-translator 1.68.0 Apache Software License -aws-xray-sdk 2.12.0 Apache Software License -black 23.3.0 MIT License -boto3 1.26.147 Apache Software License -boto3-stubs 1.26.147 MIT License -botocore 1.29.147 Apache Software License -botocore-stubs 1.29.147 MIT License -certifi 2022.12.7 Mozilla Public License 2.0 (MPL 2.0) -cffi 1.15.1 MIT License -cfn-lint 0.77.6 MIT License -charset-normalizer 2.0.12 MIT License -click 8.0.4 BSD License -coverage 7.2.7 Apache Software License -cryptography 41.0.1 Apache Software License, BSD License -docker 6.0.1 Apache Software License -dill 0.3.6 BSD License (BSD-3-Clause) -ecdsa 0.17.0 MIT License -exceptiongroup 1.1.1 MIT License -filelock 3.12.0 The Unlicense -freezegun 1.2.2 Apache Software License -future 0.18.2 MIT License -idna 3.4 BSD License -iniconfig 1.1.1 MIT License -isort 5.10.1 MIT License -jmespath 0.10.0 MIT License -jschema-to-python 1.2.3 MIT License -jsondiff 2.0.0 MIT License -jsonpatch 1.32 BSD License -jsonpickle 2.1.0 BSD License -jsonpointer 2.3 BSD License -jsonschema 3.2.0 MIT License -junit-xml 1.9 Freely Distributable, MIT License -lazy-object-proxy 1.7.1 BSD License -mccabe 0.6.1 MIT License -mpmath 1.3.0 BSD License -mock 4.0.3 BSD License -moto 4.1.11 Apache Software License -mypy-boto3-organizations 1.24.83 MIT License -mypy-boto3-ram 1.26.0.post1 MIT License -mypy-extensions 0.4.4 MIT License -networkx 2.6.3 BSD License -packaging 22.0 Apache Software License, BSD License -pathspec 0.9.0 Mozilla Public License 2.0 (MPL 2.0) -pbr 5.8.1 Apache Software License -pipdeptree 2.7.1 MIT License -platformdirs 2.5.4 MIT License -pluggy 1.0.0 MIT License -py 1.11.0 MIT License -pyasn1 0.4.8 BSD License -pycparser 2.21 BSD License -pydantic 1.10.8 MIT License -pylint 2.17.4 GNU General Public License v2 (GPLv2) -pyparsing 3.0.9 MIT License -pyrsistent 0.18.1 MIT License -pytest 7.2.2 MIT License -pytest-mock 3.10.0 MIT License -python-dateutil 2.8.2 Apache Software License, BSD License -python-jose 3.3.0 MIT License -pytz 2023.3.0 MIT License -regex 2023.6.3 Apache Software License -requests 2.31.0 Apache Software License -responses 0.18.0 Apache 2.0 -rsa 4.9 Apache Software License -s3transfer 0.6.1 Apache Software License -sarif-om 1.0.4 MIT License -six 1.16.0 MIT License -sshpubkeys 3.3.1 BSD License -sympy 1.12 BSD License -sure 2.0.1 GNU General Public License v3 or later (GPLv3+) -tomlkit 0.11.8 MIT License -toml 0.10.2 MIT License -tomli 1.2.3 MIT License -types-awscrt 0.16.19 MIT License -types-s3transfer 0.6.1 MIT License -typing_extensions 4.6.3 Python Software Foundation License -urllib3 1.26.16 MIT License -websocket-client 1.3.3 Apache Software License -wrapt 1.13.3 BSD License -xmltodict 0.12.0 MIT License \ No newline at end of file +winston MIT +decode-uri-component MIT +jest MIT +ts-jest MIT +ts-node MIT +typescript Apache-2.0 +aws-sdk-client-mock MIT +Jinja2 BSD License +MarkupSafe BSD License +PTable BSD License +PyYAML MIT License +Werkzeug BSD License +astroid GNU Lesser General Public License v2 (LGPLv2) +attrs MIT License +aws-lambda-typing MIT License +aws-lambda-powertools MIT License +aws-sam-translator Apache Software License +aws-xray-sdk Apache Software License +black MIT License +boto3 Apache Software License +boto3-stubs MIT License +botocore Apache Software License +botocore-stubs MIT License +certifi Mozilla Public License 2.0 (MPL 2.0) +cffi MIT License +cfn-lint MIT License +charset-normalizer MIT License +click BSD License +coverage Apache Software License +cryptography Apache Software License, BSD License +docker Apache Software License +dill BSD License (BSD-3-Clause) +ecdsa MIT License +exceptiongroup MIT License +filelock The Unlicense +freezegun Apache Software License +future MIT License +idna BSD License +iniconfig MIT License +isort MIT License +jmespath MIT License +jschema-to-python MIT License +jsondiff MIT License +jsonpatch BSD License +jsonpickle BSD License +jsonpointer BSD License +jsonschema MIT License +junit-xml Freely Distributable, MIT License +lazy-object-proxy BSD License +mccabe MIT License +mpmath BSD License +mock BSD License +moto Apache Software License +mypy-boto3-organizations MIT License +mypy-boto3-ram MIT License +mypy-extensions MIT License +networkx BSD License +packaging Apache Software License, BSD License +pathspec Mozilla Public License 2.0 (MPL 2.0) +pbr Apache Software License +pipdeptree MIT License +platformdirs MIT License +pluggy MIT License +py MIT License +pyasn1 BSD License +pycparser BSD License +pydantic MIT License +pylint GNU General Public License v2 (GPLv2) +pyparsing MIT License +pyrsistent MIT License +pytest MIT License +pytest-mock MIT License +python-dateutil Apache Software License, BSD License +python-jose MIT License +pytz MIT License +regex Apache Software License +requests Apache Software License +responses Apache 2.0 +rsa Apache Software License +s3transfer Apache Software License +sarif-om MIT License +six MIT License +sshpubkeys BSD License +sympy BSD License +sure GNU General Public License v3 or later (GPLv3+) +tomlkit MIT License +toml MIT License +tomli MIT License +types-awscrt MIT License +types-s3transfer MIT License +typing_extensions Python Software Foundation License +urllib3 MIT License +websocket-client Apache Software License +wrapt BSD License +xmltodict MIT License \ No newline at end of file diff --git a/README.md b/README.md index 026333e..e128bb9 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,8 @@ Use the following steps if you want to customize the solution or extend the solu ### Setup -- Python Prerequisite: python=3.9 | pip3=21.3.1 -- Javascript Prerequisite: node=v16.4.50 | npm=8.19.2 +- Python Prerequisite: python=3.11 | pip3=23.2.1 +- Javascript Prerequisite: node=v18.16.0 | npm=9.5.1 Clone the repository and make desired code changes. diff --git a/deployment/build-s3-dist.sh b/deployment/build-s3-dist.sh index 9167963..0ef3ffc 100755 --- a/deployment/build-s3-dist.sh +++ b/deployment/build-s3-dist.sh @@ -72,7 +72,7 @@ for microservices in */ ; do microservice_name=$(basename $microservices) cd $lambda_dir/$microservice_name mkdir -p dist/$microservice_name - rsync -aq $lambda_dir/.venv/lib/python3.10/site-packages/ ./dist/ + rsync -aq $lambda_dir/.venv/lib/python3.11/site-packages/ ./dist/ cp -R lib __init__.py main.py ./dist/$microservice_name/ cd dist zip -rq "$microservice_name.zip" . diff --git a/deployment/network-orchestration-hub.template b/deployment/network-orchestration-hub.template index e53a998..4bf91d7 100644 --- a/deployment/network-orchestration-hub.template +++ b/deployment/network-orchestration-hub.template @@ -315,7 +315,7 @@ Conditions: FrontEndCognitoSAMLCondition: !And - !Not [ !Equals [ !Ref CognitoSAMLProviderNameParameter, '' ] ] - !Not [ !Equals [ !Ref CognitoSAMLProviderMetadataUrlParameter, '' ] ] - - !Condition DeployGlobalNetworkCondition + - !Condition DeployWebUiCondition AllowExternalPrincipals: Fn::Equals: - Ref: AllowExternalPrincipals @@ -799,7 +799,7 @@ Resources: Handler: custom_resource.main.lambda_handler MemorySize: 1536 Role: !Sub ${CustomResourceLambdaFunctionRole.Arn} - Runtime: python3.9 + Runtime: python3.11 Timeout: 900 @@ -1021,7 +1021,7 @@ Resources: Handler: tgw_vpc_attachment.main.lambda_handler MemorySize: 1536 Role: !GetAtt 'StateMachineLambdaFunctionRole.Arn' - Runtime: python3.9 + Runtime: python3.11 Timeout: 900 StateMachineRole: @@ -2091,7 +2091,7 @@ Resources: Handler: tgw_peering_attachment.main.lambda_handler MemorySize: 1536 Role: !Sub ${TgwPeeringLambdaFunctionRole.Arn} - Runtime: python3.9 + Runtime: python3.11 Timeout: 900 @@ -2476,7 +2476,7 @@ Resources: SOLUTION_ID: !FindInMap [Solution, Metrics, SolutionId] SOLUTION_VERSION: !FindInMap [SourceCode, General, Version] Handler: index.handler - Runtime: nodejs16.x + Runtime: nodejs18.x Timeout: 60 DependsOn: - FrontEndCognitoTriggerFunctionRole @@ -3019,12 +3019,10 @@ Resources: - !Ref AWS::Region - !Ref AWS::AccountId Tags: { - 'SolutionID': !FindInMap [ Solution, Metrics, SolutionId ], - 'SolutionName': !FindInMap [ Solution, Data, SolutionName ], - 'SolutionVersion': "%VERSION%", - 'ApplicationType': 'AWS-Solutions', - 'SolutionDomain': 'CloudFoundations', - 'CloudFoundations:CostOptimizerForWorkspaces': !Ref "AWS::StackName" + 'Solutions:SolutionID': !FindInMap [ Solution, Metrics, SolutionId ], + 'Solutions:SolutionName': !FindInMap [ Solution, Data, SolutionName ], + 'Solutions:SolutionVersion': "%VERSION%", + 'Solutions:ApplicationType': 'AWS-Solutions' } AppRegistryApplicationStackAssociation: diff --git a/source/cognito-trigger/coverage/lcov-report/base.css b/source/cognito-trigger/coverage/lcov-report/base.css deleted file mode 100644 index f418035..0000000 --- a/source/cognito-trigger/coverage/lcov-report/base.css +++ /dev/null @@ -1,224 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* yellow */ -.cbranch-no { background: yellow !important; color: #111; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -.highlighted, -.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ - background: #C21F39 !important; -} -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -.medium .chart { border:1px solid #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -span.cline-neutral { background: #eaeaea; } - -.coverage-summary td.empty { - opacity: .5; - padding-top: 4px; - padding-bottom: 4px; - line-height: 1; - color: #888; -} - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/source/cognito-trigger/coverage/lcov-report/block-navigation.js b/source/cognito-trigger/coverage/lcov-report/block-navigation.js deleted file mode 100644 index cc12130..0000000 --- a/source/cognito-trigger/coverage/lcov-report/block-navigation.js +++ /dev/null @@ -1,87 +0,0 @@ -/* eslint-disable */ -var jumpToCode = (function init() { - // Classes of code we would like to highlight in the file view - var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; - - // Elements to highlight in the file listing view - var fileListingElements = ['td.pct.low']; - - // We don't want to select elements that are direct descendants of another match - var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` - - // Selecter that finds elements on the page to which we can jump - var selector = - fileListingElements.join(', ') + - ', ' + - notSelector + - missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` - - // The NodeList of matching elements - var missingCoverageElements = document.querySelectorAll(selector); - - var currentIndex; - - function toggleClass(index) { - missingCoverageElements - .item(currentIndex) - .classList.remove('highlighted'); - missingCoverageElements.item(index).classList.add('highlighted'); - } - - function makeCurrent(index) { - toggleClass(index); - currentIndex = index; - missingCoverageElements.item(index).scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center' - }); - } - - function goToPrevious() { - var nextIndex = 0; - if (typeof currentIndex !== 'number' || currentIndex === 0) { - nextIndex = missingCoverageElements.length - 1; - } else if (missingCoverageElements.length > 1) { - nextIndex = currentIndex - 1; - } - - makeCurrent(nextIndex); - } - - function goToNext() { - var nextIndex = 0; - - if ( - typeof currentIndex === 'number' && - currentIndex < missingCoverageElements.length - 1 - ) { - nextIndex = currentIndex + 1; - } - - makeCurrent(nextIndex); - } - - return function jump(event) { - if ( - document.getElementById('fileSearch') === document.activeElement && - document.activeElement != null - ) { - // if we're currently focused on the search input, we don't want to navigate - return; - } - - switch (event.which) { - case 78: // n - case 74: // j - goToNext(); - break; - case 66: // b - case 75: // k - case 80: // p - goToPrevious(); - break; - } - }; -})(); -window.addEventListener('keydown', jumpToCode); diff --git a/source/cognito-trigger/coverage/lcov-report/cognito-trigger/index.html b/source/cognito-trigger/coverage/lcov-report/cognito-trigger/index.html deleted file mode 100644 index 3474fb8..0000000 --- a/source/cognito-trigger/coverage/lcov-report/cognito-trigger/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - -
-- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
---|---|---|---|---|---|---|---|---|---|
index.ts | -
-
- |
- 100% | -14/14 | -71.42% | -5/7 | -100% | -3/3 | -100% | -14/14 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 | - - -1x -1x - - - - - - - - - - - - - - - - - - - -2x - - - - -1x - - -1x -1x -1x -1x -1x - - - - -1x - - -1x -2x - - -2x - - -1x - - - | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import {logger} from "./lib/logger"; -import {AdminAddUserToGroupCommand, CognitoIdentityProviderClient} from "@aws-sdk/client-cognito-identity-provider"; -import {UserAgent} from "@aws-sdk/types"; - -export interface IHandlerInput { - userPoolId: string; - userName: string; - triggerSource: string; - region: string; - request: { - userAttributes: { - sub?: string; - email_verified: string; - "cognito:user_status": string; - identities: string; - }; - }; -} - - -function isExternalUserLoggingInForTheFirstTime(event: IHandlerInput): boolean { - return event.triggerSource === "PostConfirmation_ConfirmSignUp" && - event.request.userAttributes["cognito:user_status"] === - "EXTERNAL_PROVIDER"; -} - -export const READ_ONLY_USER_GROUP = 'ReadOnlyUserGroup'; // GroupName of UserPoolGroupReadOnlyUsers from cf template - -async function addUserToReadOnlyUserGroup(event: IHandlerInput) { - logger.debug("Handling federated user"); - const userAgent: UserAgent = [[`AWSSOLUTION/${process.env.SOLUTION_ID || ''}`,`${process.env.SOLUTION_VERSION}` || '']]; - const configuration = {region: event.region, customUserAgent: userAgent}; - const client = new CognitoIdentityProviderClient(configuration); - const command = new AdminAddUserToGroupCommand({ - UserPoolId: event.userPoolId, - Username: event.userName, - GroupName: READ_ONLY_USER_GROUP - }); - await client.send(command); -} - -export async function handler(event: IHandlerInput): Promise<any> { - logger.debug( - `Received event: ${JSON.stringify(event, null, 2)}` - ); - if ( - isExternalUserLoggingInForTheFirstTime(event) - ) { - await addUserToReadOnlyUserGroup(event); - } -} - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
---|---|---|---|---|---|---|---|---|---|
logger.ts | -
-
- |
- 87.5% | -7/8 | -50% | -1/2 | -100% | -1/1 | -100% | -7/7 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 | - - - - - - - - - - - - - - - - - - - - - - - -1x - -1x - - - - -1x -3x -3x -3x - - -1x - - - - - - - - - - - - - - - - - - - | /** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -/** - * { - emerg: 0, - alert: 1, - crit: 2, - error: 3, - warning: 4, - notice: 5, - info: 6, - debug: 7 - } - */ -import {createLogger, format, transports} from "winston"; - -const { combine, timestamp, printf } = format; - -/* - * Formatting the output as desired - */ -const myFormat = printf(({ level, label, message }) => { - const _level = level.toUpperCase(); - Iif (label) return `[${_level}] [${label}] ${message}`; - else return `[${_level}] ${message}`; -}); - -export const logger = createLogger({ - format: combine( - // - // Order is important here, the formats are called in the - // order they are passed to combine. - // - timestamp(), - myFormat - ), - - transports: [ - //cw logs transport channel - new transports.Console({ - level: process.env.LOG_LEVEL, - handleExceptions: true, //handle uncaught exceptions - //format: format.splat() - }), - ], -}); - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
---|---|---|---|---|---|---|---|---|---|
cognito-trigger | -
-
- |
- 100% | -14/14 | -71.42% | -5/7 | -100% | -3/3 | -100% | -14/14 | -
cognito-trigger/lib | -
-
- |
- 87.5% | -7/8 | -50% | -1/2 | -100% | -1/1 | -100% | -7/7 | -