From c1cfc2998f811119817e7a92deb63125878a007d Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Fri, 24 Jan 2025 13:34:57 +0000 Subject: [PATCH] refactor(cli): organize code that should only be used by the CLI into a folder --- .../cli-lib-alpha/THIRD_PARTY_LICENSES | 1995 +---------------- packages/@aws-cdk/toolkit/lib/api/aws-cdk.ts | 36 +- packages/aws-cdk/lib/api/aws-auth/index.ts | 1 + .../lib/api/bootstrap/bootstrap-props.ts | 2 +- packages/aws-cdk/lib/api/context.ts | 108 + .../aws-cdk/lib/api/cxapp/cloud-executable.ts | 2 +- packages/aws-cdk/lib/api/cxapp/exec.ts | 5 +- .../lib/api/deployments/deployments.ts | 2 +- packages/aws-cdk/lib/api/settings.ts | 171 ++ packages/aws-cdk/lib/{ => api}/tags.ts | 2 +- packages/aws-cdk/lib/{ => cli}/cdk-toolkit.ts | 56 +- .../lib/{config.ts => cli/cli-config.ts} | 6 +- packages/aws-cdk/lib/{ => cli}/cli.ts | 52 +- .../lib/{ => cli}/convert-to-user-input.ts | 2 +- .../{ => cli}/parse-command-line-arguments.ts | 0 .../lib/{ => cli}/platform-warnings.ts | 2 +- .../aws-cdk/lib/cli/user-configuration.ts | 326 +++ packages/aws-cdk/lib/{ => cli}/user-input.ts | 2 +- .../lib/{ => cli}/util/console-formatters.ts | 0 packages/aws-cdk/lib/{ => cli}/util/npm.ts | 4 +- .../lib/{ => cli}/util/yargs-helpers.ts | 4 +- packages/aws-cdk/lib/{ => cli}/version.ts | 8 +- packages/aws-cdk/lib/commands/context.ts | 5 +- packages/aws-cdk/lib/commands/doctor.ts | 2 +- .../aws-cdk/lib/context-providers/index.ts | 2 +- packages/aws-cdk/lib/import.ts | 2 +- packages/aws-cdk/lib/index.ts | 2 +- packages/aws-cdk/lib/legacy-exports-source.ts | 9 +- packages/aws-cdk/lib/list-stacks.ts | 2 +- packages/aws-cdk/lib/migrator.ts | 2 +- packages/aws-cdk/lib/notices.ts | 6 +- packages/aws-cdk/lib/settings.ts | 543 ----- packages/aws-cdk/scripts/user-input-gen.ts | 8 +- .../{ => api/aws-auth}/account-cache.test.ts | 4 +- .../test/api/environment-resources.test.ts | 4 +- packages/aws-cdk/test/api/exec.test.ts | 2 +- .../ecs-services-hotswap-deployments.test.ts | 2 +- packages/aws-cdk/test/api/settings.test.ts | 63 + packages/aws-cdk/test/bootstrap.test.ts | 2 +- .../test/{ => cli}/cdk-toolkit.test.ts | 46 +- .../test/{ => cli}/cli-arguments.test.ts | 4 +- packages/aws-cdk/test/{ => cli}/cli.test.ts | 20 +- .../aws-cdk/test/cli/configuration.test.ts | 118 + .../parse-command-line-arguments.test.ts | 2 +- .../test/{ => cli}/platform-warnings.test.ts | 2 +- .../user-config.test.ts} | 2 +- .../user-context.test.ts} | 4 +- .../aws-cdk/test/{ => cli}/version.test.ts | 6 +- .../test/commands/context-command.test.ts | 4 +- .../test/context-providers/generic.test.ts | 2 +- packages/aws-cdk/test/diff.test.ts | 2 +- packages/aws-cdk/test/list-stacks.test.ts | 2 +- packages/aws-cdk/test/notices.test.ts | 5 +- packages/aws-cdk/test/settings.test.ts | 179 -- .../test/{ => toolkit}/toolkit-error.test.ts | 2 +- packages/aws-cdk/test/util.ts | 4 +- .../test/util/console-formatters.test.ts | 2 +- .../aws-cdk/test/util/yargs-helpers.test.ts | 2 +- .../lib/convert-to-user-input-gen.ts | 2 +- .../user-input-gen/lib/user-input-gen.ts | 2 +- 60 files changed, 1045 insertions(+), 2813 deletions(-) create mode 100644 packages/aws-cdk/lib/api/context.ts create mode 100644 packages/aws-cdk/lib/api/settings.ts rename packages/aws-cdk/lib/{ => api}/tags.ts (86%) rename packages/aws-cdk/lib/{ => cli}/cdk-toolkit.ts (97%) rename packages/aws-cdk/lib/{config.ts => cli/cli-config.ts} (99%) rename packages/aws-cdk/lib/{ => cli}/cli.ts (93%) rename packages/aws-cdk/lib/{ => cli}/convert-to-user-input.ts (99%) rename packages/aws-cdk/lib/{ => cli}/parse-command-line-arguments.ts (100%) rename packages/aws-cdk/lib/{ => cli}/platform-warnings.ts (96%) create mode 100644 packages/aws-cdk/lib/cli/user-configuration.ts rename packages/aws-cdk/lib/{ => cli}/user-input.ts (99%) rename packages/aws-cdk/lib/{ => cli}/util/console-formatters.ts (100%) rename packages/aws-cdk/lib/{ => cli}/util/npm.ts (88%) rename packages/aws-cdk/lib/{ => cli}/util/yargs-helpers.ts (93%) rename packages/aws-cdk/lib/{ => cli}/version.ts (94%) delete mode 100644 packages/aws-cdk/lib/settings.ts rename packages/aws-cdk/test/{ => api/aws-auth}/account-cache.test.ts (97%) create mode 100644 packages/aws-cdk/test/api/settings.test.ts rename packages/aws-cdk/test/{ => cli}/cdk-toolkit.test.ts (98%) rename packages/aws-cdk/test/{ => cli}/cli-arguments.test.ts (96%) rename packages/aws-cdk/test/{ => cli}/cli.test.ts (82%) create mode 100644 packages/aws-cdk/test/cli/configuration.test.ts rename packages/aws-cdk/test/{ => cli}/parse-command-line-arguments.test.ts (92%) rename packages/aws-cdk/test/{ => cli}/platform-warnings.test.ts (83%) rename packages/aws-cdk/test/{usersettings.test.ts => cli/user-config.test.ts} (98%) rename packages/aws-cdk/test/{context.test.ts => cli/user-context.test.ts} (95%) rename packages/aws-cdk/test/{ => cli}/version.test.ts (97%) delete mode 100644 packages/aws-cdk/test/settings.test.ts rename packages/aws-cdk/test/{ => toolkit}/toolkit-error.test.ts (97%) diff --git a/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES b/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES index a700ba2378bf9..0c99839ec88c9 100644 --- a/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES +++ b/packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES @@ -10914,7 +10914,7 @@ Apache License ---------------- -** @jsii/check-node@1.104.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.104.0 | Apache-2.0 +** @jsii/check-node@1.106.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.106.0 | Apache-2.0 jsii Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -12771,7 +12771,7 @@ Apache License ---------------- -** @smithy/fetch-http-handler@4.1.1 - https://www.npmjs.com/package/@smithy/fetch-http-handler/v/4.1.1 | Apache-2.0 +** @smithy/fetch-http-handler@5.0.1 - https://www.npmjs.com/package/@smithy/fetch-http-handler/v/5.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -12976,7 +12976,7 @@ Apache License ---------------- -** @smithy/fetch-http-handler@5.0.1 - https://www.npmjs.com/package/@smithy/fetch-http-handler/v/5.0.1 | Apache-2.0 +** @smithy/hash-node@4.0.1 - https://www.npmjs.com/package/@smithy/hash-node/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -13181,7 +13181,7 @@ Apache License ---------------- -** @smithy/hash-node@4.0.1 - https://www.npmjs.com/package/@smithy/hash-node/v/4.0.1 | Apache-2.0 +** @smithy/hash-stream-node@4.0.1 - https://www.npmjs.com/package/@smithy/hash-stream-node/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -13386,7 +13386,7 @@ Apache License ---------------- -** @smithy/hash-stream-node@4.0.1 - https://www.npmjs.com/package/@smithy/hash-stream-node/v/4.0.1 | Apache-2.0 +** @smithy/is-array-buffer@2.2.0 - https://www.npmjs.com/package/@smithy/is-array-buffer/v/2.2.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -13591,7 +13591,7 @@ Apache License ---------------- -** @smithy/is-array-buffer@2.2.0 - https://www.npmjs.com/package/@smithy/is-array-buffer/v/2.2.0 | Apache-2.0 +** @smithy/is-array-buffer@4.0.0 - https://www.npmjs.com/package/@smithy/is-array-buffer/v/4.0.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -13796,7 +13796,7 @@ Apache License ---------------- -** @smithy/is-array-buffer@4.0.0 - https://www.npmjs.com/package/@smithy/is-array-buffer/v/4.0.0 | Apache-2.0 +** @smithy/middleware-content-length@4.0.1 - https://www.npmjs.com/package/@smithy/middleware-content-length/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -14001,7 +14001,7 @@ Apache License ---------------- -** @smithy/middleware-content-length@4.0.1 - https://www.npmjs.com/package/@smithy/middleware-content-length/v/4.0.1 | Apache-2.0 +** @smithy/middleware-endpoint@4.0.2 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/4.0.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -14206,8 +14206,8 @@ Apache License ---------------- -** @smithy/middleware-endpoint@3.2.3 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/3.2.3 | Apache-2.0 -Apache License +** @smithy/middleware-retry@4.0.3 - https://www.npmjs.com/package/@smithy/middleware-retry/v/4.0.3 | Apache-2.0 + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -14409,10 +14409,11 @@ Apache License See the License for the specific language governing permissions and limitations under the License. + ---------------- -** @smithy/middleware-endpoint@4.0.2 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/4.0.2 | Apache-2.0 -Apache License +** @smithy/middleware-serde@4.0.1 - https://www.npmjs.com/package/@smithy/middleware-serde/v/4.0.1 | Apache-2.0 + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -14600,7 +14601,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2019 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. @@ -14614,10 +14615,11 @@ Apache License See the License for the specific language governing permissions and limitations under the License. + ---------------- -** @smithy/middleware-retry@4.0.3 - https://www.npmjs.com/package/@smithy/middleware-retry/v/4.0.3 | Apache-2.0 - Apache License +** @smithy/middleware-stack@4.0.1 - https://www.npmjs.com/package/@smithy/middleware-stack/v/4.0.1 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -14819,11 +14821,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/middleware-serde@3.0.8 - https://www.npmjs.com/package/@smithy/middleware-serde/v/3.0.8 | Apache-2.0 - Apache License +** @smithy/node-config-provider@3.1.12 - https://www.npmjs.com/package/@smithy/node-config-provider/v/3.1.12 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -15011,7 +15012,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2020 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. @@ -15025,11 +15026,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/middleware-serde@4.0.1 - https://www.npmjs.com/package/@smithy/middleware-serde/v/4.0.1 | Apache-2.0 - Apache License +** @smithy/node-config-provider@4.0.1 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.0.1 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -15217,7 +15217,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2020 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. @@ -15231,10 +15231,9 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/middleware-stack@4.0.1 - https://www.npmjs.com/package/@smithy/middleware-stack/v/4.0.1 | Apache-2.0 +** @smithy/node-http-handler@4.0.2 - https://www.npmjs.com/package/@smithy/node-http-handler/v/4.0.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -15439,7 +15438,7 @@ Apache License ---------------- -** @smithy/node-config-provider@3.1.12 - https://www.npmjs.com/package/@smithy/node-config-provider/v/3.1.12 | Apache-2.0 +** @smithy/property-provider@3.1.10 - https://www.npmjs.com/package/@smithy/property-provider/v/3.1.10 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -15628,7 +15627,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 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. @@ -15644,7 +15643,7 @@ Apache License ---------------- -** @smithy/node-config-provider@4.0.1 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.0.1 | Apache-2.0 +** @smithy/property-provider@3.1.11 - https://www.npmjs.com/package/@smithy/property-provider/v/3.1.11 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -15833,7 +15832,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 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. @@ -15849,7 +15848,7 @@ Apache License ---------------- -** @smithy/node-http-handler@4.0.2 - https://www.npmjs.com/package/@smithy/node-http-handler/v/4.0.2 | Apache-2.0 +** @smithy/property-provider@4.0.1 - https://www.npmjs.com/package/@smithy/property-provider/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -16054,8 +16053,8 @@ Apache License ---------------- -** @smithy/property-provider@3.1.10 - https://www.npmjs.com/package/@smithy/property-provider/v/3.1.10 | Apache-2.0 -Apache License +** @smithy/protocol-http@5.0.1 - https://www.npmjs.com/package/@smithy/protocol-http/v/5.0.1 | Apache-2.0 + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -16243,7 +16242,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2019 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. @@ -16257,10 +16256,11 @@ Apache License See the License for the specific language governing permissions and limitations under the License. + ---------------- -** @smithy/property-provider@3.1.11 - https://www.npmjs.com/package/@smithy/property-provider/v/3.1.11 | Apache-2.0 -Apache License +** @smithy/querystring-builder@4.0.1 - https://www.npmjs.com/package/@smithy/querystring-builder/v/4.0.1 | Apache-2.0 + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -16462,10 +16462,11 @@ Apache License See the License for the specific language governing permissions and limitations under the License. + ---------------- -** @smithy/property-provider@4.0.1 - https://www.npmjs.com/package/@smithy/property-provider/v/4.0.1 | Apache-2.0 -Apache License +** @smithy/querystring-parser@4.0.1 - https://www.npmjs.com/package/@smithy/querystring-parser/v/4.0.1 | Apache-2.0 + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -16667,9 +16668,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. + ---------------- -** @smithy/protocol-http@4.1.7 - https://www.npmjs.com/package/@smithy/protocol-http/v/4.1.7 | Apache-2.0 +** @smithy/service-error-classification@3.0.11 - https://www.npmjs.com/package/@smithy/service-error-classification/v/3.0.11 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -16858,7 +16860,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 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. @@ -16875,7 +16877,7 @@ Apache License ---------------- -** @smithy/protocol-http@5.0.1 - https://www.npmjs.com/package/@smithy/protocol-http/v/5.0.1 | Apache-2.0 +** @smithy/service-error-classification@4.0.1 - https://www.npmjs.com/package/@smithy/service-error-classification/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -17064,7 +17066,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2018-2020 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. @@ -17081,8 +17083,8 @@ Apache License ---------------- -** @smithy/querystring-builder@3.0.10 - https://www.npmjs.com/package/@smithy/querystring-builder/v/3.0.10 | Apache-2.0 - Apache License +** @smithy/shared-ini-file-loader@3.1.12 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/3.1.12 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -17284,11 +17286,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/querystring-builder@4.0.1 - https://www.npmjs.com/package/@smithy/querystring-builder/v/4.0.1 | Apache-2.0 - Apache License +** @smithy/shared-ini-file-loader@3.1.9 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/3.1.9 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -17490,11 +17491,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/querystring-parser@3.0.8 - https://www.npmjs.com/package/@smithy/querystring-parser/v/3.0.8 | Apache-2.0 - Apache License +** @smithy/shared-ini-file-loader@4.0.1 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/4.0.1 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -17696,11 +17696,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/querystring-parser@4.0.1 - https://www.npmjs.com/package/@smithy/querystring-parser/v/4.0.1 | Apache-2.0 - Apache License +** @smithy/signature-v4@5.0.1 - https://www.npmjs.com/package/@smithy/signature-v4/v/5.0.1 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -17902,10 +17901,9 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/service-error-classification@3.0.10 - https://www.npmjs.com/package/@smithy/service-error-classification/v/3.0.10 | Apache-2.0 +** @smithy/smithy-client@4.1.2 - https://www.npmjs.com/package/@smithy/smithy-client/v/4.1.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -18094,7 +18092,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2019 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. @@ -18111,7 +18109,7 @@ Apache License ---------------- -** @smithy/service-error-classification@3.0.8 - https://www.npmjs.com/package/@smithy/service-error-classification/v/3.0.8 | Apache-2.0 +** @smithy/types@3.5.0 - https://www.npmjs.com/package/@smithy/types/v/3.5.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -18300,7 +18298,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2019 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. @@ -18317,7 +18315,7 @@ Apache License ---------------- -** @smithy/service-error-classification@4.0.1 - https://www.npmjs.com/package/@smithy/service-error-classification/v/4.0.1 | Apache-2.0 +** @smithy/url-parser@4.0.1 - https://www.npmjs.com/package/@smithy/url-parser/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -18523,7 +18521,7 @@ Apache License ---------------- -** @smithy/shared-ini-file-loader@3.1.12 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/3.1.12 | Apache-2.0 +** @smithy/util-base64@4.0.0 - https://www.npmjs.com/package/@smithy/util-base64/v/4.0.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -18728,7 +18726,7 @@ Apache License ---------------- -** @smithy/shared-ini-file-loader@3.1.9 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/3.1.9 | Apache-2.0 +** @smithy/util-body-length-node@4.0.0 - https://www.npmjs.com/package/@smithy/util-body-length-node/v/4.0.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -18933,7 +18931,7 @@ Apache License ---------------- -** @smithy/shared-ini-file-loader@4.0.1 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/4.0.1 | Apache-2.0 +** @smithy/util-buffer-from@2.2.0 - https://www.npmjs.com/package/@smithy/util-buffer-from/v/2.2.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -19138,7 +19136,7 @@ Apache License ---------------- -** @smithy/signature-v4@5.0.1 - https://www.npmjs.com/package/@smithy/signature-v4/v/5.0.1 | Apache-2.0 +** @smithy/util-buffer-from@4.0.0 - https://www.npmjs.com/package/@smithy/util-buffer-from/v/4.0.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -19343,8 +19341,8 @@ Apache License ---------------- -** @smithy/smithy-client@4.1.2 - https://www.npmjs.com/package/@smithy/smithy-client/v/4.1.2 | Apache-2.0 - Apache License +** @smithy/util-config-provider@3.0.0 - https://www.npmjs.com/package/@smithy/util-config-provider/v/3.0.0 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -19532,7 +19530,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2020 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. @@ -19546,11 +19544,10 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/types@3.5.0 - https://www.npmjs.com/package/@smithy/types/v/3.5.0 | Apache-2.0 - Apache License +** @smithy/util-config-provider@4.0.0 - https://www.npmjs.com/package/@smithy/util-config-provider/v/4.0.0 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -19738,7 +19735,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2020 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. @@ -19752,10 +19749,9 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/url-parser@3.0.8 - https://www.npmjs.com/package/@smithy/url-parser/v/3.0.8 | Apache-2.0 +** @smithy/util-defaults-mode-node@4.0.3 - https://www.npmjs.com/package/@smithy/util-defaults-mode-node/v/4.0.3 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -19961,8 +19957,8 @@ Apache License ---------------- -** @smithy/url-parser@4.0.1 - https://www.npmjs.com/package/@smithy/url-parser/v/4.0.1 | Apache-2.0 - Apache License +** @smithy/util-endpoints@3.0.1 - https://www.npmjs.com/package/@smithy/util-endpoints/v/3.0.1 | Apache-2.0 +Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -20150,7 +20146,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + Copyright 2021 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. @@ -20164,1651 +20160,9 @@ Apache License See the License for the specific language governing permissions and limitations under the License. - ---------------- -** @smithy/util-base64@4.0.0 - https://www.npmjs.com/package/@smithy/util-base64/v/4.0.0 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-body-length-node@4.0.0 - https://www.npmjs.com/package/@smithy/util-body-length-node/v/4.0.0 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-buffer-from@2.2.0 - https://www.npmjs.com/package/@smithy/util-buffer-from/v/2.2.0 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-buffer-from@4.0.0 - https://www.npmjs.com/package/@smithy/util-buffer-from/v/4.0.0 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-config-provider@3.0.0 - https://www.npmjs.com/package/@smithy/util-config-provider/v/3.0.0 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-config-provider@4.0.0 - https://www.npmjs.com/package/@smithy/util-config-provider/v/4.0.0 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-defaults-mode-node@4.0.3 - https://www.npmjs.com/package/@smithy/util-defaults-mode-node/v/4.0.3 | Apache-2.0 - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2020 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ----------------- - -** @smithy/util-endpoints@3.0.1 - https://www.npmjs.com/package/@smithy/util-endpoints/v/3.0.1 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2021 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** @smithy/util-hex-encoding@4.0.0 - https://www.npmjs.com/package/@smithy/util-hex-encoding/v/4.0.0 | Apache-2.0 +** @smithy/util-hex-encoding@4.0.0 - https://www.npmjs.com/package/@smithy/util-hex-encoding/v/4.0.0 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -22218,211 +20572,6 @@ Apache License ---------------- -** @smithy/util-middleware@3.0.8 - https://www.npmjs.com/package/@smithy/util-middleware/v/3.0.8 | Apache-2.0 -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2021 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. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - ** @smithy/util-middleware@4.0.1 - https://www.npmjs.com/package/@smithy/util-middleware/v/4.0.1 | Apache-2.0 Apache License Version 2.0, January 2004 @@ -22628,7 +20777,7 @@ Apache License ---------------- -** @smithy/util-retry@3.0.8 - https://www.npmjs.com/package/@smithy/util-retry/v/3.0.8 | Apache-2.0 +** @smithy/util-retry@3.0.11 - https://www.npmjs.com/package/@smithy/util-retry/v/3.0.11 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/packages/@aws-cdk/toolkit/lib/api/aws-cdk.ts b/packages/@aws-cdk/toolkit/lib/api/aws-cdk.ts index 5fe454011acd5..533f2f6105efa 100644 --- a/packages/@aws-cdk/toolkit/lib/api/aws-cdk.ts +++ b/packages/@aws-cdk/toolkit/lib/api/aws-cdk.ts @@ -1,20 +1,23 @@ -export { DEFAULT_TOOLKIT_STACK_NAME, SdkProvider } from '../../../../aws-cdk/lib/api'; -export type { SuccessfulDeployStackResult } from '../../../../aws-cdk/lib/api'; -export { formatSdkLoggerContent } from '../../../../aws-cdk/lib/api/aws-auth/sdk-logger'; -export { CloudAssembly, sanitizePatterns, StackCollection, ExtendedStackSelection } from '../../../../aws-cdk/lib/api/cxapp/cloud-assembly'; -export { prepareDefaultEnvironment, prepareContext, spaceAvailableForContext } from '../../../../aws-cdk/lib/api/cxapp/exec'; -export { Deployments } from '../../../../aws-cdk/lib/api/deployments'; +// APIs +export { formatSdkLoggerContent, SdkProvider } from '../../../../aws-cdk/lib/api/aws-auth'; +export { Context, PROJECT_CONTEXT } from '../../../../aws-cdk/lib/api/context'; +export { Deployments, type SuccessfulDeployStackResult } from '../../../../aws-cdk/lib/api/deployments'; +export { Settings } from '../../../../aws-cdk/lib/api/settings'; +export { tagsForStack } from '../../../../aws-cdk/lib/api/tags'; +export { DEFAULT_TOOLKIT_STACK_NAME } from '../../../../aws-cdk/lib/api/toolkit-info'; + +// Context Providers +export * as contextproviders from '../../../../aws-cdk/lib/context-providers'; + +// @todo APIs not clean import export { HotswapMode } from '../../../../aws-cdk/lib/api/hotswap/common'; export { StackActivityProgress } from '../../../../aws-cdk/lib/api/util/cloudformation/stack-activity-monitor'; -export { RWLock } from '../../../../aws-cdk/lib/api/util/rwlock'; -export type { ILock } from '../../../../aws-cdk/lib/api/util/rwlock'; +export { RWLock, type ILock } from '../../../../aws-cdk/lib/api/util/rwlock'; export { formatTime } from '../../../../aws-cdk/lib/api/util/string-manipulation'; -export * as contextproviders from '../../../../aws-cdk/lib/context-providers'; + +// @todo Not yet API probably should be export { ResourceMigrator } from '../../../../aws-cdk/lib/migrator'; export { obscureTemplate, serializeStructure } from '../../../../aws-cdk/lib/serialize'; -export { Context, Settings, PROJECT_CONTEXT } from '../../../../aws-cdk/lib/settings'; -export { tagsForStack } from '../../../../aws-cdk/lib/tags'; -export { CliIoHost } from '../../../../aws-cdk/lib/toolkit/cli-io-host'; export { loadTree, some } from '../../../../aws-cdk/lib/tree'; export { splitBySize } from '../../../../aws-cdk/lib/util'; export { validateSnsTopicArn } from '../../../../aws-cdk/lib/util/validate-notification-arn'; @@ -22,5 +25,12 @@ export { WorkGraph } from '../../../../aws-cdk/lib/util/work-graph'; export type { Concurrency } from '../../../../aws-cdk/lib/util/work-graph'; export { WorkGraphBuilder } from '../../../../aws-cdk/lib/util/work-graph-builder'; export type { AssetBuildNode, AssetPublishNode, StackNode } from '../../../../aws-cdk/lib/util/work-graph-types'; -export { versionNumber } from '../../../../aws-cdk/lib/version'; + +// @todo Cloud Assembly and Executable - this is a messy API right now +export { CloudAssembly, sanitizePatterns, StackCollection, ExtendedStackSelection } from '../../../../aws-cdk/lib/api/cxapp/cloud-assembly'; +export { prepareDefaultEnvironment, prepareContext, spaceAvailableForContext } from '../../../../aws-cdk/lib/api/cxapp/exec'; export { guessExecutable } from '../../../../aws-cdk/lib/api/cxapp/exec'; + +// @todo Should not use! investigate how to replace +export { versionNumber } from '../../../../aws-cdk/lib/cli/version'; +export { CliIoHost } from '../../../../aws-cdk/lib/toolkit/cli-io-host'; diff --git a/packages/aws-cdk/lib/api/aws-auth/index.ts b/packages/aws-cdk/lib/api/aws-auth/index.ts index 987c8b1b3da54..114414547abab 100644 --- a/packages/aws-cdk/lib/api/aws-auth/index.ts +++ b/packages/aws-cdk/lib/api/aws-auth/index.ts @@ -1,2 +1,3 @@ export * from './sdk'; export * from './sdk-provider'; +export * from './sdk-logger'; diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts b/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts index cdea6a6ef4025..c163f991e1aa3 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-props.ts @@ -1,5 +1,5 @@ import { BootstrapSource } from './bootstrap-environment'; -import { Tag } from '../../tags'; +import { Tag } from '../tags'; import { StringWithoutPlaceholders } from '../util/placeholders'; export const BUCKET_NAME_OUTPUT = 'BucketName'; diff --git a/packages/aws-cdk/lib/api/context.ts b/packages/aws-cdk/lib/api/context.ts new file mode 100644 index 0000000000000..0ed422cff1786 --- /dev/null +++ b/packages/aws-cdk/lib/api/context.ts @@ -0,0 +1,108 @@ +import { Settings } from './settings'; +import { ToolkitError } from '../toolkit/error'; + +export { TRANSIENT_CONTEXT_KEY } from './settings'; +export const PROJECT_CONTEXT = 'cdk.context.json'; + +interface ContextBag { + /** + * The file name of the context. Will be used to potentially + * save new context back to the original file. + */ + fileName?: string; + + /** + * The context values. + */ + bag: Settings; +} + +/** + * Class that supports overlaying property bags + * + * Reads come from the first property bag that can has the given key, + * writes go to the first property bag that is not readonly. A write + * will remove the value from all property bags after the first + * writable one. + */ +export class Context { + private readonly bags: Settings[]; + private readonly fileNames: (string | undefined)[]; + + constructor(...bags: ContextBag[]) { + this.bags = bags.length > 0 ? bags.map((b) => b.bag) : [new Settings()]; + this.fileNames = + bags.length > 0 ? bags.map((b) => b.fileName) : ['default']; + } + + public get keys(): string[] { + return Object.keys(this.all); + } + + public has(key: string) { + return this.keys.indexOf(key) > -1; + } + + public get all(): { [key: string]: any } { + let ret = new Settings(); + + // In reverse order so keys to the left overwrite keys to the right of them + for (const bag of [...this.bags].reverse()) { + ret = ret.merge(bag); + } + + return ret.all; + } + + public get(key: string): any { + for (const bag of this.bags) { + const v = bag.get([key]); + if (v !== undefined) { + return v; + } + } + return undefined; + } + + public set(key: string, value: any) { + for (const bag of this.bags) { + if (bag.readOnly) { + continue; + } + + // All bags past the first one have the value erased + bag.set([key], value); + value = undefined; + } + } + + public unset(key: string) { + this.set(key, undefined); + } + + public clear() { + for (const key of this.keys) { + this.unset(key); + } + } + + /** + * Save a specific context file + */ + public async save(fileName: string): Promise { + const index = this.fileNames.indexOf(fileName); + + // File not found, don't do anything in this scenario + if (index === -1) { + return this; + } + + const bag = this.bags[index]; + if (bag.readOnly) { + throw new ToolkitError(`Context file ${fileName} is read only!`); + } + + await bag.save(fileName); + return this; + } +} diff --git a/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts b/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts index 5c0f1a2c2a289..4c7a708e2948a 100644 --- a/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts +++ b/packages/aws-cdk/lib/api/cxapp/cloud-executable.ts @@ -1,8 +1,8 @@ import * as cxapi from '@aws-cdk/cx-api'; import { CloudAssembly } from './cloud-assembly'; +import { Configuration } from '../../cli/user-configuration'; import * as contextproviders from '../../context-providers'; import { debug } from '../../logging'; -import { Configuration } from '../../settings'; import { ToolkitError } from '../../toolkit/error'; import { SdkProvider } from '../aws-auth'; diff --git a/packages/aws-cdk/lib/api/cxapp/exec.ts b/packages/aws-cdk/lib/api/cxapp/exec.ts index f17d0c11453df..2def5632895d1 100644 --- a/packages/aws-cdk/lib/api/cxapp/exec.ts +++ b/packages/aws-cdk/lib/api/cxapp/exec.ts @@ -5,13 +5,14 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as fs from 'fs-extra'; import * as semver from 'semver'; +import { Configuration, PROJECT_CONFIG, USER_DEFAULTS } from '../../cli/user-configuration'; +import { versionNumber } from '../../cli/version'; import { debug, warning } from '../../logging'; -import { Configuration, PROJECT_CONFIG, Settings, USER_DEFAULTS } from '../../settings'; import { ToolkitError } from '../../toolkit/error'; import { loadTree, some } from '../../tree'; import { splitBySize } from '../../util/objects'; -import { versionNumber } from '../../version'; import { SdkProvider } from '../aws-auth'; +import { Settings } from '../settings'; import { RWLock, ILock } from '../util/rwlock'; export interface ExecProgramResult { diff --git a/packages/aws-cdk/lib/api/deployments/deployments.ts b/packages/aws-cdk/lib/api/deployments/deployments.ts index fae789c845579..f42f6456851b1 100644 --- a/packages/aws-cdk/lib/api/deployments/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments/deployments.ts @@ -29,13 +29,13 @@ import { type RootTemplateWithNestedStacks, } from './nested-stack-helpers'; import { debug, warning } from '../../logging'; -import type { Tag } from '../../tags'; import { ToolkitError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util/error'; import type { SdkProvider } from '../aws-auth/sdk-provider'; import { EnvironmentAccess } from '../environment-access'; import { type EnvironmentResources } from '../environment-resources'; import { HotswapMode, HotswapPropertyOverrides } from '../hotswap/common'; +import type { Tag } from '../tags'; import { DEFAULT_TOOLKIT_STACK_NAME } from '../toolkit-info'; import { StackActivityMonitor, StackActivityProgress } from '../util/cloudformation/stack-activity-monitor'; import { StackEventPoller } from '../util/cloudformation/stack-event-poller'; diff --git a/packages/aws-cdk/lib/api/settings.ts b/packages/aws-cdk/lib/api/settings.ts new file mode 100644 index 0000000000000..41eee46c90bd5 --- /dev/null +++ b/packages/aws-cdk/lib/api/settings.ts @@ -0,0 +1,171 @@ +import * as os from 'os'; +import * as fs_path from 'path'; +import * as fs from 'fs-extra'; +import { warning } from '../logging'; +import { ToolkitError } from '../toolkit/error'; +import * as util from '../util/objects'; + +export type SettingsMap = { [key: string]: any }; + +/** + * If a context value is an object with this key set to a truthy value, it won't be saved to cdk.context.json + */ +export const TRANSIENT_CONTEXT_KEY = '$dontSaveContext'; + +/** + * A single bag of settings + */ +export class Settings { + public static mergeAll(...settings: Settings[]): Settings { + let ret = new Settings(); + for (const setting of settings) { + ret = ret.merge(setting); + } + return ret; + } + + constructor( + private settings: SettingsMap = {}, + public readonly readOnly = false, + ) {} + + public async load(fileName: string): Promise { + if (this.readOnly) { + throw new ToolkitError( + `Can't load ${fileName}: settings object is readonly`, + ); + } + this.settings = {}; + + const expanded = expandHomeDir(fileName); + if (await fs.pathExists(expanded)) { + this.settings = await fs.readJson(expanded); + } + + // See https://github.com/aws/aws-cdk/issues/59 + this.prohibitContextKey('default-account', fileName); + this.prohibitContextKey('default-region', fileName); + this.warnAboutContextKey('aws:', fileName); + + return this; + } + + public async save(fileName: string): Promise { + const expanded = expandHomeDir(fileName); + await fs.writeJson(expanded, stripTransientValues(this.settings), { + spaces: 2, + }); + return this; + } + + public get all(): any { + return this.get([]); + } + + public merge(other: Settings): Settings { + return new Settings(util.deepMerge(this.settings, other.settings)); + } + + public subSettings(keyPrefix: string[]) { + return new Settings(this.get(keyPrefix) || {}, false); + } + + public makeReadOnly(): Settings { + return new Settings(this.settings, true); + } + + public clear() { + if (this.readOnly) { + throw new ToolkitError('Cannot clear(): settings are readonly'); + } + this.settings = {}; + } + + public get empty(): boolean { + return Object.keys(this.settings).length === 0; + } + + public get(path: string[]): any { + return util.deepClone(util.deepGet(this.settings, path)); + } + + public set(path: string[], value: any): Settings { + if (this.readOnly) { + throw new ToolkitError(`Can't set ${path}: settings object is readonly`); + } + if (path.length === 0) { + // deepSet can't handle this case + this.settings = value; + } else { + util.deepSet(this.settings, path, value); + } + return this; + } + + public unset(path: string[]) { + this.set(path, undefined); + } + + private prohibitContextKey(key: string, fileName: string) { + if (!this.settings.context) { + return; + } + if (key in this.settings.context) { + // eslint-disable-next-line max-len + throw new ToolkitError( + `The 'context.${key}' key was found in ${fs_path.resolve( + fileName, + )}, but it is no longer supported. Please remove it.`, + ); + } + } + + private warnAboutContextKey(prefix: string, fileName: string) { + if (!this.settings.context) { + return; + } + for (const contextKey of Object.keys(this.settings.context)) { + if (contextKey.startsWith(prefix)) { + // eslint-disable-next-line max-len + warning( + `A reserved context key ('context.${prefix}') key was found in ${fs_path.resolve( + fileName, + )}, it might cause surprising behavior and should be removed.`, + ); + } + } + } +} + +function expandHomeDir(x: string) { + if (x.startsWith('~')) { + return fs_path.join(os.homedir(), x.slice(1)); + } + return x; +} + +/** + * Return all context value that are not transient context values + */ +function stripTransientValues(obj: { [key: string]: any }) { + const ret: any = {}; + for (const [key, value] of Object.entries(obj)) { + if (!isTransientValue(value)) { + ret[key] = value; + } + } + return ret; +} + +/** + * Return whether the given value is a transient context value + * + * Values that are objects with a magic key set to a truthy value are considered transient. + */ +function isTransientValue(value: any) { + return ( + typeof value === 'object' && + value !== null && + (value as any)[TRANSIENT_CONTEXT_KEY] + ); +} diff --git a/packages/aws-cdk/lib/tags.ts b/packages/aws-cdk/lib/api/tags.ts similarity index 86% rename from packages/aws-cdk/lib/tags.ts rename to packages/aws-cdk/lib/api/tags.ts index df6ed884c1cca..45580e4137894 100644 --- a/packages/aws-cdk/lib/tags.ts +++ b/packages/aws-cdk/lib/api/tags.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import type * as cxapi from '@aws-cdk/cx-api'; /** * @returns an array with the tags available in the stack metadata. diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cli/cdk-toolkit.ts similarity index 97% rename from packages/aws-cdk/lib/cdk-toolkit.ts rename to packages/aws-cdk/lib/cli/cdk-toolkit.ts index 7cac927b1edc9..20c8db1b96aa8 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cli/cdk-toolkit.ts @@ -6,23 +6,26 @@ import * as chokidar from 'chokidar'; import * as fs from 'fs-extra'; import * as promptly from 'promptly'; import * as uuid from 'uuid'; -import { SdkProvider } from './api/aws-auth'; -import { Bootstrapper, BootstrapEnvironmentOptions } from './api/bootstrap'; +import { Configuration, PROJECT_CONFIG } from './user-configuration'; +import { SdkProvider } from '../api/aws-auth'; +import { Bootstrapper, BootstrapEnvironmentOptions } from '../api/bootstrap'; import { CloudAssembly, DefaultSelection, ExtendedStackSelection, StackCollection, StackSelector, -} from './api/cxapp/cloud-assembly'; -import { CloudExecutable } from './api/cxapp/cloud-executable'; -import { Deployments, DeploymentMethod, SuccessfulDeployStackResult, createDiffChangeSet } from './api/deployments'; -import { GarbageCollector } from './api/garbage-collection/garbage-collector'; -import { HotswapMode, HotswapPropertyOverrides, EcsHotswapProperties } from './api/hotswap/common'; -import { findCloudWatchLogGroups } from './api/logs/find-cloudwatch-logs'; -import { CloudWatchLogEventMonitor } from './api/logs/logs-monitor'; -import { StackActivityProgress } from './api/util/cloudformation/stack-activity-monitor'; -import { formatTime } from './api/util/string-manipulation'; +} from '../api/cxapp/cloud-assembly'; +import { CloudExecutable } from '../api/cxapp/cloud-executable'; +import { environmentsFromDescriptors, globEnvironmentsFromStacks, looksLikeGlob } from '../api/cxapp/environments'; +import { Deployments, DeploymentMethod, SuccessfulDeployStackResult, createDiffChangeSet } from '../api/deployments'; +import { GarbageCollector } from '../api/garbage-collection/garbage-collector'; +import { HotswapMode, HotswapPropertyOverrides, EcsHotswapProperties } from '../api/hotswap/common'; +import { findCloudWatchLogGroups } from '../api/logs/find-cloudwatch-logs'; +import { CloudWatchLogEventMonitor } from '../api/logs/logs-monitor'; +import { tagsForStack, type Tag } from '../api/tags'; +import { StackActivityProgress } from '../api/util/cloudformation/stack-activity-monitor'; +import { formatTime } from '../api/util/string-manipulation'; import { generateCdkApp, generateStack, @@ -40,23 +43,20 @@ import { appendWarningsToReadme, isThereAWarning, buildCfnClient, -} from './commands/migrate'; -import { printSecurityDiff, printStackDiff, RequireApproval } from './diff'; -import { ResourceImporter, removeNonImportResources } from './import'; -import { listStacks } from './list-stacks'; -import { data, debug, error, highlight, info, success, warning, withCorkedLogging } from './logging'; -import { ResourceMigrator } from './migrator'; -import { deserializeStructure, obscureTemplate, serializeStructure } from './serialize'; -import { Configuration, PROJECT_CONFIG } from './settings'; -import { Tag, tagsForStack } from './tags'; -import { ToolkitError } from './toolkit/error'; -import { numberFromBool, partition } from './util'; -import { formatErrorMessage } from './util/error'; -import { validateSnsTopicArn } from './util/validate-notification-arn'; -import { Concurrency, WorkGraph } from './util/work-graph'; -import { WorkGraphBuilder } from './util/work-graph-builder'; -import { AssetBuildNode, AssetPublishNode, StackNode } from './util/work-graph-types'; -import { environmentsFromDescriptors, globEnvironmentsFromStacks, looksLikeGlob } from '../lib/api/cxapp/environments'; +} from '../commands/migrate'; +import { printSecurityDiff, printStackDiff, RequireApproval } from '../diff'; +import { ResourceImporter, removeNonImportResources } from '../import'; +import { listStacks } from '../list-stacks'; +import { data, debug, error, highlight, info, success, warning, withCorkedLogging } from '../logging'; +import { ResourceMigrator } from '../migrator'; +import { deserializeStructure, obscureTemplate, serializeStructure } from '../serialize'; +import { ToolkitError } from '../toolkit/error'; +import { numberFromBool, partition } from '../util'; +import { formatErrorMessage } from '../util/error'; +import { validateSnsTopicArn } from '../util/validate-notification-arn'; +import { Concurrency, WorkGraph } from '../util/work-graph'; +import { WorkGraphBuilder } from '../util/work-graph-builder'; +import { AssetBuildNode, AssetPublishNode, StackNode } from '../util/work-graph-types'; // Must use a require() otherwise esbuild complains about calling a namespace // eslint-disable-next-line @typescript-eslint/no-require-imports diff --git a/packages/aws-cdk/lib/config.ts b/packages/aws-cdk/lib/cli/cli-config.ts similarity index 99% rename from packages/aws-cdk/lib/config.ts rename to packages/aws-cdk/lib/cli/cli-config.ts index ed585b2d49be9..2bed63e1b9731 100644 --- a/packages/aws-cdk/lib/config.ts +++ b/packages/aws-cdk/lib/cli/cli-config.ts @@ -1,9 +1,9 @@ // eslint-disable-next-line import/no-extraneous-dependencies import { CliHelpers, type CliConfig } from '@aws-cdk/user-input-gen'; import * as cdk_from_cfn from 'cdk-from-cfn'; -import { StackActivityProgress } from './api/util/cloudformation/stack-activity-monitor'; -import { RequireApproval } from './diff'; -import { availableInitLanguages } from './init'; +import { StackActivityProgress } from '../api/util/cloudformation/stack-activity-monitor'; +import { RequireApproval } from '../diff'; +import { availableInitLanguages } from '../init'; export const YARGS_HELPERS = new CliHelpers('./util/yargs-helpers'); diff --git a/packages/aws-cdk/lib/cli.ts b/packages/aws-cdk/lib/cli/cli.ts similarity index 93% rename from packages/aws-cdk/lib/cli.ts rename to packages/aws-cdk/lib/cli/cli.ts index 01e5c06c3d761..a890c223c1f62 100644 --- a/packages/aws-cdk/lib/cli.ts +++ b/packages/aws-cdk/lib/cli/cli.ts @@ -1,34 +1,34 @@ import * as cxapi from '@aws-cdk/cx-api'; import '@jsii/check-node/run'; import * as chalk from 'chalk'; -import { DeploymentMethod } from './api'; -import { HotswapMode } from './api/hotswap/common'; -import { ILock } from './api/util/rwlock'; +import { CdkToolkit, AssetBuildTime } from './cdk-toolkit'; import { parseCommandLineArguments } from './parse-command-line-arguments'; import { checkForPlatformWarnings } from './platform-warnings'; -import { IoMessageLevel, CliIoHost } from './toolkit/cli-io-host'; - -import { enableTracing } from './util/tracing'; -import { SdkProvider } from '../lib/api/aws-auth'; -import { BootstrapSource, Bootstrapper } from '../lib/api/bootstrap'; -import { StackSelector } from '../lib/api/cxapp/cloud-assembly'; -import { CloudExecutable, Synthesizer } from '../lib/api/cxapp/cloud-executable'; -import { execProgram } from '../lib/api/cxapp/exec'; -import { Deployments } from '../lib/api/deployments'; -import { PluginHost } from '../lib/api/plugin'; -import { ToolkitInfo } from '../lib/api/toolkit-info'; -import { CdkToolkit, AssetBuildTime } from '../lib/cdk-toolkit'; -import { contextHandler as context } from '../lib/commands/context'; -import { docs } from '../lib/commands/docs'; -import { doctor } from '../lib/commands/doctor'; -import { getMigrateScanType } from '../lib/commands/migrate'; -import { cliInit, printAvailableTemplates } from '../lib/init'; -import { data, debug, error, info } from '../lib/logging'; -import { Notices } from '../lib/notices'; -import { Command, Configuration, Settings } from '../lib/settings'; -import * as version from '../lib/version'; -import { SdkToCliLogger } from './api/aws-auth/sdk-logger'; -import { ToolkitError } from './toolkit/error'; + +import * as version from './version'; +import { SdkProvider } from '../api/aws-auth'; +import { SdkToCliLogger } from '../api/aws-auth/sdk-logger'; +import { BootstrapSource, Bootstrapper } from '../api/bootstrap'; +import { StackSelector } from '../api/cxapp/cloud-assembly'; +import { CloudExecutable, Synthesizer } from '../api/cxapp/cloud-executable'; +import { execProgram } from '../api/cxapp/exec'; +import { Deployments, DeploymentMethod } from '../api/deployments'; +import { HotswapMode } from '../api/hotswap/common'; +import { PluginHost } from '../api/plugin'; +import { Settings } from '../api/settings'; +import { ToolkitInfo } from '../api/toolkit-info'; +import { ILock } from '../api/util/rwlock'; +import { contextHandler as context } from '../commands/context'; +import { docs } from '../commands/docs'; +import { doctor } from '../commands/doctor'; +import { getMigrateScanType } from '../commands/migrate'; +import { cliInit, printAvailableTemplates } from '../init'; +import { data, debug, error, info } from '../logging'; +import { Notices } from '../notices'; +import { Command, Configuration } from './user-configuration'; +import { IoMessageLevel, CliIoHost } from '../toolkit/cli-io-host'; +import { ToolkitError } from '../toolkit/error'; +import { enableTracing } from '../util/tracing'; /* eslint-disable max-len */ /* eslint-disable @typescript-eslint/no-shadow */ // yargs diff --git a/packages/aws-cdk/lib/convert-to-user-input.ts b/packages/aws-cdk/lib/cli/convert-to-user-input.ts similarity index 99% rename from packages/aws-cdk/lib/convert-to-user-input.ts rename to packages/aws-cdk/lib/cli/convert-to-user-input.ts index 65f3dfdbd5b79..f5f454521d29f 100644 --- a/packages/aws-cdk/lib/convert-to-user-input.ts +++ b/packages/aws-cdk/lib/cli/convert-to-user-input.ts @@ -3,7 +3,7 @@ // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ -import { Command } from './settings'; +import { Command } from './user-configuration'; import { UserInput, GlobalOptions } from './user-input'; // @ts-ignore TS6133 diff --git a/packages/aws-cdk/lib/parse-command-line-arguments.ts b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts similarity index 100% rename from packages/aws-cdk/lib/parse-command-line-arguments.ts rename to packages/aws-cdk/lib/cli/parse-command-line-arguments.ts diff --git a/packages/aws-cdk/lib/platform-warnings.ts b/packages/aws-cdk/lib/cli/platform-warnings.ts similarity index 96% rename from packages/aws-cdk/lib/platform-warnings.ts rename to packages/aws-cdk/lib/cli/platform-warnings.ts index b832edf5f4a1c..9ab6edb6c1adc 100644 --- a/packages/aws-cdk/lib/platform-warnings.ts +++ b/packages/aws-cdk/lib/cli/platform-warnings.ts @@ -1,6 +1,6 @@ import * as os from 'os'; import * as fs from 'fs-extra'; -import * as logging from './logging'; +import * as logging from '../logging'; export async function checkForPlatformWarnings() { if (await hasDockerCopyBug()) { diff --git a/packages/aws-cdk/lib/cli/user-configuration.ts b/packages/aws-cdk/lib/cli/user-configuration.ts new file mode 100644 index 0000000000000..caf865bc4107a --- /dev/null +++ b/packages/aws-cdk/lib/cli/user-configuration.ts @@ -0,0 +1,326 @@ +import { Context, PROJECT_CONTEXT } from '../api/context'; +import { Settings } from '../api/settings'; +import { Tag } from '../api/tags'; +import { debug, warning } from '../logging'; +import { ToolkitError } from '../toolkit/error'; + +export const PROJECT_CONFIG = 'cdk.json'; +export { PROJECT_CONTEXT } from '../api/context'; +export const USER_DEFAULTS = '~/.cdk.json'; +const CONTEXT_KEY = 'context'; + +export enum Command { + LS = 'ls', + LIST = 'list', + DIFF = 'diff', + BOOTSTRAP = 'bootstrap', + DEPLOY = 'deploy', + DESTROY = 'destroy', + SYNTHESIZE = 'synthesize', + SYNTH = 'synth', + METADATA = 'metadata', + INIT = 'init', + VERSION = 'version', + WATCH = 'watch', + GC = 'gc', + ROLLBACK = 'rollback', + IMPORT = 'import', + ACKNOWLEDGE = 'acknowledge', + ACK = 'ack', + NOTICES = 'notices', + MIGRATE = 'migrate', + CONTEXT = 'context', + DOCS = 'docs', + DOC = 'doc', + DOCTOR = 'doctor', +} + +const BUNDLING_COMMANDS = [ + Command.DEPLOY, + Command.DIFF, + Command.SYNTH, + Command.SYNTHESIZE, + Command.WATCH, +]; + +export type Arguments = { + readonly _: [Command, ...string[]]; + readonly exclusively?: boolean; + readonly STACKS?: string[]; + readonly lookups?: boolean; + readonly [name: string]: unknown; +}; + +export interface ConfigurationProps { + /** + * Configuration passed via command line arguments + * + * @default - Nothing passed + */ + readonly commandLineArguments?: Arguments; + + /** + * Whether or not to use context from `.cdk.json` in user home directory + * + * @default true + */ + readonly readUserContext?: boolean; +} + +/** + * All sources of settings combined + */ +export class Configuration { + public settings = new Settings(); + public context = new Context(); + + public readonly defaultConfig = new Settings({ + versionReporting: true, + assetMetadata: true, + pathMetadata: true, + output: 'cdk.out', + }); + + private readonly commandLineArguments: Settings; + private readonly commandLineContext: Settings; + private _projectConfig?: Settings; + private _projectContext?: Settings; + private loaded = false; + + constructor(private readonly props: ConfigurationProps = {}) { + this.commandLineArguments = props.commandLineArguments + ? commandLineArgumentsToSettings(props.commandLineArguments) + : new Settings(); + this.commandLineContext = this.commandLineArguments + .subSettings([CONTEXT_KEY]) + .makeReadOnly(); + } + + private get projectConfig() { + if (!this._projectConfig) { + throw new ToolkitError('#load has not been called yet!'); + } + return this._projectConfig; + } + + public get projectContext() { + if (!this._projectContext) { + throw new ToolkitError('#load has not been called yet!'); + } + return this._projectContext; + } + + /** + * Load all config + */ + public async load(): Promise { + const userConfig = await loadAndLog(USER_DEFAULTS); + this._projectConfig = await loadAndLog(PROJECT_CONFIG); + this._projectContext = await loadAndLog(PROJECT_CONTEXT); + + // @todo cannot currently be disabled by cli users + const readUserContext = this.props.readUserContext ?? true; + + if (userConfig.get(['build'])) { + throw new ToolkitError( + 'The `build` key cannot be specified in the user config (~/.cdk.json), specify it in the project config (cdk.json) instead', + ); + } + + const contextSources = [ + { bag: this.commandLineContext }, + { + fileName: PROJECT_CONFIG, + bag: this.projectConfig.subSettings([CONTEXT_KEY]).makeReadOnly(), + }, + { fileName: PROJECT_CONTEXT, bag: this.projectContext }, + ]; + if (readUserContext) { + contextSources.push({ + fileName: USER_DEFAULTS, + bag: userConfig.subSettings([CONTEXT_KEY]).makeReadOnly(), + }); + } + + this.context = new Context(...contextSources); + + // Build settings from what's left + this.settings = this.defaultConfig + .merge(userConfig) + .merge(this.projectConfig) + .merge(this.commandLineArguments) + .makeReadOnly(); + + debug('merged settings:', this.settings.all); + + this.loaded = true; + + return this; + } + + /** + * Save the project context + */ + public async saveContext(): Promise { + if (!this.loaded) { + return this; + } // Avoid overwriting files with nothing + + await this.projectContext.save(PROJECT_CONTEXT); + + return this; + } +} + +async function loadAndLog(fileName: string): Promise { + const ret = new Settings(); + await ret.load(fileName); + if (!ret.empty) { + debug(fileName + ':', JSON.stringify(ret.all, undefined, 2)); + } + return ret; +} + +/** + * Parse CLI arguments into Settings + * + * CLI arguments in must be accessed in the CLI code via + * `configuration.settings.get(['argName'])` instead of via `args.argName`. + * + * The advantage is that they can be configured via `cdk.json` and + * `$HOME/.cdk.json`. Arguments not listed below and accessed via this object + * can only be specified on the command line. + * + * @param argv the received CLI arguments. + * @returns a new Settings object. + */ +export function commandLineArgumentsToSettings(argv: Arguments): Settings { + const context = parseStringContextListToObject(argv); + const tags = parseStringTagsListToObject(expectStringList(argv.tags)); + + // Determine bundling stacks + let bundlingStacks: string[]; + if (BUNDLING_COMMANDS.includes(argv._[0])) { + // If we deploy, diff, synth or watch a list of stacks exclusively we skip + // bundling for all other stacks. + bundlingStacks = argv.exclusively ? argv.STACKS ?? ['**'] : ['**']; + } else { + // Skip bundling for all stacks + bundlingStacks = []; + } + + return new Settings({ + app: argv.app, + browser: argv.browser, + build: argv.build, + caBundlePath: argv.caBundlePath, + context, + debug: argv.debug, + tags, + language: argv.language, + pathMetadata: argv.pathMetadata, + assetMetadata: argv.assetMetadata, + profile: argv.profile, + plugin: argv.plugin, + requireApproval: argv.requireApproval, + toolkitStackName: argv.toolkitStackName, + toolkitBucket: { + bucketName: argv.bootstrapBucketName, + kmsKeyId: argv.bootstrapKmsKeyId, + }, + versionReporting: argv.versionReporting, + staging: argv.staging, + output: argv.output, + outputsFile: argv.outputsFile, + progress: argv.progress, + proxy: argv.proxy, + bundlingStacks, + lookups: argv.lookups, + rollback: argv.rollback, + notices: argv.notices, + assetParallelism: argv['asset-parallelism'], + assetPrebuild: argv['asset-prebuild'], + ignoreNoStacks: argv['ignore-no-stacks'], + hotswap: { + ecs: { + minimumEcsHealthyPercent: argv.minimumEcsHealthyPercent, + maximumEcsHealthyPercent: argv.maximumEcsHealthyPercent, + }, + }, + unstable: argv.unstable, + }); +} + +function expectStringList(x: unknown): string[] | undefined { + if (x === undefined) { + return undefined; + } + if (!Array.isArray(x)) { + throw new ToolkitError(`Expected array, got '${x}'`); + } + const nonStrings = x.filter((e) => typeof e !== 'string'); + if (nonStrings.length > 0) { + throw new ToolkitError(`Expected list of strings, found ${nonStrings}`); + } + return x; +} + +function parseStringContextListToObject(argv: Arguments): any { + const context: any = {}; + + for (const assignment of (argv as any).context || []) { + const parts = assignment.split(/=(.*)/, 2); + if (parts.length === 2) { + debug('CLI argument context: %s=%s', parts[0], parts[1]); + if (parts[0].match(/^aws:.+/)) { + throw new ToolkitError( + `User-provided context cannot use keys prefixed with 'aws:', but ${parts[0]} was provided.`, + ); + } + context[parts[0]] = parts[1]; + } else { + warning( + 'Context argument is not an assignment (key=value): %s', + assignment, + ); + } + } + return context; +} + +/** + * Parse tags out of arguments + * + * Return undefined if no tags were provided, return an empty array if only empty + * strings were provided + */ +function parseStringTagsListToObject( + argTags: string[] | undefined, +): Tag[] | undefined { + if (argTags === undefined) { + return undefined; + } + if (argTags.length === 0) { + return undefined; + } + const nonEmptyTags = argTags.filter((t) => t !== ''); + if (nonEmptyTags.length === 0) { + return []; + } + + const tags: Tag[] = []; + + for (const assignment of nonEmptyTags) { + const parts = assignment.split(/=(.*)/, 2); + if (parts.length === 2) { + debug('CLI argument tags: %s=%s', parts[0], parts[1]); + tags.push({ + Key: parts[0], + Value: parts[1], + }); + } else { + warning('Tags argument is not an assignment (key=value): %s', assignment); + } + } + return tags.length > 0 ? tags : undefined; +} diff --git a/packages/aws-cdk/lib/user-input.ts b/packages/aws-cdk/lib/cli/user-input.ts similarity index 99% rename from packages/aws-cdk/lib/user-input.ts rename to packages/aws-cdk/lib/cli/user-input.ts index 279d0635cca2b..f8973df29828a 100644 --- a/packages/aws-cdk/lib/user-input.ts +++ b/packages/aws-cdk/lib/cli/user-input.ts @@ -3,7 +3,7 @@ // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ -import { Command } from './settings'; +import { Command } from './user-configuration'; /** * The structure of the user input -- either CLI options or cdk.json -- generated from packages/aws-cdk/lib/config.ts diff --git a/packages/aws-cdk/lib/util/console-formatters.ts b/packages/aws-cdk/lib/cli/util/console-formatters.ts similarity index 100% rename from packages/aws-cdk/lib/util/console-formatters.ts rename to packages/aws-cdk/lib/cli/util/console-formatters.ts diff --git a/packages/aws-cdk/lib/util/npm.ts b/packages/aws-cdk/lib/cli/util/npm.ts similarity index 88% rename from packages/aws-cdk/lib/util/npm.ts rename to packages/aws-cdk/lib/cli/util/npm.ts index 6af8a01f62cb2..6bda584e89415 100644 --- a/packages/aws-cdk/lib/util/npm.ts +++ b/packages/aws-cdk/lib/cli/util/npm.ts @@ -1,8 +1,8 @@ import { exec as _exec } from 'child_process'; import { promisify } from 'util'; import * as semver from 'semver'; -import { debug } from '../../lib/logging'; -import { ToolkitError } from '../toolkit/error'; +import { debug } from '../../logging'; +import { ToolkitError } from '../../toolkit/error'; const exec = promisify(_exec); diff --git a/packages/aws-cdk/lib/util/yargs-helpers.ts b/packages/aws-cdk/lib/cli/util/yargs-helpers.ts similarity index 93% rename from packages/aws-cdk/lib/util/yargs-helpers.ts rename to packages/aws-cdk/lib/cli/util/yargs-helpers.ts index 72c315fc19488..dfff5575c2186 100644 --- a/packages/aws-cdk/lib/util/yargs-helpers.ts +++ b/packages/aws-cdk/lib/cli/util/yargs-helpers.ts @@ -1,6 +1,6 @@ -import * as version from '../../lib/version'; +import * as version from '../version'; -export { isCI } from '../toolkit/cli-io-host'; +export { isCI } from '../../toolkit/cli-io-host'; /** * yargs middleware to negate an option if a negative alias is provided diff --git a/packages/aws-cdk/lib/version.ts b/packages/aws-cdk/lib/cli/version.ts similarity index 94% rename from packages/aws-cdk/lib/version.ts rename to packages/aws-cdk/lib/cli/version.ts index bff01ade6b885..35e56f928d86c 100644 --- a/packages/aws-cdk/lib/version.ts +++ b/packages/aws-cdk/lib/cli/version.ts @@ -3,11 +3,11 @@ import * as path from 'path'; import * as chalk from 'chalk'; import * as fs from 'fs-extra'; import * as semver from 'semver'; -import { cdkCacheDir, rootDir } from './util/directories'; +import { debug, info } from '../logging'; +import { ToolkitError } from '../toolkit/error'; +import { formatAsBanner } from './util/console-formatters'; +import { cdkCacheDir, rootDir } from '../util/directories'; import { getLatestVersionFromNpm } from './util/npm'; -import { debug, info } from '../lib/logging'; -import { ToolkitError } from './toolkit/error'; -import { formatAsBanner } from '../lib/util/console-formatters'; const ONE_DAY_IN_SECONDS = 1 * 24 * 60 * 60; diff --git a/packages/aws-cdk/lib/commands/context.ts b/packages/aws-cdk/lib/commands/context.ts index 3d22aa8866a76..28b4a1ab10598 100644 --- a/packages/aws-cdk/lib/commands/context.ts +++ b/packages/aws-cdk/lib/commands/context.ts @@ -1,8 +1,9 @@ import * as chalk from 'chalk'; import { minimatch } from 'minimatch'; -import * as version from '../../lib/version'; +import { Context } from '../api/context'; +import { PROJECT_CONFIG, PROJECT_CONTEXT, USER_DEFAULTS } from '../cli/user-configuration'; +import * as version from '../cli/version'; import { error, warning, info, data } from '../logging'; -import { Context, PROJECT_CONFIG, PROJECT_CONTEXT, USER_DEFAULTS } from '../settings'; import { ToolkitError } from '../toolkit/error'; import { renderTable } from '../util'; diff --git a/packages/aws-cdk/lib/commands/doctor.ts b/packages/aws-cdk/lib/commands/doctor.ts index a2f03f08e08c0..7564984527e1f 100644 --- a/packages/aws-cdk/lib/commands/doctor.ts +++ b/packages/aws-cdk/lib/commands/doctor.ts @@ -2,7 +2,7 @@ import * as process from 'process'; import * as cxapi from '@aws-cdk/cx-api'; import * as chalk from 'chalk'; import { info } from '../../lib/logging'; -import * as version from '../../lib/version'; +import * as version from '../cli/version'; export async function doctor(): Promise { let exitStatus: number = 0; diff --git a/packages/aws-cdk/lib/context-providers/index.ts b/packages/aws-cdk/lib/context-providers/index.ts index 256dd40a0ffdf..1e111fa55d2c5 100644 --- a/packages/aws-cdk/lib/context-providers/index.ts +++ b/packages/aws-cdk/lib/context-providers/index.ts @@ -10,11 +10,11 @@ import { SecurityGroupContextProviderPlugin } from './security-groups'; import { SSMContextProviderPlugin } from './ssm-parameters'; import { VpcNetworkContextProviderPlugin } from './vpcs'; import { SdkProvider } from '../api'; +import { Context, TRANSIENT_CONTEXT_KEY } from '../api/context'; import { PluginHost } from '../api/plugin'; import { ContextProviderPlugin } from '../api/plugin/context-provider-plugin'; import { replaceEnvPlaceholders } from '../api/util/placeholders'; import { debug } from '../logging'; -import { Context, TRANSIENT_CONTEXT_KEY } from '../settings'; import { ContextProviderError } from '../toolkit/error'; import { formatErrorMessage } from '../util/error'; diff --git a/packages/aws-cdk/lib/import.ts b/packages/aws-cdk/lib/import.ts index 4979cef83c068..9c27b5934b14a 100644 --- a/packages/aws-cdk/lib/import.ts +++ b/packages/aws-cdk/lib/import.ts @@ -6,9 +6,9 @@ import * as chalk from 'chalk'; import * as fs from 'fs-extra'; import * as promptly from 'promptly'; import { assertIsSuccessfulDeployStackResult, Deployments, DeploymentMethod, ResourceIdentifierProperties, ResourcesToImport } from './api/deployments'; +import { Tag } from './api/tags'; import { StackActivityProgress } from './api/util/cloudformation/stack-activity-monitor'; import { error, info, success, warning } from './logging'; -import { Tag } from './tags'; import { ToolkitError } from './toolkit/error'; export interface ImportDeploymentOptions extends DeployOptions { diff --git a/packages/aws-cdk/lib/index.ts b/packages/aws-cdk/lib/index.ts index f049782506f2e..2e4a1c183851b 100644 --- a/packages/aws-cdk/lib/index.ts +++ b/packages/aws-cdk/lib/index.ts @@ -1,5 +1,5 @@ export * from './api'; -export { cli, exec } from './cli'; +export { cli, exec } from './cli/cli'; // Re-export the legacy exports under a name // We import and re-export them from the index.ts file to generate a single bundle of all code and dependencies diff --git a/packages/aws-cdk/lib/legacy-exports-source.ts b/packages/aws-cdk/lib/legacy-exports-source.ts index 9e72d19bd0b93..46bdd000f4298 100644 --- a/packages/aws-cdk/lib/legacy-exports-source.ts +++ b/packages/aws-cdk/lib/legacy-exports-source.ts @@ -7,24 +7,25 @@ export * from './legacy-logging-source'; export { deepClone, flatten, ifDefined, isArray, isEmpty, numberFromBool, partition } from './util'; export { deployStack } from './api/deployments/deploy-stack'; -export { cli, exec } from './cli'; +export { cli, exec } from './cli/cli'; export { SdkProvider } from './api/aws-auth'; export { PluginHost } from './api/plugin'; export { contentHash } from './util/content-hash'; -export { Command, Configuration, PROJECT_CONTEXT, Settings } from './settings'; +export { Command, Configuration, PROJECT_CONTEXT } from './cli/user-configuration'; +export { Settings } from './api/settings'; export { Bootstrapper } from './api/bootstrap'; export { CloudExecutable } from './api/cxapp/cloud-executable'; export { execProgram } from './api/cxapp/exec'; export { RequireApproval } from './diff'; export { leftPad } from './api/util/string-manipulation'; -export { formatAsBanner } from './util/console-formatters'; +export { formatAsBanner } from './cli/util/console-formatters'; export { enableTracing } from './util/tracing'; export { aliases, command, describe } from './commands/docs'; export { lowerCaseFirstCharacter } from './api/hotswap/common'; export { deepMerge } from './util/objects'; export { Deployments } from './api/deployments'; export { rootDir } from './util/directories'; -export { latestVersionIfHigher, versionNumber } from './version'; +export { latestVersionIfHigher, versionNumber } from './cli/version'; export { availableInitTemplates } from './init'; export { cached } from './api/aws-auth/cached'; export { CfnEvaluationException } from './api/evaluate-cloudformation-template'; diff --git a/packages/aws-cdk/lib/list-stacks.ts b/packages/aws-cdk/lib/list-stacks.ts index f1b49712e89c8..df9b4cea7f68b 100644 --- a/packages/aws-cdk/lib/list-stacks.ts +++ b/packages/aws-cdk/lib/list-stacks.ts @@ -2,7 +2,7 @@ import '@jsii/check-node/run'; import { Environment } from '@aws-cdk/cx-api'; import { DefaultSelection, ExtendedStackSelection, StackCollection } from './api/cxapp/cloud-assembly'; -import { CdkToolkit } from './cdk-toolkit'; +import { CdkToolkit } from './cli/cdk-toolkit'; /** * Options for List Stacks diff --git a/packages/aws-cdk/lib/migrator.ts b/packages/aws-cdk/lib/migrator.ts index e7e84f3ece24a..4998de95ec7b5 100644 --- a/packages/aws-cdk/lib/migrator.ts +++ b/packages/aws-cdk/lib/migrator.ts @@ -4,7 +4,7 @@ import * as fs from 'fs-extra'; import { StackCollection } from './api/cxapp/cloud-assembly'; import { Deployments, ResourcesToImport } from './api/deployments'; import { formatTime } from './api/util/string-manipulation'; -import { DeployOptions } from './cdk-toolkit'; +import { DeployOptions } from './cli/cdk-toolkit'; import { ResourceImporter } from './import'; import { info } from './logging'; diff --git a/packages/aws-cdk/lib/notices.ts b/packages/aws-cdk/lib/notices.ts index 5d21f6ced47d7..50481beafaedf 100644 --- a/packages/aws-cdk/lib/notices.ts +++ b/packages/aws-cdk/lib/notices.ts @@ -7,14 +7,14 @@ import * as fs from 'fs-extra'; import * as semver from 'semver'; import { SdkHttpOptions } from './api'; import { AwsCliCompatible } from './api/aws-auth/awscli-compatible'; +import type { Context } from './api/context'; +import { versionNumber } from './cli/version'; import { debug, info, warning, error } from './logging'; -import { Context } from './settings'; import { ToolkitError } from './toolkit/error'; import { loadTreeFromDir, some } from './tree'; import { flatMap } from './util'; import { cdkCacheDir } from './util/directories'; import { formatErrorMessage } from './util/error'; -import { versionNumber } from './version'; const CACHE_FILE_PATH = path.join(cdkCacheDir(), 'notices.json'); @@ -265,7 +265,7 @@ export class Notices { /** * Refresh the list of notices this instance is aware of. * To make sure this never crashes the CLI process, all failures are caught and - * slitently logged. + * silently logged. * * If context is configured to not display notices, this will no-op. */ diff --git a/packages/aws-cdk/lib/settings.ts b/packages/aws-cdk/lib/settings.ts deleted file mode 100644 index a567fa9996099..0000000000000 --- a/packages/aws-cdk/lib/settings.ts +++ /dev/null @@ -1,543 +0,0 @@ -import * as os from 'os'; -import * as fs_path from 'path'; -import * as fs from 'fs-extra'; -import { debug, warning } from './logging'; -import { Tag } from './tags'; -import { ToolkitError } from './toolkit/error'; -import * as util from './util'; - -export type SettingsMap = {[key: string]: any}; - -export const PROJECT_CONFIG = 'cdk.json'; -export const PROJECT_CONTEXT = 'cdk.context.json'; -export const USER_DEFAULTS = '~/.cdk.json'; - -/** - * If a context value is an object with this key set to a truthy value, it won't be saved to cdk.context.json - */ -export const TRANSIENT_CONTEXT_KEY = '$dontSaveContext'; - -const CONTEXT_KEY = 'context'; - -export enum Command { - LS = 'ls', - LIST = 'list', - DIFF = 'diff', - BOOTSTRAP = 'bootstrap', - DEPLOY = 'deploy', - DESTROY = 'destroy', - SYNTHESIZE = 'synthesize', - SYNTH = 'synth', - METADATA = 'metadata', - INIT = 'init', - VERSION = 'version', - WATCH = 'watch', - GC = 'gc', - ROLLBACK = 'rollback', - IMPORT = 'import', - ACKNOWLEDGE = 'acknowledge', - ACK = 'ack', - NOTICES = 'notices', - MIGRATE = 'migrate', - CONTEXT = 'context', - DOCS = 'docs', - DOC = 'doc', - DOCTOR = 'doctor', -} - -const BUNDLING_COMMANDS = [ - Command.DEPLOY, - Command.DIFF, - Command.SYNTH, - Command.SYNTHESIZE, - Command.WATCH, -]; - -export type Arguments = { - readonly _: [Command, ...string[]]; - readonly exclusively?: boolean; - readonly STACKS?: string[]; - readonly lookups?: boolean; - readonly [name: string]: unknown; -}; - -export interface ConfigurationProps { - /** - * Configuration passed via command line arguments - * - * @default - Nothing passed - */ - readonly commandLineArguments?: Arguments; - - /** - * Whether or not to use context from `.cdk.json` in user home directory - * - * @default true - */ - readonly readUserContext?: boolean; -} - -/** - * All sources of settings combined - */ -export class Configuration { - public settings = new Settings(); - public context = new Context(); - - public readonly defaultConfig = new Settings({ - versionReporting: true, - assetMetadata: true, - pathMetadata: true, - output: 'cdk.out', - }); - - private readonly commandLineArguments: Settings; - private readonly commandLineContext: Settings; - private _projectConfig?: Settings; - private _projectContext?: Settings; - private loaded = false; - - constructor(private readonly props: ConfigurationProps = {}) { - this.commandLineArguments = props.commandLineArguments - ? Settings.fromCommandLineArguments(props.commandLineArguments) - : new Settings(); - this.commandLineContext = this.commandLineArguments.subSettings([CONTEXT_KEY]).makeReadOnly(); - } - - private get projectConfig() { - if (!this._projectConfig) { - throw new ToolkitError('#load has not been called yet!'); - } - return this._projectConfig; - } - - public get projectContext() { - if (!this._projectContext) { - throw new ToolkitError('#load has not been called yet!'); - } - return this._projectContext; - } - - /** - * Load all config - */ - public async load(): Promise { - const userConfig = await loadAndLog(USER_DEFAULTS); - this._projectConfig = await loadAndLog(PROJECT_CONFIG); - this._projectContext = await loadAndLog(PROJECT_CONTEXT); - - // @todo cannot currently be disabled by cli users - const readUserContext = this.props.readUserContext ?? true; - - if (userConfig.get(['build'])) { - throw new ToolkitError('The `build` key cannot be specified in the user config (~/.cdk.json), specify it in the project config (cdk.json) instead'); - } - - const contextSources = [ - { bag: this.commandLineContext }, - { fileName: PROJECT_CONFIG, bag: this.projectConfig.subSettings([CONTEXT_KEY]).makeReadOnly() }, - { fileName: PROJECT_CONTEXT, bag: this.projectContext }, - ]; - if (readUserContext) { - contextSources.push({ fileName: USER_DEFAULTS, bag: userConfig.subSettings([CONTEXT_KEY]).makeReadOnly() }); - } - - this.context = new Context(...contextSources); - - // Build settings from what's left - this.settings = this.defaultConfig - .merge(userConfig) - .merge(this.projectConfig) - .merge(this.commandLineArguments) - .makeReadOnly(); - - debug('merged settings:', this.settings.all); - - this.loaded = true; - - return this; - } - - /** - * Save the project context - */ - public async saveContext(): Promise { - if (!this.loaded) { return this; } // Avoid overwriting files with nothing - - await this.projectContext.save(PROJECT_CONTEXT); - - return this; - } -} - -async function loadAndLog(fileName: string): Promise { - const ret = new Settings(); - await ret.load(fileName); - if (!ret.empty) { - debug(fileName + ':', JSON.stringify(ret.all, undefined, 2)); - } - return ret; -} - -interface ContextBag { - /** - * The file name of the context. Will be used to potentially - * save new context back to the original file. - */ - fileName?: string; - - /** - * The context values. - */ - bag: Settings; -} - -/** - * Class that supports overlaying property bags - * - * Reads come from the first property bag that can has the given key, - * writes go to the first property bag that is not readonly. A write - * will remove the value from all property bags after the first - * writable one. - */ -export class Context { - private readonly bags: Settings[]; - private readonly fileNames: (string|undefined)[]; - - constructor(...bags: ContextBag[]) { - this.bags = bags.length > 0 ? bags.map(b => b.bag) : [new Settings()]; - this.fileNames = bags.length > 0 ? bags.map(b => b.fileName) : ['default']; - } - - public get keys(): string[] { - return Object.keys(this.all); - } - - public has(key: string) { - return this.keys.indexOf(key) > -1; - } - - public get all(): {[key: string]: any} { - let ret = new Settings(); - - // In reverse order so keys to the left overwrite keys to the right of them - for (const bag of [...this.bags].reverse()) { - ret = ret.merge(bag); - } - - return ret.all; - } - - public get(key: string): any { - for (const bag of this.bags) { - const v = bag.get([key]); - if (v !== undefined) { return v; } - } - return undefined; - } - - public set(key: string, value: any) { - for (const bag of this.bags) { - if (bag.readOnly) { continue; } - - // All bags past the first one have the value erased - bag.set([key], value); - value = undefined; - } - } - - public unset(key: string) { - this.set(key, undefined); - } - - public clear() { - for (const key of this.keys) { - this.unset(key); - } - } - - /** - * Save a specific context file - */ - public async save(fileName: string): Promise { - const index = this.fileNames.indexOf(fileName); - - // File not found, don't do anything in this scenario - if (index === -1) { - return this; - } - - const bag = this.bags[index]; - if (bag.readOnly) { - throw new ToolkitError(`Context file ${fileName} is read only!`); - } - - await bag.save(fileName); - return this; - } -} - -/** - * A single bag of settings - */ -export class Settings { - /** - * Parse Settings out of CLI arguments. - * - * CLI arguments in must be accessed in the CLI code via - * `configuration.settings.get(['argName'])` instead of via `args.argName`. - * - * The advantage is that they can be configured via `cdk.json` and - * `$HOME/.cdk.json`. Arguments not listed below and accessed via this object - * can only be specified on the command line. - * - * @param argv the received CLI arguments. - * @returns a new Settings object. - */ - public static fromCommandLineArguments(argv: Arguments): Settings { - const context = this.parseStringContextListToObject(argv); - const tags = this.parseStringTagsListToObject(expectStringList(argv.tags)); - - // Determine bundling stacks - let bundlingStacks: string[]; - if (BUNDLING_COMMANDS.includes(argv._[0])) { - // If we deploy, diff, synth or watch a list of stacks exclusively we skip - // bundling for all other stacks. - bundlingStacks = argv.exclusively - ? argv.STACKS ?? ['**'] - : ['**']; - } else { // Skip bundling for all stacks - bundlingStacks = []; - } - - return new Settings({ - app: argv.app, - browser: argv.browser, - build: argv.build, - caBundlePath: argv.caBundlePath, - context, - debug: argv.debug, - tags, - language: argv.language, - pathMetadata: argv.pathMetadata, - assetMetadata: argv.assetMetadata, - profile: argv.profile, - plugin: argv.plugin, - requireApproval: argv.requireApproval, - toolkitStackName: argv.toolkitStackName, - toolkitBucket: { - bucketName: argv.bootstrapBucketName, - kmsKeyId: argv.bootstrapKmsKeyId, - }, - versionReporting: argv.versionReporting, - staging: argv.staging, - output: argv.output, - outputsFile: argv.outputsFile, - progress: argv.progress, - proxy: argv.proxy, - bundlingStacks, - lookups: argv.lookups, - rollback: argv.rollback, - notices: argv.notices, - assetParallelism: argv['asset-parallelism'], - assetPrebuild: argv['asset-prebuild'], - ignoreNoStacks: argv['ignore-no-stacks'], - hotswap: { - ecs: { - minimumEcsHealthyPercent: argv.minimumEcsHealthyPercent, - maximumEcsHealthyPercent: argv.maximumEcsHealthyPercent, - }, - }, - unstable: argv.unstable, - }); - } - - public static mergeAll(...settings: Settings[]): Settings { - let ret = new Settings(); - for (const setting of settings) { - ret = ret.merge(setting); - } - return ret; - } - - private static parseStringContextListToObject(argv: Arguments): any { - const context: any = {}; - - for (const assignment of ((argv as any).context || [])) { - const parts = assignment.split(/=(.*)/, 2); - if (parts.length === 2) { - debug('CLI argument context: %s=%s', parts[0], parts[1]); - if (parts[0].match(/^aws:.+/)) { - throw new ToolkitError(`User-provided context cannot use keys prefixed with 'aws:', but ${parts[0]} was provided.`); - } - context[parts[0]] = parts[1]; - } else { - warning('Context argument is not an assignment (key=value): %s', assignment); - } - } - return context; - } - - /** - * Parse tags out of arguments - * - * Return undefined if no tags were provided, return an empty array if only empty - * strings were provided - */ - private static parseStringTagsListToObject(argTags: string[] | undefined): Tag[] | undefined { - if (argTags === undefined) { return undefined; } - if (argTags.length === 0) { return undefined; } - const nonEmptyTags = argTags.filter(t => t !== ''); - if (nonEmptyTags.length === 0) { return []; } - - const tags: Tag[] = []; - - for (const assignment of nonEmptyTags) { - const parts = assignment.split(/=(.*)/, 2); - if (parts.length === 2) { - debug('CLI argument tags: %s=%s', parts[0], parts[1]); - tags.push({ - Key: parts[0], - Value: parts[1], - }); - } else { - warning('Tags argument is not an assignment (key=value): %s', assignment); - } - } - return tags.length > 0 ? tags : undefined; - } - - constructor(private settings: SettingsMap = {}, public readonly readOnly = false) {} - - public async load(fileName: string): Promise { - if (this.readOnly) { - throw new ToolkitError(`Can't load ${fileName}: settings object is readonly`); - } - this.settings = {}; - - const expanded = expandHomeDir(fileName); - if (await fs.pathExists(expanded)) { - this.settings = await fs.readJson(expanded); - } - - // See https://github.com/aws/aws-cdk/issues/59 - this.prohibitContextKey('default-account', fileName); - this.prohibitContextKey('default-region', fileName); - this.warnAboutContextKey('aws:', fileName); - - return this; - } - - public async save(fileName: string): Promise { - const expanded = expandHomeDir(fileName); - await fs.writeJson(expanded, stripTransientValues(this.settings), { spaces: 2 }); - return this; - } - - public get all(): any { - return this.get([]); - } - - public merge(other: Settings): Settings { - return new Settings(util.deepMerge(this.settings, other.settings)); - } - - public subSettings(keyPrefix: string[]) { - return new Settings(this.get(keyPrefix) || {}, false); - } - - public makeReadOnly(): Settings { - return new Settings(this.settings, true); - } - - public clear() { - if (this.readOnly) { - throw new ToolkitError('Cannot clear(): settings are readonly'); - } - this.settings = {}; - } - - public get empty(): boolean { - return Object.keys(this.settings).length === 0; - } - - public get(path: string[]): any { - return util.deepClone(util.deepGet(this.settings, path)); - } - - public set(path: string[], value: any): Settings { - if (this.readOnly) { - throw new ToolkitError(`Can't set ${path}: settings object is readonly`); - } - if (path.length === 0) { - // deepSet can't handle this case - this.settings = value; - } else { - util.deepSet(this.settings, path, value); - } - return this; - } - - public unset(path: string[]) { - this.set(path, undefined); - } - - private prohibitContextKey(key: string, fileName: string) { - if (!this.settings.context) { return; } - if (key in this.settings.context) { - // eslint-disable-next-line max-len - throw new ToolkitError(`The 'context.${key}' key was found in ${fs_path.resolve(fileName)}, but it is no longer supported. Please remove it.`); - } - } - - private warnAboutContextKey(prefix: string, fileName: string) { - if (!this.settings.context) { return; } - for (const contextKey of Object.keys(this.settings.context)) { - if (contextKey.startsWith(prefix)) { - // eslint-disable-next-line max-len - warning(`A reserved context key ('context.${prefix}') key was found in ${fs_path.resolve(fileName)}, it might cause surprising behavior and should be removed.`); - } - } - } -} - -function expandHomeDir(x: string) { - if (x.startsWith('~')) { - return fs_path.join(os.homedir(), x.slice(1)); - } - return x; -} - -/** - * Return all context value that are not transient context values - */ -function stripTransientValues(obj: {[key: string]: any}) { - const ret: any = {}; - for (const [key, value] of Object.entries(obj)) { - if (!isTransientValue(value)) { - ret[key] = value; - } - } - return ret; -} - -/** - * Return whether the given value is a transient context value - * - * Values that are objects with a magic key set to a truthy value are considered transient. - */ -function isTransientValue(value: any) { - return typeof value === 'object' && value !== null && (value as any)[TRANSIENT_CONTEXT_KEY]; -} - -function expectStringList(x: unknown): string[] | undefined { - if (x === undefined) { return undefined; } - if (!Array.isArray(x)) { - throw new ToolkitError(`Expected array, got '${x}'`); - } - const nonStrings = x.filter(e => typeof e !== 'string'); - if (nonStrings.length > 0) { - throw new ToolkitError(`Expected list of strings, found ${nonStrings}`); - } - return x; -} diff --git a/packages/aws-cdk/scripts/user-input-gen.ts b/packages/aws-cdk/scripts/user-input-gen.ts index 3ef7e03204165..a446b3eea571a 100644 --- a/packages/aws-cdk/scripts/user-input-gen.ts +++ b/packages/aws-cdk/scripts/user-input-gen.ts @@ -1,13 +1,13 @@ import * as fs from 'fs'; // eslint-disable-next-line import/no-extraneous-dependencies import { renderYargs, renderUserInputType, renderUserInputFuncs } from '@aws-cdk/user-input-gen'; -import { makeConfig, YARGS_HELPERS } from '../lib/config'; +import { makeConfig, YARGS_HELPERS } from '../lib/cli/cli-config'; async function main() { const config = await makeConfig(); - fs.writeFileSync('./lib/parse-command-line-arguments.ts', await renderYargs(config, YARGS_HELPERS)); - fs.writeFileSync('./lib/user-input.ts', await renderUserInputType(config)); - fs.writeFileSync('./lib/convert-to-user-input.ts', await renderUserInputFuncs(config)); + fs.writeFileSync('./lib/cli/parse-command-line-arguments.ts', await renderYargs(config, YARGS_HELPERS)); + fs.writeFileSync('./lib/cli/user-input.ts', await renderUserInputType(config)); + fs.writeFileSync('./lib/cli/convert-to-user-input.ts', await renderUserInputFuncs(config)); } main().then(() => { diff --git a/packages/aws-cdk/test/account-cache.test.ts b/packages/aws-cdk/test/api/aws-auth/account-cache.test.ts similarity index 97% rename from packages/aws-cdk/test/account-cache.test.ts rename to packages/aws-cdk/test/api/aws-auth/account-cache.test.ts index 5c338fd42e3e1..6c3d1591a9e2f 100644 --- a/packages/aws-cdk/test/account-cache.test.ts +++ b/packages/aws-cdk/test/api/aws-auth/account-cache.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import * as fs from 'fs-extra'; -import { withMocked } from './util'; -import { AccountAccessKeyCache } from '../lib/api/aws-auth/account-cache'; +import { AccountAccessKeyCache } from '../../../lib/api/aws-auth/account-cache'; +import { withMocked } from '../../util'; async function makeCache() { const dir = await fs.mkdtemp('/tmp/account-cache-test'); diff --git a/packages/aws-cdk/test/api/environment-resources.test.ts b/packages/aws-cdk/test/api/environment-resources.test.ts index aa29b750afb10..95dba3f8c4339 100644 --- a/packages/aws-cdk/test/api/environment-resources.test.ts +++ b/packages/aws-cdk/test/api/environment-resources.test.ts @@ -1,9 +1,9 @@ import { GetParameterCommand } from '@aws-sdk/client-ssm'; import { ToolkitInfo } from '../../lib/api'; +import { Context } from '../../lib/api/context'; import { EnvironmentResourcesRegistry } from '../../lib/api/environment-resources'; +import * as version from '../../lib/cli/version'; import { CachedDataSource, Notices, NoticesFilter } from '../../lib/notices'; -import { Context } from '../../lib/settings'; -import * as version from '../../lib/version'; import { MockSdk, mockBootstrapStack, mockSSMClient } from '../util/mock-sdk'; import { MockToolkitInfo } from '../util/mock-toolkitinfo'; diff --git a/packages/aws-cdk/test/api/exec.test.ts b/packages/aws-cdk/test/api/exec.test.ts index dfbb8920125e8..7c5241fd79bfc 100644 --- a/packages/aws-cdk/test/api/exec.test.ts +++ b/packages/aws-cdk/test/api/exec.test.ts @@ -7,7 +7,7 @@ import * as semver from 'semver'; import * as sinon from 'sinon'; import { ImportMock } from 'ts-mock-imports'; import { execProgram } from '../../lib/api/cxapp/exec'; -import { Configuration } from '../../lib/settings'; +import { Configuration } from '../../lib/cli/user-configuration'; import { testAssembly } from '../util'; import { mockSpawn } from '../util/mock-child_process'; import { MockSdkProvider } from '../util/mock-sdk'; diff --git a/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts index f5eaf4f3be4d9..f80efa3855757 100644 --- a/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts @@ -1,7 +1,7 @@ import { DescribeServicesCommand, RegisterTaskDefinitionCommand, UpdateServiceCommand } from '@aws-sdk/client-ecs'; import * as setup from './hotswap-test-setup'; import { EcsHotswapProperties, HotswapMode, HotswapPropertyOverrides } from '../../../lib/api/hotswap/common'; -import { Configuration } from '../../../lib/settings'; +import { Configuration } from '../../../lib/cli/user-configuration'; import { mockECSClient } from '../../util/mock-sdk'; import { silentTest } from '../../util/silent'; diff --git a/packages/aws-cdk/test/api/settings.test.ts b/packages/aws-cdk/test/api/settings.test.ts new file mode 100644 index 0000000000000..361a0934aa92e --- /dev/null +++ b/packages/aws-cdk/test/api/settings.test.ts @@ -0,0 +1,63 @@ +/* eslint-disable import/order */ +import { Context } from '../../lib/api/context'; +import { Settings } from '../../lib/api/settings'; + +test('can delete values from Context object', () => { + // GIVEN + const settings1 = new Settings({ foo: 'bar' }); + const settings2 = new Settings({ boo: 'baz' }); + const context = new Context({ bag: settings1 }, { bag: settings2 }); + + // WHEN + context.unset('foo'); + + // THEN + expect(context.all).toEqual({ boo: 'baz' }); + expect(settings1.all).toEqual({}); + expect(settings2.all).toEqual({ boo: 'baz' }); +}); + +test('can set values in Context object', () => { + // GIVEN + const settings1 = new Settings(); + const settings2 = new Settings(); + const context = new Context({ bag: settings1 }, { bag: settings2 }); + + // WHEN + context.set('foo', 'bar'); + + // THEN + expect(context.all).toEqual({ foo: 'bar' }); + expect(settings1.all).toEqual({ foo: 'bar' }); + expect(settings2.all).toEqual({}); +}); + +test('can set values in Context object if first is immutable', () => { + // GIVEN + const settings1 = new Settings(); + const settings2 = new Settings(); + const context = new Context({ bag: settings1.makeReadOnly() }, { bag: settings2 }); + + // WHEN + context.set('foo', 'bar'); + + // THEN + expect(context.all).toEqual({ foo: 'bar' }); + expect(settings1.all).toEqual({ }); + expect(settings2.all).toEqual({ foo: 'bar' }); +}); + +test('can clear all values in all objects', () => { + // GIVEN + const settings1 = new Settings({ foo: 'bar' }); + const settings2 = new Settings({ foo: 'snar', boo: 'gar' }); + const context = new Context({ bag: settings1 }, { bag: settings2 }); + + // WHEN + context.clear(); + + // THEN + expect(context.all).toEqual({}); + expect(settings1.all).toEqual({ }); + expect(settings2.all).toEqual({}); +}); diff --git a/packages/aws-cdk/test/bootstrap.test.ts b/packages/aws-cdk/test/bootstrap.test.ts index 842d1235a2555..9fb3a474e2f9a 100644 --- a/packages/aws-cdk/test/bootstrap.test.ts +++ b/packages/aws-cdk/test/bootstrap.test.ts @@ -1,5 +1,5 @@ import { Bootstrapper } from '../lib/api/bootstrap/bootstrap-environment'; -import { exec } from '../lib/cli'; +import { exec } from '../lib/cli/cli'; beforeEach(() => { jest.clearAllMocks(); diff --git a/packages/aws-cdk/test/cdk-toolkit.test.ts b/packages/aws-cdk/test/cli/cdk-toolkit.test.ts similarity index 98% rename from packages/aws-cdk/test/cdk-toolkit.test.ts rename to packages/aws-cdk/test/cli/cdk-toolkit.test.ts index 79a15ec826230..60ab842031dec 100644 --- a/packages/aws-cdk/test/cdk-toolkit.test.ts +++ b/packages/aws-cdk/test/cli/cdk-toolkit.test.ts @@ -51,8 +51,8 @@ const fakeChokidarWatch = { }; const mockData = jest.fn(); -jest.mock('../lib/logging', () => ({ - ...jest.requireActual('../lib/logging'), +jest.mock('../../lib/logging', () => ({ + ...jest.requireActual('../../lib/logging'), data: mockData, })); jest.setTimeout(30_000); @@ -67,16 +67,8 @@ import { DescribeStacksCommand, GetTemplateCommand, StackStatus } from '@aws-sdk import { GetParameterCommand } from '@aws-sdk/client-ssm'; import * as fs from 'fs-extra'; import * as promptly from 'promptly'; -import { instanceMockFrom, MockCloudExecutable, TestStackArtifact } from './util'; -import { SdkProvider } from '../lib/api'; -import { - mockCloudFormationClient, - MockSdk, - MockSdkProvider, - mockSSMClient, - restoreSdkMocksToDefault, -} from './util/mock-sdk'; -import { Bootstrapper, type BootstrapSource } from '../lib/api/bootstrap'; +import { SdkProvider } from '../../lib/api'; +import { Bootstrapper, type BootstrapSource } from '../../lib/api/bootstrap'; import { DeployStackResult, SuccessfulDeployStackResult, @@ -86,15 +78,23 @@ import { DestroyStackOptions, RollbackStackOptions, RollbackStackResult, -} from '../lib/api/deployments'; -import { HotswapMode } from '../lib/api/hotswap/common'; -import { Mode } from '../lib/api/plugin'; -import { CdkToolkit, markTesting } from '../lib/cdk-toolkit'; -import { RequireApproval } from '../lib/diff'; -import { Configuration } from '../lib/settings'; -import { Tag } from '../lib/tags'; -import { CliIoHost } from '../lib/toolkit/cli-io-host'; -import { flatten } from '../lib/util'; +} from '../../lib/api/deployments'; +import { HotswapMode } from '../../lib/api/hotswap/common'; +import { Mode } from '../../lib/api/plugin'; +import { Tag } from '../../lib/api/tags'; +import { CdkToolkit, markTesting } from '../../lib/cli/cdk-toolkit'; +import { Configuration } from '../../lib/cli/user-configuration'; +import { RequireApproval } from '../../lib/diff'; +import { CliIoHost } from '../../lib/toolkit/cli-io-host'; +import { flatten } from '../../lib/util'; +import { instanceMockFrom, MockCloudExecutable, TestStackArtifact } from '../util'; +import { + mockCloudFormationClient, + MockSdk, + MockSdkProvider, + mockSSMClient, + restoreSdkMocksToDefault, +} from '../util/mock-sdk'; markTesting(); @@ -1223,7 +1223,7 @@ describe('synth', () => { }); describe('migrate', () => { - const testResourcePath = [__dirname, 'commands', 'test-resources']; + const testResourcePath = [__dirname, '..', 'commands', 'test-resources']; const templatePath = [...testResourcePath, 'templates']; const sqsTemplatePath = path.join(...templatePath, 'sqs-template.json'); const autoscalingTemplatePath = path.join(...templatePath, 'autoscaling-template.yml'); @@ -1287,7 +1287,7 @@ describe('synth', () => { await expect(() => toolkit.migrate({ stackName: 'cannot-generate-template', - fromPath: path.join(__dirname, 'commands', 'test-resources', 'templates', 'sqs-template.json'), + fromPath: sqsTemplatePath, language: 'rust', }), ).rejects.toThrow( diff --git a/packages/aws-cdk/test/cli-arguments.test.ts b/packages/aws-cdk/test/cli/cli-arguments.test.ts similarity index 96% rename from packages/aws-cdk/test/cli-arguments.test.ts rename to packages/aws-cdk/test/cli/cli-arguments.test.ts index 4158e6569fa80..0f62282a2e364 100644 --- a/packages/aws-cdk/test/cli-arguments.test.ts +++ b/packages/aws-cdk/test/cli/cli-arguments.test.ts @@ -1,5 +1,5 @@ -import { convertConfigToUserInput, convertYargsToUserInput } from '../lib/convert-to-user-input'; -import { parseCommandLineArguments } from '../lib/parse-command-line-arguments'; +import { convertConfigToUserInput, convertYargsToUserInput } from '../../lib/cli/convert-to-user-input'; +import { parseCommandLineArguments } from '../../lib/cli/parse-command-line-arguments'; describe('yargs', () => { test('yargs object can be converted to cli arguments', async () => { diff --git a/packages/aws-cdk/test/cli.test.ts b/packages/aws-cdk/test/cli/cli.test.ts similarity index 82% rename from packages/aws-cdk/test/cli.test.ts rename to packages/aws-cdk/test/cli/cli.test.ts index b905de2a4221b..c430613d97878 100644 --- a/packages/aws-cdk/test/cli.test.ts +++ b/packages/aws-cdk/test/cli/cli.test.ts @@ -1,11 +1,11 @@ -import { exec } from '../lib/cli'; -import { CliIoHost } from '../lib/toolkit/cli-io-host'; +import { exec } from '../../lib/cli/cli'; +import { CliIoHost } from '../../lib/toolkit/cli-io-host'; // Store original version module exports so we don't conflict with other tests -const originalVersion = jest.requireActual('../lib/version'); +const originalVersion = jest.requireActual('../../lib/cli/version'); // Mock the dependencies -jest.mock('../lib/logging', () => ({ +jest.mock('../../lib/logging', () => ({ debug: jest.fn(), error: jest.fn(), print: jest.fn(), @@ -14,11 +14,11 @@ jest.mock('../lib/logging', () => ({ jest.mock('@aws-cdk/cx-api'); jest.mock('@jsii/check-node/run'); -jest.mock('../lib/platform-warnings', () => ({ +jest.mock('../../lib/cli/platform-warnings', () => ({ checkForPlatformWarnings: jest.fn().mockResolvedValue(undefined), })); -jest.mock('../lib/settings', () => ({ +jest.mock('../../lib/cli/user-configuration', () => ({ Configuration: jest.fn().mockImplementation(() => ({ load: jest.fn().mockResolvedValue(undefined), settings: { @@ -30,7 +30,7 @@ jest.mock('../lib/settings', () => ({ })), })); -jest.mock('../lib/notices', () => ({ +jest.mock('../../lib/notices', () => ({ Notices: { create: jest.fn().mockReturnValue({ refresh: jest.fn().mockResolvedValue(undefined), @@ -39,7 +39,7 @@ jest.mock('../lib/notices', () => ({ }, })); -jest.mock('../lib/parse-command-line-arguments', () => ({ +jest.mock('../../lib/cli/parse-command-line-arguments', () => ({ parseCommandLineArguments: jest.fn().mockImplementation((args) => Promise.resolve({ _: ['version'], verbose: args.includes('-v') ? ( @@ -54,7 +54,7 @@ describe('exec verbose flag tests', () => { beforeEach(() => { jest.clearAllMocks(); // Set up version module for our tests - jest.mock('../lib/version', () => ({ + jest.mock('../../lib/cli/version', () => ({ ...originalVersion, DISPLAY_VERSION: 'test-version', displayVersionMessage: jest.fn().mockResolvedValue(undefined), @@ -64,7 +64,7 @@ describe('exec verbose flag tests', () => { afterEach(() => { // Restore the version module to its original state jest.resetModules(); - jest.setMock('../lib/version', originalVersion); + jest.setMock('../../lib/cli/version', originalVersion); }); test('should not set log level when no verbose flag is present', async () => { diff --git a/packages/aws-cdk/test/cli/configuration.test.ts b/packages/aws-cdk/test/cli/configuration.test.ts new file mode 100644 index 0000000000000..3e8c0b36180e9 --- /dev/null +++ b/packages/aws-cdk/test/cli/configuration.test.ts @@ -0,0 +1,118 @@ +import type { Tag } from '../../lib/api/tags'; +import { Command, commandLineArgumentsToSettings } from '../../lib/cli/user-configuration'; + +test('can parse string context from command line arguments', () => { + // GIVEN + const settings1 = commandLineArgumentsToSettings({ context: ['foo=bar'], _: [Command.DEPLOY] }); + const settings2 = commandLineArgumentsToSettings({ context: ['foo='], _: [Command.DEPLOY] }); + + // THEN + expect(settings1.get(['context']).foo).toEqual( 'bar'); + expect(settings2.get(['context']).foo).toEqual( ''); +}); + +test('can parse string context from command line arguments with equals sign in value', () => { + // GIVEN + const settings1 = commandLineArgumentsToSettings({ context: ['foo==bar='], _: [Command.DEPLOY] }); + const settings2 = commandLineArgumentsToSettings({ context: ['foo=bar='], _: [Command.DEPLOY] }); + + // THEN + expect(settings1.get(['context']).foo).toEqual( '=bar='); + expect(settings2.get(['context']).foo).toEqual( 'bar='); +}); + +test('can parse tag values from command line arguments', () => { + // GIVEN + const settings1 = commandLineArgumentsToSettings({ tags: ['foo=bar'], _: [Command.DEPLOY] }); + const settings2 = commandLineArgumentsToSettings({ tags: ['foo='], _: [Command.DEPLOY] }); + + // THEN + expect(settings1.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('bar'); + expect(settings2.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual(''); +}); + +test('can parse tag values from command line arguments with equals sign in value', () => { + // GIVEN + const settings1 = commandLineArgumentsToSettings({ tags: ['foo==bar='], _: [Command.DEPLOY] }); + const settings2 = commandLineArgumentsToSettings({ tags: ['foo=bar='], _: [Command.DEPLOY] }); + + // THEN + expect(settings1.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('=bar='); + expect(settings2.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('bar='); +}); + +test('bundling stacks defaults to an empty list', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.LIST], + }); + + // THEN + expect(settings.get(['bundlingStacks'])).toEqual([]); +}); + +test('bundling stacks defaults to ** for deploy', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.DEPLOY], + }); + + // THEN + expect(settings.get(['bundlingStacks'])).toEqual(['**']); +}); + +test('bundling stacks defaults to ** for watch', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.WATCH], + }); + + // THEN + expect(settings.get(['bundlingStacks'])).toEqual(['**']); +}); + +test('bundling stacks with deploy exclusively', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.DEPLOY], + exclusively: true, + STACKS: ['cool-stack'], + }); + + // THEN + expect(settings.get(['bundlingStacks'])).toEqual(['cool-stack']); +}); + +test('bundling stacks with watch exclusively', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.WATCH], + exclusively: true, + STACKS: ['cool-stack'], + }); + + // THEN + expect(settings.get(['bundlingStacks'])).toEqual(['cool-stack']); +}); + +test('should include outputs-file in settings', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.DEPLOY], + outputsFile: 'my-outputs-file.json', + }); + + // THEN + expect(settings.get(['outputsFile'])).toEqual('my-outputs-file.json'); +}); + +test('providing a build arg', () => { + // GIVEN + const settings = commandLineArgumentsToSettings({ + _: [Command.SYNTH], + build: 'mvn package', + }); + + // THEN + expect(settings.get(['build'])).toEqual('mvn package'); +}); diff --git a/packages/aws-cdk/test/parse-command-line-arguments.test.ts b/packages/aws-cdk/test/cli/parse-command-line-arguments.test.ts similarity index 92% rename from packages/aws-cdk/test/parse-command-line-arguments.test.ts rename to packages/aws-cdk/test/cli/parse-command-line-arguments.test.ts index 485536a7c28df..05b8f326ec86e 100644 --- a/packages/aws-cdk/test/parse-command-line-arguments.test.ts +++ b/packages/aws-cdk/test/cli/parse-command-line-arguments.test.ts @@ -1,4 +1,4 @@ -import { parseCommandLineArguments } from '../lib/parse-command-line-arguments'; +import { parseCommandLineArguments } from '../../lib/cli/parse-command-line-arguments'; test('cdk deploy -R sets rollback to false', async () => { const argv = await parseCommandLineArguments(['deploy', '-R']); diff --git a/packages/aws-cdk/test/platform-warnings.test.ts b/packages/aws-cdk/test/cli/platform-warnings.test.ts similarity index 83% rename from packages/aws-cdk/test/platform-warnings.test.ts rename to packages/aws-cdk/test/cli/platform-warnings.test.ts index 8299e46441904..8f38cf02d42c6 100644 --- a/packages/aws-cdk/test/platform-warnings.test.ts +++ b/packages/aws-cdk/test/cli/platform-warnings.test.ts @@ -1,5 +1,5 @@ /* eslint-disable import/order */ -import { isVersionBetween } from '../lib/platform-warnings'; +import { isVersionBetween } from '../../lib/cli/platform-warnings'; test.each([ ['2.1', false], diff --git a/packages/aws-cdk/test/usersettings.test.ts b/packages/aws-cdk/test/cli/user-config.test.ts similarity index 98% rename from packages/aws-cdk/test/usersettings.test.ts rename to packages/aws-cdk/test/cli/user-config.test.ts index 6f5e0fb4fb642..7956c6bb1457c 100644 --- a/packages/aws-cdk/test/usersettings.test.ts +++ b/packages/aws-cdk/test/cli/user-config.test.ts @@ -2,7 +2,7 @@ import * as os from 'os'; import * as fs_path from 'path'; import * as fs from 'fs-extra'; -import { Configuration, PROJECT_CONFIG, PROJECT_CONTEXT } from '../lib/settings'; +import { Configuration, PROJECT_CONFIG, PROJECT_CONTEXT } from '../../lib/cli/user-configuration'; // mock fs deeply jest.mock('fs-extra'); diff --git a/packages/aws-cdk/test/context.test.ts b/packages/aws-cdk/test/cli/user-context.test.ts similarity index 95% rename from packages/aws-cdk/test/context.test.ts rename to packages/aws-cdk/test/cli/user-context.test.ts index 5f2c766146089..4bf8d006776f2 100644 --- a/packages/aws-cdk/test/context.test.ts +++ b/packages/aws-cdk/test/cli/user-context.test.ts @@ -2,7 +2,9 @@ import * as os from 'os'; import * as path from 'path'; import * as fs from 'fs-extra'; -import { Configuration, Context, PROJECT_CONFIG, PROJECT_CONTEXT, Settings, TRANSIENT_CONTEXT_KEY } from '../lib/settings'; +import { Configuration, PROJECT_CONFIG, PROJECT_CONTEXT } from '../../lib/cli/user-configuration'; +import { Context, TRANSIENT_CONTEXT_KEY } from '../../lib/api/context'; +import { Settings } from '../../lib/api/settings'; const state: { previousWorkingDir?: string; diff --git a/packages/aws-cdk/test/version.test.ts b/packages/aws-cdk/test/cli/version.test.ts similarity index 97% rename from packages/aws-cdk/test/version.test.ts rename to packages/aws-cdk/test/cli/version.test.ts index c0242d779ef48..c34a3af9aaac2 100644 --- a/packages/aws-cdk/test/version.test.ts +++ b/packages/aws-cdk/test/cli/version.test.ts @@ -5,9 +5,9 @@ import { promisify } from 'util'; import * as fs from 'fs-extra'; import * as os from 'os'; import * as sinon from 'sinon'; -import * as logging from '../lib/logging'; -import * as npm from '../lib/util/npm'; -import { latestVersionIfHigher, VersionCheckTTL, displayVersionMessage, isDeveloperBuild } from '../lib/version'; +import * as logging from '../../lib/logging'; +import * as npm from '../../lib/cli/util/npm'; +import { latestVersionIfHigher, VersionCheckTTL, displayVersionMessage, isDeveloperBuild } from '../../lib/cli/version'; jest.setTimeout(10_000); diff --git a/packages/aws-cdk/test/commands/context-command.test.ts b/packages/aws-cdk/test/commands/context-command.test.ts index 988076b7c1d1c..45e29b6a1d770 100644 --- a/packages/aws-cdk/test/commands/context-command.test.ts +++ b/packages/aws-cdk/test/commands/context-command.test.ts @@ -1,6 +1,8 @@ /* eslint-disable import/order */ import { contextHandler } from '../../lib/commands/context'; -import { Configuration, Settings, Context } from '../../lib/settings'; +import { Settings } from '../../lib/api/settings'; +import { Context } from '../../lib/api/context'; +import { Configuration } from '../../lib/cli/user-configuration'; describe('context --list', () => { test('runs', async() => { diff --git a/packages/aws-cdk/test/context-providers/generic.test.ts b/packages/aws-cdk/test/context-providers/generic.test.ts index ade5fd224c478..60a4ee690ed93 100644 --- a/packages/aws-cdk/test/context-providers/generic.test.ts +++ b/packages/aws-cdk/test/context-providers/generic.test.ts @@ -1,7 +1,7 @@ /* eslint-disable import/order */ import { PluginHost } from '../../lib/api/plugin'; import * as contextproviders from '../../lib/context-providers'; -import { Context, TRANSIENT_CONTEXT_KEY } from '../../lib/settings'; +import { Context, TRANSIENT_CONTEXT_KEY } from '../../lib/api/context'; import { MockSdkProvider, setDefaultSTSMocks } from '../util/mock-sdk'; const mockSDK = new MockSdkProvider(); diff --git a/packages/aws-cdk/test/diff.test.ts b/packages/aws-cdk/test/diff.test.ts index 24de9d0a551dc..9c0819440d57e 100644 --- a/packages/aws-cdk/test/diff.test.ts +++ b/packages/aws-cdk/test/diff.test.ts @@ -9,7 +9,7 @@ import { DescribeChangeSetCommandOutput } from '@aws-sdk/client-cloudformation'; import { instanceMockFrom, MockCloudExecutable } from './util'; import { Deployments, PrepareChangeSetOptions, type NestedStackTemplates } from '../lib/api/deployments'; import * as cfn from '../lib/api/deployments/cloudformation'; -import { CdkToolkit } from '../lib/cdk-toolkit'; +import { CdkToolkit } from '../lib/cli/cdk-toolkit'; let cloudExecutable: MockCloudExecutable; let cloudFormation: jest.Mocked; diff --git a/packages/aws-cdk/test/list-stacks.test.ts b/packages/aws-cdk/test/list-stacks.test.ts index c6788df91670b..0d607b5d8343a 100644 --- a/packages/aws-cdk/test/list-stacks.test.ts +++ b/packages/aws-cdk/test/list-stacks.test.ts @@ -2,7 +2,7 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema';; import { instanceMockFrom, MockCloudExecutable, TestStackArtifact } from './util'; import { Bootstrapper } from '../lib/api/bootstrap'; import { Deployments } from '../lib/api/deployments'; -import { CdkToolkit } from '../lib/cdk-toolkit'; +import { CdkToolkit } from '../lib/cli/cdk-toolkit'; import { listStacks } from '../lib/list-stacks'; describe('list', () => { diff --git a/packages/aws-cdk/test/notices.test.ts b/packages/aws-cdk/test/notices.test.ts index f082091c5ae31..763973185256c 100644 --- a/packages/aws-cdk/test/notices.test.ts +++ b/packages/aws-cdk/test/notices.test.ts @@ -14,8 +14,9 @@ import { WebsiteNoticeDataSource, BootstrappedEnvironment, } from '../lib/notices'; -import * as version from '../lib/version'; -import { Context, Settings } from '../lib/settings'; +import * as version from '../lib/cli/version'; +import { Settings } from '../lib/api/settings'; +import { Context } from '../lib/api/context'; const BASIC_BOOTSTRAP_NOTICE = { title: 'Exccessive permissions on file asset publishing role', diff --git a/packages/aws-cdk/test/settings.test.ts b/packages/aws-cdk/test/settings.test.ts deleted file mode 100644 index 4e2053e8e2848..0000000000000 --- a/packages/aws-cdk/test/settings.test.ts +++ /dev/null @@ -1,179 +0,0 @@ -/* eslint-disable import/order */ -import { Command, Context, Settings } from '../lib/settings'; -import { Tag } from '../lib/tags'; - -test('can delete values from Context object', () => { - // GIVEN - const settings1 = new Settings({ foo: 'bar' }); - const settings2 = new Settings({ boo: 'baz' }); - const context = new Context({ bag: settings1 }, { bag: settings2 }); - - // WHEN - context.unset('foo'); - - // THEN - expect(context.all).toEqual({ boo: 'baz' }); - expect(settings1.all).toEqual({}); - expect(settings2.all).toEqual({ boo: 'baz' }); -}); - -test('can set values in Context object', () => { - // GIVEN - const settings1 = new Settings(); - const settings2 = new Settings(); - const context = new Context({ bag: settings1 }, { bag: settings2 }); - - // WHEN - context.set('foo', 'bar'); - - // THEN - expect(context.all).toEqual({ foo: 'bar' }); - expect(settings1.all).toEqual({ foo: 'bar' }); - expect(settings2.all).toEqual({}); -}); - -test('can set values in Context object if first is immutable', () => { - // GIVEN - const settings1 = new Settings(); - const settings2 = new Settings(); - const context = new Context({ bag: settings1.makeReadOnly() }, { bag: settings2 }); - - // WHEN - context.set('foo', 'bar'); - - // THEN - expect(context.all).toEqual({ foo: 'bar' }); - expect(settings1.all).toEqual({ }); - expect(settings2.all).toEqual({ foo: 'bar' }); -}); - -test('can clear all values in all objects', () => { - // GIVEN - const settings1 = new Settings({ foo: 'bar' }); - const settings2 = new Settings({ foo: 'snar', boo: 'gar' }); - const context = new Context({ bag: settings1 }, { bag: settings2 }); - - // WHEN - context.clear(); - - // THEN - expect(context.all).toEqual({}); - expect(settings1.all).toEqual({ }); - expect(settings2.all).toEqual({}); -}); - -test('can parse string context from command line arguments', () => { - // GIVEN - const settings1 = Settings.fromCommandLineArguments({ context: ['foo=bar'], _: [Command.DEPLOY] }); - const settings2 = Settings.fromCommandLineArguments({ context: ['foo='], _: [Command.DEPLOY] }); - - // THEN - expect(settings1.get(['context']).foo).toEqual( 'bar'); - expect(settings2.get(['context']).foo).toEqual( ''); -}); - -test('can parse string context from command line arguments with equals sign in value', () => { - // GIVEN - const settings1 = Settings.fromCommandLineArguments({ context: ['foo==bar='], _: [Command.DEPLOY] }); - const settings2 = Settings.fromCommandLineArguments({ context: ['foo=bar='], _: [Command.DEPLOY] }); - - // THEN - expect(settings1.get(['context']).foo).toEqual( '=bar='); - expect(settings2.get(['context']).foo).toEqual( 'bar='); -}); - -test('can parse tag values from command line arguments', () => { - // GIVEN - const settings1 = Settings.fromCommandLineArguments({ tags: ['foo=bar'], _: [Command.DEPLOY] }); - const settings2 = Settings.fromCommandLineArguments({ tags: ['foo='], _: [Command.DEPLOY] }); - - // THEN - expect(settings1.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('bar'); - expect(settings2.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual(''); -}); - -test('can parse tag values from command line arguments with equals sign in value', () => { - // GIVEN - const settings1 = Settings.fromCommandLineArguments({ tags: ['foo==bar='], _: [Command.DEPLOY] }); - const settings2 = Settings.fromCommandLineArguments({ tags: ['foo=bar='], _: [Command.DEPLOY] }); - - // THEN - expect(settings1.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('=bar='); - expect(settings2.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('bar='); -}); - -test('bundling stacks defaults to an empty list', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.LIST], - }); - - // THEN - expect(settings.get(['bundlingStacks'])).toEqual([]); -}); - -test('bundling stacks defaults to ** for deploy', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.DEPLOY], - }); - - // THEN - expect(settings.get(['bundlingStacks'])).toEqual(['**']); -}); - -test('bundling stacks defaults to ** for watch', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.WATCH], - }); - - // THEN - expect(settings.get(['bundlingStacks'])).toEqual(['**']); -}); - -test('bundling stacks with deploy exclusively', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.DEPLOY], - exclusively: true, - STACKS: ['cool-stack'], - }); - - // THEN - expect(settings.get(['bundlingStacks'])).toEqual(['cool-stack']); -}); - -test('bundling stacks with watch exclusively', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.WATCH], - exclusively: true, - STACKS: ['cool-stack'], - }); - - // THEN - expect(settings.get(['bundlingStacks'])).toEqual(['cool-stack']); -}); - -test('should include outputs-file in settings', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.DEPLOY], - outputsFile: 'my-outputs-file.json', - }); - - // THEN - expect(settings.get(['outputsFile'])).toEqual('my-outputs-file.json'); -}); - -test('providing a build arg', () => { - // GIVEN - const settings = Settings.fromCommandLineArguments({ - _: [Command.SYNTH], - build: 'mvn package', - }); - - // THEN - expect(settings.get(['build'])).toEqual('mvn package'); -}); diff --git a/packages/aws-cdk/test/toolkit-error.test.ts b/packages/aws-cdk/test/toolkit/toolkit-error.test.ts similarity index 97% rename from packages/aws-cdk/test/toolkit-error.test.ts rename to packages/aws-cdk/test/toolkit/toolkit-error.test.ts index b1ae00d43c76d..04a02050c5d1d 100644 --- a/packages/aws-cdk/test/toolkit-error.test.ts +++ b/packages/aws-cdk/test/toolkit/toolkit-error.test.ts @@ -1,4 +1,4 @@ -import { AssemblyError, AuthenticationError, ContextProviderError, ToolkitError } from '../lib/toolkit/error'; +import { AssemblyError, AuthenticationError, ContextProviderError, ToolkitError } from '../../lib/toolkit/error'; describe('toolkit error', () => { let toolkitError = new ToolkitError('Test toolkit error'); diff --git a/packages/aws-cdk/test/util.ts b/packages/aws-cdk/test/util.ts index 7df664dbade9f..b9552bf77d813 100644 --- a/packages/aws-cdk/test/util.ts +++ b/packages/aws-cdk/test/util.ts @@ -2,10 +2,10 @@ import * as fs from 'fs'; import * as path from 'path'; import { ArtifactMetadataEntryType, ArtifactType, type AssetManifest, type AssetMetadataEntry, type AwsCloudFormationStackProperties, type MetadataEntry, type MissingContext } from '@aws-cdk/cloud-assembly-schema'; import { type CloudAssembly, CloudAssemblyBuilder, type CloudFormationStackArtifact, type StackMetadata } from '@aws-cdk/cx-api'; +import { cxapiAssemblyWithForcedVersion } from './api/assembly-versions'; import { MockSdkProvider } from './util/mock-sdk'; import { CloudExecutable } from '../lib/api/cxapp/cloud-executable'; -import { Configuration } from '../lib/settings'; -import { cxapiAssemblyWithForcedVersion } from './api/assembly-versions'; +import { Configuration } from '../lib/cli/user-configuration'; export const DEFAULT_FAKE_TEMPLATE = { No: 'Resources' }; diff --git a/packages/aws-cdk/test/util/console-formatters.test.ts b/packages/aws-cdk/test/util/console-formatters.test.ts index b4b9457a43f13..7448707304a98 100644 --- a/packages/aws-cdk/test/util/console-formatters.test.ts +++ b/packages/aws-cdk/test/util/console-formatters.test.ts @@ -1,6 +1,6 @@ /* eslint-disable import/order */ import * as chalk from 'chalk'; -import { formatAsBanner } from '../../lib/util/console-formatters'; +import { formatAsBanner } from '../../lib/cli/util/console-formatters'; test('no banner on empty msg list', () => expect(formatAsBanner([])).toEqual([])); diff --git a/packages/aws-cdk/test/util/yargs-helpers.test.ts b/packages/aws-cdk/test/util/yargs-helpers.test.ts index 5ad8a17a62f78..3fe8fb1d6e5f0 100644 --- a/packages/aws-cdk/test/util/yargs-helpers.test.ts +++ b/packages/aws-cdk/test/util/yargs-helpers.test.ts @@ -1,4 +1,4 @@ -import { isCI } from '../../lib/util/yargs-helpers'; +import { isCI } from '../../lib/cli/util/yargs-helpers'; test.each([ ['true', true], diff --git a/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts b/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts index b348059eff33e..80ed9755a44f1 100644 --- a/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts +++ b/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts @@ -15,7 +15,7 @@ export async function renderUserInputFuncs(config: CliConfig): Promise { scope.documentation.push('Do not edit by hand; all changes will be overwritten at build time from the config file.'); scope.documentation.push('-------------------------------------------------------------------------------------------'); - scope.addImport(new SelectiveModuleImport(scope, './settings', ['Command'])); + scope.addImport(new SelectiveModuleImport(scope, './user-configuration', ['Command'])); scope.addImport(new SelectiveModuleImport(scope, './user-input', ['UserInput', 'GlobalOptions'])); const userInputType = Type.fromName(scope, 'UserInput'); diff --git a/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts b/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts index e6f97f90e8865..2401603c2cc0e 100644 --- a/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts +++ b/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts @@ -21,7 +21,7 @@ export async function renderUserInputType(config: CliConfig): Promise { }); // add required command - scope.addImport(new SelectiveModuleImport(scope, './settings', ['Command'])); + scope.addImport(new SelectiveModuleImport(scope, './user-configuration', ['Command'])); const commandEnum = Type.fromName(scope, 'Command'); userInputType.addProperty({