From 660570557ef50229647c51714244e8a867e1391b Mon Sep 17 00:00:00 2001 From: Allan Zheng Date: Mon, 12 Jul 2021 18:43:50 -0700 Subject: [PATCH] feat(clients): use inline nullish coalescing --- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-accessanalyzer/runtimeConfig.ts | 36 +++++++-------- .../client-acm-pca/runtimeConfig.browser.ts | 36 +++++++-------- .../client-acm-pca/runtimeConfig.native.ts | 3 +- .../client-acm-pca/runtimeConfig.shared.ts | 11 +++-- clients/client-acm-pca/runtimeConfig.ts | 36 +++++++-------- clients/client-acm/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-acm/runtimeConfig.native.ts | 3 +- clients/client-acm/runtimeConfig.shared.ts | 11 +++-- clients/client-acm/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- clients/client-amp/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-amp/runtimeConfig.native.ts | 3 +- clients/client-amp/runtimeConfig.shared.ts | 11 +++-- clients/client-amp/runtimeConfig.ts | 36 +++++++-------- .../client-amplify/runtimeConfig.browser.ts | 36 +++++++-------- .../client-amplify/runtimeConfig.native.ts | 3 +- .../client-amplify/runtimeConfig.shared.ts | 11 +++-- clients/client-amplify/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-amplifybackend/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-api-gateway/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-apigatewayv2/runtimeConfig.ts | 36 +++++++-------- .../client-app-mesh/runtimeConfig.browser.ts | 36 +++++++-------- .../client-app-mesh/runtimeConfig.native.ts | 3 +- .../client-app-mesh/runtimeConfig.shared.ts | 11 +++-- clients/client-app-mesh/runtimeConfig.ts | 36 +++++++-------- .../client-appconfig/runtimeConfig.browser.ts | 36 +++++++-------- .../client-appconfig/runtimeConfig.native.ts | 3 +- .../client-appconfig/runtimeConfig.shared.ts | 11 +++-- clients/client-appconfig/runtimeConfig.ts | 36 +++++++-------- .../client-appflow/runtimeConfig.browser.ts | 36 +++++++-------- .../client-appflow/runtimeConfig.native.ts | 3 +- .../client-appflow/runtimeConfig.shared.ts | 11 +++-- clients/client-appflow/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-appintegrations/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../client-apprunner/runtimeConfig.browser.ts | 36 +++++++-------- .../client-apprunner/runtimeConfig.native.ts | 3 +- .../client-apprunner/runtimeConfig.shared.ts | 11 +++-- clients/client-apprunner/runtimeConfig.ts | 36 +++++++-------- .../client-appstream/runtimeConfig.browser.ts | 36 +++++++-------- .../client-appstream/runtimeConfig.native.ts | 3 +- .../client-appstream/runtimeConfig.shared.ts | 11 +++-- clients/client-appstream/runtimeConfig.ts | 36 +++++++-------- .../client-appsync/runtimeConfig.browser.ts | 36 +++++++-------- .../client-appsync/runtimeConfig.native.ts | 3 +- .../client-appsync/runtimeConfig.shared.ts | 11 +++-- clients/client-appsync/runtimeConfig.ts | 36 +++++++-------- .../client-athena/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-athena/runtimeConfig.native.ts | 3 +- clients/client-athena/runtimeConfig.shared.ts | 11 +++-- clients/client-athena/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-auditmanager/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-auto-scaling/runtimeConfig.ts | 36 +++++++-------- .../client-backup/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-backup/runtimeConfig.native.ts | 3 +- clients/client-backup/runtimeConfig.shared.ts | 11 +++-- clients/client-backup/runtimeConfig.ts | 36 +++++++-------- clients/client-batch/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-batch/runtimeConfig.native.ts | 3 +- clients/client-batch/runtimeConfig.shared.ts | 11 +++-- clients/client-batch/runtimeConfig.ts | 36 +++++++-------- .../client-braket/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-braket/runtimeConfig.native.ts | 3 +- clients/client-braket/runtimeConfig.shared.ts | 11 +++-- clients/client-braket/runtimeConfig.ts | 36 +++++++-------- .../client-budgets/runtimeConfig.browser.ts | 36 +++++++-------- .../client-budgets/runtimeConfig.native.ts | 3 +- .../client-budgets/runtimeConfig.shared.ts | 11 +++-- clients/client-budgets/runtimeConfig.ts | 36 +++++++-------- clients/client-chime/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-chime/runtimeConfig.native.ts | 3 +- clients/client-chime/runtimeConfig.shared.ts | 11 +++-- clients/client-chime/runtimeConfig.ts | 36 +++++++-------- .../client-cloud9/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-cloud9/runtimeConfig.native.ts | 3 +- clients/client-cloud9/runtimeConfig.shared.ts | 11 +++-- clients/client-cloud9/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-clouddirectory/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-cloudformation/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-cloudfront/runtimeConfig.native.ts | 3 +- .../client-cloudfront/runtimeConfig.shared.ts | 11 +++-- clients/client-cloudfront/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-cloudhsm-v2/runtimeConfig.ts | 36 +++++++-------- .../client-cloudhsm/runtimeConfig.browser.ts | 36 +++++++-------- .../client-cloudhsm/runtimeConfig.native.ts | 3 +- .../client-cloudhsm/runtimeConfig.shared.ts | 11 +++-- clients/client-cloudhsm/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-cloudsearch/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-cloudtrail/runtimeConfig.native.ts | 3 +- .../client-cloudtrail/runtimeConfig.shared.ts | 11 +++-- clients/client-cloudtrail/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-cloudwatch-events/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-cloudwatch-logs/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-cloudwatch/runtimeConfig.native.ts | 3 +- .../client-cloudwatch/runtimeConfig.shared.ts | 11 +++-- clients/client-cloudwatch/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-codeartifact/runtimeConfig.ts | 36 +++++++-------- .../client-codebuild/runtimeConfig.browser.ts | 36 +++++++-------- .../client-codebuild/runtimeConfig.native.ts | 3 +- .../client-codebuild/runtimeConfig.shared.ts | 11 +++-- clients/client-codebuild/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-codecommit/runtimeConfig.native.ts | 3 +- .../client-codecommit/runtimeConfig.shared.ts | 11 +++-- clients/client-codecommit/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-codedeploy/runtimeConfig.native.ts | 3 +- .../client-codedeploy/runtimeConfig.shared.ts | 11 +++-- clients/client-codedeploy/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-codeguru-reviewer/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-codeguruprofiler/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-codepipeline/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../client-codestar/runtimeConfig.browser.ts | 36 +++++++-------- .../client-codestar/runtimeConfig.native.ts | 3 +- .../client-codestar/runtimeConfig.shared.ts | 11 +++-- clients/client-codestar/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-cognito-identity/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-cognito-sync/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-comprehend/runtimeConfig.native.ts | 3 +- .../client-comprehend/runtimeConfig.shared.ts | 11 +++-- clients/client-comprehend/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-comprehendmedical/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-compute-optimizer/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-config-service/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../client-connect/runtimeConfig.browser.ts | 36 +++++++-------- .../client-connect/runtimeConfig.native.ts | 3 +- .../client-connect/runtimeConfig.shared.ts | 11 +++-- clients/client-connect/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-cost-explorer/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-customer-profiles/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-data-pipeline/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../client-databrew/runtimeConfig.browser.ts | 36 +++++++-------- .../client-databrew/runtimeConfig.native.ts | 3 +- .../client-databrew/runtimeConfig.shared.ts | 11 +++-- clients/client-databrew/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-dataexchange/runtimeConfig.ts | 36 +++++++-------- .../client-datasync/runtimeConfig.browser.ts | 36 +++++++-------- .../client-datasync/runtimeConfig.native.ts | 3 +- .../client-datasync/runtimeConfig.shared.ts | 11 +++-- clients/client-datasync/runtimeConfig.ts | 36 +++++++-------- clients/client-dax/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-dax/runtimeConfig.native.ts | 3 +- clients/client-dax/runtimeConfig.shared.ts | 11 +++-- clients/client-dax/runtimeConfig.ts | 36 +++++++-------- .../client-detective/runtimeConfig.browser.ts | 36 +++++++-------- .../client-detective/runtimeConfig.native.ts | 3 +- .../client-detective/runtimeConfig.shared.ts | 11 +++-- clients/client-detective/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-device-farm/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-devops-guru/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-direct-connect/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-directory-service/runtimeConfig.ts | 36 +++++++-------- clients/client-dlm/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-dlm/runtimeConfig.native.ts | 3 +- clients/client-dlm/runtimeConfig.shared.ts | 11 +++-- clients/client-dlm/runtimeConfig.ts | 36 +++++++-------- clients/client-docdb/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-docdb/runtimeConfig.native.ts | 3 +- clients/client-docdb/runtimeConfig.shared.ts | 11 +++-- clients/client-docdb/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-dynamodb-streams/runtimeConfig.ts | 36 +++++++-------- .../client-dynamodb/runtimeConfig.browser.ts | 40 +++++++---------- .../client-dynamodb/runtimeConfig.native.ts | 3 +- .../client-dynamodb/runtimeConfig.shared.ts | 11 +++-- clients/client-dynamodb/runtimeConfig.ts | 42 ++++++++---------- clients/client-ebs/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ebs/runtimeConfig.native.ts | 3 +- clients/client-ebs/runtimeConfig.shared.ts | 11 +++-- clients/client-ebs/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- clients/client-ec2/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ec2/runtimeConfig.native.ts | 3 +- clients/client-ec2/runtimeConfig.shared.ts | 11 +++-- clients/client-ec2/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-ecr-public/runtimeConfig.native.ts | 3 +- .../client-ecr-public/runtimeConfig.shared.ts | 11 +++-- clients/client-ecr-public/runtimeConfig.ts | 36 +++++++-------- clients/client-ecr/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ecr/runtimeConfig.native.ts | 3 +- clients/client-ecr/runtimeConfig.shared.ts | 11 +++-- clients/client-ecr/runtimeConfig.ts | 36 +++++++-------- clients/client-ecs/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ecs/runtimeConfig.native.ts | 3 +- clients/client-ecs/runtimeConfig.shared.ts | 11 +++-- clients/client-ecs/runtimeConfig.ts | 36 +++++++-------- clients/client-efs/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-efs/runtimeConfig.native.ts | 3 +- clients/client-efs/runtimeConfig.shared.ts | 11 +++-- clients/client-efs/runtimeConfig.ts | 36 +++++++-------- clients/client-eks/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-eks/runtimeConfig.native.ts | 3 +- clients/client-eks/runtimeConfig.shared.ts | 11 +++-- clients/client-eks/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-elastic-beanstalk/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-elastic-inference/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-elasticache/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-emr-containers/runtimeConfig.ts | 36 +++++++-------- clients/client-emr/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-emr/runtimeConfig.native.ts | 3 +- clients/client-emr/runtimeConfig.shared.ts | 11 +++-- clients/client-emr/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-eventbridge/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-finspace-data/runtimeConfig.ts | 36 +++++++-------- .../client-finspace/runtimeConfig.browser.ts | 36 +++++++-------- .../client-finspace/runtimeConfig.native.ts | 3 +- .../client-finspace/runtimeConfig.shared.ts | 11 +++-- clients/client-finspace/runtimeConfig.ts | 36 +++++++-------- .../client-firehose/runtimeConfig.browser.ts | 36 +++++++-------- .../client-firehose/runtimeConfig.native.ts | 3 +- .../client-firehose/runtimeConfig.shared.ts | 11 +++-- clients/client-firehose/runtimeConfig.ts | 36 +++++++-------- clients/client-fis/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-fis/runtimeConfig.native.ts | 3 +- clients/client-fis/runtimeConfig.shared.ts | 11 +++-- clients/client-fis/runtimeConfig.ts | 36 +++++++-------- clients/client-fms/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-fms/runtimeConfig.native.ts | 3 +- clients/client-fms/runtimeConfig.shared.ts | 11 +++-- clients/client-fms/runtimeConfig.ts | 36 +++++++-------- .../client-forecast/runtimeConfig.browser.ts | 36 +++++++-------- .../client-forecast/runtimeConfig.native.ts | 3 +- .../client-forecast/runtimeConfig.shared.ts | 11 +++-- clients/client-forecast/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-forecastquery/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-frauddetector/runtimeConfig.ts | 36 +++++++-------- clients/client-fsx/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-fsx/runtimeConfig.native.ts | 3 +- clients/client-fsx/runtimeConfig.shared.ts | 11 +++-- clients/client-fsx/runtimeConfig.ts | 36 +++++++-------- .../client-gamelift/runtimeConfig.browser.ts | 36 +++++++-------- .../client-gamelift/runtimeConfig.native.ts | 3 +- .../client-gamelift/runtimeConfig.shared.ts | 11 +++-- clients/client-gamelift/runtimeConfig.ts | 36 +++++++-------- .../client-glacier/runtimeConfig.browser.ts | 38 +++++++--------- .../client-glacier/runtimeConfig.native.ts | 3 +- .../client-glacier/runtimeConfig.shared.ts | 11 +++-- clients/client-glacier/runtimeConfig.ts | 38 +++++++--------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- clients/client-glue/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-glue/runtimeConfig.native.ts | 3 +- clients/client-glue/runtimeConfig.shared.ts | 11 +++-- clients/client-glue/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-greengrass/runtimeConfig.native.ts | 3 +- .../client-greengrass/runtimeConfig.shared.ts | 11 +++-- clients/client-greengrass/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-greengrassv2/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-groundstation/runtimeConfig.ts | 36 +++++++-------- .../client-guardduty/runtimeConfig.browser.ts | 36 +++++++-------- .../client-guardduty/runtimeConfig.native.ts | 3 +- .../client-guardduty/runtimeConfig.shared.ts | 11 +++-- clients/client-guardduty/runtimeConfig.ts | 36 +++++++-------- .../client-health/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-health/runtimeConfig.native.ts | 3 +- clients/client-health/runtimeConfig.shared.ts | 11 +++-- clients/client-health/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-healthlake/runtimeConfig.native.ts | 3 +- .../client-healthlake/runtimeConfig.shared.ts | 11 +++-- clients/client-healthlake/runtimeConfig.ts | 36 +++++++-------- .../client-honeycode/runtimeConfig.browser.ts | 36 +++++++-------- .../client-honeycode/runtimeConfig.native.ts | 3 +- .../client-honeycode/runtimeConfig.shared.ts | 11 +++-- clients/client-honeycode/runtimeConfig.ts | 36 +++++++-------- clients/client-iam/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-iam/runtimeConfig.native.ts | 3 +- clients/client-iam/runtimeConfig.shared.ts | 11 +++-- clients/client-iam/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-identitystore/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-imagebuilder/runtimeConfig.ts | 36 +++++++-------- .../client-inspector/runtimeConfig.browser.ts | 36 +++++++-------- .../client-inspector/runtimeConfig.native.ts | 3 +- .../client-inspector/runtimeConfig.shared.ts | 11 +++-- clients/client-inspector/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-iot-data-plane/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-iot-events-data/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-iot-events/runtimeConfig.native.ts | 3 +- .../client-iot-events/runtimeConfig.shared.ts | 11 +++-- clients/client-iot-events/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-iot-wireless/runtimeConfig.ts | 36 +++++++-------- clients/client-iot/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-iot/runtimeConfig.native.ts | 3 +- clients/client-iot/runtimeConfig.shared.ts | 11 +++-- clients/client-iot/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-iotanalytics/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-iotdeviceadvisor/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-iotfleethub/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-iotsitewise/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-iotthingsgraph/runtimeConfig.ts | 36 +++++++-------- clients/client-ivs/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ivs/runtimeConfig.native.ts | 3 +- clients/client-ivs/runtimeConfig.shared.ts | 11 +++-- clients/client-ivs/runtimeConfig.ts | 36 +++++++-------- clients/client-kafka/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-kafka/runtimeConfig.native.ts | 3 +- clients/client-kafka/runtimeConfig.shared.ts | 11 +++-- clients/client-kafka/runtimeConfig.ts | 36 +++++++-------- .../client-kendra/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-kendra/runtimeConfig.native.ts | 3 +- clients/client-kendra/runtimeConfig.shared.ts | 11 +++-- clients/client-kendra/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-kinesis-analytics/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-kinesis-video/runtimeConfig.ts | 36 +++++++-------- .../client-kinesis/runtimeConfig.browser.ts | 38 +++++++--------- .../client-kinesis/runtimeConfig.native.ts | 3 +- .../client-kinesis/runtimeConfig.shared.ts | 11 +++-- clients/client-kinesis/runtimeConfig.ts | 38 +++++++--------- clients/client-kms/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-kms/runtimeConfig.native.ts | 3 +- clients/client-kms/runtimeConfig.shared.ts | 11 +++-- clients/client-kms/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-lakeformation/runtimeConfig.ts | 36 +++++++-------- .../client-lambda/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-lambda/runtimeConfig.native.ts | 3 +- clients/client-lambda/runtimeConfig.shared.ts | 11 +++-- clients/client-lambda/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-lex-models-v2/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 44 +++++++++---------- .../runtimeConfig.native.ts | 9 ++-- .../runtimeConfig.shared.ts | 11 +++-- .../client-lex-runtime-v2/runtimeConfig.ts | 43 ++++++++---------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-license-manager/runtimeConfig.ts | 36 +++++++-------- .../client-lightsail/runtimeConfig.browser.ts | 36 +++++++-------- .../client-lightsail/runtimeConfig.native.ts | 3 +- .../client-lightsail/runtimeConfig.shared.ts | 11 +++-- clients/client-lightsail/runtimeConfig.ts | 36 +++++++-------- .../client-location/runtimeConfig.browser.ts | 36 +++++++-------- .../client-location/runtimeConfig.native.ts | 3 +- .../client-location/runtimeConfig.shared.ts | 11 +++-- clients/client-location/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-lookoutequipment/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-lookoutmetrics/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-lookoutvision/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-machine-learning/runtimeConfig.ts | 36 +++++++-------- clients/client-macie/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-macie/runtimeConfig.native.ts | 3 +- clients/client-macie/runtimeConfig.shared.ts | 11 +++-- clients/client-macie/runtimeConfig.ts | 36 +++++++-------- .../client-macie2/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-macie2/runtimeConfig.native.ts | 3 +- clients/client-macie2/runtimeConfig.shared.ts | 11 +++-- clients/client-macie2/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-managedblockchain/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-mediaconnect/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-mediaconvert/runtimeConfig.ts | 36 +++++++-------- .../client-medialive/runtimeConfig.browser.ts | 36 +++++++-------- .../client-medialive/runtimeConfig.native.ts | 3 +- .../client-medialive/runtimeConfig.shared.ts | 11 +++-- clients/client-medialive/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-mediapackage-vod/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-mediapackage/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-mediastore-data/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-mediastore/runtimeConfig.native.ts | 3 +- .../client-mediastore/runtimeConfig.shared.ts | 11 +++-- clients/client-mediastore/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-mediatailor/runtimeConfig.ts | 36 +++++++-------- clients/client-mgn/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-mgn/runtimeConfig.native.ts | 3 +- clients/client-mgn/runtimeConfig.shared.ts | 11 +++-- clients/client-mgn/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-migration-hub/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../client-mobile/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-mobile/runtimeConfig.native.ts | 3 +- clients/client-mobile/runtimeConfig.shared.ts | 11 +++-- clients/client-mobile/runtimeConfig.ts | 36 +++++++-------- clients/client-mq/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-mq/runtimeConfig.native.ts | 3 +- clients/client-mq/runtimeConfig.shared.ts | 11 +++-- clients/client-mq/runtimeConfig.ts | 36 +++++++-------- clients/client-mturk/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-mturk/runtimeConfig.native.ts | 3 +- clients/client-mturk/runtimeConfig.shared.ts | 11 +++-- clients/client-mturk/runtimeConfig.ts | 36 +++++++-------- clients/client-mwaa/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-mwaa/runtimeConfig.native.ts | 3 +- clients/client-mwaa/runtimeConfig.shared.ts | 11 +++-- clients/client-mwaa/runtimeConfig.ts | 36 +++++++-------- .../client-neptune/runtimeConfig.browser.ts | 36 +++++++-------- .../client-neptune/runtimeConfig.native.ts | 3 +- .../client-neptune/runtimeConfig.shared.ts | 11 +++-- clients/client-neptune/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-network-firewall/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-networkmanager/runtimeConfig.ts | 36 +++++++-------- .../client-nimble/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-nimble/runtimeConfig.native.ts | 3 +- clients/client-nimble/runtimeConfig.shared.ts | 11 +++-- clients/client-nimble/runtimeConfig.ts | 36 +++++++-------- .../client-opsworks/runtimeConfig.browser.ts | 36 +++++++-------- .../client-opsworks/runtimeConfig.native.ts | 3 +- .../client-opsworks/runtimeConfig.shared.ts | 11 +++-- clients/client-opsworks/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-opsworkscm/runtimeConfig.native.ts | 3 +- .../client-opsworkscm/runtimeConfig.shared.ts | 11 +++-- clients/client-opsworkscm/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-organizations/runtimeConfig.ts | 36 +++++++-------- .../client-outposts/runtimeConfig.browser.ts | 36 +++++++-------- .../client-outposts/runtimeConfig.native.ts | 3 +- .../client-outposts/runtimeConfig.shared.ts | 11 +++-- clients/client-outposts/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-personalize/runtimeConfig.ts | 36 +++++++-------- clients/client-pi/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-pi/runtimeConfig.native.ts | 3 +- clients/client-pi/runtimeConfig.shared.ts | 11 +++-- clients/client-pi/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-pinpoint-email/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../client-pinpoint/runtimeConfig.browser.ts | 36 +++++++-------- .../client-pinpoint/runtimeConfig.native.ts | 3 +- .../client-pinpoint/runtimeConfig.shared.ts | 11 +++-- clients/client-pinpoint/runtimeConfig.ts | 36 +++++++-------- clients/client-polly/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-polly/runtimeConfig.native.ts | 3 +- clients/client-polly/runtimeConfig.shared.ts | 11 +++-- clients/client-polly/runtimeConfig.ts | 36 +++++++-------- .../client-pricing/runtimeConfig.browser.ts | 36 +++++++-------- .../client-pricing/runtimeConfig.native.ts | 3 +- .../client-pricing/runtimeConfig.shared.ts | 11 +++-- clients/client-pricing/runtimeConfig.ts | 36 +++++++-------- .../client-proton/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-proton/runtimeConfig.native.ts | 3 +- clients/client-proton/runtimeConfig.shared.ts | 11 +++-- clients/client-proton/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-qldb-session/runtimeConfig.ts | 36 +++++++-------- clients/client-qldb/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-qldb/runtimeConfig.native.ts | 3 +- clients/client-qldb/runtimeConfig.shared.ts | 11 +++-- clients/client-qldb/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-quicksight/runtimeConfig.native.ts | 3 +- .../client-quicksight/runtimeConfig.shared.ts | 11 +++-- clients/client-quicksight/runtimeConfig.ts | 36 +++++++-------- clients/client-ram/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ram/runtimeConfig.native.ts | 3 +- clients/client-ram/runtimeConfig.shared.ts | 11 +++-- clients/client-ram/runtimeConfig.ts | 36 +++++++-------- .../client-rds-data/runtimeConfig.browser.ts | 36 +++++++-------- .../client-rds-data/runtimeConfig.native.ts | 3 +- .../client-rds-data/runtimeConfig.shared.ts | 11 +++-- clients/client-rds-data/runtimeConfig.ts | 36 +++++++-------- clients/client-rds/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-rds/runtimeConfig.native.ts | 3 +- clients/client-rds/runtimeConfig.shared.ts | 11 +++-- clients/client-rds/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-redshift-data/runtimeConfig.ts | 36 +++++++-------- .../client-redshift/runtimeConfig.browser.ts | 36 +++++++-------- .../client-redshift/runtimeConfig.native.ts | 3 +- .../client-redshift/runtimeConfig.shared.ts | 11 +++-- clients/client-redshift/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-rekognition/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-resource-groups/runtimeConfig.ts | 36 +++++++-------- .../client-robomaker/runtimeConfig.browser.ts | 36 +++++++-------- .../client-robomaker/runtimeConfig.native.ts | 3 +- .../client-robomaker/runtimeConfig.shared.ts | 11 +++-- clients/client-robomaker/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-route-53-domains/runtimeConfig.ts | 36 +++++++-------- .../client-route-53/runtimeConfig.browser.ts | 36 +++++++-------- .../client-route-53/runtimeConfig.native.ts | 3 +- .../client-route-53/runtimeConfig.shared.ts | 11 +++-- clients/client-route-53/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-route53resolver/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 40 ++++++++--------- .../client-s3-control/runtimeConfig.native.ts | 3 +- .../client-s3-control/runtimeConfig.shared.ts | 11 +++-- clients/client-s3-control/runtimeConfig.ts | 40 ++++++++--------- clients/client-s3/runtimeConfig.browser.ts | 42 ++++++++---------- clients/client-s3/runtimeConfig.native.ts | 3 +- clients/client-s3/runtimeConfig.shared.ts | 15 +++---- clients/client-s3/runtimeConfig.ts | 44 +++++++++---------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-s3outposts/runtimeConfig.native.ts | 3 +- .../client-s3outposts/runtimeConfig.shared.ts | 11 +++-- clients/client-s3outposts/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-sagemaker-edge/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-sagemaker-runtime/runtimeConfig.ts | 36 +++++++-------- .../client-sagemaker/runtimeConfig.browser.ts | 36 +++++++-------- .../client-sagemaker/runtimeConfig.native.ts | 3 +- .../client-sagemaker/runtimeConfig.shared.ts | 11 +++-- clients/client-sagemaker/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-savingsplans/runtimeConfig.ts | 36 +++++++-------- .../client-schemas/runtimeConfig.browser.ts | 36 +++++++-------- .../client-schemas/runtimeConfig.native.ts | 3 +- .../client-schemas/runtimeConfig.shared.ts | 11 +++-- clients/client-schemas/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-secrets-manager/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-securityhub/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-service-catalog/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-service-quotas/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-servicediscovery/runtimeConfig.ts | 36 +++++++-------- clients/client-ses/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ses/runtimeConfig.native.ts | 3 +- clients/client-ses/runtimeConfig.shared.ts | 11 +++-- clients/client-ses/runtimeConfig.ts | 36 +++++++-------- clients/client-sesv2/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-sesv2/runtimeConfig.native.ts | 3 +- clients/client-sesv2/runtimeConfig.shared.ts | 11 +++-- clients/client-sesv2/runtimeConfig.ts | 36 +++++++-------- clients/client-sfn/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-sfn/runtimeConfig.native.ts | 3 +- clients/client-sfn/runtimeConfig.shared.ts | 11 +++-- clients/client-sfn/runtimeConfig.ts | 36 +++++++-------- .../client-shield/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-shield/runtimeConfig.native.ts | 3 +- clients/client-shield/runtimeConfig.shared.ts | 11 +++-- clients/client-shield/runtimeConfig.ts | 36 +++++++-------- .../client-signer/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-signer/runtimeConfig.native.ts | 3 +- clients/client-signer/runtimeConfig.shared.ts | 11 +++-- clients/client-signer/runtimeConfig.ts | 36 +++++++-------- clients/client-sms/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-sms/runtimeConfig.native.ts | 3 +- clients/client-sms/runtimeConfig.shared.ts | 11 +++-- clients/client-sms/runtimeConfig.ts | 36 +++++++-------- .../client-snowball/runtimeConfig.browser.ts | 36 +++++++-------- .../client-snowball/runtimeConfig.native.ts | 3 +- .../client-snowball/runtimeConfig.shared.ts | 11 +++-- clients/client-snowball/runtimeConfig.ts | 36 +++++++-------- clients/client-sns/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-sns/runtimeConfig.native.ts | 3 +- clients/client-sns/runtimeConfig.shared.ts | 11 +++-- clients/client-sns/runtimeConfig.ts | 36 +++++++-------- clients/client-sqs/runtimeConfig.browser.ts | 38 +++++++--------- clients/client-sqs/runtimeConfig.native.ts | 3 +- clients/client-sqs/runtimeConfig.shared.ts | 11 +++-- clients/client-sqs/runtimeConfig.ts | 38 +++++++--------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-ssm-contacts/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-ssm-incidents/runtimeConfig.ts | 36 +++++++-------- clients/client-ssm/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-ssm/runtimeConfig.native.ts | 3 +- clients/client-ssm/runtimeConfig.shared.ts | 11 +++-- clients/client-ssm/runtimeConfig.ts | 36 +++++++-------- .../client-sso-admin/runtimeConfig.browser.ts | 36 +++++++-------- .../client-sso-admin/runtimeConfig.native.ts | 3 +- .../client-sso-admin/runtimeConfig.shared.ts | 11 +++-- clients/client-sso-admin/runtimeConfig.ts | 36 +++++++-------- .../client-sso-oidc/runtimeConfig.browser.ts | 30 ++++++------- .../client-sso-oidc/runtimeConfig.native.ts | 3 +- .../client-sso-oidc/runtimeConfig.shared.ts | 11 +++-- clients/client-sso-oidc/runtimeConfig.ts | 30 ++++++------- clients/client-sso/runtimeConfig.browser.ts | 30 ++++++------- clients/client-sso/runtimeConfig.native.ts | 3 +- clients/client-sso/runtimeConfig.shared.ts | 11 +++-- clients/client-sso/runtimeConfig.ts | 30 ++++++------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-storage-gateway/runtimeConfig.ts | 36 +++++++-------- clients/client-sts/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-sts/runtimeConfig.native.ts | 3 +- clients/client-sts/runtimeConfig.shared.ts | 11 +++-- clients/client-sts/runtimeConfig.ts | 36 +++++++-------- .../client-support/runtimeConfig.browser.ts | 36 +++++++-------- .../client-support/runtimeConfig.native.ts | 3 +- .../client-support/runtimeConfig.shared.ts | 11 +++-- clients/client-support/runtimeConfig.ts | 36 +++++++-------- clients/client-swf/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-swf/runtimeConfig.native.ts | 3 +- clients/client-swf/runtimeConfig.shared.ts | 11 +++-- clients/client-swf/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-synthetics/runtimeConfig.native.ts | 3 +- .../client-synthetics/runtimeConfig.shared.ts | 11 +++-- clients/client-synthetics/runtimeConfig.ts | 36 +++++++-------- .../client-textract/runtimeConfig.browser.ts | 36 +++++++-------- .../client-textract/runtimeConfig.native.ts | 3 +- .../client-textract/runtimeConfig.shared.ts | 11 +++-- clients/client-textract/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 40 +++++++---------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-timestream-query/runtimeConfig.ts | 42 ++++++++---------- .../runtimeConfig.browser.ts | 40 +++++++---------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-timestream-write/runtimeConfig.ts | 42 ++++++++---------- .../runtimeConfig.browser.ts | 43 ++++++++---------- .../runtimeConfig.native.ts | 10 ++--- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 43 ++++++++---------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-transcribe/runtimeConfig.native.ts | 3 +- .../client-transcribe/runtimeConfig.shared.ts | 11 +++-- clients/client-transcribe/runtimeConfig.ts | 36 +++++++-------- .../client-transfer/runtimeConfig.browser.ts | 36 +++++++-------- .../client-transfer/runtimeConfig.native.ts | 3 +- .../client-transfer/runtimeConfig.shared.ts | 11 +++-- clients/client-transfer/runtimeConfig.ts | 36 +++++++-------- .../client-translate/runtimeConfig.browser.ts | 36 +++++++-------- .../client-translate/runtimeConfig.native.ts | 3 +- .../client-translate/runtimeConfig.shared.ts | 11 +++-- clients/client-translate/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- clients/client-waf-regional/runtimeConfig.ts | 36 +++++++-------- clients/client-waf/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-waf/runtimeConfig.native.ts | 3 +- clients/client-waf/runtimeConfig.shared.ts | 11 +++-- clients/client-waf/runtimeConfig.ts | 36 +++++++-------- clients/client-wafv2/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-wafv2/runtimeConfig.native.ts | 3 +- clients/client-wafv2/runtimeConfig.shared.ts | 11 +++-- clients/client-wafv2/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../client-wellarchitected/runtimeConfig.ts | 36 +++++++-------- .../client-workdocs/runtimeConfig.browser.ts | 36 +++++++-------- .../client-workdocs/runtimeConfig.native.ts | 3 +- .../client-workdocs/runtimeConfig.shared.ts | 11 +++-- clients/client-workdocs/runtimeConfig.ts | 36 +++++++-------- .../client-worklink/runtimeConfig.browser.ts | 36 +++++++-------- .../client-worklink/runtimeConfig.native.ts | 3 +- .../client-worklink/runtimeConfig.shared.ts | 11 +++-- clients/client-worklink/runtimeConfig.ts | 36 +++++++-------- .../client-workmail/runtimeConfig.browser.ts | 36 +++++++-------- .../client-workmail/runtimeConfig.native.ts | 3 +- .../client-workmail/runtimeConfig.shared.ts | 11 +++-- clients/client-workmail/runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../runtimeConfig.native.ts | 3 +- .../runtimeConfig.shared.ts | 11 +++-- .../runtimeConfig.ts | 36 +++++++-------- .../runtimeConfig.browser.ts | 36 +++++++-------- .../client-workspaces/runtimeConfig.native.ts | 3 +- .../client-workspaces/runtimeConfig.shared.ts | 11 +++-- clients/client-workspaces/runtimeConfig.ts | 36 +++++++-------- clients/client-xray/runtimeConfig.browser.ts | 36 +++++++-------- clients/client-xray/runtimeConfig.native.ts | 3 +- clients/client-xray/runtimeConfig.shared.ts | 11 +++-- clients/client-xray/runtimeConfig.ts | 36 +++++++-------- .../aws-ec2/runtimeConfig.browser.ts | 28 ++++++------ .../aws-ec2/runtimeConfig.native.ts | 3 +- .../aws-ec2/runtimeConfig.shared.ts | 11 +++-- protocol_tests/aws-ec2/runtimeConfig.ts | 28 ++++++------ .../aws-json/runtimeConfig.browser.ts | 36 +++++++-------- .../aws-json/runtimeConfig.native.ts | 3 +- .../aws-json/runtimeConfig.shared.ts | 11 +++-- protocol_tests/aws-json/runtimeConfig.ts | 36 +++++++-------- .../aws-query/runtimeConfig.browser.ts | 28 ++++++------ .../aws-query/runtimeConfig.native.ts | 3 +- .../aws-query/runtimeConfig.shared.ts | 11 +++-- protocol_tests/aws-query/runtimeConfig.ts | 28 ++++++------ .../aws-restjson/runtimeConfig.browser.ts | 28 ++++++------ .../aws-restjson/runtimeConfig.native.ts | 3 +- .../aws-restjson/runtimeConfig.shared.ts | 11 +++-- protocol_tests/aws-restjson/runtimeConfig.ts | 28 ++++++------ .../aws-restxml/runtimeConfig.browser.ts | 28 ++++++------ .../aws-restxml/runtimeConfig.native.ts | 3 +- .../aws-restxml/runtimeConfig.shared.ts | 11 +++-- protocol_tests/aws-restxml/runtimeConfig.ts | 28 ++++++------ 1096 files changed, 10423 insertions(+), 13163 deletions(-) diff --git a/clients/client-accessanalyzer/runtimeConfig.browser.ts b/clients/client-accessanalyzer/runtimeConfig.browser.ts index d3895fe48b5c..5f00a4bf24e3 100644 --- a/clients/client-accessanalyzer/runtimeConfig.browser.ts +++ b/clients/client-accessanalyzer/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-accessanalyzer/runtimeConfig.native.ts b/clients/client-accessanalyzer/runtimeConfig.native.ts index 266c4ac75f48..cde2988196d8 100644 --- a/clients/client-accessanalyzer/runtimeConfig.native.ts +++ b/clients/client-accessanalyzer/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-accessanalyzer/runtimeConfig.shared.ts b/clients/client-accessanalyzer/runtimeConfig.shared.ts index 8ccf5c5f00ec..f7f45588b59c 100644 --- a/clients/client-accessanalyzer/runtimeConfig.shared.ts +++ b/clients/client-accessanalyzer/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient"; @@ -9,9 +8,9 @@ import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient"; */ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => ({ apiVersion: "2019-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AccessAnalyzer"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AccessAnalyzer", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-accessanalyzer/runtimeConfig.ts b/clients/client-accessanalyzer/runtimeConfig.ts index b19d12b03015..705b0b702bd6 100644 --- a/clients/client-accessanalyzer/runtimeConfig.ts +++ b/clients/client-accessanalyzer/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-acm-pca/runtimeConfig.browser.ts b/clients/client-acm-pca/runtimeConfig.browser.ts index 19438c479c92..5c4bbc1c069a 100644 --- a/clients/client-acm-pca/runtimeConfig.browser.ts +++ b/clients/client-acm-pca/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-acm-pca/runtimeConfig.native.ts b/clients/client-acm-pca/runtimeConfig.native.ts index 540388f283c0..93b913bbdddf 100644 --- a/clients/client-acm-pca/runtimeConfig.native.ts +++ b/clients/client-acm-pca/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ACMPCAClientConfig } from "./ACMPCAClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-acm-pca/runtimeConfig.shared.ts b/clients/client-acm-pca/runtimeConfig.shared.ts index 385564aacfb8..05f24099b2a9 100644 --- a/clients/client-acm-pca/runtimeConfig.shared.ts +++ b/clients/client-acm-pca/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ACMPCAClientConfig } from "./ACMPCAClient"; @@ -9,9 +8,9 @@ import { ACMPCAClientConfig } from "./ACMPCAClient"; */ export const getRuntimeConfig = (config: ACMPCAClientConfig) => ({ apiVersion: "2017-08-22", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ACM PCA"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ACM PCA", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-acm-pca/runtimeConfig.ts b/clients/client-acm-pca/runtimeConfig.ts index 02576cf4a505..803dbcc43df1 100644 --- a/clients/client-acm-pca/runtimeConfig.ts +++ b/clients/client-acm-pca/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-acm/runtimeConfig.browser.ts b/clients/client-acm/runtimeConfig.browser.ts index 24710fe5920f..032b5cbbc1db 100644 --- a/clients/client-acm/runtimeConfig.browser.ts +++ b/clients/client-acm/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ACMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-acm/runtimeConfig.native.ts b/clients/client-acm/runtimeConfig.native.ts index 627bcdefb3ee..c7c2fb1eb5c7 100644 --- a/clients/client-acm/runtimeConfig.native.ts +++ b/clients/client-acm/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ACMClientConfig } from "./ACMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ACMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-acm/runtimeConfig.shared.ts b/clients/client-acm/runtimeConfig.shared.ts index d3c954159b31..0da4e1b7fdf7 100644 --- a/clients/client-acm/runtimeConfig.shared.ts +++ b/clients/client-acm/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ACMClientConfig } from "./ACMClient"; @@ -9,9 +8,9 @@ import { ACMClientConfig } from "./ACMClient"; */ export const getRuntimeConfig = (config: ACMClientConfig) => ({ apiVersion: "2015-12-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ACM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ACM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-acm/runtimeConfig.ts b/clients/client-acm/runtimeConfig.ts index 485d6d79d428..5f0474bae64f 100644 --- a/clients/client-acm/runtimeConfig.ts +++ b/clients/client-acm/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ACMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-alexa-for-business/runtimeConfig.browser.ts b/clients/client-alexa-for-business/runtimeConfig.browser.ts index 6a802f698c31..db59b40bf4ac 100644 --- a/clients/client-alexa-for-business/runtimeConfig.browser.ts +++ b/clients/client-alexa-for-business/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-alexa-for-business/runtimeConfig.native.ts b/clients/client-alexa-for-business/runtimeConfig.native.ts index 37dbd643673d..b35a5c5b8563 100644 --- a/clients/client-alexa-for-business/runtimeConfig.native.ts +++ b/clients/client-alexa-for-business/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AlexaForBusinessClientConfig } from "./AlexaForBusinessClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-alexa-for-business/runtimeConfig.shared.ts b/clients/client-alexa-for-business/runtimeConfig.shared.ts index 79e3677b0911..19e68ce9d7a0 100644 --- a/clients/client-alexa-for-business/runtimeConfig.shared.ts +++ b/clients/client-alexa-for-business/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AlexaForBusinessClientConfig } from "./AlexaForBusinessClient"; @@ -9,9 +8,9 @@ import { AlexaForBusinessClientConfig } from "./AlexaForBusinessClient"; */ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => ({ apiVersion: "2017-11-09", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Alexa For Business"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Alexa For Business", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-alexa-for-business/runtimeConfig.ts b/clients/client-alexa-for-business/runtimeConfig.ts index 7988b4f0c375..06157882a438 100644 --- a/clients/client-alexa-for-business/runtimeConfig.ts +++ b/clients/client-alexa-for-business/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-amp/runtimeConfig.browser.ts b/clients/client-amp/runtimeConfig.browser.ts index 08cf24decd85..d51b219b5758 100644 --- a/clients/client-amp/runtimeConfig.browser.ts +++ b/clients/client-amp/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AmpClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-amp/runtimeConfig.native.ts b/clients/client-amp/runtimeConfig.native.ts index 04d7bef9f6fb..b4213d26a208 100644 --- a/clients/client-amp/runtimeConfig.native.ts +++ b/clients/client-amp/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AmpClientConfig } from "./AmpClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AmpClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-amp/runtimeConfig.shared.ts b/clients/client-amp/runtimeConfig.shared.ts index e1ff634c3061..3d86a96ffff2 100644 --- a/clients/client-amp/runtimeConfig.shared.ts +++ b/clients/client-amp/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AmpClientConfig } from "./AmpClient"; @@ -9,9 +8,9 @@ import { AmpClientConfig } from "./AmpClient"; */ export const getRuntimeConfig = (config: AmpClientConfig) => ({ apiVersion: "2020-08-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "amp"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "amp", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-amp/runtimeConfig.ts b/clients/client-amp/runtimeConfig.ts index 4cafe36391f6..760e56148f4a 100644 --- a/clients/client-amp/runtimeConfig.ts +++ b/clients/client-amp/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AmpClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-amplify/runtimeConfig.browser.ts b/clients/client-amplify/runtimeConfig.browser.ts index 1aaddefb2186..dd73740ffc3e 100644 --- a/clients/client-amplify/runtimeConfig.browser.ts +++ b/clients/client-amplify/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AmplifyClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-amplify/runtimeConfig.native.ts b/clients/client-amplify/runtimeConfig.native.ts index b92765b60ded..69d58ed9f03b 100644 --- a/clients/client-amplify/runtimeConfig.native.ts +++ b/clients/client-amplify/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AmplifyClientConfig } from "./AmplifyClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AmplifyClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-amplify/runtimeConfig.shared.ts b/clients/client-amplify/runtimeConfig.shared.ts index 6ed63c799d3d..b68484771e1a 100644 --- a/clients/client-amplify/runtimeConfig.shared.ts +++ b/clients/client-amplify/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AmplifyClientConfig } from "./AmplifyClient"; @@ -9,9 +8,9 @@ import { AmplifyClientConfig } from "./AmplifyClient"; */ export const getRuntimeConfig = (config: AmplifyClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Amplify"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Amplify", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-amplify/runtimeConfig.ts b/clients/client-amplify/runtimeConfig.ts index 1228edc5ec7b..82252600702d 100644 --- a/clients/client-amplify/runtimeConfig.ts +++ b/clients/client-amplify/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AmplifyClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-amplifybackend/runtimeConfig.browser.ts b/clients/client-amplifybackend/runtimeConfig.browser.ts index 3009695c225d..8776ae6fcd2a 100644 --- a/clients/client-amplifybackend/runtimeConfig.browser.ts +++ b/clients/client-amplifybackend/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-amplifybackend/runtimeConfig.native.ts b/clients/client-amplifybackend/runtimeConfig.native.ts index 6a4cea8aeb9f..8db5111869a3 100644 --- a/clients/client-amplifybackend/runtimeConfig.native.ts +++ b/clients/client-amplifybackend/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AmplifyBackendClientConfig } from "./AmplifyBackendClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-amplifybackend/runtimeConfig.shared.ts b/clients/client-amplifybackend/runtimeConfig.shared.ts index d902bdb3ffed..6263392d52b8 100644 --- a/clients/client-amplifybackend/runtimeConfig.shared.ts +++ b/clients/client-amplifybackend/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AmplifyBackendClientConfig } from "./AmplifyBackendClient"; @@ -9,9 +8,9 @@ import { AmplifyBackendClientConfig } from "./AmplifyBackendClient"; */ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => ({ apiVersion: "2020-08-11", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AmplifyBackend"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AmplifyBackend", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-amplifybackend/runtimeConfig.ts b/clients/client-amplifybackend/runtimeConfig.ts index ab777efdc529..7d48472ffe6d 100644 --- a/clients/client-amplifybackend/runtimeConfig.ts +++ b/clients/client-amplifybackend/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-api-gateway/runtimeConfig.browser.ts b/clients/client-api-gateway/runtimeConfig.browser.ts index d6a8064caab1..88a6ea1609f4 100644 --- a/clients/client-api-gateway/runtimeConfig.browser.ts +++ b/clients/client-api-gateway/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: APIGatewayClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-api-gateway/runtimeConfig.native.ts b/clients/client-api-gateway/runtimeConfig.native.ts index 48a31a85f131..622e0f997fab 100644 --- a/clients/client-api-gateway/runtimeConfig.native.ts +++ b/clients/client-api-gateway/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { APIGatewayClientConfig } from "./APIGatewayClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: APIGatewayClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-api-gateway/runtimeConfig.shared.ts b/clients/client-api-gateway/runtimeConfig.shared.ts index 831375ea5ab6..fb7b75780100 100644 --- a/clients/client-api-gateway/runtimeConfig.shared.ts +++ b/clients/client-api-gateway/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { APIGatewayClientConfig } from "./APIGatewayClient"; @@ -9,9 +8,9 @@ import { APIGatewayClientConfig } from "./APIGatewayClient"; */ export const getRuntimeConfig = (config: APIGatewayClientConfig) => ({ apiVersion: "2015-07-09", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "API Gateway"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "API Gateway", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-api-gateway/runtimeConfig.ts b/clients/client-api-gateway/runtimeConfig.ts index fb069e599b62..24138da57ee2 100644 --- a/clients/client-api-gateway/runtimeConfig.ts +++ b/clients/client-api-gateway/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: APIGatewayClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts index 875de387d1d4..224d17ccc226 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts index 07e8d18f5ef6..456afbbcf10c 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ApiGatewayManagementApiClientConfig } from "./ApiGatewayManagementApiClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts index 2f903feda05a..43a4ec634602 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ApiGatewayManagementApiClientConfig } from "./ApiGatewayManagementApiClient"; @@ -9,9 +8,9 @@ import { ApiGatewayManagementApiClientConfig } from "./ApiGatewayManagementApiCl */ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => ({ apiVersion: "2018-11-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ApiGatewayManagementApi"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ApiGatewayManagementApi", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.ts index 87fa950fb50b..7e92c5178641 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-apigatewayv2/runtimeConfig.browser.ts b/clients/client-apigatewayv2/runtimeConfig.browser.ts index eb774107f37c..838833140adb 100644 --- a/clients/client-apigatewayv2/runtimeConfig.browser.ts +++ b/clients/client-apigatewayv2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-apigatewayv2/runtimeConfig.native.ts b/clients/client-apigatewayv2/runtimeConfig.native.ts index 18dff7e1e68f..851f0aa0f607 100644 --- a/clients/client-apigatewayv2/runtimeConfig.native.ts +++ b/clients/client-apigatewayv2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ApiGatewayV2ClientConfig } from "./ApiGatewayV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-apigatewayv2/runtimeConfig.shared.ts b/clients/client-apigatewayv2/runtimeConfig.shared.ts index 83fc2d3ee399..bd9e538f766c 100644 --- a/clients/client-apigatewayv2/runtimeConfig.shared.ts +++ b/clients/client-apigatewayv2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ApiGatewayV2ClientConfig } from "./ApiGatewayV2Client"; @@ -9,9 +8,9 @@ import { ApiGatewayV2ClientConfig } from "./ApiGatewayV2Client"; */ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => ({ apiVersion: "2018-11-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ApiGatewayV2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ApiGatewayV2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-apigatewayv2/runtimeConfig.ts b/clients/client-apigatewayv2/runtimeConfig.ts index 9741793fa852..0868eefe0a66 100644 --- a/clients/client-apigatewayv2/runtimeConfig.ts +++ b/clients/client-apigatewayv2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-app-mesh/runtimeConfig.browser.ts b/clients/client-app-mesh/runtimeConfig.browser.ts index 8e465cc48a04..4dfc86aecc6c 100644 --- a/clients/client-app-mesh/runtimeConfig.browser.ts +++ b/clients/client-app-mesh/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppMeshClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-app-mesh/runtimeConfig.native.ts b/clients/client-app-mesh/runtimeConfig.native.ts index a789dd2fe4f4..ded52b4da78c 100644 --- a/clients/client-app-mesh/runtimeConfig.native.ts +++ b/clients/client-app-mesh/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppMeshClientConfig } from "./AppMeshClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppMeshClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-app-mesh/runtimeConfig.shared.ts b/clients/client-app-mesh/runtimeConfig.shared.ts index f38588afa141..02ae0264ef0c 100644 --- a/clients/client-app-mesh/runtimeConfig.shared.ts +++ b/clients/client-app-mesh/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppMeshClientConfig } from "./AppMeshClient"; @@ -9,9 +8,9 @@ import { AppMeshClientConfig } from "./AppMeshClient"; */ export const getRuntimeConfig = (config: AppMeshClientConfig) => ({ apiVersion: "2019-01-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "App Mesh"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "App Mesh", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-app-mesh/runtimeConfig.ts b/clients/client-app-mesh/runtimeConfig.ts index 324ba16bc204..2f7e0a37cbcf 100644 --- a/clients/client-app-mesh/runtimeConfig.ts +++ b/clients/client-app-mesh/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppMeshClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appconfig/runtimeConfig.browser.ts b/clients/client-appconfig/runtimeConfig.browser.ts index 51c0a8469e98..df6628fd76e9 100644 --- a/clients/client-appconfig/runtimeConfig.browser.ts +++ b/clients/client-appconfig/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppConfigClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appconfig/runtimeConfig.native.ts b/clients/client-appconfig/runtimeConfig.native.ts index f7afb10a6c66..f504bd54c7a9 100644 --- a/clients/client-appconfig/runtimeConfig.native.ts +++ b/clients/client-appconfig/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppConfigClientConfig } from "./AppConfigClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppConfigClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-appconfig/runtimeConfig.shared.ts b/clients/client-appconfig/runtimeConfig.shared.ts index 64c719a9dc8e..d7ecc8a3fdce 100644 --- a/clients/client-appconfig/runtimeConfig.shared.ts +++ b/clients/client-appconfig/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppConfigClientConfig } from "./AppConfigClient"; @@ -9,9 +8,9 @@ import { AppConfigClientConfig } from "./AppConfigClient"; */ export const getRuntimeConfig = (config: AppConfigClientConfig) => ({ apiVersion: "2019-10-09", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AppConfig"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AppConfig", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-appconfig/runtimeConfig.ts b/clients/client-appconfig/runtimeConfig.ts index 9e7b60f2dde0..486542dd45b1 100644 --- a/clients/client-appconfig/runtimeConfig.ts +++ b/clients/client-appconfig/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppConfigClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appflow/runtimeConfig.browser.ts b/clients/client-appflow/runtimeConfig.browser.ts index ac54e3e96ab1..5f2df3d549a4 100644 --- a/clients/client-appflow/runtimeConfig.browser.ts +++ b/clients/client-appflow/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppflowClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appflow/runtimeConfig.native.ts b/clients/client-appflow/runtimeConfig.native.ts index 1bf3cbfea880..9660df46dd6c 100644 --- a/clients/client-appflow/runtimeConfig.native.ts +++ b/clients/client-appflow/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppflowClientConfig } from "./AppflowClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppflowClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-appflow/runtimeConfig.shared.ts b/clients/client-appflow/runtimeConfig.shared.ts index 5f7399e6bf47..e60f86337d26 100644 --- a/clients/client-appflow/runtimeConfig.shared.ts +++ b/clients/client-appflow/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppflowClientConfig } from "./AppflowClient"; @@ -9,9 +8,9 @@ import { AppflowClientConfig } from "./AppflowClient"; */ export const getRuntimeConfig = (config: AppflowClientConfig) => ({ apiVersion: "2020-08-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Appflow"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Appflow", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-appflow/runtimeConfig.ts b/clients/client-appflow/runtimeConfig.ts index 9657d05c985a..f36cc250bf5d 100644 --- a/clients/client-appflow/runtimeConfig.ts +++ b/clients/client-appflow/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppflowClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appintegrations/runtimeConfig.browser.ts b/clients/client-appintegrations/runtimeConfig.browser.ts index 8de6bb23120f..29fea133cc63 100644 --- a/clients/client-appintegrations/runtimeConfig.browser.ts +++ b/clients/client-appintegrations/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appintegrations/runtimeConfig.native.ts b/clients/client-appintegrations/runtimeConfig.native.ts index 88367effd711..ef2336055b19 100644 --- a/clients/client-appintegrations/runtimeConfig.native.ts +++ b/clients/client-appintegrations/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppIntegrationsClientConfig } from "./AppIntegrationsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-appintegrations/runtimeConfig.shared.ts b/clients/client-appintegrations/runtimeConfig.shared.ts index 18c3b85790c0..238845e4b1e9 100644 --- a/clients/client-appintegrations/runtimeConfig.shared.ts +++ b/clients/client-appintegrations/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppIntegrationsClientConfig } from "./AppIntegrationsClient"; @@ -9,9 +8,9 @@ import { AppIntegrationsClientConfig } from "./AppIntegrationsClient"; */ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => ({ apiVersion: "2020-07-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AppIntegrations"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AppIntegrations", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-appintegrations/runtimeConfig.ts b/clients/client-appintegrations/runtimeConfig.ts index a2a757663488..1c3012b54287 100644 --- a/clients/client-appintegrations/runtimeConfig.ts +++ b/clients/client-appintegrations/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-application-auto-scaling/runtimeConfig.browser.ts b/clients/client-application-auto-scaling/runtimeConfig.browser.ts index 9340fdce146b..e786dc2bee84 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.browser.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-application-auto-scaling/runtimeConfig.native.ts b/clients/client-application-auto-scaling/runtimeConfig.native.ts index d1e15579df8f..a2b58b68ca9f 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.native.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ApplicationAutoScalingClientConfig } from "./ApplicationAutoScalingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-application-auto-scaling/runtimeConfig.shared.ts b/clients/client-application-auto-scaling/runtimeConfig.shared.ts index 620194a353aa..41cbb47f6223 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.shared.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ApplicationAutoScalingClientConfig } from "./ApplicationAutoScalingClient"; @@ -9,9 +8,9 @@ import { ApplicationAutoScalingClientConfig } from "./ApplicationAutoScalingClie */ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => ({ apiVersion: "2016-02-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Application Auto Scaling"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Application Auto Scaling", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-application-auto-scaling/runtimeConfig.ts b/clients/client-application-auto-scaling/runtimeConfig.ts index 2340548fd805..5659b80ca02d 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-application-discovery-service/runtimeConfig.browser.ts b/clients/client-application-discovery-service/runtimeConfig.browser.ts index 154251d25a30..f61609d3bcfa 100644 --- a/clients/client-application-discovery-service/runtimeConfig.browser.ts +++ b/clients/client-application-discovery-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-application-discovery-service/runtimeConfig.native.ts b/clients/client-application-discovery-service/runtimeConfig.native.ts index 92b23d8c926b..6334d32e73b2 100644 --- a/clients/client-application-discovery-service/runtimeConfig.native.ts +++ b/clients/client-application-discovery-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ApplicationDiscoveryServiceClientConfig } from "./ApplicationDiscoveryServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-application-discovery-service/runtimeConfig.shared.ts b/clients/client-application-discovery-service/runtimeConfig.shared.ts index 492b2b0a9244..a9d656fa056c 100644 --- a/clients/client-application-discovery-service/runtimeConfig.shared.ts +++ b/clients/client-application-discovery-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ApplicationDiscoveryServiceClientConfig } from "./ApplicationDiscoveryServiceClient"; @@ -9,9 +8,9 @@ import { ApplicationDiscoveryServiceClientConfig } from "./ApplicationDiscoveryS */ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig) => ({ apiVersion: "2015-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Application Discovery Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Application Discovery Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-application-discovery-service/runtimeConfig.ts b/clients/client-application-discovery-service/runtimeConfig.ts index e165bc2d36ee..481e4586b40e 100644 --- a/clients/client-application-discovery-service/runtimeConfig.ts +++ b/clients/client-application-discovery-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-application-insights/runtimeConfig.browser.ts b/clients/client-application-insights/runtimeConfig.browser.ts index 51c779f60f58..1a127f55ecc5 100644 --- a/clients/client-application-insights/runtimeConfig.browser.ts +++ b/clients/client-application-insights/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-application-insights/runtimeConfig.native.ts b/clients/client-application-insights/runtimeConfig.native.ts index fd1245431ea9..715af80c0bf4 100644 --- a/clients/client-application-insights/runtimeConfig.native.ts +++ b/clients/client-application-insights/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ApplicationInsightsClientConfig } from "./ApplicationInsightsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-application-insights/runtimeConfig.shared.ts b/clients/client-application-insights/runtimeConfig.shared.ts index 91e509070dee..dc5fcdd0a58b 100644 --- a/clients/client-application-insights/runtimeConfig.shared.ts +++ b/clients/client-application-insights/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ApplicationInsightsClientConfig } from "./ApplicationInsightsClient"; @@ -9,9 +8,9 @@ import { ApplicationInsightsClientConfig } from "./ApplicationInsightsClient"; */ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => ({ apiVersion: "2018-11-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Application Insights"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Application Insights", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-application-insights/runtimeConfig.ts b/clients/client-application-insights/runtimeConfig.ts index 9dbb6863abd3..704da81f8a95 100644 --- a/clients/client-application-insights/runtimeConfig.ts +++ b/clients/client-application-insights/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-applicationcostprofiler/runtimeConfig.browser.ts b/clients/client-applicationcostprofiler/runtimeConfig.browser.ts index 94afd4c69fd9..d74dc16b6517 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.browser.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-applicationcostprofiler/runtimeConfig.native.ts b/clients/client-applicationcostprofiler/runtimeConfig.native.ts index 42b4c685d62c..3ffbb1813a48 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.native.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ApplicationCostProfilerClientConfig } from "./ApplicationCostProfilerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-applicationcostprofiler/runtimeConfig.shared.ts b/clients/client-applicationcostprofiler/runtimeConfig.shared.ts index 41fc8c4d9cdd..5d44e99b066e 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.shared.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ApplicationCostProfilerClientConfig } from "./ApplicationCostProfilerClient"; @@ -9,9 +8,9 @@ import { ApplicationCostProfilerClientConfig } from "./ApplicationCostProfilerCl */ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => ({ apiVersion: "2020-09-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ApplicationCostProfiler"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ApplicationCostProfiler", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-applicationcostprofiler/runtimeConfig.ts b/clients/client-applicationcostprofiler/runtimeConfig.ts index e0106ca0ccc7..565b28f9646f 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-apprunner/runtimeConfig.browser.ts b/clients/client-apprunner/runtimeConfig.browser.ts index f1bcb1e465b6..d8ec991b98b2 100644 --- a/clients/client-apprunner/runtimeConfig.browser.ts +++ b/clients/client-apprunner/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppRunnerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-apprunner/runtimeConfig.native.ts b/clients/client-apprunner/runtimeConfig.native.ts index 1ab920a2547e..04a95be0a8bf 100644 --- a/clients/client-apprunner/runtimeConfig.native.ts +++ b/clients/client-apprunner/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppRunnerClientConfig } from "./AppRunnerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppRunnerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-apprunner/runtimeConfig.shared.ts b/clients/client-apprunner/runtimeConfig.shared.ts index f303435e66c0..5c1842a952c9 100644 --- a/clients/client-apprunner/runtimeConfig.shared.ts +++ b/clients/client-apprunner/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppRunnerClientConfig } from "./AppRunnerClient"; @@ -9,9 +8,9 @@ import { AppRunnerClientConfig } from "./AppRunnerClient"; */ export const getRuntimeConfig = (config: AppRunnerClientConfig) => ({ apiVersion: "2020-05-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AppRunner"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AppRunner", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-apprunner/runtimeConfig.ts b/clients/client-apprunner/runtimeConfig.ts index c4948467f561..e0596e00aa58 100644 --- a/clients/client-apprunner/runtimeConfig.ts +++ b/clients/client-apprunner/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppRunnerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appstream/runtimeConfig.browser.ts b/clients/client-appstream/runtimeConfig.browser.ts index fbe936e1ec3b..c76413d43aed 100644 --- a/clients/client-appstream/runtimeConfig.browser.ts +++ b/clients/client-appstream/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppStreamClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appstream/runtimeConfig.native.ts b/clients/client-appstream/runtimeConfig.native.ts index 0b394c83570c..dd367e061d9e 100644 --- a/clients/client-appstream/runtimeConfig.native.ts +++ b/clients/client-appstream/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppStreamClientConfig } from "./AppStreamClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppStreamClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-appstream/runtimeConfig.shared.ts b/clients/client-appstream/runtimeConfig.shared.ts index 4834f533423f..9b814cad013a 100644 --- a/clients/client-appstream/runtimeConfig.shared.ts +++ b/clients/client-appstream/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppStreamClientConfig } from "./AppStreamClient"; @@ -9,9 +8,9 @@ import { AppStreamClientConfig } from "./AppStreamClient"; */ export const getRuntimeConfig = (config: AppStreamClientConfig) => ({ apiVersion: "2016-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AppStream"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AppStream", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-appstream/runtimeConfig.ts b/clients/client-appstream/runtimeConfig.ts index a76c8c80bb87..885f1972f4da 100644 --- a/clients/client-appstream/runtimeConfig.ts +++ b/clients/client-appstream/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppStreamClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appsync/runtimeConfig.browser.ts b/clients/client-appsync/runtimeConfig.browser.ts index 318ee565e941..2a8d1dd67aef 100644 --- a/clients/client-appsync/runtimeConfig.browser.ts +++ b/clients/client-appsync/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AppSyncClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-appsync/runtimeConfig.native.ts b/clients/client-appsync/runtimeConfig.native.ts index 6b6bd4748415..ae37dc897dfd 100644 --- a/clients/client-appsync/runtimeConfig.native.ts +++ b/clients/client-appsync/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AppSyncClientConfig } from "./AppSyncClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AppSyncClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-appsync/runtimeConfig.shared.ts b/clients/client-appsync/runtimeConfig.shared.ts index 76614ea2cb7a..0f75b5f6dabe 100644 --- a/clients/client-appsync/runtimeConfig.shared.ts +++ b/clients/client-appsync/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AppSyncClientConfig } from "./AppSyncClient"; @@ -9,9 +8,9 @@ import { AppSyncClientConfig } from "./AppSyncClient"; */ export const getRuntimeConfig = (config: AppSyncClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AppSync"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AppSync", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-appsync/runtimeConfig.ts b/clients/client-appsync/runtimeConfig.ts index fd6f77e4a863..4b1a0d4fa4c4 100644 --- a/clients/client-appsync/runtimeConfig.ts +++ b/clients/client-appsync/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AppSyncClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-athena/runtimeConfig.browser.ts b/clients/client-athena/runtimeConfig.browser.ts index 50a6d14a8312..b1d5dfb98327 100644 --- a/clients/client-athena/runtimeConfig.browser.ts +++ b/clients/client-athena/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AthenaClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-athena/runtimeConfig.native.ts b/clients/client-athena/runtimeConfig.native.ts index 68b91cd4a767..9137cd037f7d 100644 --- a/clients/client-athena/runtimeConfig.native.ts +++ b/clients/client-athena/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AthenaClientConfig } from "./AthenaClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AthenaClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-athena/runtimeConfig.shared.ts b/clients/client-athena/runtimeConfig.shared.ts index 6bf9fafee104..c1c0b24fca4b 100644 --- a/clients/client-athena/runtimeConfig.shared.ts +++ b/clients/client-athena/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AthenaClientConfig } from "./AthenaClient"; @@ -9,9 +8,9 @@ import { AthenaClientConfig } from "./AthenaClient"; */ export const getRuntimeConfig = (config: AthenaClientConfig) => ({ apiVersion: "2017-05-18", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Athena"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Athena", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-athena/runtimeConfig.ts b/clients/client-athena/runtimeConfig.ts index 4a1cd0116c55..a1a8a355e729 100644 --- a/clients/client-athena/runtimeConfig.ts +++ b/clients/client-athena/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AthenaClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-auditmanager/runtimeConfig.browser.ts b/clients/client-auditmanager/runtimeConfig.browser.ts index 21881a3e84a6..b421fd4b4c2b 100644 --- a/clients/client-auditmanager/runtimeConfig.browser.ts +++ b/clients/client-auditmanager/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AuditManagerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-auditmanager/runtimeConfig.native.ts b/clients/client-auditmanager/runtimeConfig.native.ts index 7d23d2466100..2d3578ee0fb3 100644 --- a/clients/client-auditmanager/runtimeConfig.native.ts +++ b/clients/client-auditmanager/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AuditManagerClientConfig } from "./AuditManagerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AuditManagerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-auditmanager/runtimeConfig.shared.ts b/clients/client-auditmanager/runtimeConfig.shared.ts index e1256494cd52..20d217539d3e 100644 --- a/clients/client-auditmanager/runtimeConfig.shared.ts +++ b/clients/client-auditmanager/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AuditManagerClientConfig } from "./AuditManagerClient"; @@ -9,9 +8,9 @@ import { AuditManagerClientConfig } from "./AuditManagerClient"; */ export const getRuntimeConfig = (config: AuditManagerClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "AuditManager"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "AuditManager", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-auditmanager/runtimeConfig.ts b/clients/client-auditmanager/runtimeConfig.ts index 322ffd641f99..b07541a47c44 100644 --- a/clients/client-auditmanager/runtimeConfig.ts +++ b/clients/client-auditmanager/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AuditManagerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-auto-scaling-plans/runtimeConfig.browser.ts b/clients/client-auto-scaling-plans/runtimeConfig.browser.ts index 26ad2cd6dc1a..95cf4fecf94a 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.browser.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-auto-scaling-plans/runtimeConfig.native.ts b/clients/client-auto-scaling-plans/runtimeConfig.native.ts index 9230a3edfe30..03990f5f3015 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.native.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AutoScalingPlansClientConfig } from "./AutoScalingPlansClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-auto-scaling-plans/runtimeConfig.shared.ts b/clients/client-auto-scaling-plans/runtimeConfig.shared.ts index 8d44a1462c2a..1a65afce7c4d 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.shared.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AutoScalingPlansClientConfig } from "./AutoScalingPlansClient"; @@ -9,9 +8,9 @@ import { AutoScalingPlansClientConfig } from "./AutoScalingPlansClient"; */ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => ({ apiVersion: "2018-01-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Auto Scaling Plans"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Auto Scaling Plans", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-auto-scaling-plans/runtimeConfig.ts b/clients/client-auto-scaling-plans/runtimeConfig.ts index f6ac522cd856..ddb3a8ea29e8 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-auto-scaling/runtimeConfig.browser.ts b/clients/client-auto-scaling/runtimeConfig.browser.ts index 8a7981ef42a6..c2e83c1970f2 100644 --- a/clients/client-auto-scaling/runtimeConfig.browser.ts +++ b/clients/client-auto-scaling/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: AutoScalingClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-auto-scaling/runtimeConfig.native.ts b/clients/client-auto-scaling/runtimeConfig.native.ts index b33ea892e40b..4a80d1bd8c39 100644 --- a/clients/client-auto-scaling/runtimeConfig.native.ts +++ b/clients/client-auto-scaling/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { AutoScalingClientConfig } from "./AutoScalingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: AutoScalingClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-auto-scaling/runtimeConfig.shared.ts b/clients/client-auto-scaling/runtimeConfig.shared.ts index 6dedc161e346..d6a93ec729e9 100644 --- a/clients/client-auto-scaling/runtimeConfig.shared.ts +++ b/clients/client-auto-scaling/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { AutoScalingClientConfig } from "./AutoScalingClient"; @@ -9,9 +8,9 @@ import { AutoScalingClientConfig } from "./AutoScalingClient"; */ export const getRuntimeConfig = (config: AutoScalingClientConfig) => ({ apiVersion: "2011-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Auto Scaling"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Auto Scaling", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-auto-scaling/runtimeConfig.ts b/clients/client-auto-scaling/runtimeConfig.ts index cb24b9688838..5bbe3e6d5634 100644 --- a/clients/client-auto-scaling/runtimeConfig.ts +++ b/clients/client-auto-scaling/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: AutoScalingClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-backup/runtimeConfig.browser.ts b/clients/client-backup/runtimeConfig.browser.ts index 79315c3f0519..85935d46fa30 100644 --- a/clients/client-backup/runtimeConfig.browser.ts +++ b/clients/client-backup/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: BackupClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-backup/runtimeConfig.native.ts b/clients/client-backup/runtimeConfig.native.ts index 263f86f04c7a..c5c2aed531a3 100644 --- a/clients/client-backup/runtimeConfig.native.ts +++ b/clients/client-backup/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { BackupClientConfig } from "./BackupClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: BackupClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-backup/runtimeConfig.shared.ts b/clients/client-backup/runtimeConfig.shared.ts index 2db2d7d8d06d..c712f778d85d 100644 --- a/clients/client-backup/runtimeConfig.shared.ts +++ b/clients/client-backup/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { BackupClientConfig } from "./BackupClient"; @@ -9,9 +8,9 @@ import { BackupClientConfig } from "./BackupClient"; */ export const getRuntimeConfig = (config: BackupClientConfig) => ({ apiVersion: "2018-11-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Backup"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Backup", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-backup/runtimeConfig.ts b/clients/client-backup/runtimeConfig.ts index 497334c10cd0..d39b59f6c1a7 100644 --- a/clients/client-backup/runtimeConfig.ts +++ b/clients/client-backup/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: BackupClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-batch/runtimeConfig.browser.ts b/clients/client-batch/runtimeConfig.browser.ts index e209ad761646..e58fd282e680 100644 --- a/clients/client-batch/runtimeConfig.browser.ts +++ b/clients/client-batch/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: BatchClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-batch/runtimeConfig.native.ts b/clients/client-batch/runtimeConfig.native.ts index 73bb573704c5..334b943427f4 100644 --- a/clients/client-batch/runtimeConfig.native.ts +++ b/clients/client-batch/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { BatchClientConfig } from "./BatchClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: BatchClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-batch/runtimeConfig.shared.ts b/clients/client-batch/runtimeConfig.shared.ts index 54ebdb65bc16..c257dc78ff7b 100644 --- a/clients/client-batch/runtimeConfig.shared.ts +++ b/clients/client-batch/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { BatchClientConfig } from "./BatchClient"; @@ -9,9 +8,9 @@ import { BatchClientConfig } from "./BatchClient"; */ export const getRuntimeConfig = (config: BatchClientConfig) => ({ apiVersion: "2016-08-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Batch"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Batch", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-batch/runtimeConfig.ts b/clients/client-batch/runtimeConfig.ts index 4cd9e04e7c27..c49c0857eca6 100644 --- a/clients/client-batch/runtimeConfig.ts +++ b/clients/client-batch/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: BatchClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-braket/runtimeConfig.browser.ts b/clients/client-braket/runtimeConfig.browser.ts index 5e68f9d18bdd..f31677451e81 100644 --- a/clients/client-braket/runtimeConfig.browser.ts +++ b/clients/client-braket/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: BraketClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-braket/runtimeConfig.native.ts b/clients/client-braket/runtimeConfig.native.ts index d6d57fa580e3..6bc1083fe1df 100644 --- a/clients/client-braket/runtimeConfig.native.ts +++ b/clients/client-braket/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { BraketClientConfig } from "./BraketClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: BraketClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-braket/runtimeConfig.shared.ts b/clients/client-braket/runtimeConfig.shared.ts index ace8c7f5e937..d1c06d24464d 100644 --- a/clients/client-braket/runtimeConfig.shared.ts +++ b/clients/client-braket/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { BraketClientConfig } from "./BraketClient"; @@ -9,9 +8,9 @@ import { BraketClientConfig } from "./BraketClient"; */ export const getRuntimeConfig = (config: BraketClientConfig) => ({ apiVersion: "2019-09-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Braket"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Braket", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-braket/runtimeConfig.ts b/clients/client-braket/runtimeConfig.ts index d399205b0013..90bc8144e7c1 100644 --- a/clients/client-braket/runtimeConfig.ts +++ b/clients/client-braket/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: BraketClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-budgets/runtimeConfig.browser.ts b/clients/client-budgets/runtimeConfig.browser.ts index 10ca56c80dad..1de41b3bd43f 100644 --- a/clients/client-budgets/runtimeConfig.browser.ts +++ b/clients/client-budgets/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: BudgetsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-budgets/runtimeConfig.native.ts b/clients/client-budgets/runtimeConfig.native.ts index 1816ab11a6c4..30b6f636e324 100644 --- a/clients/client-budgets/runtimeConfig.native.ts +++ b/clients/client-budgets/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { BudgetsClientConfig } from "./BudgetsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: BudgetsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-budgets/runtimeConfig.shared.ts b/clients/client-budgets/runtimeConfig.shared.ts index 42d3b8d21f67..5520c35361ed 100644 --- a/clients/client-budgets/runtimeConfig.shared.ts +++ b/clients/client-budgets/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { BudgetsClientConfig } from "./BudgetsClient"; @@ -9,9 +8,9 @@ import { BudgetsClientConfig } from "./BudgetsClient"; */ export const getRuntimeConfig = (config: BudgetsClientConfig) => ({ apiVersion: "2016-10-20", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Budgets"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Budgets", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-budgets/runtimeConfig.ts b/clients/client-budgets/runtimeConfig.ts index 9886143724d3..e078abd0a0da 100644 --- a/clients/client-budgets/runtimeConfig.ts +++ b/clients/client-budgets/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: BudgetsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-chime/runtimeConfig.browser.ts b/clients/client-chime/runtimeConfig.browser.ts index a5820b0e3c7e..8a2dc6e7c420 100644 --- a/clients/client-chime/runtimeConfig.browser.ts +++ b/clients/client-chime/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ChimeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-chime/runtimeConfig.native.ts b/clients/client-chime/runtimeConfig.native.ts index e79da1753faf..2110f438d133 100644 --- a/clients/client-chime/runtimeConfig.native.ts +++ b/clients/client-chime/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ChimeClientConfig } from "./ChimeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ChimeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-chime/runtimeConfig.shared.ts b/clients/client-chime/runtimeConfig.shared.ts index e5d18e9f30b5..8b2cacbe499f 100644 --- a/clients/client-chime/runtimeConfig.shared.ts +++ b/clients/client-chime/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ChimeClientConfig } from "./ChimeClient"; @@ -9,9 +8,9 @@ import { ChimeClientConfig } from "./ChimeClient"; */ export const getRuntimeConfig = (config: ChimeClientConfig) => ({ apiVersion: "2018-05-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Chime"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Chime", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-chime/runtimeConfig.ts b/clients/client-chime/runtimeConfig.ts index e562141a7ff3..afd5bfc37797 100644 --- a/clients/client-chime/runtimeConfig.ts +++ b/clients/client-chime/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ChimeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloud9/runtimeConfig.browser.ts b/clients/client-cloud9/runtimeConfig.browser.ts index 4eadc599c97b..59c6615296a5 100644 --- a/clients/client-cloud9/runtimeConfig.browser.ts +++ b/clients/client-cloud9/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: Cloud9ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloud9/runtimeConfig.native.ts b/clients/client-cloud9/runtimeConfig.native.ts index 2db9112e9d3c..f49563e9367b 100644 --- a/clients/client-cloud9/runtimeConfig.native.ts +++ b/clients/client-cloud9/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Cloud9ClientConfig } from "./Cloud9Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: Cloud9ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloud9/runtimeConfig.shared.ts b/clients/client-cloud9/runtimeConfig.shared.ts index 1bdb31db3fe5..f6ccfa23b88d 100644 --- a/clients/client-cloud9/runtimeConfig.shared.ts +++ b/clients/client-cloud9/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { Cloud9ClientConfig } from "./Cloud9Client"; @@ -9,9 +8,9 @@ import { Cloud9ClientConfig } from "./Cloud9Client"; */ export const getRuntimeConfig = (config: Cloud9ClientConfig) => ({ apiVersion: "2017-09-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Cloud9"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Cloud9", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloud9/runtimeConfig.ts b/clients/client-cloud9/runtimeConfig.ts index 33fda76e29cc..ce5fbd14aa16 100644 --- a/clients/client-cloud9/runtimeConfig.ts +++ b/clients/client-cloud9/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: Cloud9ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-clouddirectory/runtimeConfig.browser.ts b/clients/client-clouddirectory/runtimeConfig.browser.ts index 30cb36da4f60..4ac58609525d 100644 --- a/clients/client-clouddirectory/runtimeConfig.browser.ts +++ b/clients/client-clouddirectory/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-clouddirectory/runtimeConfig.native.ts b/clients/client-clouddirectory/runtimeConfig.native.ts index e7ac4035e9f3..1afc324e6365 100644 --- a/clients/client-clouddirectory/runtimeConfig.native.ts +++ b/clients/client-clouddirectory/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudDirectoryClientConfig } from "./CloudDirectoryClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-clouddirectory/runtimeConfig.shared.ts b/clients/client-clouddirectory/runtimeConfig.shared.ts index 22af83c5b64a..7537a543fab7 100644 --- a/clients/client-clouddirectory/runtimeConfig.shared.ts +++ b/clients/client-clouddirectory/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudDirectoryClientConfig } from "./CloudDirectoryClient"; @@ -9,9 +8,9 @@ import { CloudDirectoryClientConfig } from "./CloudDirectoryClient"; */ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => ({ apiVersion: "2017-01-11", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudDirectory"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudDirectory", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-clouddirectory/runtimeConfig.ts b/clients/client-clouddirectory/runtimeConfig.ts index c71ed505e0cb..f10d2e260495 100644 --- a/clients/client-clouddirectory/runtimeConfig.ts +++ b/clients/client-clouddirectory/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudformation/runtimeConfig.browser.ts b/clients/client-cloudformation/runtimeConfig.browser.ts index 9a2267815670..ea4a99abc384 100644 --- a/clients/client-cloudformation/runtimeConfig.browser.ts +++ b/clients/client-cloudformation/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudFormationClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudformation/runtimeConfig.native.ts b/clients/client-cloudformation/runtimeConfig.native.ts index 9b7e753d7549..cdec0360512e 100644 --- a/clients/client-cloudformation/runtimeConfig.native.ts +++ b/clients/client-cloudformation/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudFormationClientConfig } from "./CloudFormationClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudFormationClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudformation/runtimeConfig.shared.ts b/clients/client-cloudformation/runtimeConfig.shared.ts index fdfbcee258aa..37b4948a5de5 100644 --- a/clients/client-cloudformation/runtimeConfig.shared.ts +++ b/clients/client-cloudformation/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudFormationClientConfig } from "./CloudFormationClient"; @@ -9,9 +8,9 @@ import { CloudFormationClientConfig } from "./CloudFormationClient"; */ export const getRuntimeConfig = (config: CloudFormationClientConfig) => ({ apiVersion: "2010-05-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudFormation"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudFormation", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudformation/runtimeConfig.ts b/clients/client-cloudformation/runtimeConfig.ts index 4b4234429245..ff4b523953e4 100644 --- a/clients/client-cloudformation/runtimeConfig.ts +++ b/clients/client-cloudformation/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudFormationClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudfront/runtimeConfig.browser.ts b/clients/client-cloudfront/runtimeConfig.browser.ts index 7935c014c867..0443293ad235 100644 --- a/clients/client-cloudfront/runtimeConfig.browser.ts +++ b/clients/client-cloudfront/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudFrontClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudfront/runtimeConfig.native.ts b/clients/client-cloudfront/runtimeConfig.native.ts index 1310d0c9a673..74f8c1bd7251 100644 --- a/clients/client-cloudfront/runtimeConfig.native.ts +++ b/clients/client-cloudfront/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudFrontClientConfig } from "./CloudFrontClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudFrontClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudfront/runtimeConfig.shared.ts b/clients/client-cloudfront/runtimeConfig.shared.ts index a26a88d5c3c3..271074be5529 100644 --- a/clients/client-cloudfront/runtimeConfig.shared.ts +++ b/clients/client-cloudfront/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudFrontClientConfig } from "./CloudFrontClient"; @@ -9,9 +8,9 @@ import { CloudFrontClientConfig } from "./CloudFrontClient"; */ export const getRuntimeConfig = (config: CloudFrontClientConfig) => ({ apiVersion: "2020-05-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudFront"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudFront", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudfront/runtimeConfig.ts b/clients/client-cloudfront/runtimeConfig.ts index c8cb1e6fe6bb..8a417b31ee6c 100644 --- a/clients/client-cloudfront/runtimeConfig.ts +++ b/clients/client-cloudfront/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudFrontClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudhsm-v2/runtimeConfig.browser.ts b/clients/client-cloudhsm-v2/runtimeConfig.browser.ts index de043bcaeb1c..e30090301ad7 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.browser.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudhsm-v2/runtimeConfig.native.ts b/clients/client-cloudhsm-v2/runtimeConfig.native.ts index a425ef3525c8..d103f4861bcd 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.native.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudHSMV2ClientConfig } from "./CloudHSMV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudhsm-v2/runtimeConfig.shared.ts b/clients/client-cloudhsm-v2/runtimeConfig.shared.ts index e851195c6e2b..cc5a30b4f9b2 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.shared.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudHSMV2ClientConfig } from "./CloudHSMV2Client"; @@ -9,9 +8,9 @@ import { CloudHSMV2ClientConfig } from "./CloudHSMV2Client"; */ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => ({ apiVersion: "2017-04-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudHSM V2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudHSM V2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudhsm-v2/runtimeConfig.ts b/clients/client-cloudhsm-v2/runtimeConfig.ts index 011190a259af..692cac3a9484 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudhsm/runtimeConfig.browser.ts b/clients/client-cloudhsm/runtimeConfig.browser.ts index 13a780f7473d..309fdb68765b 100644 --- a/clients/client-cloudhsm/runtimeConfig.browser.ts +++ b/clients/client-cloudhsm/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudHSMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudhsm/runtimeConfig.native.ts b/clients/client-cloudhsm/runtimeConfig.native.ts index d9474da95fce..34b5a5e7837e 100644 --- a/clients/client-cloudhsm/runtimeConfig.native.ts +++ b/clients/client-cloudhsm/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudHSMClientConfig } from "./CloudHSMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudHSMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudhsm/runtimeConfig.shared.ts b/clients/client-cloudhsm/runtimeConfig.shared.ts index 29e2dbb2fc3a..24c82fc5ccb2 100644 --- a/clients/client-cloudhsm/runtimeConfig.shared.ts +++ b/clients/client-cloudhsm/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudHSMClientConfig } from "./CloudHSMClient"; @@ -9,9 +8,9 @@ import { CloudHSMClientConfig } from "./CloudHSMClient"; */ export const getRuntimeConfig = (config: CloudHSMClientConfig) => ({ apiVersion: "2014-05-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudHSM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudHSM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudhsm/runtimeConfig.ts b/clients/client-cloudhsm/runtimeConfig.ts index ca0804209d78..3daa98bdb43f 100644 --- a/clients/client-cloudhsm/runtimeConfig.ts +++ b/clients/client-cloudhsm/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudHSMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudsearch-domain/runtimeConfig.browser.ts b/clients/client-cloudsearch-domain/runtimeConfig.browser.ts index ab13de455e01..92572943b295 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.browser.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudsearch-domain/runtimeConfig.native.ts b/clients/client-cloudsearch-domain/runtimeConfig.native.ts index a16cef2a5fe0..f31f6ce8fef6 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.native.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudsearch-domain/runtimeConfig.shared.ts b/clients/client-cloudsearch-domain/runtimeConfig.shared.ts index 80cff7c4880f..f9459ddb8620 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.shared.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient"; @@ -9,9 +8,9 @@ import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient"; */ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => ({ apiVersion: "2013-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudSearch Domain"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudSearch Domain", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudsearch-domain/runtimeConfig.ts b/clients/client-cloudsearch-domain/runtimeConfig.ts index 9ada80c26276..76ffe641cd41 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudsearch/runtimeConfig.browser.ts b/clients/client-cloudsearch/runtimeConfig.browser.ts index f9f07dd88c22..723350a48598 100644 --- a/clients/client-cloudsearch/runtimeConfig.browser.ts +++ b/clients/client-cloudsearch/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudSearchClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudsearch/runtimeConfig.native.ts b/clients/client-cloudsearch/runtimeConfig.native.ts index 57ec0d2df85c..7984f05f957b 100644 --- a/clients/client-cloudsearch/runtimeConfig.native.ts +++ b/clients/client-cloudsearch/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudSearchClientConfig } from "./CloudSearchClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudSearchClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudsearch/runtimeConfig.shared.ts b/clients/client-cloudsearch/runtimeConfig.shared.ts index c719753aca8e..24184a693bc5 100644 --- a/clients/client-cloudsearch/runtimeConfig.shared.ts +++ b/clients/client-cloudsearch/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudSearchClientConfig } from "./CloudSearchClient"; @@ -9,9 +8,9 @@ import { CloudSearchClientConfig } from "./CloudSearchClient"; */ export const getRuntimeConfig = (config: CloudSearchClientConfig) => ({ apiVersion: "2013-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudSearch"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudSearch", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudsearch/runtimeConfig.ts b/clients/client-cloudsearch/runtimeConfig.ts index 15a5a2601061..fc80815c6609 100644 --- a/clients/client-cloudsearch/runtimeConfig.ts +++ b/clients/client-cloudsearch/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudSearchClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudtrail/runtimeConfig.browser.ts b/clients/client-cloudtrail/runtimeConfig.browser.ts index 9edcd1a78b43..a8b996771c45 100644 --- a/clients/client-cloudtrail/runtimeConfig.browser.ts +++ b/clients/client-cloudtrail/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudTrailClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudtrail/runtimeConfig.native.ts b/clients/client-cloudtrail/runtimeConfig.native.ts index 943d9bba92e0..e116b68f386a 100644 --- a/clients/client-cloudtrail/runtimeConfig.native.ts +++ b/clients/client-cloudtrail/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudTrailClientConfig } from "./CloudTrailClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudTrailClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudtrail/runtimeConfig.shared.ts b/clients/client-cloudtrail/runtimeConfig.shared.ts index 27726fe72b7f..08565aca1826 100644 --- a/clients/client-cloudtrail/runtimeConfig.shared.ts +++ b/clients/client-cloudtrail/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudTrailClientConfig } from "./CloudTrailClient"; @@ -9,9 +8,9 @@ import { CloudTrailClientConfig } from "./CloudTrailClient"; */ export const getRuntimeConfig = (config: CloudTrailClientConfig) => ({ apiVersion: "2013-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudTrail"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudTrail", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudtrail/runtimeConfig.ts b/clients/client-cloudtrail/runtimeConfig.ts index 68807c8a88be..f2b91cb1ce12 100644 --- a/clients/client-cloudtrail/runtimeConfig.ts +++ b/clients/client-cloudtrail/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudTrailClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudwatch-events/runtimeConfig.browser.ts b/clients/client-cloudwatch-events/runtimeConfig.browser.ts index 8f637477411b..012219965033 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudwatch-events/runtimeConfig.native.ts b/clients/client-cloudwatch-events/runtimeConfig.native.ts index 14db27281f13..cb35618f5a21 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.native.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudWatchEventsClientConfig } from "./CloudWatchEventsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudwatch-events/runtimeConfig.shared.ts b/clients/client-cloudwatch-events/runtimeConfig.shared.ts index ec42c45324e8..a55678ec8a8a 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.shared.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudWatchEventsClientConfig } from "./CloudWatchEventsClient"; @@ -9,9 +8,9 @@ import { CloudWatchEventsClientConfig } from "./CloudWatchEventsClient"; */ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => ({ apiVersion: "2015-10-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudWatch Events"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudWatch Events", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudwatch-events/runtimeConfig.ts b/clients/client-cloudwatch-events/runtimeConfig.ts index 0d454ec3f8c5..e07aea719d64 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudwatch-logs/runtimeConfig.browser.ts b/clients/client-cloudwatch-logs/runtimeConfig.browser.ts index 00ad40d24293..e105f21a8ef2 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudwatch-logs/runtimeConfig.native.ts b/clients/client-cloudwatch-logs/runtimeConfig.native.ts index 9f09e9b9c7e9..c11873e8ee4a 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.native.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudWatchLogsClientConfig } from "./CloudWatchLogsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudwatch-logs/runtimeConfig.shared.ts b/clients/client-cloudwatch-logs/runtimeConfig.shared.ts index f731ad3e1906..17fcc27c2eb3 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.shared.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudWatchLogsClientConfig } from "./CloudWatchLogsClient"; @@ -9,9 +8,9 @@ import { CloudWatchLogsClientConfig } from "./CloudWatchLogsClient"; */ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => ({ apiVersion: "2014-03-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudWatch Logs"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudWatch Logs", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudwatch-logs/runtimeConfig.ts b/clients/client-cloudwatch-logs/runtimeConfig.ts index a73e7590ca7a..322c36bf9c02 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudwatch/runtimeConfig.browser.ts b/clients/client-cloudwatch/runtimeConfig.browser.ts index e49595a4e64f..1e8a53937e7d 100644 --- a/clients/client-cloudwatch/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CloudWatchClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cloudwatch/runtimeConfig.native.ts b/clients/client-cloudwatch/runtimeConfig.native.ts index f82a57c9d0ee..5bb93a2b41d5 100644 --- a/clients/client-cloudwatch/runtimeConfig.native.ts +++ b/clients/client-cloudwatch/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CloudWatchClientConfig } from "./CloudWatchClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CloudWatchClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cloudwatch/runtimeConfig.shared.ts b/clients/client-cloudwatch/runtimeConfig.shared.ts index 4decbb65a59c..0cb8e20cb0be 100644 --- a/clients/client-cloudwatch/runtimeConfig.shared.ts +++ b/clients/client-cloudwatch/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CloudWatchClientConfig } from "./CloudWatchClient"; @@ -9,9 +8,9 @@ import { CloudWatchClientConfig } from "./CloudWatchClient"; */ export const getRuntimeConfig = (config: CloudWatchClientConfig) => ({ apiVersion: "2010-08-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CloudWatch"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CloudWatch", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cloudwatch/runtimeConfig.ts b/clients/client-cloudwatch/runtimeConfig.ts index 35bc8b3ded7a..4e719854e512 100644 --- a/clients/client-cloudwatch/runtimeConfig.ts +++ b/clients/client-cloudwatch/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CloudWatchClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codeartifact/runtimeConfig.browser.ts b/clients/client-codeartifact/runtimeConfig.browser.ts index 7549f9392956..ca87b30a67fd 100644 --- a/clients/client-codeartifact/runtimeConfig.browser.ts +++ b/clients/client-codeartifact/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codeartifact/runtimeConfig.native.ts b/clients/client-codeartifact/runtimeConfig.native.ts index 54e390612449..87be7570fb38 100644 --- a/clients/client-codeartifact/runtimeConfig.native.ts +++ b/clients/client-codeartifact/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeartifactClientConfig } from "./CodeartifactClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codeartifact/runtimeConfig.shared.ts b/clients/client-codeartifact/runtimeConfig.shared.ts index a03875716efb..a03ba08abdfd 100644 --- a/clients/client-codeartifact/runtimeConfig.shared.ts +++ b/clients/client-codeartifact/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeartifactClientConfig } from "./CodeartifactClient"; @@ -9,9 +8,9 @@ import { CodeartifactClientConfig } from "./CodeartifactClient"; */ export const getRuntimeConfig = (config: CodeartifactClientConfig) => ({ apiVersion: "2018-09-22", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "codeartifact"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "codeartifact", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codeartifact/runtimeConfig.ts b/clients/client-codeartifact/runtimeConfig.ts index 3b4d921c8cac..80b400194bbe 100644 --- a/clients/client-codeartifact/runtimeConfig.ts +++ b/clients/client-codeartifact/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codebuild/runtimeConfig.browser.ts b/clients/client-codebuild/runtimeConfig.browser.ts index 0bd5e5f00a93..0c9431a745f4 100644 --- a/clients/client-codebuild/runtimeConfig.browser.ts +++ b/clients/client-codebuild/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeBuildClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codebuild/runtimeConfig.native.ts b/clients/client-codebuild/runtimeConfig.native.ts index a245856511e6..8d64aa5f2f70 100644 --- a/clients/client-codebuild/runtimeConfig.native.ts +++ b/clients/client-codebuild/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeBuildClientConfig } from "./CodeBuildClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeBuildClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codebuild/runtimeConfig.shared.ts b/clients/client-codebuild/runtimeConfig.shared.ts index d944bb9ab192..97f7006aaab0 100644 --- a/clients/client-codebuild/runtimeConfig.shared.ts +++ b/clients/client-codebuild/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeBuildClientConfig } from "./CodeBuildClient"; @@ -9,9 +8,9 @@ import { CodeBuildClientConfig } from "./CodeBuildClient"; */ export const getRuntimeConfig = (config: CodeBuildClientConfig) => ({ apiVersion: "2016-10-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeBuild"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeBuild", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codebuild/runtimeConfig.ts b/clients/client-codebuild/runtimeConfig.ts index b713a7cf32ec..f8e08718b5b1 100644 --- a/clients/client-codebuild/runtimeConfig.ts +++ b/clients/client-codebuild/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeBuildClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codecommit/runtimeConfig.browser.ts b/clients/client-codecommit/runtimeConfig.browser.ts index ceb3a613fe88..9dc9c2fac106 100644 --- a/clients/client-codecommit/runtimeConfig.browser.ts +++ b/clients/client-codecommit/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeCommitClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codecommit/runtimeConfig.native.ts b/clients/client-codecommit/runtimeConfig.native.ts index c9a651ce13db..d57cfe46c124 100644 --- a/clients/client-codecommit/runtimeConfig.native.ts +++ b/clients/client-codecommit/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeCommitClientConfig } from "./CodeCommitClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeCommitClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codecommit/runtimeConfig.shared.ts b/clients/client-codecommit/runtimeConfig.shared.ts index ad7b674af96a..a99f80a0f389 100644 --- a/clients/client-codecommit/runtimeConfig.shared.ts +++ b/clients/client-codecommit/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeCommitClientConfig } from "./CodeCommitClient"; @@ -9,9 +8,9 @@ import { CodeCommitClientConfig } from "./CodeCommitClient"; */ export const getRuntimeConfig = (config: CodeCommitClientConfig) => ({ apiVersion: "2015-04-13", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeCommit"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeCommit", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codecommit/runtimeConfig.ts b/clients/client-codecommit/runtimeConfig.ts index 6ffb150c8680..32f86d4e9c73 100644 --- a/clients/client-codecommit/runtimeConfig.ts +++ b/clients/client-codecommit/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeCommitClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codedeploy/runtimeConfig.browser.ts b/clients/client-codedeploy/runtimeConfig.browser.ts index 655fadfdcdf4..00a90e202ab7 100644 --- a/clients/client-codedeploy/runtimeConfig.browser.ts +++ b/clients/client-codedeploy/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeDeployClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codedeploy/runtimeConfig.native.ts b/clients/client-codedeploy/runtimeConfig.native.ts index 4c6d84fb67c9..d0a95a19390c 100644 --- a/clients/client-codedeploy/runtimeConfig.native.ts +++ b/clients/client-codedeploy/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeDeployClientConfig } from "./CodeDeployClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeDeployClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codedeploy/runtimeConfig.shared.ts b/clients/client-codedeploy/runtimeConfig.shared.ts index 5e4d2e6801ca..f3a7437c5e00 100644 --- a/clients/client-codedeploy/runtimeConfig.shared.ts +++ b/clients/client-codedeploy/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeDeployClientConfig } from "./CodeDeployClient"; @@ -9,9 +8,9 @@ import { CodeDeployClientConfig } from "./CodeDeployClient"; */ export const getRuntimeConfig = (config: CodeDeployClientConfig) => ({ apiVersion: "2014-10-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeDeploy"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeDeploy", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codedeploy/runtimeConfig.ts b/clients/client-codedeploy/runtimeConfig.ts index 202f773f1dbf..0a9425b8b49d 100644 --- a/clients/client-codedeploy/runtimeConfig.ts +++ b/clients/client-codedeploy/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeDeployClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codeguru-reviewer/runtimeConfig.browser.ts b/clients/client-codeguru-reviewer/runtimeConfig.browser.ts index 02d5f070abe0..008e6bb8e2b1 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.browser.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codeguru-reviewer/runtimeConfig.native.ts b/clients/client-codeguru-reviewer/runtimeConfig.native.ts index 1fda4dec9f43..4ab1685eafbf 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.native.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeGuruReviewerClientConfig } from "./CodeGuruReviewerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codeguru-reviewer/runtimeConfig.shared.ts b/clients/client-codeguru-reviewer/runtimeConfig.shared.ts index 51a95b877b0d..7d47e1e91aaf 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.shared.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeGuruReviewerClientConfig } from "./CodeGuruReviewerClient"; @@ -9,9 +8,9 @@ import { CodeGuruReviewerClientConfig } from "./CodeGuruReviewerClient"; */ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => ({ apiVersion: "2019-09-19", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeGuru Reviewer"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeGuru Reviewer", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codeguru-reviewer/runtimeConfig.ts b/clients/client-codeguru-reviewer/runtimeConfig.ts index 3bb9808fcc15..a49890d44856 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codeguruprofiler/runtimeConfig.browser.ts b/clients/client-codeguruprofiler/runtimeConfig.browser.ts index d932c778f3cf..3da51b99388c 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.browser.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codeguruprofiler/runtimeConfig.native.ts b/clients/client-codeguruprofiler/runtimeConfig.native.ts index f6fd36f66286..ffdbb77be694 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.native.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeGuruProfilerClientConfig } from "./CodeGuruProfilerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codeguruprofiler/runtimeConfig.shared.ts b/clients/client-codeguruprofiler/runtimeConfig.shared.ts index be62bd3a12f1..2e37e581700d 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.shared.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeGuruProfilerClientConfig } from "./CodeGuruProfilerClient"; @@ -9,9 +8,9 @@ import { CodeGuruProfilerClientConfig } from "./CodeGuruProfilerClient"; */ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => ({ apiVersion: "2019-07-18", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeGuruProfiler"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeGuruProfiler", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codeguruprofiler/runtimeConfig.ts b/clients/client-codeguruprofiler/runtimeConfig.ts index b30ea3446443..74c73c189816 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codepipeline/runtimeConfig.browser.ts b/clients/client-codepipeline/runtimeConfig.browser.ts index 163fef31407d..54f1a8ea81f7 100644 --- a/clients/client-codepipeline/runtimeConfig.browser.ts +++ b/clients/client-codepipeline/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodePipelineClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codepipeline/runtimeConfig.native.ts b/clients/client-codepipeline/runtimeConfig.native.ts index dd5dd1e44dec..06e03fb7230e 100644 --- a/clients/client-codepipeline/runtimeConfig.native.ts +++ b/clients/client-codepipeline/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodePipelineClientConfig } from "./CodePipelineClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodePipelineClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codepipeline/runtimeConfig.shared.ts b/clients/client-codepipeline/runtimeConfig.shared.ts index e4b3d1104438..eb5b492ca6f0 100644 --- a/clients/client-codepipeline/runtimeConfig.shared.ts +++ b/clients/client-codepipeline/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodePipelineClientConfig } from "./CodePipelineClient"; @@ -9,9 +8,9 @@ import { CodePipelineClientConfig } from "./CodePipelineClient"; */ export const getRuntimeConfig = (config: CodePipelineClientConfig) => ({ apiVersion: "2015-07-09", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodePipeline"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodePipeline", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codepipeline/runtimeConfig.ts b/clients/client-codepipeline/runtimeConfig.ts index 0294567cafc7..0bb7fe257ee8 100644 --- a/clients/client-codepipeline/runtimeConfig.ts +++ b/clients/client-codepipeline/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodePipelineClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codestar-connections/runtimeConfig.browser.ts b/clients/client-codestar-connections/runtimeConfig.browser.ts index 60af51e9f073..fae3fa58ddbb 100644 --- a/clients/client-codestar-connections/runtimeConfig.browser.ts +++ b/clients/client-codestar-connections/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codestar-connections/runtimeConfig.native.ts b/clients/client-codestar-connections/runtimeConfig.native.ts index 8492a53129c5..58c99910ab21 100644 --- a/clients/client-codestar-connections/runtimeConfig.native.ts +++ b/clients/client-codestar-connections/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeStarConnectionsClientConfig } from "./CodeStarConnectionsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codestar-connections/runtimeConfig.shared.ts b/clients/client-codestar-connections/runtimeConfig.shared.ts index 18339da87c42..f03d78bea11c 100644 --- a/clients/client-codestar-connections/runtimeConfig.shared.ts +++ b/clients/client-codestar-connections/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeStarConnectionsClientConfig } from "./CodeStarConnectionsClient"; @@ -9,9 +8,9 @@ import { CodeStarConnectionsClientConfig } from "./CodeStarConnectionsClient"; */ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => ({ apiVersion: "2019-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeStar connections"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeStar connections", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codestar-connections/runtimeConfig.ts b/clients/client-codestar-connections/runtimeConfig.ts index 7ed7813d34f1..5396c1ef7cad 100644 --- a/clients/client-codestar-connections/runtimeConfig.ts +++ b/clients/client-codestar-connections/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codestar-notifications/runtimeConfig.browser.ts b/clients/client-codestar-notifications/runtimeConfig.browser.ts index bfedc47689fe..9a8221569684 100644 --- a/clients/client-codestar-notifications/runtimeConfig.browser.ts +++ b/clients/client-codestar-notifications/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codestar-notifications/runtimeConfig.native.ts b/clients/client-codestar-notifications/runtimeConfig.native.ts index d3821264ca56..80ad97502a03 100644 --- a/clients/client-codestar-notifications/runtimeConfig.native.ts +++ b/clients/client-codestar-notifications/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodestarNotificationsClientConfig } from "./CodestarNotificationsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codestar-notifications/runtimeConfig.shared.ts b/clients/client-codestar-notifications/runtimeConfig.shared.ts index 7aa426f5d4fe..53c0e07df1ba 100644 --- a/clients/client-codestar-notifications/runtimeConfig.shared.ts +++ b/clients/client-codestar-notifications/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodestarNotificationsClientConfig } from "./CodestarNotificationsClient"; @@ -9,9 +8,9 @@ import { CodestarNotificationsClientConfig } from "./CodestarNotificationsClient */ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => ({ apiVersion: "2019-10-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "codestar notifications"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "codestar notifications", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codestar-notifications/runtimeConfig.ts b/clients/client-codestar-notifications/runtimeConfig.ts index 92690bf1686a..7e898107a995 100644 --- a/clients/client-codestar-notifications/runtimeConfig.ts +++ b/clients/client-codestar-notifications/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codestar/runtimeConfig.browser.ts b/clients/client-codestar/runtimeConfig.browser.ts index e3ec59ef5441..472b1587576b 100644 --- a/clients/client-codestar/runtimeConfig.browser.ts +++ b/clients/client-codestar/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CodeStarClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-codestar/runtimeConfig.native.ts b/clients/client-codestar/runtimeConfig.native.ts index 6da04e101c95..dce74c72a623 100644 --- a/clients/client-codestar/runtimeConfig.native.ts +++ b/clients/client-codestar/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CodeStarClientConfig } from "./CodeStarClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CodeStarClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-codestar/runtimeConfig.shared.ts b/clients/client-codestar/runtimeConfig.shared.ts index ad2f8009b452..1f5861569efd 100644 --- a/clients/client-codestar/runtimeConfig.shared.ts +++ b/clients/client-codestar/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CodeStarClientConfig } from "./CodeStarClient"; @@ -9,9 +8,9 @@ import { CodeStarClientConfig } from "./CodeStarClient"; */ export const getRuntimeConfig = (config: CodeStarClientConfig) => ({ apiVersion: "2017-04-19", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "CodeStar"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "CodeStar", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-codestar/runtimeConfig.ts b/clients/client-codestar/runtimeConfig.ts index ecf6fa2a2738..52f27c3c86b2 100644 --- a/clients/client-codestar/runtimeConfig.ts +++ b/clients/client-codestar/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CodeStarClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cognito-identity-provider/runtimeConfig.browser.ts b/clients/client-cognito-identity-provider/runtimeConfig.browser.ts index afcc338daef5..72f109ca248e 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.browser.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cognito-identity-provider/runtimeConfig.native.ts b/clients/client-cognito-identity-provider/runtimeConfig.native.ts index 0a8e71f3a4a9..5510ebcb2ff2 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.native.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CognitoIdentityProviderClientConfig } from "./CognitoIdentityProviderClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cognito-identity-provider/runtimeConfig.shared.ts b/clients/client-cognito-identity-provider/runtimeConfig.shared.ts index daab9efa6880..f7bfd581c863 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.shared.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CognitoIdentityProviderClientConfig } from "./CognitoIdentityProviderClient"; @@ -9,9 +8,9 @@ import { CognitoIdentityProviderClientConfig } from "./CognitoIdentityProviderCl */ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => ({ apiVersion: "2016-04-18", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Cognito Identity Provider"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Cognito Identity Provider", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cognito-identity-provider/runtimeConfig.ts b/clients/client-cognito-identity-provider/runtimeConfig.ts index 4bd6cd47a25b..761b2bd362f2 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cognito-identity/runtimeConfig.browser.ts b/clients/client-cognito-identity/runtimeConfig.browser.ts index 2b7d5f6d215b..24a7c1f9a68a 100644 --- a/clients/client-cognito-identity/runtimeConfig.browser.ts +++ b/clients/client-cognito-identity/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cognito-identity/runtimeConfig.native.ts b/clients/client-cognito-identity/runtimeConfig.native.ts index 2661b9ea9cdb..e7819fbe466f 100644 --- a/clients/client-cognito-identity/runtimeConfig.native.ts +++ b/clients/client-cognito-identity/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CognitoIdentityClientConfig } from "./CognitoIdentityClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cognito-identity/runtimeConfig.shared.ts b/clients/client-cognito-identity/runtimeConfig.shared.ts index d37beb7a9b83..5c934131a68c 100644 --- a/clients/client-cognito-identity/runtimeConfig.shared.ts +++ b/clients/client-cognito-identity/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CognitoIdentityClientConfig } from "./CognitoIdentityClient"; @@ -9,9 +8,9 @@ import { CognitoIdentityClientConfig } from "./CognitoIdentityClient"; */ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => ({ apiVersion: "2014-06-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Cognito Identity"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Cognito Identity", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cognito-identity/runtimeConfig.ts b/clients/client-cognito-identity/runtimeConfig.ts index d88e33af0ee0..f2dece56f913 100644 --- a/clients/client-cognito-identity/runtimeConfig.ts +++ b/clients/client-cognito-identity/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cognito-sync/runtimeConfig.browser.ts b/clients/client-cognito-sync/runtimeConfig.browser.ts index 63908d39bff7..185de25873be 100644 --- a/clients/client-cognito-sync/runtimeConfig.browser.ts +++ b/clients/client-cognito-sync/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cognito-sync/runtimeConfig.native.ts b/clients/client-cognito-sync/runtimeConfig.native.ts index 59c958d87fc8..05447738adc1 100644 --- a/clients/client-cognito-sync/runtimeConfig.native.ts +++ b/clients/client-cognito-sync/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CognitoSyncClientConfig } from "./CognitoSyncClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cognito-sync/runtimeConfig.shared.ts b/clients/client-cognito-sync/runtimeConfig.shared.ts index b2aaf4ce2ca6..95424ae31495 100644 --- a/clients/client-cognito-sync/runtimeConfig.shared.ts +++ b/clients/client-cognito-sync/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CognitoSyncClientConfig } from "./CognitoSyncClient"; @@ -9,9 +8,9 @@ import { CognitoSyncClientConfig } from "./CognitoSyncClient"; */ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => ({ apiVersion: "2014-06-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Cognito Sync"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Cognito Sync", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cognito-sync/runtimeConfig.ts b/clients/client-cognito-sync/runtimeConfig.ts index 61734a2dc09c..e74c08b30274 100644 --- a/clients/client-cognito-sync/runtimeConfig.ts +++ b/clients/client-cognito-sync/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-comprehend/runtimeConfig.browser.ts b/clients/client-comprehend/runtimeConfig.browser.ts index ce7dc33795c5..43e393cc7f35 100644 --- a/clients/client-comprehend/runtimeConfig.browser.ts +++ b/clients/client-comprehend/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ComprehendClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-comprehend/runtimeConfig.native.ts b/clients/client-comprehend/runtimeConfig.native.ts index d924c8f13319..1c1fbe348ccd 100644 --- a/clients/client-comprehend/runtimeConfig.native.ts +++ b/clients/client-comprehend/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ComprehendClientConfig } from "./ComprehendClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ComprehendClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-comprehend/runtimeConfig.shared.ts b/clients/client-comprehend/runtimeConfig.shared.ts index bca1aaa1f2f9..5818b4127e2f 100644 --- a/clients/client-comprehend/runtimeConfig.shared.ts +++ b/clients/client-comprehend/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ComprehendClientConfig } from "./ComprehendClient"; @@ -9,9 +8,9 @@ import { ComprehendClientConfig } from "./ComprehendClient"; */ export const getRuntimeConfig = (config: ComprehendClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Comprehend"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Comprehend", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-comprehend/runtimeConfig.ts b/clients/client-comprehend/runtimeConfig.ts index 9d12c1e05f2c..148bbd44b78d 100644 --- a/clients/client-comprehend/runtimeConfig.ts +++ b/clients/client-comprehend/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ComprehendClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-comprehendmedical/runtimeConfig.browser.ts b/clients/client-comprehendmedical/runtimeConfig.browser.ts index 087acb0ba93b..534258a06100 100644 --- a/clients/client-comprehendmedical/runtimeConfig.browser.ts +++ b/clients/client-comprehendmedical/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-comprehendmedical/runtimeConfig.native.ts b/clients/client-comprehendmedical/runtimeConfig.native.ts index 9cc51fa66449..541ed86dc054 100644 --- a/clients/client-comprehendmedical/runtimeConfig.native.ts +++ b/clients/client-comprehendmedical/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ComprehendMedicalClientConfig } from "./ComprehendMedicalClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-comprehendmedical/runtimeConfig.shared.ts b/clients/client-comprehendmedical/runtimeConfig.shared.ts index da3bfc1fc5e7..2f2408774668 100644 --- a/clients/client-comprehendmedical/runtimeConfig.shared.ts +++ b/clients/client-comprehendmedical/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ComprehendMedicalClientConfig } from "./ComprehendMedicalClient"; @@ -9,9 +8,9 @@ import { ComprehendMedicalClientConfig } from "./ComprehendMedicalClient"; */ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => ({ apiVersion: "2018-10-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ComprehendMedical"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ComprehendMedical", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-comprehendmedical/runtimeConfig.ts b/clients/client-comprehendmedical/runtimeConfig.ts index a73356177006..734add172cbc 100644 --- a/clients/client-comprehendmedical/runtimeConfig.ts +++ b/clients/client-comprehendmedical/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-compute-optimizer/runtimeConfig.browser.ts b/clients/client-compute-optimizer/runtimeConfig.browser.ts index cd4e889888ca..caeb9770f34f 100644 --- a/clients/client-compute-optimizer/runtimeConfig.browser.ts +++ b/clients/client-compute-optimizer/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-compute-optimizer/runtimeConfig.native.ts b/clients/client-compute-optimizer/runtimeConfig.native.ts index 05dce3f9c360..776639b17b62 100644 --- a/clients/client-compute-optimizer/runtimeConfig.native.ts +++ b/clients/client-compute-optimizer/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ComputeOptimizerClientConfig } from "./ComputeOptimizerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-compute-optimizer/runtimeConfig.shared.ts b/clients/client-compute-optimizer/runtimeConfig.shared.ts index b0db78e5d8fd..57d7512e3d43 100644 --- a/clients/client-compute-optimizer/runtimeConfig.shared.ts +++ b/clients/client-compute-optimizer/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ComputeOptimizerClientConfig } from "./ComputeOptimizerClient"; @@ -9,9 +8,9 @@ import { ComputeOptimizerClientConfig } from "./ComputeOptimizerClient"; */ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => ({ apiVersion: "2019-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Compute Optimizer"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Compute Optimizer", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-compute-optimizer/runtimeConfig.ts b/clients/client-compute-optimizer/runtimeConfig.ts index ec93bba0faac..c0381929632f 100644 --- a/clients/client-compute-optimizer/runtimeConfig.ts +++ b/clients/client-compute-optimizer/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-config-service/runtimeConfig.browser.ts b/clients/client-config-service/runtimeConfig.browser.ts index be9ac386865e..f9e793929c41 100644 --- a/clients/client-config-service/runtimeConfig.browser.ts +++ b/clients/client-config-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-config-service/runtimeConfig.native.ts b/clients/client-config-service/runtimeConfig.native.ts index 74979d0d9825..d409e982a33d 100644 --- a/clients/client-config-service/runtimeConfig.native.ts +++ b/clients/client-config-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ConfigServiceClientConfig } from "./ConfigServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-config-service/runtimeConfig.shared.ts b/clients/client-config-service/runtimeConfig.shared.ts index 663c06cbcdb2..699c6b0090e2 100644 --- a/clients/client-config-service/runtimeConfig.shared.ts +++ b/clients/client-config-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ConfigServiceClientConfig } from "./ConfigServiceClient"; @@ -9,9 +8,9 @@ import { ConfigServiceClientConfig } from "./ConfigServiceClient"; */ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => ({ apiVersion: "2014-11-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Config Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Config Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-config-service/runtimeConfig.ts b/clients/client-config-service/runtimeConfig.ts index c254e970f9cc..02ff6aabae1c 100644 --- a/clients/client-config-service/runtimeConfig.ts +++ b/clients/client-config-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-connect-contact-lens/runtimeConfig.browser.ts b/clients/client-connect-contact-lens/runtimeConfig.browser.ts index 5e00e6587103..dd20e40cf1c8 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.browser.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-connect-contact-lens/runtimeConfig.native.ts b/clients/client-connect-contact-lens/runtimeConfig.native.ts index 3f0422a76558..6a8d17349fae 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.native.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ConnectContactLensClientConfig } from "./ConnectContactLensClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-connect-contact-lens/runtimeConfig.shared.ts b/clients/client-connect-contact-lens/runtimeConfig.shared.ts index f6e2cbe89c77..0f7b1ffa90fc 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.shared.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ConnectContactLensClientConfig } from "./ConnectContactLensClient"; @@ -9,9 +8,9 @@ import { ConnectContactLensClientConfig } from "./ConnectContactLensClient"; */ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => ({ apiVersion: "2020-08-21", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Connect Contact Lens"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Connect Contact Lens", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-connect-contact-lens/runtimeConfig.ts b/clients/client-connect-contact-lens/runtimeConfig.ts index cc250f0da546..92c4c8cf5a54 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-connect/runtimeConfig.browser.ts b/clients/client-connect/runtimeConfig.browser.ts index 80b3ae9dc3b1..79f9a7ae84c0 100644 --- a/clients/client-connect/runtimeConfig.browser.ts +++ b/clients/client-connect/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ConnectClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-connect/runtimeConfig.native.ts b/clients/client-connect/runtimeConfig.native.ts index e30c65207a14..b5f743e7a094 100644 --- a/clients/client-connect/runtimeConfig.native.ts +++ b/clients/client-connect/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ConnectClientConfig } from "./ConnectClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ConnectClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-connect/runtimeConfig.shared.ts b/clients/client-connect/runtimeConfig.shared.ts index ea772058db8a..56359a9a3c51 100644 --- a/clients/client-connect/runtimeConfig.shared.ts +++ b/clients/client-connect/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ConnectClientConfig } from "./ConnectClient"; @@ -9,9 +8,9 @@ import { ConnectClientConfig } from "./ConnectClient"; */ export const getRuntimeConfig = (config: ConnectClientConfig) => ({ apiVersion: "2017-08-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Connect"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Connect", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-connect/runtimeConfig.ts b/clients/client-connect/runtimeConfig.ts index a7547acc1246..b9097342f3b6 100644 --- a/clients/client-connect/runtimeConfig.ts +++ b/clients/client-connect/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ConnectClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-connectparticipant/runtimeConfig.browser.ts b/clients/client-connectparticipant/runtimeConfig.browser.ts index 5bad0de5183d..cd7fece2f85e 100644 --- a/clients/client-connectparticipant/runtimeConfig.browser.ts +++ b/clients/client-connectparticipant/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-connectparticipant/runtimeConfig.native.ts b/clients/client-connectparticipant/runtimeConfig.native.ts index 5bfadbb3ef08..4667a5c2ab41 100644 --- a/clients/client-connectparticipant/runtimeConfig.native.ts +++ b/clients/client-connectparticipant/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ConnectParticipantClientConfig } from "./ConnectParticipantClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-connectparticipant/runtimeConfig.shared.ts b/clients/client-connectparticipant/runtimeConfig.shared.ts index 33b86ba14350..c077cf8056a1 100644 --- a/clients/client-connectparticipant/runtimeConfig.shared.ts +++ b/clients/client-connectparticipant/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ConnectParticipantClientConfig } from "./ConnectParticipantClient"; @@ -9,9 +8,9 @@ import { ConnectParticipantClientConfig } from "./ConnectParticipantClient"; */ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => ({ apiVersion: "2018-09-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ConnectParticipant"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ConnectParticipant", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-connectparticipant/runtimeConfig.ts b/clients/client-connectparticipant/runtimeConfig.ts index 53e9ad9e9cbb..54ead025ac32 100644 --- a/clients/client-connectparticipant/runtimeConfig.ts +++ b/clients/client-connectparticipant/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts b/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts index b91170c17a5b..082b32aaf83d 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts b/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts index d6d57a68583a..e3da889e7e26 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CostAndUsageReportServiceClientConfig } from "./CostAndUsageReportServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cost-and-usage-report-service/runtimeConfig.shared.ts b/clients/client-cost-and-usage-report-service/runtimeConfig.shared.ts index 3a3a30d1bbd9..7a26edc74f75 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.shared.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CostAndUsageReportServiceClientConfig } from "./CostAndUsageReportServiceClient"; @@ -9,9 +8,9 @@ import { CostAndUsageReportServiceClientConfig } from "./CostAndUsageReportServi */ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) => ({ apiVersion: "2017-01-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Cost and Usage Report Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Cost and Usage Report Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cost-and-usage-report-service/runtimeConfig.ts b/clients/client-cost-and-usage-report-service/runtimeConfig.ts index 030cef8c304d..9e58dda4a5a3 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cost-explorer/runtimeConfig.browser.ts b/clients/client-cost-explorer/runtimeConfig.browser.ts index e2334efdc420..a6857cc080f2 100644 --- a/clients/client-cost-explorer/runtimeConfig.browser.ts +++ b/clients/client-cost-explorer/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CostExplorerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-cost-explorer/runtimeConfig.native.ts b/clients/client-cost-explorer/runtimeConfig.native.ts index 34d16bea3ee5..5ebb48efbb63 100644 --- a/clients/client-cost-explorer/runtimeConfig.native.ts +++ b/clients/client-cost-explorer/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CostExplorerClientConfig } from "./CostExplorerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CostExplorerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-cost-explorer/runtimeConfig.shared.ts b/clients/client-cost-explorer/runtimeConfig.shared.ts index 304751b45b9f..4ae8b043dde5 100644 --- a/clients/client-cost-explorer/runtimeConfig.shared.ts +++ b/clients/client-cost-explorer/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CostExplorerClientConfig } from "./CostExplorerClient"; @@ -9,9 +8,9 @@ import { CostExplorerClientConfig } from "./CostExplorerClient"; */ export const getRuntimeConfig = (config: CostExplorerClientConfig) => ({ apiVersion: "2017-10-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Cost Explorer"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Cost Explorer", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-cost-explorer/runtimeConfig.ts b/clients/client-cost-explorer/runtimeConfig.ts index bd89a403be65..cd88f709dde5 100644 --- a/clients/client-cost-explorer/runtimeConfig.ts +++ b/clients/client-cost-explorer/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CostExplorerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-customer-profiles/runtimeConfig.browser.ts b/clients/client-customer-profiles/runtimeConfig.browser.ts index 2d5528cde6cc..5826fce7e40f 100644 --- a/clients/client-customer-profiles/runtimeConfig.browser.ts +++ b/clients/client-customer-profiles/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-customer-profiles/runtimeConfig.native.ts b/clients/client-customer-profiles/runtimeConfig.native.ts index 2ad209846f25..175282252bf5 100644 --- a/clients/client-customer-profiles/runtimeConfig.native.ts +++ b/clients/client-customer-profiles/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { CustomerProfilesClientConfig } from "./CustomerProfilesClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-customer-profiles/runtimeConfig.shared.ts b/clients/client-customer-profiles/runtimeConfig.shared.ts index 0c2d2d4af17a..00928c07418c 100644 --- a/clients/client-customer-profiles/runtimeConfig.shared.ts +++ b/clients/client-customer-profiles/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { CustomerProfilesClientConfig } from "./CustomerProfilesClient"; @@ -9,9 +8,9 @@ import { CustomerProfilesClientConfig } from "./CustomerProfilesClient"; */ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => ({ apiVersion: "2020-08-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Customer Profiles"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Customer Profiles", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-customer-profiles/runtimeConfig.ts b/clients/client-customer-profiles/runtimeConfig.ts index f7c7ac30994a..96b16d9012d6 100644 --- a/clients/client-customer-profiles/runtimeConfig.ts +++ b/clients/client-customer-profiles/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-data-pipeline/runtimeConfig.browser.ts b/clients/client-data-pipeline/runtimeConfig.browser.ts index c2a244cda7c5..13b175e9d717 100644 --- a/clients/client-data-pipeline/runtimeConfig.browser.ts +++ b/clients/client-data-pipeline/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DataPipelineClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-data-pipeline/runtimeConfig.native.ts b/clients/client-data-pipeline/runtimeConfig.native.ts index 0c61638e8cd9..4a19734d1b9b 100644 --- a/clients/client-data-pipeline/runtimeConfig.native.ts +++ b/clients/client-data-pipeline/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DataPipelineClientConfig } from "./DataPipelineClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DataPipelineClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-data-pipeline/runtimeConfig.shared.ts b/clients/client-data-pipeline/runtimeConfig.shared.ts index a6ec2e7111b4..d4338f572b76 100644 --- a/clients/client-data-pipeline/runtimeConfig.shared.ts +++ b/clients/client-data-pipeline/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DataPipelineClientConfig } from "./DataPipelineClient"; @@ -9,9 +8,9 @@ import { DataPipelineClientConfig } from "./DataPipelineClient"; */ export const getRuntimeConfig = (config: DataPipelineClientConfig) => ({ apiVersion: "2012-10-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Data Pipeline"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Data Pipeline", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-data-pipeline/runtimeConfig.ts b/clients/client-data-pipeline/runtimeConfig.ts index 96195bef78f1..b162ec394685 100644 --- a/clients/client-data-pipeline/runtimeConfig.ts +++ b/clients/client-data-pipeline/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DataPipelineClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-database-migration-service/runtimeConfig.browser.ts b/clients/client-database-migration-service/runtimeConfig.browser.ts index c945aafce95a..0af0b4b27b08 100644 --- a/clients/client-database-migration-service/runtimeConfig.browser.ts +++ b/clients/client-database-migration-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) = return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-database-migration-service/runtimeConfig.native.ts b/clients/client-database-migration-service/runtimeConfig.native.ts index 048250220f71..e95a72e99b17 100644 --- a/clients/client-database-migration-service/runtimeConfig.native.ts +++ b/clients/client-database-migration-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DatabaseMigrationServiceClientConfig } from "./DatabaseMigrationServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) = return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-database-migration-service/runtimeConfig.shared.ts b/clients/client-database-migration-service/runtimeConfig.shared.ts index e00aa4e19904..1a22deed676d 100644 --- a/clients/client-database-migration-service/runtimeConfig.shared.ts +++ b/clients/client-database-migration-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DatabaseMigrationServiceClientConfig } from "./DatabaseMigrationServiceClient"; @@ -9,9 +8,9 @@ import { DatabaseMigrationServiceClientConfig } from "./DatabaseMigrationService */ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) => ({ apiVersion: "2016-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Database Migration Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Database Migration Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-database-migration-service/runtimeConfig.ts b/clients/client-database-migration-service/runtimeConfig.ts index e1d082b80715..7809bd5d4cf6 100644 --- a/clients/client-database-migration-service/runtimeConfig.ts +++ b/clients/client-database-migration-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) = return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-databrew/runtimeConfig.browser.ts b/clients/client-databrew/runtimeConfig.browser.ts index e5c053bf9c86..582eba8129b7 100644 --- a/clients/client-databrew/runtimeConfig.browser.ts +++ b/clients/client-databrew/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DataBrewClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-databrew/runtimeConfig.native.ts b/clients/client-databrew/runtimeConfig.native.ts index b9e00b3d4c4c..f80b61ad1227 100644 --- a/clients/client-databrew/runtimeConfig.native.ts +++ b/clients/client-databrew/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DataBrewClientConfig } from "./DataBrewClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DataBrewClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-databrew/runtimeConfig.shared.ts b/clients/client-databrew/runtimeConfig.shared.ts index e4e8983fe35c..112131f119e6 100644 --- a/clients/client-databrew/runtimeConfig.shared.ts +++ b/clients/client-databrew/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DataBrewClientConfig } from "./DataBrewClient"; @@ -9,9 +8,9 @@ import { DataBrewClientConfig } from "./DataBrewClient"; */ export const getRuntimeConfig = (config: DataBrewClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DataBrew"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DataBrew", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-databrew/runtimeConfig.ts b/clients/client-databrew/runtimeConfig.ts index 839e00f0db8a..02ed064cdb33 100644 --- a/clients/client-databrew/runtimeConfig.ts +++ b/clients/client-databrew/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DataBrewClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dataexchange/runtimeConfig.browser.ts b/clients/client-dataexchange/runtimeConfig.browser.ts index c340db953111..7ff33e62d347 100644 --- a/clients/client-dataexchange/runtimeConfig.browser.ts +++ b/clients/client-dataexchange/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DataExchangeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dataexchange/runtimeConfig.native.ts b/clients/client-dataexchange/runtimeConfig.native.ts index bf308de7667e..bf90dbf163a3 100644 --- a/clients/client-dataexchange/runtimeConfig.native.ts +++ b/clients/client-dataexchange/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DataExchangeClientConfig } from "./DataExchangeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DataExchangeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-dataexchange/runtimeConfig.shared.ts b/clients/client-dataexchange/runtimeConfig.shared.ts index 215570e16ba9..068f6cb826e8 100644 --- a/clients/client-dataexchange/runtimeConfig.shared.ts +++ b/clients/client-dataexchange/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DataExchangeClientConfig } from "./DataExchangeClient"; @@ -9,9 +8,9 @@ import { DataExchangeClientConfig } from "./DataExchangeClient"; */ export const getRuntimeConfig = (config: DataExchangeClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DataExchange"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DataExchange", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-dataexchange/runtimeConfig.ts b/clients/client-dataexchange/runtimeConfig.ts index e821ba9ad7f2..3dd25284e8ab 100644 --- a/clients/client-dataexchange/runtimeConfig.ts +++ b/clients/client-dataexchange/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DataExchangeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-datasync/runtimeConfig.browser.ts b/clients/client-datasync/runtimeConfig.browser.ts index 74a2f5c4dff1..685baecac246 100644 --- a/clients/client-datasync/runtimeConfig.browser.ts +++ b/clients/client-datasync/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DataSyncClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-datasync/runtimeConfig.native.ts b/clients/client-datasync/runtimeConfig.native.ts index 29754840f0e4..ebf74f069dee 100644 --- a/clients/client-datasync/runtimeConfig.native.ts +++ b/clients/client-datasync/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DataSyncClientConfig } from "./DataSyncClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DataSyncClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-datasync/runtimeConfig.shared.ts b/clients/client-datasync/runtimeConfig.shared.ts index cb05a5a261fa..f9cdf5b39a91 100644 --- a/clients/client-datasync/runtimeConfig.shared.ts +++ b/clients/client-datasync/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DataSyncClientConfig } from "./DataSyncClient"; @@ -9,9 +8,9 @@ import { DataSyncClientConfig } from "./DataSyncClient"; */ export const getRuntimeConfig = (config: DataSyncClientConfig) => ({ apiVersion: "2018-11-09", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DataSync"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DataSync", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-datasync/runtimeConfig.ts b/clients/client-datasync/runtimeConfig.ts index a3bea7d9b1e4..8de4714b39dd 100644 --- a/clients/client-datasync/runtimeConfig.ts +++ b/clients/client-datasync/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DataSyncClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dax/runtimeConfig.browser.ts b/clients/client-dax/runtimeConfig.browser.ts index 6228da7cb30f..3f16f83bc815 100644 --- a/clients/client-dax/runtimeConfig.browser.ts +++ b/clients/client-dax/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DAXClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dax/runtimeConfig.native.ts b/clients/client-dax/runtimeConfig.native.ts index 1bdbbc26494b..4f358c1accbf 100644 --- a/clients/client-dax/runtimeConfig.native.ts +++ b/clients/client-dax/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DAXClientConfig } from "./DAXClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DAXClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-dax/runtimeConfig.shared.ts b/clients/client-dax/runtimeConfig.shared.ts index 4224d57db56d..ecf9d8c628e5 100644 --- a/clients/client-dax/runtimeConfig.shared.ts +++ b/clients/client-dax/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DAXClientConfig } from "./DAXClient"; @@ -9,9 +8,9 @@ import { DAXClientConfig } from "./DAXClient"; */ export const getRuntimeConfig = (config: DAXClientConfig) => ({ apiVersion: "2017-04-19", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DAX"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DAX", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-dax/runtimeConfig.ts b/clients/client-dax/runtimeConfig.ts index 81e1e2917134..36ee98ff4dfa 100644 --- a/clients/client-dax/runtimeConfig.ts +++ b/clients/client-dax/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DAXClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-detective/runtimeConfig.browser.ts b/clients/client-detective/runtimeConfig.browser.ts index 911a92b5d918..e369172446d6 100644 --- a/clients/client-detective/runtimeConfig.browser.ts +++ b/clients/client-detective/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DetectiveClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-detective/runtimeConfig.native.ts b/clients/client-detective/runtimeConfig.native.ts index 59a82738976a..2fe38d59a5b1 100644 --- a/clients/client-detective/runtimeConfig.native.ts +++ b/clients/client-detective/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DetectiveClientConfig } from "./DetectiveClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DetectiveClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-detective/runtimeConfig.shared.ts b/clients/client-detective/runtimeConfig.shared.ts index 9727b9ba7e1d..cbd3aecdff96 100644 --- a/clients/client-detective/runtimeConfig.shared.ts +++ b/clients/client-detective/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DetectiveClientConfig } from "./DetectiveClient"; @@ -9,9 +8,9 @@ import { DetectiveClientConfig } from "./DetectiveClient"; */ export const getRuntimeConfig = (config: DetectiveClientConfig) => ({ apiVersion: "2018-10-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Detective"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Detective", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-detective/runtimeConfig.ts b/clients/client-detective/runtimeConfig.ts index 026f33698cf5..a44e7ae607b0 100644 --- a/clients/client-detective/runtimeConfig.ts +++ b/clients/client-detective/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DetectiveClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-device-farm/runtimeConfig.browser.ts b/clients/client-device-farm/runtimeConfig.browser.ts index b07fe815dacf..b99c80591613 100644 --- a/clients/client-device-farm/runtimeConfig.browser.ts +++ b/clients/client-device-farm/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-device-farm/runtimeConfig.native.ts b/clients/client-device-farm/runtimeConfig.native.ts index 5dc204a62e75..eac7f43569ec 100644 --- a/clients/client-device-farm/runtimeConfig.native.ts +++ b/clients/client-device-farm/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DeviceFarmClientConfig } from "./DeviceFarmClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-device-farm/runtimeConfig.shared.ts b/clients/client-device-farm/runtimeConfig.shared.ts index 5af9a28fec9c..cf3d897679ce 100644 --- a/clients/client-device-farm/runtimeConfig.shared.ts +++ b/clients/client-device-farm/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DeviceFarmClientConfig } from "./DeviceFarmClient"; @@ -9,9 +8,9 @@ import { DeviceFarmClientConfig } from "./DeviceFarmClient"; */ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => ({ apiVersion: "2015-06-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Device Farm"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Device Farm", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-device-farm/runtimeConfig.ts b/clients/client-device-farm/runtimeConfig.ts index 9aade7e0d6f1..5ce8d1e7bd51 100644 --- a/clients/client-device-farm/runtimeConfig.ts +++ b/clients/client-device-farm/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-devops-guru/runtimeConfig.browser.ts b/clients/client-devops-guru/runtimeConfig.browser.ts index b58ac961424e..36130f9dc5d7 100644 --- a/clients/client-devops-guru/runtimeConfig.browser.ts +++ b/clients/client-devops-guru/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-devops-guru/runtimeConfig.native.ts b/clients/client-devops-guru/runtimeConfig.native.ts index c40957151a73..599aca6bbcb1 100644 --- a/clients/client-devops-guru/runtimeConfig.native.ts +++ b/clients/client-devops-guru/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DevOpsGuruClientConfig } from "./DevOpsGuruClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-devops-guru/runtimeConfig.shared.ts b/clients/client-devops-guru/runtimeConfig.shared.ts index e9190049064f..1e2648d1d593 100644 --- a/clients/client-devops-guru/runtimeConfig.shared.ts +++ b/clients/client-devops-guru/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DevOpsGuruClientConfig } from "./DevOpsGuruClient"; @@ -9,9 +8,9 @@ import { DevOpsGuruClientConfig } from "./DevOpsGuruClient"; */ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => ({ apiVersion: "2020-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DevOps Guru"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DevOps Guru", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-devops-guru/runtimeConfig.ts b/clients/client-devops-guru/runtimeConfig.ts index 2e498ab0f6ce..0ed8efc0c8ca 100644 --- a/clients/client-devops-guru/runtimeConfig.ts +++ b/clients/client-devops-guru/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-direct-connect/runtimeConfig.browser.ts b/clients/client-direct-connect/runtimeConfig.browser.ts index 824482a976b0..709729c7db6c 100644 --- a/clients/client-direct-connect/runtimeConfig.browser.ts +++ b/clients/client-direct-connect/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DirectConnectClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-direct-connect/runtimeConfig.native.ts b/clients/client-direct-connect/runtimeConfig.native.ts index 3341c93d1d5b..0f81b4df9d17 100644 --- a/clients/client-direct-connect/runtimeConfig.native.ts +++ b/clients/client-direct-connect/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DirectConnectClientConfig } from "./DirectConnectClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DirectConnectClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-direct-connect/runtimeConfig.shared.ts b/clients/client-direct-connect/runtimeConfig.shared.ts index 791d2ac74bcf..b80eb3005bef 100644 --- a/clients/client-direct-connect/runtimeConfig.shared.ts +++ b/clients/client-direct-connect/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DirectConnectClientConfig } from "./DirectConnectClient"; @@ -9,9 +8,9 @@ import { DirectConnectClientConfig } from "./DirectConnectClient"; */ export const getRuntimeConfig = (config: DirectConnectClientConfig) => ({ apiVersion: "2012-10-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Direct Connect"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Direct Connect", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-direct-connect/runtimeConfig.ts b/clients/client-direct-connect/runtimeConfig.ts index 87bb983a4d72..2f4eb169ed66 100644 --- a/clients/client-direct-connect/runtimeConfig.ts +++ b/clients/client-direct-connect/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DirectConnectClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-directory-service/runtimeConfig.browser.ts b/clients/client-directory-service/runtimeConfig.browser.ts index b4a7a8759618..be1ee8b3d757 100644 --- a/clients/client-directory-service/runtimeConfig.browser.ts +++ b/clients/client-directory-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-directory-service/runtimeConfig.native.ts b/clients/client-directory-service/runtimeConfig.native.ts index 14fd0adae2b6..f630ed21e32e 100644 --- a/clients/client-directory-service/runtimeConfig.native.ts +++ b/clients/client-directory-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DirectoryServiceClientConfig } from "./DirectoryServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-directory-service/runtimeConfig.shared.ts b/clients/client-directory-service/runtimeConfig.shared.ts index 36fe6b411619..2469ccba760d 100644 --- a/clients/client-directory-service/runtimeConfig.shared.ts +++ b/clients/client-directory-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DirectoryServiceClientConfig } from "./DirectoryServiceClient"; @@ -9,9 +8,9 @@ import { DirectoryServiceClientConfig } from "./DirectoryServiceClient"; */ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => ({ apiVersion: "2015-04-16", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Directory Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Directory Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-directory-service/runtimeConfig.ts b/clients/client-directory-service/runtimeConfig.ts index 284f9105f49f..58934338380b 100644 --- a/clients/client-directory-service/runtimeConfig.ts +++ b/clients/client-directory-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dlm/runtimeConfig.browser.ts b/clients/client-dlm/runtimeConfig.browser.ts index 24fd476ad78f..f08e8c4b24e1 100644 --- a/clients/client-dlm/runtimeConfig.browser.ts +++ b/clients/client-dlm/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DLMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dlm/runtimeConfig.native.ts b/clients/client-dlm/runtimeConfig.native.ts index 19d3d7c44435..d6aa44181ac8 100644 --- a/clients/client-dlm/runtimeConfig.native.ts +++ b/clients/client-dlm/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DLMClientConfig } from "./DLMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DLMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-dlm/runtimeConfig.shared.ts b/clients/client-dlm/runtimeConfig.shared.ts index f69992be4b8a..33c003f3a2aa 100644 --- a/clients/client-dlm/runtimeConfig.shared.ts +++ b/clients/client-dlm/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DLMClientConfig } from "./DLMClient"; @@ -9,9 +8,9 @@ import { DLMClientConfig } from "./DLMClient"; */ export const getRuntimeConfig = (config: DLMClientConfig) => ({ apiVersion: "2018-01-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DLM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DLM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-dlm/runtimeConfig.ts b/clients/client-dlm/runtimeConfig.ts index c9239cb7424b..8d24cbaa34ce 100644 --- a/clients/client-dlm/runtimeConfig.ts +++ b/clients/client-dlm/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DLMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-docdb/runtimeConfig.browser.ts b/clients/client-docdb/runtimeConfig.browser.ts index 0d6993865827..ffd88107c7d0 100644 --- a/clients/client-docdb/runtimeConfig.browser.ts +++ b/clients/client-docdb/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DocDBClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-docdb/runtimeConfig.native.ts b/clients/client-docdb/runtimeConfig.native.ts index 76cc64843994..45d20275def3 100644 --- a/clients/client-docdb/runtimeConfig.native.ts +++ b/clients/client-docdb/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DocDBClientConfig } from "./DocDBClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DocDBClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-docdb/runtimeConfig.shared.ts b/clients/client-docdb/runtimeConfig.shared.ts index 084c2ca80b6f..a8c2ae41a4b1 100644 --- a/clients/client-docdb/runtimeConfig.shared.ts +++ b/clients/client-docdb/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DocDBClientConfig } from "./DocDBClient"; @@ -9,9 +8,9 @@ import { DocDBClientConfig } from "./DocDBClient"; */ export const getRuntimeConfig = (config: DocDBClientConfig) => ({ apiVersion: "2014-10-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DocDB"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DocDB", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-docdb/runtimeConfig.ts b/clients/client-docdb/runtimeConfig.ts index 4e405ac5778b..1500f927bbaa 100644 --- a/clients/client-docdb/runtimeConfig.ts +++ b/clients/client-docdb/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DocDBClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dynamodb-streams/runtimeConfig.browser.ts b/clients/client-dynamodb-streams/runtimeConfig.browser.ts index b7cda4136388..546c16de03a3 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.browser.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dynamodb-streams/runtimeConfig.native.ts b/clients/client-dynamodb-streams/runtimeConfig.native.ts index f6a066129dba..ed5218b7641c 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.native.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DynamoDBStreamsClientConfig } from "./DynamoDBStreamsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-dynamodb-streams/runtimeConfig.shared.ts b/clients/client-dynamodb-streams/runtimeConfig.shared.ts index ca6917dcc646..dee631eccef1 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.shared.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DynamoDBStreamsClientConfig } from "./DynamoDBStreamsClient"; @@ -9,9 +8,9 @@ import { DynamoDBStreamsClientConfig } from "./DynamoDBStreamsClient"; */ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => ({ apiVersion: "2012-08-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DynamoDB Streams"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DynamoDB Streams", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-dynamodb-streams/runtimeConfig.ts b/clients/client-dynamodb-streams/runtimeConfig.ts index 017a0c90033d..31bde3af14bf 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dynamodb/runtimeConfig.browser.ts b/clients/client-dynamodb/runtimeConfig.browser.ts index 8fc83b6151b1..62a984ec4062 100644 --- a/clients/client-dynamodb/runtimeConfig.browser.ts +++ b/clients/client-dynamodb/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,27 +19,22 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - endpointDiscoveryEnabledProvider: coalesce(config.endpointDiscoveryEnabledProvider, () => - Promise.resolve(undefined) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + endpointDiscoveryEnabledProvider: config.endpointDiscoveryEnabledProvider ?? (() => Promise.resolve(undefined)), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-dynamodb/runtimeConfig.native.ts b/clients/client-dynamodb/runtimeConfig.native.ts index 25740861703b..a1defe39de9d 100644 --- a/clients/client-dynamodb/runtimeConfig.native.ts +++ b/clients/client-dynamodb/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { DynamoDBClientConfig } from "./DynamoDBClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-dynamodb/runtimeConfig.shared.ts b/clients/client-dynamodb/runtimeConfig.shared.ts index 50db37959f50..aab6347f744b 100644 --- a/clients/client-dynamodb/runtimeConfig.shared.ts +++ b/clients/client-dynamodb/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { DynamoDBClientConfig } from "./DynamoDBClient"; @@ -9,9 +8,9 @@ import { DynamoDBClientConfig } from "./DynamoDBClient"; */ export const getRuntimeConfig = (config: DynamoDBClientConfig) => ({ apiVersion: "2012-08-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "DynamoDB"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "DynamoDB", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-dynamodb/runtimeConfig.ts b/clients/client-dynamodb/runtimeConfig.ts index 02062b80f4dc..7a5de90ab683 100644 --- a/clients/client-dynamodb/runtimeConfig.ts +++ b/clients/client-dynamodb/runtimeConfig.ts @@ -8,7 +8,6 @@ import { NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS } from "@aws-sdk/middleware-endp import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -24,28 +23,23 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - endpointDiscoveryEnabledProvider: coalesce( - config.endpointDiscoveryEnabledProvider, - loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + endpointDiscoveryEnabledProvider: + config.endpointDiscoveryEnabledProvider ?? loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ebs/runtimeConfig.browser.ts b/clients/client-ebs/runtimeConfig.browser.ts index be9b4ebe64fc..8cbd86a3959e 100644 --- a/clients/client-ebs/runtimeConfig.browser.ts +++ b/clients/client-ebs/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ebs/runtimeConfig.native.ts b/clients/client-ebs/runtimeConfig.native.ts index 4fbda83098a6..84748112b2a0 100644 --- a/clients/client-ebs/runtimeConfig.native.ts +++ b/clients/client-ebs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EBSClientConfig } from "./EBSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ebs/runtimeConfig.shared.ts b/clients/client-ebs/runtimeConfig.shared.ts index bf7683b8458a..55b67ca11295 100644 --- a/clients/client-ebs/runtimeConfig.shared.ts +++ b/clients/client-ebs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EBSClientConfig } from "./EBSClient"; @@ -9,9 +8,9 @@ import { EBSClientConfig } from "./EBSClient"; */ export const getRuntimeConfig = (config: EBSClientConfig) => ({ apiVersion: "2019-11-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EBS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EBS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ebs/runtimeConfig.ts b/clients/client-ebs/runtimeConfig.ts index b0dbf48d137e..99b7c90218fb 100644 --- a/clients/client-ebs/runtimeConfig.ts +++ b/clients/client-ebs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ec2-instance-connect/runtimeConfig.browser.ts b/clients/client-ec2-instance-connect/runtimeConfig.browser.ts index 430c6992e516..0ed9a7d37fba 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.browser.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ec2-instance-connect/runtimeConfig.native.ts b/clients/client-ec2-instance-connect/runtimeConfig.native.ts index f31e91adfba2..01fb4e780b29 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.native.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EC2InstanceConnectClientConfig } from "./EC2InstanceConnectClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ec2-instance-connect/runtimeConfig.shared.ts b/clients/client-ec2-instance-connect/runtimeConfig.shared.ts index e9369207b967..130909cc5837 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.shared.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EC2InstanceConnectClientConfig } from "./EC2InstanceConnectClient"; @@ -9,9 +8,9 @@ import { EC2InstanceConnectClientConfig } from "./EC2InstanceConnectClient"; */ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => ({ apiVersion: "2018-04-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EC2 Instance Connect"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EC2 Instance Connect", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ec2-instance-connect/runtimeConfig.ts b/clients/client-ec2-instance-connect/runtimeConfig.ts index 51c9a952aa2c..24ddf94d1806 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ec2/runtimeConfig.browser.ts b/clients/client-ec2/runtimeConfig.browser.ts index b3334bc42482..e0bd4227defe 100644 --- a/clients/client-ec2/runtimeConfig.browser.ts +++ b/clients/client-ec2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ec2/runtimeConfig.native.ts b/clients/client-ec2/runtimeConfig.native.ts index cdd4483a7c53..f9db094c1655 100644 --- a/clients/client-ec2/runtimeConfig.native.ts +++ b/clients/client-ec2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EC2ClientConfig } from "./EC2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ec2/runtimeConfig.shared.ts b/clients/client-ec2/runtimeConfig.shared.ts index 8b482c343394..6caa26acd132 100644 --- a/clients/client-ec2/runtimeConfig.shared.ts +++ b/clients/client-ec2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EC2ClientConfig } from "./EC2Client"; @@ -9,9 +8,9 @@ import { EC2ClientConfig } from "./EC2Client"; */ export const getRuntimeConfig = (config: EC2ClientConfig) => ({ apiVersion: "2016-11-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EC2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EC2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ec2/runtimeConfig.ts b/clients/client-ec2/runtimeConfig.ts index 172655c3317e..feab4e127a74 100644 --- a/clients/client-ec2/runtimeConfig.ts +++ b/clients/client-ec2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ecr-public/runtimeConfig.browser.ts b/clients/client-ecr-public/runtimeConfig.browser.ts index bb51fc55dd25..2d2e9b87c9c7 100644 --- a/clients/client-ecr-public/runtimeConfig.browser.ts +++ b/clients/client-ecr-public/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ecr-public/runtimeConfig.native.ts b/clients/client-ecr-public/runtimeConfig.native.ts index 8dc4c8e7b74d..0395b65c5e03 100644 --- a/clients/client-ecr-public/runtimeConfig.native.ts +++ b/clients/client-ecr-public/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ECRPUBLICClientConfig } from "./ECRPUBLICClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ecr-public/runtimeConfig.shared.ts b/clients/client-ecr-public/runtimeConfig.shared.ts index d23efee0458a..b5f610186b74 100644 --- a/clients/client-ecr-public/runtimeConfig.shared.ts +++ b/clients/client-ecr-public/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ECRPUBLICClientConfig } from "./ECRPUBLICClient"; @@ -9,9 +8,9 @@ import { ECRPUBLICClientConfig } from "./ECRPUBLICClient"; */ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => ({ apiVersion: "2020-10-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ECR PUBLIC"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ECR PUBLIC", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ecr-public/runtimeConfig.ts b/clients/client-ecr-public/runtimeConfig.ts index d5e531eecb5f..8fed787ba92c 100644 --- a/clients/client-ecr-public/runtimeConfig.ts +++ b/clients/client-ecr-public/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ecr/runtimeConfig.browser.ts b/clients/client-ecr/runtimeConfig.browser.ts index 62d609e57fdc..e28a58938926 100644 --- a/clients/client-ecr/runtimeConfig.browser.ts +++ b/clients/client-ecr/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ECRClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ecr/runtimeConfig.native.ts b/clients/client-ecr/runtimeConfig.native.ts index 70d12c470e70..a76a3742be46 100644 --- a/clients/client-ecr/runtimeConfig.native.ts +++ b/clients/client-ecr/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ECRClientConfig } from "./ECRClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ECRClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ecr/runtimeConfig.shared.ts b/clients/client-ecr/runtimeConfig.shared.ts index e7a53398f8dc..144f0c864b48 100644 --- a/clients/client-ecr/runtimeConfig.shared.ts +++ b/clients/client-ecr/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ECRClientConfig } from "./ECRClient"; @@ -9,9 +8,9 @@ import { ECRClientConfig } from "./ECRClient"; */ export const getRuntimeConfig = (config: ECRClientConfig) => ({ apiVersion: "2015-09-21", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ECR"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ECR", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ecr/runtimeConfig.ts b/clients/client-ecr/runtimeConfig.ts index 6a239462849a..90f87f0c1608 100644 --- a/clients/client-ecr/runtimeConfig.ts +++ b/clients/client-ecr/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ECRClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ecs/runtimeConfig.browser.ts b/clients/client-ecs/runtimeConfig.browser.ts index fcb41b8305e0..7fa548a98841 100644 --- a/clients/client-ecs/runtimeConfig.browser.ts +++ b/clients/client-ecs/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ECSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ecs/runtimeConfig.native.ts b/clients/client-ecs/runtimeConfig.native.ts index f39aa5813283..2c8276025554 100644 --- a/clients/client-ecs/runtimeConfig.native.ts +++ b/clients/client-ecs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ECSClientConfig } from "./ECSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ECSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ecs/runtimeConfig.shared.ts b/clients/client-ecs/runtimeConfig.shared.ts index 1903832b65f7..3ac2f4389a53 100644 --- a/clients/client-ecs/runtimeConfig.shared.ts +++ b/clients/client-ecs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ECSClientConfig } from "./ECSClient"; @@ -9,9 +8,9 @@ import { ECSClientConfig } from "./ECSClient"; */ export const getRuntimeConfig = (config: ECSClientConfig) => ({ apiVersion: "2014-11-13", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ECS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ECS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ecs/runtimeConfig.ts b/clients/client-ecs/runtimeConfig.ts index 706ed44a5a4e..cc8dffe7df60 100644 --- a/clients/client-ecs/runtimeConfig.ts +++ b/clients/client-ecs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ECSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-efs/runtimeConfig.browser.ts b/clients/client-efs/runtimeConfig.browser.ts index 805ebc4f07ee..03de71207550 100644 --- a/clients/client-efs/runtimeConfig.browser.ts +++ b/clients/client-efs/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EFSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-efs/runtimeConfig.native.ts b/clients/client-efs/runtimeConfig.native.ts index c28070a5e0f8..4ca0cbfd389a 100644 --- a/clients/client-efs/runtimeConfig.native.ts +++ b/clients/client-efs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EFSClientConfig } from "./EFSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EFSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-efs/runtimeConfig.shared.ts b/clients/client-efs/runtimeConfig.shared.ts index b0b8409a1361..d1e66f6d3774 100644 --- a/clients/client-efs/runtimeConfig.shared.ts +++ b/clients/client-efs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EFSClientConfig } from "./EFSClient"; @@ -9,9 +8,9 @@ import { EFSClientConfig } from "./EFSClient"; */ export const getRuntimeConfig = (config: EFSClientConfig) => ({ apiVersion: "2015-02-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EFS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EFS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-efs/runtimeConfig.ts b/clients/client-efs/runtimeConfig.ts index ccbddc00e54a..63df74b84c37 100644 --- a/clients/client-efs/runtimeConfig.ts +++ b/clients/client-efs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EFSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-eks/runtimeConfig.browser.ts b/clients/client-eks/runtimeConfig.browser.ts index ea2803b7e022..5c66b7fa9ce7 100644 --- a/clients/client-eks/runtimeConfig.browser.ts +++ b/clients/client-eks/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EKSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-eks/runtimeConfig.native.ts b/clients/client-eks/runtimeConfig.native.ts index 46322dfbfbe8..26c869d53fd3 100644 --- a/clients/client-eks/runtimeConfig.native.ts +++ b/clients/client-eks/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EKSClientConfig } from "./EKSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EKSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-eks/runtimeConfig.shared.ts b/clients/client-eks/runtimeConfig.shared.ts index ad95a430ba3d..a3bfa26157b5 100644 --- a/clients/client-eks/runtimeConfig.shared.ts +++ b/clients/client-eks/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EKSClientConfig } from "./EKSClient"; @@ -9,9 +8,9 @@ import { EKSClientConfig } from "./EKSClient"; */ export const getRuntimeConfig = (config: EKSClientConfig) => ({ apiVersion: "2017-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EKS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EKS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-eks/runtimeConfig.ts b/clients/client-eks/runtimeConfig.ts index 385535df4dbc..cd67ea7ce8bf 100644 --- a/clients/client-eks/runtimeConfig.ts +++ b/clients/client-eks/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EKSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-beanstalk/runtimeConfig.browser.ts b/clients/client-elastic-beanstalk/runtimeConfig.browser.ts index 6b6f5803100e..63d2fda584ae 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.browser.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-beanstalk/runtimeConfig.native.ts b/clients/client-elastic-beanstalk/runtimeConfig.native.ts index 5a1d8137327a..7ee21cc6fc02 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.native.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElasticBeanstalkClientConfig } from "./ElasticBeanstalkClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elastic-beanstalk/runtimeConfig.shared.ts b/clients/client-elastic-beanstalk/runtimeConfig.shared.ts index 10ae99bbd83f..ef06e8a029b9 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.shared.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElasticBeanstalkClientConfig } from "./ElasticBeanstalkClient"; @@ -9,9 +8,9 @@ import { ElasticBeanstalkClientConfig } from "./ElasticBeanstalkClient"; */ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => ({ apiVersion: "2010-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Elastic Beanstalk"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Elastic Beanstalk", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elastic-beanstalk/runtimeConfig.ts b/clients/client-elastic-beanstalk/runtimeConfig.ts index dbf6c8f11564..28bea3383c9d 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-inference/runtimeConfig.browser.ts b/clients/client-elastic-inference/runtimeConfig.browser.ts index 2e65a8bb7787..760e60c653ac 100644 --- a/clients/client-elastic-inference/runtimeConfig.browser.ts +++ b/clients/client-elastic-inference/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-inference/runtimeConfig.native.ts b/clients/client-elastic-inference/runtimeConfig.native.ts index 9ab69006cdbf..5d70e176ce17 100644 --- a/clients/client-elastic-inference/runtimeConfig.native.ts +++ b/clients/client-elastic-inference/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElasticInferenceClientConfig } from "./ElasticInferenceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elastic-inference/runtimeConfig.shared.ts b/clients/client-elastic-inference/runtimeConfig.shared.ts index 505452b4a8cc..c7bc71743b1f 100644 --- a/clients/client-elastic-inference/runtimeConfig.shared.ts +++ b/clients/client-elastic-inference/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElasticInferenceClientConfig } from "./ElasticInferenceClient"; @@ -9,9 +8,9 @@ import { ElasticInferenceClientConfig } from "./ElasticInferenceClient"; */ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Elastic Inference"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Elastic Inference", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elastic-inference/runtimeConfig.ts b/clients/client-elastic-inference/runtimeConfig.ts index fd67f402027c..c5844fa83c47 100644 --- a/clients/client-elastic-inference/runtimeConfig.ts +++ b/clients/client-elastic-inference/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts index b60a396d8743..8fbb1f94777e 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts index f0061b1cdec3..c4856bd680fa 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElasticLoadBalancingV2ClientConfig } from "./ElasticLoadBalancingV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.shared.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.shared.ts index e7376ed8f29e..52cf89c11119 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.shared.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElasticLoadBalancingV2ClientConfig } from "./ElasticLoadBalancingV2Client"; @@ -9,9 +8,9 @@ import { ElasticLoadBalancingV2ClientConfig } from "./ElasticLoadBalancingV2Clie */ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => ({ apiVersion: "2015-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Elastic Load Balancing v2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Elastic Load Balancing v2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.ts index 6821fa685271..551077522070 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-load-balancing/runtimeConfig.browser.ts b/clients/client-elastic-load-balancing/runtimeConfig.browser.ts index a4c27af53c91..d177fe44d1b7 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.browser.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-load-balancing/runtimeConfig.native.ts b/clients/client-elastic-load-balancing/runtimeConfig.native.ts index 98e06446363c..0e7adb89c828 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.native.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElasticLoadBalancingClientConfig } from "./ElasticLoadBalancingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elastic-load-balancing/runtimeConfig.shared.ts b/clients/client-elastic-load-balancing/runtimeConfig.shared.ts index 523379a18102..c76e8fefc7e2 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.shared.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElasticLoadBalancingClientConfig } from "./ElasticLoadBalancingClient"; @@ -9,9 +8,9 @@ import { ElasticLoadBalancingClientConfig } from "./ElasticLoadBalancingClient"; */ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => ({ apiVersion: "2012-06-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Elastic Load Balancing"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Elastic Load Balancing", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elastic-load-balancing/runtimeConfig.ts b/clients/client-elastic-load-balancing/runtimeConfig.ts index 8d2740e983a6..c058065572c9 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-transcoder/runtimeConfig.browser.ts b/clients/client-elastic-transcoder/runtimeConfig.browser.ts index 3b2e5fefbb5e..a84e0437cbd8 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.browser.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elastic-transcoder/runtimeConfig.native.ts b/clients/client-elastic-transcoder/runtimeConfig.native.ts index 034011c2a5d3..14fc1972ade0 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.native.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElasticTranscoderClientConfig } from "./ElasticTranscoderClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elastic-transcoder/runtimeConfig.shared.ts b/clients/client-elastic-transcoder/runtimeConfig.shared.ts index e2b3407dd310..8b932fecaf18 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.shared.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElasticTranscoderClientConfig } from "./ElasticTranscoderClient"; @@ -9,9 +8,9 @@ import { ElasticTranscoderClientConfig } from "./ElasticTranscoderClient"; */ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => ({ apiVersion: "2012-09-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Elastic Transcoder"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Elastic Transcoder", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elastic-transcoder/runtimeConfig.ts b/clients/client-elastic-transcoder/runtimeConfig.ts index fd54a4c03d76..8a845154b2f4 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elasticache/runtimeConfig.browser.ts b/clients/client-elasticache/runtimeConfig.browser.ts index 57957c140e63..adaa1d0ffb05 100644 --- a/clients/client-elasticache/runtimeConfig.browser.ts +++ b/clients/client-elasticache/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elasticache/runtimeConfig.native.ts b/clients/client-elasticache/runtimeConfig.native.ts index 056c3bd7a1ca..caeae680686f 100644 --- a/clients/client-elasticache/runtimeConfig.native.ts +++ b/clients/client-elasticache/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElastiCacheClientConfig } from "./ElastiCacheClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elasticache/runtimeConfig.shared.ts b/clients/client-elasticache/runtimeConfig.shared.ts index fc5beeb4817b..861fb559db63 100644 --- a/clients/client-elasticache/runtimeConfig.shared.ts +++ b/clients/client-elasticache/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElastiCacheClientConfig } from "./ElastiCacheClient"; @@ -9,9 +8,9 @@ import { ElastiCacheClientConfig } from "./ElastiCacheClient"; */ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => ({ apiVersion: "2015-02-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ElastiCache"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ElastiCache", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elasticache/runtimeConfig.ts b/clients/client-elasticache/runtimeConfig.ts index 8caa837b38d2..1c8e8cdf2311 100644 --- a/clients/client-elasticache/runtimeConfig.ts +++ b/clients/client-elasticache/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elasticsearch-service/runtimeConfig.browser.ts b/clients/client-elasticsearch-service/runtimeConfig.browser.ts index ec0e50b0e13a..e0ab494fd388 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.browser.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-elasticsearch-service/runtimeConfig.native.ts b/clients/client-elasticsearch-service/runtimeConfig.native.ts index 8e40095a93c8..043e0d5ba1f7 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.native.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ElasticsearchServiceClientConfig } from "./ElasticsearchServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-elasticsearch-service/runtimeConfig.shared.ts b/clients/client-elasticsearch-service/runtimeConfig.shared.ts index 3ecd54216d98..2e8e06dbb675 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.shared.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ElasticsearchServiceClientConfig } from "./ElasticsearchServiceClient"; @@ -9,9 +8,9 @@ import { ElasticsearchServiceClientConfig } from "./ElasticsearchServiceClient"; */ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => ({ apiVersion: "2015-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Elasticsearch Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Elasticsearch Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-elasticsearch-service/runtimeConfig.ts b/clients/client-elasticsearch-service/runtimeConfig.ts index 20a594ac6892..211842b7595a 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-emr-containers/runtimeConfig.browser.ts b/clients/client-emr-containers/runtimeConfig.browser.ts index 2d994da08c0b..d30c4e6a6e03 100644 --- a/clients/client-emr-containers/runtimeConfig.browser.ts +++ b/clients/client-emr-containers/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EMRContainersClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-emr-containers/runtimeConfig.native.ts b/clients/client-emr-containers/runtimeConfig.native.ts index 0c1068696647..ed7cb675b5ff 100644 --- a/clients/client-emr-containers/runtimeConfig.native.ts +++ b/clients/client-emr-containers/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EMRContainersClientConfig } from "./EMRContainersClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EMRContainersClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-emr-containers/runtimeConfig.shared.ts b/clients/client-emr-containers/runtimeConfig.shared.ts index 96666485bb45..6660f5cfbe75 100644 --- a/clients/client-emr-containers/runtimeConfig.shared.ts +++ b/clients/client-emr-containers/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EMRContainersClientConfig } from "./EMRContainersClient"; @@ -9,9 +8,9 @@ import { EMRContainersClientConfig } from "./EMRContainersClient"; */ export const getRuntimeConfig = (config: EMRContainersClientConfig) => ({ apiVersion: "2020-10-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EMR containers"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EMR containers", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-emr-containers/runtimeConfig.ts b/clients/client-emr-containers/runtimeConfig.ts index 8e7d6e5d26e4..1da38dbe7ee5 100644 --- a/clients/client-emr-containers/runtimeConfig.ts +++ b/clients/client-emr-containers/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EMRContainersClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-emr/runtimeConfig.browser.ts b/clients/client-emr/runtimeConfig.browser.ts index 2efa4794061c..630912f02d25 100644 --- a/clients/client-emr/runtimeConfig.browser.ts +++ b/clients/client-emr/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EMRClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-emr/runtimeConfig.native.ts b/clients/client-emr/runtimeConfig.native.ts index 163987ae525a..46ff651484c7 100644 --- a/clients/client-emr/runtimeConfig.native.ts +++ b/clients/client-emr/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EMRClientConfig } from "./EMRClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EMRClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-emr/runtimeConfig.shared.ts b/clients/client-emr/runtimeConfig.shared.ts index 0d9c66b6b0b9..7eb98c1bfe76 100644 --- a/clients/client-emr/runtimeConfig.shared.ts +++ b/clients/client-emr/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EMRClientConfig } from "./EMRClient"; @@ -9,9 +8,9 @@ import { EMRClientConfig } from "./EMRClient"; */ export const getRuntimeConfig = (config: EMRClientConfig) => ({ apiVersion: "2009-03-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EMR"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EMR", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-emr/runtimeConfig.ts b/clients/client-emr/runtimeConfig.ts index 82bd0ca8466a..eb91c3b5a374 100644 --- a/clients/client-emr/runtimeConfig.ts +++ b/clients/client-emr/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EMRClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-eventbridge/runtimeConfig.browser.ts b/clients/client-eventbridge/runtimeConfig.browser.ts index 852e3cbf0293..b7e9e4f9a70e 100644 --- a/clients/client-eventbridge/runtimeConfig.browser.ts +++ b/clients/client-eventbridge/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: EventBridgeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-eventbridge/runtimeConfig.native.ts b/clients/client-eventbridge/runtimeConfig.native.ts index d19ba27cdb34..df32d3921220 100644 --- a/clients/client-eventbridge/runtimeConfig.native.ts +++ b/clients/client-eventbridge/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EventBridgeClientConfig } from "./EventBridgeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EventBridgeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-eventbridge/runtimeConfig.shared.ts b/clients/client-eventbridge/runtimeConfig.shared.ts index 7073ca9a32a1..95c827eb66e1 100644 --- a/clients/client-eventbridge/runtimeConfig.shared.ts +++ b/clients/client-eventbridge/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EventBridgeClientConfig } from "./EventBridgeClient"; @@ -9,9 +8,9 @@ import { EventBridgeClientConfig } from "./EventBridgeClient"; */ export const getRuntimeConfig = (config: EventBridgeClientConfig) => ({ apiVersion: "2015-10-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EventBridge"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EventBridge", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-eventbridge/runtimeConfig.ts b/clients/client-eventbridge/runtimeConfig.ts index 0dade41b8987..1415ac46ae6f 100644 --- a/clients/client-eventbridge/runtimeConfig.ts +++ b/clients/client-eventbridge/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: EventBridgeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-finspace-data/runtimeConfig.browser.ts b/clients/client-finspace-data/runtimeConfig.browser.ts index bc5f468181da..ccb6758e9a51 100644 --- a/clients/client-finspace-data/runtimeConfig.browser.ts +++ b/clients/client-finspace-data/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-finspace-data/runtimeConfig.native.ts b/clients/client-finspace-data/runtimeConfig.native.ts index e3ddd8e060ee..73bc2fcac328 100644 --- a/clients/client-finspace-data/runtimeConfig.native.ts +++ b/clients/client-finspace-data/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FinspaceDataClientConfig } from "./FinspaceDataClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-finspace-data/runtimeConfig.shared.ts b/clients/client-finspace-data/runtimeConfig.shared.ts index 38de2432e649..b4cd2f4e8684 100644 --- a/clients/client-finspace-data/runtimeConfig.shared.ts +++ b/clients/client-finspace-data/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FinspaceDataClientConfig } from "./FinspaceDataClient"; @@ -9,9 +8,9 @@ import { FinspaceDataClientConfig } from "./FinspaceDataClient"; */ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => ({ apiVersion: "2020-07-13", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "finspace data"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "finspace data", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-finspace-data/runtimeConfig.ts b/clients/client-finspace-data/runtimeConfig.ts index 0e5d525f4394..b34478ea15e2 100644 --- a/clients/client-finspace-data/runtimeConfig.ts +++ b/clients/client-finspace-data/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-finspace/runtimeConfig.browser.ts b/clients/client-finspace/runtimeConfig.browser.ts index b9428233d2be..7c18d94135ea 100644 --- a/clients/client-finspace/runtimeConfig.browser.ts +++ b/clients/client-finspace/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FinspaceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-finspace/runtimeConfig.native.ts b/clients/client-finspace/runtimeConfig.native.ts index 2c18dee7e37d..59bbfd81e195 100644 --- a/clients/client-finspace/runtimeConfig.native.ts +++ b/clients/client-finspace/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FinspaceClientConfig } from "./FinspaceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FinspaceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-finspace/runtimeConfig.shared.ts b/clients/client-finspace/runtimeConfig.shared.ts index a8cf08d1c462..4d2b7949be89 100644 --- a/clients/client-finspace/runtimeConfig.shared.ts +++ b/clients/client-finspace/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FinspaceClientConfig } from "./FinspaceClient"; @@ -9,9 +8,9 @@ import { FinspaceClientConfig } from "./FinspaceClient"; */ export const getRuntimeConfig = (config: FinspaceClientConfig) => ({ apiVersion: "2021-03-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "finspace"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "finspace", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-finspace/runtimeConfig.ts b/clients/client-finspace/runtimeConfig.ts index db78c2011f3c..d6a5286deda4 100644 --- a/clients/client-finspace/runtimeConfig.ts +++ b/clients/client-finspace/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FinspaceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-firehose/runtimeConfig.browser.ts b/clients/client-firehose/runtimeConfig.browser.ts index 70799f5bfaa2..4af3caae3a6a 100644 --- a/clients/client-firehose/runtimeConfig.browser.ts +++ b/clients/client-firehose/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FirehoseClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-firehose/runtimeConfig.native.ts b/clients/client-firehose/runtimeConfig.native.ts index 41ae1e006c6e..675d7a838d20 100644 --- a/clients/client-firehose/runtimeConfig.native.ts +++ b/clients/client-firehose/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FirehoseClientConfig } from "./FirehoseClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FirehoseClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-firehose/runtimeConfig.shared.ts b/clients/client-firehose/runtimeConfig.shared.ts index a22dbf3c9b6d..cd59da498c54 100644 --- a/clients/client-firehose/runtimeConfig.shared.ts +++ b/clients/client-firehose/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FirehoseClientConfig } from "./FirehoseClient"; @@ -9,9 +8,9 @@ import { FirehoseClientConfig } from "./FirehoseClient"; */ export const getRuntimeConfig = (config: FirehoseClientConfig) => ({ apiVersion: "2015-08-04", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Firehose"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Firehose", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-firehose/runtimeConfig.ts b/clients/client-firehose/runtimeConfig.ts index 855f775db611..3fc4a83f8170 100644 --- a/clients/client-firehose/runtimeConfig.ts +++ b/clients/client-firehose/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FirehoseClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-fis/runtimeConfig.browser.ts b/clients/client-fis/runtimeConfig.browser.ts index efcb64964b2a..e897b5205b63 100644 --- a/clients/client-fis/runtimeConfig.browser.ts +++ b/clients/client-fis/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FisClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-fis/runtimeConfig.native.ts b/clients/client-fis/runtimeConfig.native.ts index 620186b13efa..e2ce1ee81f16 100644 --- a/clients/client-fis/runtimeConfig.native.ts +++ b/clients/client-fis/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FisClientConfig } from "./FisClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FisClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-fis/runtimeConfig.shared.ts b/clients/client-fis/runtimeConfig.shared.ts index 6e10f41cba4a..817d2bc8927a 100644 --- a/clients/client-fis/runtimeConfig.shared.ts +++ b/clients/client-fis/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FisClientConfig } from "./FisClient"; @@ -9,9 +8,9 @@ import { FisClientConfig } from "./FisClient"; */ export const getRuntimeConfig = (config: FisClientConfig) => ({ apiVersion: "2020-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "fis"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "fis", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-fis/runtimeConfig.ts b/clients/client-fis/runtimeConfig.ts index 21ff5f9159f0..5ff4d9e3e995 100644 --- a/clients/client-fis/runtimeConfig.ts +++ b/clients/client-fis/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FisClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-fms/runtimeConfig.browser.ts b/clients/client-fms/runtimeConfig.browser.ts index 3a04d3ae250e..3375d8c3c0d5 100644 --- a/clients/client-fms/runtimeConfig.browser.ts +++ b/clients/client-fms/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FMSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-fms/runtimeConfig.native.ts b/clients/client-fms/runtimeConfig.native.ts index b5cb15635c2b..2dda547918f9 100644 --- a/clients/client-fms/runtimeConfig.native.ts +++ b/clients/client-fms/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FMSClientConfig } from "./FMSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FMSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-fms/runtimeConfig.shared.ts b/clients/client-fms/runtimeConfig.shared.ts index c53e422bae45..d53ed016bbb3 100644 --- a/clients/client-fms/runtimeConfig.shared.ts +++ b/clients/client-fms/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FMSClientConfig } from "./FMSClient"; @@ -9,9 +8,9 @@ import { FMSClientConfig } from "./FMSClient"; */ export const getRuntimeConfig = (config: FMSClientConfig) => ({ apiVersion: "2018-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "FMS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "FMS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-fms/runtimeConfig.ts b/clients/client-fms/runtimeConfig.ts index a4d9143000c7..2fb4abdb2d05 100644 --- a/clients/client-fms/runtimeConfig.ts +++ b/clients/client-fms/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FMSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-forecast/runtimeConfig.browser.ts b/clients/client-forecast/runtimeConfig.browser.ts index 009e7cb082bd..45697fc35554 100644 --- a/clients/client-forecast/runtimeConfig.browser.ts +++ b/clients/client-forecast/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ForecastClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-forecast/runtimeConfig.native.ts b/clients/client-forecast/runtimeConfig.native.ts index 6e03b1a3603a..f108667776f1 100644 --- a/clients/client-forecast/runtimeConfig.native.ts +++ b/clients/client-forecast/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ForecastClientConfig } from "./ForecastClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ForecastClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-forecast/runtimeConfig.shared.ts b/clients/client-forecast/runtimeConfig.shared.ts index 6acedd3e5493..5cb077f9dc82 100644 --- a/clients/client-forecast/runtimeConfig.shared.ts +++ b/clients/client-forecast/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ForecastClientConfig } from "./ForecastClient"; @@ -9,9 +8,9 @@ import { ForecastClientConfig } from "./ForecastClient"; */ export const getRuntimeConfig = (config: ForecastClientConfig) => ({ apiVersion: "2018-06-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "forecast"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "forecast", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-forecast/runtimeConfig.ts b/clients/client-forecast/runtimeConfig.ts index d6081bc8e3db..dd69f568c52e 100644 --- a/clients/client-forecast/runtimeConfig.ts +++ b/clients/client-forecast/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ForecastClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-forecastquery/runtimeConfig.browser.ts b/clients/client-forecastquery/runtimeConfig.browser.ts index 6fd6ac0154d9..6b8833566c21 100644 --- a/clients/client-forecastquery/runtimeConfig.browser.ts +++ b/clients/client-forecastquery/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-forecastquery/runtimeConfig.native.ts b/clients/client-forecastquery/runtimeConfig.native.ts index d47804eb07fb..1d773bb1b4b8 100644 --- a/clients/client-forecastquery/runtimeConfig.native.ts +++ b/clients/client-forecastquery/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ForecastqueryClientConfig } from "./ForecastqueryClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-forecastquery/runtimeConfig.shared.ts b/clients/client-forecastquery/runtimeConfig.shared.ts index e39e2ac449ff..96de7f5a545e 100644 --- a/clients/client-forecastquery/runtimeConfig.shared.ts +++ b/clients/client-forecastquery/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ForecastqueryClientConfig } from "./ForecastqueryClient"; @@ -9,9 +8,9 @@ import { ForecastqueryClientConfig } from "./ForecastqueryClient"; */ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => ({ apiVersion: "2018-06-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "forecastquery"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "forecastquery", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-forecastquery/runtimeConfig.ts b/clients/client-forecastquery/runtimeConfig.ts index 2e5c2b93f264..ef7a0bf425ca 100644 --- a/clients/client-forecastquery/runtimeConfig.ts +++ b/clients/client-forecastquery/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-frauddetector/runtimeConfig.browser.ts b/clients/client-frauddetector/runtimeConfig.browser.ts index 9def664cada4..5a68ca443498 100644 --- a/clients/client-frauddetector/runtimeConfig.browser.ts +++ b/clients/client-frauddetector/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-frauddetector/runtimeConfig.native.ts b/clients/client-frauddetector/runtimeConfig.native.ts index 6dbd4c007822..334866ea05e8 100644 --- a/clients/client-frauddetector/runtimeConfig.native.ts +++ b/clients/client-frauddetector/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FraudDetectorClientConfig } from "./FraudDetectorClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-frauddetector/runtimeConfig.shared.ts b/clients/client-frauddetector/runtimeConfig.shared.ts index d7ea62465518..dbab0f6547e6 100644 --- a/clients/client-frauddetector/runtimeConfig.shared.ts +++ b/clients/client-frauddetector/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FraudDetectorClientConfig } from "./FraudDetectorClient"; @@ -9,9 +8,9 @@ import { FraudDetectorClientConfig } from "./FraudDetectorClient"; */ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => ({ apiVersion: "2019-11-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "FraudDetector"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "FraudDetector", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-frauddetector/runtimeConfig.ts b/clients/client-frauddetector/runtimeConfig.ts index 3f08bd42cd48..0dd76afef758 100644 --- a/clients/client-frauddetector/runtimeConfig.ts +++ b/clients/client-frauddetector/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-fsx/runtimeConfig.browser.ts b/clients/client-fsx/runtimeConfig.browser.ts index ae30d27da904..40c433440d38 100644 --- a/clients/client-fsx/runtimeConfig.browser.ts +++ b/clients/client-fsx/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: FSxClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-fsx/runtimeConfig.native.ts b/clients/client-fsx/runtimeConfig.native.ts index c13e02b7c25f..46445c1cd48b 100644 --- a/clients/client-fsx/runtimeConfig.native.ts +++ b/clients/client-fsx/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { FSxClientConfig } from "./FSxClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: FSxClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-fsx/runtimeConfig.shared.ts b/clients/client-fsx/runtimeConfig.shared.ts index 3d884982c9fc..bd08ffa6d94c 100644 --- a/clients/client-fsx/runtimeConfig.shared.ts +++ b/clients/client-fsx/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { FSxClientConfig } from "./FSxClient"; @@ -9,9 +8,9 @@ import { FSxClientConfig } from "./FSxClient"; */ export const getRuntimeConfig = (config: FSxClientConfig) => ({ apiVersion: "2018-03-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "FSx"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "FSx", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-fsx/runtimeConfig.ts b/clients/client-fsx/runtimeConfig.ts index 909f62e8cd22..2869c0a18ea9 100644 --- a/clients/client-fsx/runtimeConfig.ts +++ b/clients/client-fsx/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: FSxClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-gamelift/runtimeConfig.browser.ts b/clients/client-gamelift/runtimeConfig.browser.ts index a3632d704482..7615f00c2045 100644 --- a/clients/client-gamelift/runtimeConfig.browser.ts +++ b/clients/client-gamelift/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GameLiftClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-gamelift/runtimeConfig.native.ts b/clients/client-gamelift/runtimeConfig.native.ts index 0b6dcfcd8a7e..001707d029e6 100644 --- a/clients/client-gamelift/runtimeConfig.native.ts +++ b/clients/client-gamelift/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GameLiftClientConfig } from "./GameLiftClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GameLiftClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-gamelift/runtimeConfig.shared.ts b/clients/client-gamelift/runtimeConfig.shared.ts index b584306c08a6..4ba8a3f3db1f 100644 --- a/clients/client-gamelift/runtimeConfig.shared.ts +++ b/clients/client-gamelift/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GameLiftClientConfig } from "./GameLiftClient"; @@ -9,9 +8,9 @@ import { GameLiftClientConfig } from "./GameLiftClient"; */ export const getRuntimeConfig = (config: GameLiftClientConfig) => ({ apiVersion: "2015-10-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "GameLift"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "GameLift", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-gamelift/runtimeConfig.ts b/clients/client-gamelift/runtimeConfig.ts index b8ec6cc0c796..db0a9bbb5258 100644 --- a/clients/client-gamelift/runtimeConfig.ts +++ b/clients/client-gamelift/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GameLiftClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-glacier/runtimeConfig.browser.ts b/clients/client-glacier/runtimeConfig.browser.ts index d2b5d52cd974..5f1f3cecbb16 100644 --- a/clients/client-glacier/runtimeConfig.browser.ts +++ b/clients/client-glacier/runtimeConfig.browser.ts @@ -5,7 +5,6 @@ import { bodyChecksumGenerator } from "@aws-sdk/body-checksum-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -21,25 +20,22 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyChecksumGenerator: coalesce(config.bodyChecksumGenerator, bodyChecksumGenerator), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyChecksumGenerator: config.bodyChecksumGenerator ?? bodyChecksumGenerator, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-glacier/runtimeConfig.native.ts b/clients/client-glacier/runtimeConfig.native.ts index 76c84a150c3f..249840f06794 100644 --- a/clients/client-glacier/runtimeConfig.native.ts +++ b/clients/client-glacier/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GlacierClientConfig } from "./GlacierClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-glacier/runtimeConfig.shared.ts b/clients/client-glacier/runtimeConfig.shared.ts index 4e29f2cc5c14..b8867e891b05 100644 --- a/clients/client-glacier/runtimeConfig.shared.ts +++ b/clients/client-glacier/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GlacierClientConfig } from "./GlacierClient"; @@ -9,9 +8,9 @@ import { GlacierClientConfig } from "./GlacierClient"; */ export const getRuntimeConfig = (config: GlacierClientConfig) => ({ apiVersion: "2012-06-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Glacier"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Glacier", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-glacier/runtimeConfig.ts b/clients/client-glacier/runtimeConfig.ts index a9912d37d1d1..ac64facfb1e7 100644 --- a/clients/client-glacier/runtimeConfig.ts +++ b/clients/client-glacier/runtimeConfig.ts @@ -8,7 +8,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -24,25 +23,22 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyChecksumGenerator: coalesce(config.bodyChecksumGenerator, bodyChecksumGenerator), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyChecksumGenerator: config.bodyChecksumGenerator ?? bodyChecksumGenerator, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-global-accelerator/runtimeConfig.browser.ts b/clients/client-global-accelerator/runtimeConfig.browser.ts index b74af69fcfbd..413f9deac127 100644 --- a/clients/client-global-accelerator/runtimeConfig.browser.ts +++ b/clients/client-global-accelerator/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-global-accelerator/runtimeConfig.native.ts b/clients/client-global-accelerator/runtimeConfig.native.ts index abb684ecd9c9..adf19cf93f08 100644 --- a/clients/client-global-accelerator/runtimeConfig.native.ts +++ b/clients/client-global-accelerator/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GlobalAcceleratorClientConfig } from "./GlobalAcceleratorClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-global-accelerator/runtimeConfig.shared.ts b/clients/client-global-accelerator/runtimeConfig.shared.ts index 2c08f2e49f0d..59ddead7208a 100644 --- a/clients/client-global-accelerator/runtimeConfig.shared.ts +++ b/clients/client-global-accelerator/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GlobalAcceleratorClientConfig } from "./GlobalAcceleratorClient"; @@ -9,9 +8,9 @@ import { GlobalAcceleratorClientConfig } from "./GlobalAcceleratorClient"; */ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => ({ apiVersion: "2018-08-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Global Accelerator"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Global Accelerator", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-global-accelerator/runtimeConfig.ts b/clients/client-global-accelerator/runtimeConfig.ts index bb8a5d2ee025..aa1003d6ba27 100644 --- a/clients/client-global-accelerator/runtimeConfig.ts +++ b/clients/client-global-accelerator/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-glue/runtimeConfig.browser.ts b/clients/client-glue/runtimeConfig.browser.ts index 8c52b251146b..401cebb4ac21 100644 --- a/clients/client-glue/runtimeConfig.browser.ts +++ b/clients/client-glue/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GlueClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-glue/runtimeConfig.native.ts b/clients/client-glue/runtimeConfig.native.ts index 044e25fe8792..0ead0a4aa57d 100644 --- a/clients/client-glue/runtimeConfig.native.ts +++ b/clients/client-glue/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GlueClientConfig } from "./GlueClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GlueClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-glue/runtimeConfig.shared.ts b/clients/client-glue/runtimeConfig.shared.ts index 59509e87e333..214a06eb76f9 100644 --- a/clients/client-glue/runtimeConfig.shared.ts +++ b/clients/client-glue/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GlueClientConfig } from "./GlueClient"; @@ -9,9 +8,9 @@ import { GlueClientConfig } from "./GlueClient"; */ export const getRuntimeConfig = (config: GlueClientConfig) => ({ apiVersion: "2017-03-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Glue"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Glue", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-glue/runtimeConfig.ts b/clients/client-glue/runtimeConfig.ts index 560a47c3f23b..154d48ba57e5 100644 --- a/clients/client-glue/runtimeConfig.ts +++ b/clients/client-glue/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GlueClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-greengrass/runtimeConfig.browser.ts b/clients/client-greengrass/runtimeConfig.browser.ts index 5040f33ba598..a8c753385201 100644 --- a/clients/client-greengrass/runtimeConfig.browser.ts +++ b/clients/client-greengrass/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GreengrassClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-greengrass/runtimeConfig.native.ts b/clients/client-greengrass/runtimeConfig.native.ts index 80ba04fa6b2e..90592bd6f8b7 100644 --- a/clients/client-greengrass/runtimeConfig.native.ts +++ b/clients/client-greengrass/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GreengrassClientConfig } from "./GreengrassClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GreengrassClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-greengrass/runtimeConfig.shared.ts b/clients/client-greengrass/runtimeConfig.shared.ts index 72f52f13268c..b0b29241c21f 100644 --- a/clients/client-greengrass/runtimeConfig.shared.ts +++ b/clients/client-greengrass/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GreengrassClientConfig } from "./GreengrassClient"; @@ -9,9 +8,9 @@ import { GreengrassClientConfig } from "./GreengrassClient"; */ export const getRuntimeConfig = (config: GreengrassClientConfig) => ({ apiVersion: "2017-06-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Greengrass"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Greengrass", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-greengrass/runtimeConfig.ts b/clients/client-greengrass/runtimeConfig.ts index 574e923cedfa..191e18f70a8c 100644 --- a/clients/client-greengrass/runtimeConfig.ts +++ b/clients/client-greengrass/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GreengrassClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-greengrassv2/runtimeConfig.browser.ts b/clients/client-greengrassv2/runtimeConfig.browser.ts index 5553f4b46116..1c51a1c63d02 100644 --- a/clients/client-greengrassv2/runtimeConfig.browser.ts +++ b/clients/client-greengrassv2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-greengrassv2/runtimeConfig.native.ts b/clients/client-greengrassv2/runtimeConfig.native.ts index 5b695722c15b..647a2bd9ec91 100644 --- a/clients/client-greengrassv2/runtimeConfig.native.ts +++ b/clients/client-greengrassv2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GreengrassV2ClientConfig } from "./GreengrassV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-greengrassv2/runtimeConfig.shared.ts b/clients/client-greengrassv2/runtimeConfig.shared.ts index 6a994478aa74..0a68ff83b4ec 100644 --- a/clients/client-greengrassv2/runtimeConfig.shared.ts +++ b/clients/client-greengrassv2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GreengrassV2ClientConfig } from "./GreengrassV2Client"; @@ -9,9 +8,9 @@ import { GreengrassV2ClientConfig } from "./GreengrassV2Client"; */ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => ({ apiVersion: "2020-11-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "GreengrassV2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "GreengrassV2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-greengrassv2/runtimeConfig.ts b/clients/client-greengrassv2/runtimeConfig.ts index 5e639cfa966c..8042bbf69206 100644 --- a/clients/client-greengrassv2/runtimeConfig.ts +++ b/clients/client-greengrassv2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-groundstation/runtimeConfig.browser.ts b/clients/client-groundstation/runtimeConfig.browser.ts index bfef6e555445..d8fa2cb6eb72 100644 --- a/clients/client-groundstation/runtimeConfig.browser.ts +++ b/clients/client-groundstation/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GroundStationClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-groundstation/runtimeConfig.native.ts b/clients/client-groundstation/runtimeConfig.native.ts index 701b0cc35f6b..f992e2ab649a 100644 --- a/clients/client-groundstation/runtimeConfig.native.ts +++ b/clients/client-groundstation/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GroundStationClientConfig } from "./GroundStationClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GroundStationClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-groundstation/runtimeConfig.shared.ts b/clients/client-groundstation/runtimeConfig.shared.ts index da6f0dbf4ea0..e84d268a68bf 100644 --- a/clients/client-groundstation/runtimeConfig.shared.ts +++ b/clients/client-groundstation/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GroundStationClientConfig } from "./GroundStationClient"; @@ -9,9 +8,9 @@ import { GroundStationClientConfig } from "./GroundStationClient"; */ export const getRuntimeConfig = (config: GroundStationClientConfig) => ({ apiVersion: "2019-05-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "GroundStation"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "GroundStation", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-groundstation/runtimeConfig.ts b/clients/client-groundstation/runtimeConfig.ts index f07684723254..c8aae876d9cb 100644 --- a/clients/client-groundstation/runtimeConfig.ts +++ b/clients/client-groundstation/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GroundStationClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-guardduty/runtimeConfig.browser.ts b/clients/client-guardduty/runtimeConfig.browser.ts index 566ffb121b61..7afbed16d2b2 100644 --- a/clients/client-guardduty/runtimeConfig.browser.ts +++ b/clients/client-guardduty/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: GuardDutyClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-guardduty/runtimeConfig.native.ts b/clients/client-guardduty/runtimeConfig.native.ts index e85a04b93b0c..9c14cb839bdc 100644 --- a/clients/client-guardduty/runtimeConfig.native.ts +++ b/clients/client-guardduty/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { GuardDutyClientConfig } from "./GuardDutyClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: GuardDutyClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-guardduty/runtimeConfig.shared.ts b/clients/client-guardduty/runtimeConfig.shared.ts index fe8df7bbc439..f0b1b406dfa4 100644 --- a/clients/client-guardduty/runtimeConfig.shared.ts +++ b/clients/client-guardduty/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { GuardDutyClientConfig } from "./GuardDutyClient"; @@ -9,9 +8,9 @@ import { GuardDutyClientConfig } from "./GuardDutyClient"; */ export const getRuntimeConfig = (config: GuardDutyClientConfig) => ({ apiVersion: "2017-11-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "GuardDuty"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "GuardDuty", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-guardduty/runtimeConfig.ts b/clients/client-guardduty/runtimeConfig.ts index 94dd11d78f4c..fa68e5e4aaaf 100644 --- a/clients/client-guardduty/runtimeConfig.ts +++ b/clients/client-guardduty/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: GuardDutyClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-health/runtimeConfig.browser.ts b/clients/client-health/runtimeConfig.browser.ts index 5a17c23f2166..dbd288ec84cd 100644 --- a/clients/client-health/runtimeConfig.browser.ts +++ b/clients/client-health/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: HealthClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-health/runtimeConfig.native.ts b/clients/client-health/runtimeConfig.native.ts index ffa52344e51e..32346d57336d 100644 --- a/clients/client-health/runtimeConfig.native.ts +++ b/clients/client-health/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { HealthClientConfig } from "./HealthClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: HealthClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-health/runtimeConfig.shared.ts b/clients/client-health/runtimeConfig.shared.ts index 24aa9abad813..749b19072aeb 100644 --- a/clients/client-health/runtimeConfig.shared.ts +++ b/clients/client-health/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { HealthClientConfig } from "./HealthClient"; @@ -9,9 +8,9 @@ import { HealthClientConfig } from "./HealthClient"; */ export const getRuntimeConfig = (config: HealthClientConfig) => ({ apiVersion: "2016-08-04", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Health"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Health", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-health/runtimeConfig.ts b/clients/client-health/runtimeConfig.ts index 5f65ebd62365..475a7d43b3b2 100644 --- a/clients/client-health/runtimeConfig.ts +++ b/clients/client-health/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: HealthClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-healthlake/runtimeConfig.browser.ts b/clients/client-healthlake/runtimeConfig.browser.ts index e6bf685d3d0b..ec22301ef894 100644 --- a/clients/client-healthlake/runtimeConfig.browser.ts +++ b/clients/client-healthlake/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: HealthLakeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-healthlake/runtimeConfig.native.ts b/clients/client-healthlake/runtimeConfig.native.ts index a0e0a26a9280..cb88b5fb4e56 100644 --- a/clients/client-healthlake/runtimeConfig.native.ts +++ b/clients/client-healthlake/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { HealthLakeClientConfig } from "./HealthLakeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: HealthLakeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-healthlake/runtimeConfig.shared.ts b/clients/client-healthlake/runtimeConfig.shared.ts index 24a3490679b5..87d86b911834 100644 --- a/clients/client-healthlake/runtimeConfig.shared.ts +++ b/clients/client-healthlake/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { HealthLakeClientConfig } from "./HealthLakeClient"; @@ -9,9 +8,9 @@ import { HealthLakeClientConfig } from "./HealthLakeClient"; */ export const getRuntimeConfig = (config: HealthLakeClientConfig) => ({ apiVersion: "2017-07-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "HealthLake"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "HealthLake", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-healthlake/runtimeConfig.ts b/clients/client-healthlake/runtimeConfig.ts index acfa42ee40ce..68707b8475f4 100644 --- a/clients/client-healthlake/runtimeConfig.ts +++ b/clients/client-healthlake/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: HealthLakeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-honeycode/runtimeConfig.browser.ts b/clients/client-honeycode/runtimeConfig.browser.ts index 5811497c9d56..28de5cf3e337 100644 --- a/clients/client-honeycode/runtimeConfig.browser.ts +++ b/clients/client-honeycode/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: HoneycodeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-honeycode/runtimeConfig.native.ts b/clients/client-honeycode/runtimeConfig.native.ts index f4ca3196745b..78f0ba4e4f7e 100644 --- a/clients/client-honeycode/runtimeConfig.native.ts +++ b/clients/client-honeycode/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { HoneycodeClientConfig } from "./HoneycodeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: HoneycodeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-honeycode/runtimeConfig.shared.ts b/clients/client-honeycode/runtimeConfig.shared.ts index c77c33288785..748b828c065e 100644 --- a/clients/client-honeycode/runtimeConfig.shared.ts +++ b/clients/client-honeycode/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { HoneycodeClientConfig } from "./HoneycodeClient"; @@ -9,9 +8,9 @@ import { HoneycodeClientConfig } from "./HoneycodeClient"; */ export const getRuntimeConfig = (config: HoneycodeClientConfig) => ({ apiVersion: "2020-03-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Honeycode"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Honeycode", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-honeycode/runtimeConfig.ts b/clients/client-honeycode/runtimeConfig.ts index 66c4c8dcb38e..5073960e2658 100644 --- a/clients/client-honeycode/runtimeConfig.ts +++ b/clients/client-honeycode/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: HoneycodeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iam/runtimeConfig.browser.ts b/clients/client-iam/runtimeConfig.browser.ts index ed2a642a66cf..d1d2e4ae84bc 100644 --- a/clients/client-iam/runtimeConfig.browser.ts +++ b/clients/client-iam/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IAMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iam/runtimeConfig.native.ts b/clients/client-iam/runtimeConfig.native.ts index e2dc8d83cdab..f2c504292102 100644 --- a/clients/client-iam/runtimeConfig.native.ts +++ b/clients/client-iam/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IAMClientConfig } from "./IAMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IAMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iam/runtimeConfig.shared.ts b/clients/client-iam/runtimeConfig.shared.ts index 812be93483f4..f2c648466388 100644 --- a/clients/client-iam/runtimeConfig.shared.ts +++ b/clients/client-iam/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IAMClientConfig } from "./IAMClient"; @@ -9,9 +8,9 @@ import { IAMClientConfig } from "./IAMClient"; */ export const getRuntimeConfig = (config: IAMClientConfig) => ({ apiVersion: "2010-05-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IAM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IAM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iam/runtimeConfig.ts b/clients/client-iam/runtimeConfig.ts index f73e319dd8c0..7fc4a8133bed 100644 --- a/clients/client-iam/runtimeConfig.ts +++ b/clients/client-iam/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IAMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-identitystore/runtimeConfig.browser.ts b/clients/client-identitystore/runtimeConfig.browser.ts index 9913cda5a827..8de443b11266 100644 --- a/clients/client-identitystore/runtimeConfig.browser.ts +++ b/clients/client-identitystore/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-identitystore/runtimeConfig.native.ts b/clients/client-identitystore/runtimeConfig.native.ts index 17de8197cecf..45910532c2aa 100644 --- a/clients/client-identitystore/runtimeConfig.native.ts +++ b/clients/client-identitystore/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IdentitystoreClientConfig } from "./IdentitystoreClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-identitystore/runtimeConfig.shared.ts b/clients/client-identitystore/runtimeConfig.shared.ts index 256e03525574..924de6c0e1f2 100644 --- a/clients/client-identitystore/runtimeConfig.shared.ts +++ b/clients/client-identitystore/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IdentitystoreClientConfig } from "./IdentitystoreClient"; @@ -9,9 +8,9 @@ import { IdentitystoreClientConfig } from "./IdentitystoreClient"; */ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => ({ apiVersion: "2020-06-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "identitystore"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "identitystore", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-identitystore/runtimeConfig.ts b/clients/client-identitystore/runtimeConfig.ts index 07fbfc92ac6a..11d4be2c400c 100644 --- a/clients/client-identitystore/runtimeConfig.ts +++ b/clients/client-identitystore/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-imagebuilder/runtimeConfig.browser.ts b/clients/client-imagebuilder/runtimeConfig.browser.ts index 9eb2537da89c..ee437b9a965c 100644 --- a/clients/client-imagebuilder/runtimeConfig.browser.ts +++ b/clients/client-imagebuilder/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-imagebuilder/runtimeConfig.native.ts b/clients/client-imagebuilder/runtimeConfig.native.ts index e064e6fc18fc..581fca9e5e06 100644 --- a/clients/client-imagebuilder/runtimeConfig.native.ts +++ b/clients/client-imagebuilder/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ImagebuilderClientConfig } from "./ImagebuilderClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-imagebuilder/runtimeConfig.shared.ts b/clients/client-imagebuilder/runtimeConfig.shared.ts index 5a5793d781d8..7618708bd8c8 100644 --- a/clients/client-imagebuilder/runtimeConfig.shared.ts +++ b/clients/client-imagebuilder/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ImagebuilderClientConfig } from "./ImagebuilderClient"; @@ -9,9 +8,9 @@ import { ImagebuilderClientConfig } from "./ImagebuilderClient"; */ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => ({ apiVersion: "2019-12-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "imagebuilder"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "imagebuilder", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-imagebuilder/runtimeConfig.ts b/clients/client-imagebuilder/runtimeConfig.ts index 3cb76938bbe9..244159902e88 100644 --- a/clients/client-imagebuilder/runtimeConfig.ts +++ b/clients/client-imagebuilder/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-inspector/runtimeConfig.browser.ts b/clients/client-inspector/runtimeConfig.browser.ts index ca9da1a757f7..11754d57f0ee 100644 --- a/clients/client-inspector/runtimeConfig.browser.ts +++ b/clients/client-inspector/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: InspectorClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-inspector/runtimeConfig.native.ts b/clients/client-inspector/runtimeConfig.native.ts index 07a3f85dd817..809e1be41e99 100644 --- a/clients/client-inspector/runtimeConfig.native.ts +++ b/clients/client-inspector/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { InspectorClientConfig } from "./InspectorClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: InspectorClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-inspector/runtimeConfig.shared.ts b/clients/client-inspector/runtimeConfig.shared.ts index 54cf5566169d..9f2d1d67ccf3 100644 --- a/clients/client-inspector/runtimeConfig.shared.ts +++ b/clients/client-inspector/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { InspectorClientConfig } from "./InspectorClient"; @@ -9,9 +8,9 @@ import { InspectorClientConfig } from "./InspectorClient"; */ export const getRuntimeConfig = (config: InspectorClientConfig) => ({ apiVersion: "2016-02-16", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Inspector"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Inspector", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-inspector/runtimeConfig.ts b/clients/client-inspector/runtimeConfig.ts index 91934c4a3b20..f452e0f3b653 100644 --- a/clients/client-inspector/runtimeConfig.ts +++ b/clients/client-inspector/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: InspectorClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts b/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts index fe654a06ee08..d433cd48ceb2 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.native.ts b/clients/client-iot-1click-devices-service/runtimeConfig.native.ts index b8480e11b568..5011eb3b8ad8 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.native.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoT1ClickDevicesServiceClientConfig } from "./IoT1ClickDevicesServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.shared.ts b/clients/client-iot-1click-devices-service/runtimeConfig.shared.ts index a4c9bd469bf9..a4db5db5b163 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.shared.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoT1ClickDevicesServiceClientConfig } from "./IoT1ClickDevicesServiceClient"; @@ -9,9 +8,9 @@ import { IoT1ClickDevicesServiceClientConfig } from "./IoT1ClickDevicesServiceCl */ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => ({ apiVersion: "2018-05-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT 1Click Devices Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT 1Click Devices Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.ts b/clients/client-iot-1click-devices-service/runtimeConfig.ts index f7ad305379d6..13b4b9f5fdd8 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-1click-projects/runtimeConfig.browser.ts b/clients/client-iot-1click-projects/runtimeConfig.browser.ts index 44bb5812982f..606f042a4771 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.browser.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-1click-projects/runtimeConfig.native.ts b/clients/client-iot-1click-projects/runtimeConfig.native.ts index aaabc89746e6..59a04b72b5b2 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.native.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoT1ClickProjectsClientConfig } from "./IoT1ClickProjectsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-1click-projects/runtimeConfig.shared.ts b/clients/client-iot-1click-projects/runtimeConfig.shared.ts index 7e3153e6f585..c0e8c308f9e9 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.shared.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoT1ClickProjectsClientConfig } from "./IoT1ClickProjectsClient"; @@ -9,9 +8,9 @@ import { IoT1ClickProjectsClientConfig } from "./IoT1ClickProjectsClient"; */ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => ({ apiVersion: "2018-05-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT 1Click Projects"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT 1Click Projects", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-1click-projects/runtimeConfig.ts b/clients/client-iot-1click-projects/runtimeConfig.ts index 48b7b9a0bee6..5ba477eef38c 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-data-plane/runtimeConfig.browser.ts b/clients/client-iot-data-plane/runtimeConfig.browser.ts index ac987cc62acd..a6532a107533 100644 --- a/clients/client-iot-data-plane/runtimeConfig.browser.ts +++ b/clients/client-iot-data-plane/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-data-plane/runtimeConfig.native.ts b/clients/client-iot-data-plane/runtimeConfig.native.ts index 11f7741ba6cb..8db703a78a68 100644 --- a/clients/client-iot-data-plane/runtimeConfig.native.ts +++ b/clients/client-iot-data-plane/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTDataPlaneClientConfig } from "./IoTDataPlaneClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-data-plane/runtimeConfig.shared.ts b/clients/client-iot-data-plane/runtimeConfig.shared.ts index efe9ef3131e8..1b22298e8de0 100644 --- a/clients/client-iot-data-plane/runtimeConfig.shared.ts +++ b/clients/client-iot-data-plane/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTDataPlaneClientConfig } from "./IoTDataPlaneClient"; @@ -9,9 +8,9 @@ import { IoTDataPlaneClientConfig } from "./IoTDataPlaneClient"; */ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => ({ apiVersion: "2015-05-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT Data Plane"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT Data Plane", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-data-plane/runtimeConfig.ts b/clients/client-iot-data-plane/runtimeConfig.ts index af620240a35e..0955a2bf7660 100644 --- a/clients/client-iot-data-plane/runtimeConfig.ts +++ b/clients/client-iot-data-plane/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-events-data/runtimeConfig.browser.ts b/clients/client-iot-events-data/runtimeConfig.browser.ts index 29bf7304fa86..04da09a6e578 100644 --- a/clients/client-iot-events-data/runtimeConfig.browser.ts +++ b/clients/client-iot-events-data/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-events-data/runtimeConfig.native.ts b/clients/client-iot-events-data/runtimeConfig.native.ts index 4f810c0b95e0..7ad120754263 100644 --- a/clients/client-iot-events-data/runtimeConfig.native.ts +++ b/clients/client-iot-events-data/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTEventsDataClientConfig } from "./IoTEventsDataClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-events-data/runtimeConfig.shared.ts b/clients/client-iot-events-data/runtimeConfig.shared.ts index 981d48f0d609..195f511b14dc 100644 --- a/clients/client-iot-events-data/runtimeConfig.shared.ts +++ b/clients/client-iot-events-data/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTEventsDataClientConfig } from "./IoTEventsDataClient"; @@ -9,9 +8,9 @@ import { IoTEventsDataClientConfig } from "./IoTEventsDataClient"; */ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => ({ apiVersion: "2018-10-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT Events Data"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT Events Data", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-events-data/runtimeConfig.ts b/clients/client-iot-events-data/runtimeConfig.ts index fd514c21cc4c..3d2657783124 100644 --- a/clients/client-iot-events-data/runtimeConfig.ts +++ b/clients/client-iot-events-data/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-events/runtimeConfig.browser.ts b/clients/client-iot-events/runtimeConfig.browser.ts index 3e600ffde421..0415edfe9d1c 100644 --- a/clients/client-iot-events/runtimeConfig.browser.ts +++ b/clients/client-iot-events/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTEventsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-events/runtimeConfig.native.ts b/clients/client-iot-events/runtimeConfig.native.ts index 724f828020ed..0758402b9721 100644 --- a/clients/client-iot-events/runtimeConfig.native.ts +++ b/clients/client-iot-events/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTEventsClientConfig } from "./IoTEventsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTEventsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-events/runtimeConfig.shared.ts b/clients/client-iot-events/runtimeConfig.shared.ts index d9658124a9c9..359b6d3c556e 100644 --- a/clients/client-iot-events/runtimeConfig.shared.ts +++ b/clients/client-iot-events/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTEventsClientConfig } from "./IoTEventsClient"; @@ -9,9 +8,9 @@ import { IoTEventsClientConfig } from "./IoTEventsClient"; */ export const getRuntimeConfig = (config: IoTEventsClientConfig) => ({ apiVersion: "2018-07-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT Events"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT Events", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-events/runtimeConfig.ts b/clients/client-iot-events/runtimeConfig.ts index 7c12fc54f526..432b3b405d65 100644 --- a/clients/client-iot-events/runtimeConfig.ts +++ b/clients/client-iot-events/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTEventsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts index f03f7d382f80..5f06648756e9 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts index 3dce822679a7..e71ff357b739 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTJobsDataPlaneClientConfig } from "./IoTJobsDataPlaneClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.shared.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.shared.ts index 56f6f0096f4a..d4f858ef4a7c 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.shared.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTJobsDataPlaneClientConfig } from "./IoTJobsDataPlaneClient"; @@ -9,9 +8,9 @@ import { IoTJobsDataPlaneClientConfig } from "./IoTJobsDataPlaneClient"; */ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => ({ apiVersion: "2017-09-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT Jobs Data Plane"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT Jobs Data Plane", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.ts index 25157fa8b1cd..08366094dce3 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-wireless/runtimeConfig.browser.ts b/clients/client-iot-wireless/runtimeConfig.browser.ts index 30ee8603cdc2..e1e8dc74ca98 100644 --- a/clients/client-iot-wireless/runtimeConfig.browser.ts +++ b/clients/client-iot-wireless/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot-wireless/runtimeConfig.native.ts b/clients/client-iot-wireless/runtimeConfig.native.ts index 80dcc236e741..906ff4ffc2f8 100644 --- a/clients/client-iot-wireless/runtimeConfig.native.ts +++ b/clients/client-iot-wireless/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTWirelessClientConfig } from "./IoTWirelessClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot-wireless/runtimeConfig.shared.ts b/clients/client-iot-wireless/runtimeConfig.shared.ts index d6d80ec8cf6a..87be4d64605d 100644 --- a/clients/client-iot-wireless/runtimeConfig.shared.ts +++ b/clients/client-iot-wireless/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTWirelessClientConfig } from "./IoTWirelessClient"; @@ -9,9 +8,9 @@ import { IoTWirelessClientConfig } from "./IoTWirelessClient"; */ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => ({ apiVersion: "2020-11-22", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT Wireless"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT Wireless", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot-wireless/runtimeConfig.ts b/clients/client-iot-wireless/runtimeConfig.ts index 7cae259bd619..0df9c60f8b8e 100644 --- a/clients/client-iot-wireless/runtimeConfig.ts +++ b/clients/client-iot-wireless/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot/runtimeConfig.browser.ts b/clients/client-iot/runtimeConfig.browser.ts index 45ab72b06ad2..49dfaa65b36a 100644 --- a/clients/client-iot/runtimeConfig.browser.ts +++ b/clients/client-iot/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iot/runtimeConfig.native.ts b/clients/client-iot/runtimeConfig.native.ts index 3108081e4319..1c62088ec8b7 100644 --- a/clients/client-iot/runtimeConfig.native.ts +++ b/clients/client-iot/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTClientConfig } from "./IoTClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iot/runtimeConfig.shared.ts b/clients/client-iot/runtimeConfig.shared.ts index fb9f0c76b690..d619d030aa61 100644 --- a/clients/client-iot/runtimeConfig.shared.ts +++ b/clients/client-iot/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTClientConfig } from "./IoTClient"; @@ -9,9 +8,9 @@ import { IoTClientConfig } from "./IoTClient"; */ export const getRuntimeConfig = (config: IoTClientConfig) => ({ apiVersion: "2015-05-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoT"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoT", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iot/runtimeConfig.ts b/clients/client-iot/runtimeConfig.ts index 9cacee7af830..e195a8c6cc43 100644 --- a/clients/client-iot/runtimeConfig.ts +++ b/clients/client-iot/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotanalytics/runtimeConfig.browser.ts b/clients/client-iotanalytics/runtimeConfig.browser.ts index 8aa54e7d5be1..8e2b2da493e6 100644 --- a/clients/client-iotanalytics/runtimeConfig.browser.ts +++ b/clients/client-iotanalytics/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotanalytics/runtimeConfig.native.ts b/clients/client-iotanalytics/runtimeConfig.native.ts index 430163b19172..3d7f2f4f3c31 100644 --- a/clients/client-iotanalytics/runtimeConfig.native.ts +++ b/clients/client-iotanalytics/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTAnalyticsClientConfig } from "./IoTAnalyticsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iotanalytics/runtimeConfig.shared.ts b/clients/client-iotanalytics/runtimeConfig.shared.ts index f306a536ed47..6e709be0c39f 100644 --- a/clients/client-iotanalytics/runtimeConfig.shared.ts +++ b/clients/client-iotanalytics/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTAnalyticsClientConfig } from "./IoTAnalyticsClient"; @@ -9,9 +8,9 @@ import { IoTAnalyticsClientConfig } from "./IoTAnalyticsClient"; */ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoTAnalytics"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoTAnalytics", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iotanalytics/runtimeConfig.ts b/clients/client-iotanalytics/runtimeConfig.ts index cd2780120e91..4ed685d59df3 100644 --- a/clients/client-iotanalytics/runtimeConfig.ts +++ b/clients/client-iotanalytics/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts b/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts index dd7b438a560f..0e9b4dd5b540 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.native.ts b/clients/client-iotdeviceadvisor/runtimeConfig.native.ts index df1b8cad55fa..b563e1a8bd3a 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.native.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IotDeviceAdvisorClientConfig } from "./IotDeviceAdvisorClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts b/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts index ec0c03f4e9c7..14174fdff0df 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IotDeviceAdvisorClientConfig } from "./IotDeviceAdvisorClient"; @@ -9,9 +8,9 @@ import { IotDeviceAdvisorClientConfig } from "./IotDeviceAdvisorClient"; */ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => ({ apiVersion: "2020-09-18", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IotDeviceAdvisor"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IotDeviceAdvisor", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.ts b/clients/client-iotdeviceadvisor/runtimeConfig.ts index 48ba3bda00e6..0adb960912e2 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotfleethub/runtimeConfig.browser.ts b/clients/client-iotfleethub/runtimeConfig.browser.ts index 49ab16a748b6..9fdfa6856ee4 100644 --- a/clients/client-iotfleethub/runtimeConfig.browser.ts +++ b/clients/client-iotfleethub/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotfleethub/runtimeConfig.native.ts b/clients/client-iotfleethub/runtimeConfig.native.ts index ccde355e602f..af762151143f 100644 --- a/clients/client-iotfleethub/runtimeConfig.native.ts +++ b/clients/client-iotfleethub/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTFleetHubClientConfig } from "./IoTFleetHubClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iotfleethub/runtimeConfig.shared.ts b/clients/client-iotfleethub/runtimeConfig.shared.ts index 66d62d984daa..291046dc167b 100644 --- a/clients/client-iotfleethub/runtimeConfig.shared.ts +++ b/clients/client-iotfleethub/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTFleetHubClientConfig } from "./IoTFleetHubClient"; @@ -9,9 +8,9 @@ import { IoTFleetHubClientConfig } from "./IoTFleetHubClient"; */ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => ({ apiVersion: "2020-11-03", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoTFleetHub"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoTFleetHub", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iotfleethub/runtimeConfig.ts b/clients/client-iotfleethub/runtimeConfig.ts index 58c6a747d8d5..2fdd3997ac6a 100644 --- a/clients/client-iotfleethub/runtimeConfig.ts +++ b/clients/client-iotfleethub/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotsecuretunneling/runtimeConfig.browser.ts b/clients/client-iotsecuretunneling/runtimeConfig.browser.ts index 8c319862fbd2..ac22562c410d 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.browser.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotsecuretunneling/runtimeConfig.native.ts b/clients/client-iotsecuretunneling/runtimeConfig.native.ts index 4407b576f65b..d6847b12f0c0 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.native.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTSecureTunnelingClientConfig } from "./IoTSecureTunnelingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iotsecuretunneling/runtimeConfig.shared.ts b/clients/client-iotsecuretunneling/runtimeConfig.shared.ts index e9250c21d029..c5c92ec34b42 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.shared.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTSecureTunnelingClientConfig } from "./IoTSecureTunnelingClient"; @@ -9,9 +8,9 @@ import { IoTSecureTunnelingClientConfig } from "./IoTSecureTunnelingClient"; */ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => ({ apiVersion: "2018-10-05", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoTSecureTunneling"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoTSecureTunneling", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iotsecuretunneling/runtimeConfig.ts b/clients/client-iotsecuretunneling/runtimeConfig.ts index 812572e280fa..b98aa790b523 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotsitewise/runtimeConfig.browser.ts b/clients/client-iotsitewise/runtimeConfig.browser.ts index aa28b30be66a..49c28f4fac04 100644 --- a/clients/client-iotsitewise/runtimeConfig.browser.ts +++ b/clients/client-iotsitewise/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotsitewise/runtimeConfig.native.ts b/clients/client-iotsitewise/runtimeConfig.native.ts index 35a4bd461eb2..37c90663bfd2 100644 --- a/clients/client-iotsitewise/runtimeConfig.native.ts +++ b/clients/client-iotsitewise/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTSiteWiseClientConfig } from "./IoTSiteWiseClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iotsitewise/runtimeConfig.shared.ts b/clients/client-iotsitewise/runtimeConfig.shared.ts index 20c1db8a2bca..f9170625c10c 100644 --- a/clients/client-iotsitewise/runtimeConfig.shared.ts +++ b/clients/client-iotsitewise/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTSiteWiseClientConfig } from "./IoTSiteWiseClient"; @@ -9,9 +8,9 @@ import { IoTSiteWiseClientConfig } from "./IoTSiteWiseClient"; */ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => ({ apiVersion: "2019-12-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoTSiteWise"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoTSiteWise", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iotsitewise/runtimeConfig.ts b/clients/client-iotsitewise/runtimeConfig.ts index 344c435215e7..7f70d55514a3 100644 --- a/clients/client-iotsitewise/runtimeConfig.ts +++ b/clients/client-iotsitewise/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotthingsgraph/runtimeConfig.browser.ts b/clients/client-iotthingsgraph/runtimeConfig.browser.ts index 6acedc3ac462..56464348b1a0 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.browser.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-iotthingsgraph/runtimeConfig.native.ts b/clients/client-iotthingsgraph/runtimeConfig.native.ts index 43e2e572f227..ea667db5e7ff 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.native.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IoTThingsGraphClientConfig } from "./IoTThingsGraphClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-iotthingsgraph/runtimeConfig.shared.ts b/clients/client-iotthingsgraph/runtimeConfig.shared.ts index ed26144685b0..ec1e7f7112e9 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.shared.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IoTThingsGraphClientConfig } from "./IoTThingsGraphClient"; @@ -9,9 +8,9 @@ import { IoTThingsGraphClientConfig } from "./IoTThingsGraphClient"; */ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => ({ apiVersion: "2018-09-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "IoTThingsGraph"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "IoTThingsGraph", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-iotthingsgraph/runtimeConfig.ts b/clients/client-iotthingsgraph/runtimeConfig.ts index e4a6cd1ccbd0..a8519bbe79de 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ivs/runtimeConfig.browser.ts b/clients/client-ivs/runtimeConfig.browser.ts index e90f14b5a041..79261579e356 100644 --- a/clients/client-ivs/runtimeConfig.browser.ts +++ b/clients/client-ivs/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: IvsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ivs/runtimeConfig.native.ts b/clients/client-ivs/runtimeConfig.native.ts index c6091b8b4d82..7e0e60bb5dff 100644 --- a/clients/client-ivs/runtimeConfig.native.ts +++ b/clients/client-ivs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { IvsClientConfig } from "./IvsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: IvsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ivs/runtimeConfig.shared.ts b/clients/client-ivs/runtimeConfig.shared.ts index a1a6204c053d..eb40e88a0362 100644 --- a/clients/client-ivs/runtimeConfig.shared.ts +++ b/clients/client-ivs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { IvsClientConfig } from "./IvsClient"; @@ -9,9 +8,9 @@ import { IvsClientConfig } from "./IvsClient"; */ export const getRuntimeConfig = (config: IvsClientConfig) => ({ apiVersion: "2020-07-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ivs"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ivs", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ivs/runtimeConfig.ts b/clients/client-ivs/runtimeConfig.ts index 066198b1b59d..c413171238b7 100644 --- a/clients/client-ivs/runtimeConfig.ts +++ b/clients/client-ivs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: IvsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kafka/runtimeConfig.browser.ts b/clients/client-kafka/runtimeConfig.browser.ts index 6338137043f7..adaff51d7d38 100644 --- a/clients/client-kafka/runtimeConfig.browser.ts +++ b/clients/client-kafka/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KafkaClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kafka/runtimeConfig.native.ts b/clients/client-kafka/runtimeConfig.native.ts index 23bfd3dc3db0..386e5305795c 100644 --- a/clients/client-kafka/runtimeConfig.native.ts +++ b/clients/client-kafka/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KafkaClientConfig } from "./KafkaClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KafkaClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kafka/runtimeConfig.shared.ts b/clients/client-kafka/runtimeConfig.shared.ts index d0b81dc6154b..b3018256d8fb 100644 --- a/clients/client-kafka/runtimeConfig.shared.ts +++ b/clients/client-kafka/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KafkaClientConfig } from "./KafkaClient"; @@ -9,9 +8,9 @@ import { KafkaClientConfig } from "./KafkaClient"; */ export const getRuntimeConfig = (config: KafkaClientConfig) => ({ apiVersion: "2018-11-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kafka"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kafka", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kafka/runtimeConfig.ts b/clients/client-kafka/runtimeConfig.ts index fb610f178cf4..8eef6f679fd2 100644 --- a/clients/client-kafka/runtimeConfig.ts +++ b/clients/client-kafka/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KafkaClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kendra/runtimeConfig.browser.ts b/clients/client-kendra/runtimeConfig.browser.ts index c265f4d442af..52b4a73c2ebb 100644 --- a/clients/client-kendra/runtimeConfig.browser.ts +++ b/clients/client-kendra/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KendraClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kendra/runtimeConfig.native.ts b/clients/client-kendra/runtimeConfig.native.ts index 1d66d0b54f82..de8f97859d4a 100644 --- a/clients/client-kendra/runtimeConfig.native.ts +++ b/clients/client-kendra/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KendraClientConfig } from "./KendraClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KendraClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kendra/runtimeConfig.shared.ts b/clients/client-kendra/runtimeConfig.shared.ts index 30b48a5a8fe9..2fd4a11e6162 100644 --- a/clients/client-kendra/runtimeConfig.shared.ts +++ b/clients/client-kendra/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KendraClientConfig } from "./KendraClient"; @@ -9,9 +8,9 @@ import { KendraClientConfig } from "./KendraClient"; */ export const getRuntimeConfig = (config: KendraClientConfig) => ({ apiVersion: "2019-02-03", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "kendra"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "kendra", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kendra/runtimeConfig.ts b/clients/client-kendra/runtimeConfig.ts index 288f7d6c4e17..bdac3d41173d 100644 --- a/clients/client-kendra/runtimeConfig.ts +++ b/clients/client-kendra/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KendraClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts index 7408676eb982..012de9be3812 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts index 365340444e16..c131eb6cc900 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisAnalyticsV2ClientConfig } from "./KinesisAnalyticsV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts index 5b8fc9388b78..07053bda9de1 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisAnalyticsV2ClientConfig } from "./KinesisAnalyticsV2Client"; @@ -9,9 +8,9 @@ import { KinesisAnalyticsV2ClientConfig } from "./KinesisAnalyticsV2Client"; */ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => ({ apiVersion: "2018-05-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis Analytics V2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis Analytics V2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.ts index 8be9ef410907..5e66e7a9d26c 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-analytics/runtimeConfig.browser.ts b/clients/client-kinesis-analytics/runtimeConfig.browser.ts index d86916d51832..98135263aba7 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.browser.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-analytics/runtimeConfig.native.ts b/clients/client-kinesis-analytics/runtimeConfig.native.ts index 98b9c709bb2f..779d59b499d7 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.native.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisAnalyticsClientConfig } from "./KinesisAnalyticsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis-analytics/runtimeConfig.shared.ts b/clients/client-kinesis-analytics/runtimeConfig.shared.ts index b978fa19a4d7..2351e4420bac 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.shared.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisAnalyticsClientConfig } from "./KinesisAnalyticsClient"; @@ -9,9 +8,9 @@ import { KinesisAnalyticsClientConfig } from "./KinesisAnalyticsClient"; */ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => ({ apiVersion: "2015-08-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis Analytics"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis Analytics", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis-analytics/runtimeConfig.ts b/clients/client-kinesis-analytics/runtimeConfig.ts index b66adb3dce70..82c78f566a4d 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts index b2d65f3b777c..6c432c6b9cbe 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts index 25f5a9d592fa..b6f3afad2bbd 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.shared.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.shared.ts index 4e227fa248a6..25b0cb8de7b7 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; @@ -9,9 +8,9 @@ import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMed */ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) => ({ apiVersion: "2017-09-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis Video Archived Media"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis Video Archived Media", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.ts index 2762e82352cd..84c8b09cb8af 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video-media/runtimeConfig.browser.ts b/clients/client-kinesis-video-media/runtimeConfig.browser.ts index f6923681db31..f5fbc1b1ec57 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video-media/runtimeConfig.native.ts b/clients/client-kinesis-video-media/runtimeConfig.native.ts index 3341bd0ee9ed..b4208b04bc00 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis-video-media/runtimeConfig.shared.ts b/clients/client-kinesis-video-media/runtimeConfig.shared.ts index 112299c36e22..46d6c7aa077c 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; @@ -9,9 +8,9 @@ import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; */ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => ({ apiVersion: "2017-09-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis Video Media"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis Video Media", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis-video-media/runtimeConfig.ts b/clients/client-kinesis-video-media/runtimeConfig.ts index 86d5c4134577..0cd1b8c0dae2 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts b/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts index 4f54b9eedc98..69a5a14687b3 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.native.ts b/clients/client-kinesis-video-signaling/runtimeConfig.native.ts index 69fc8cd75484..319816924f38 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisVideoSignalingClientConfig } from "./KinesisVideoSignalingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts b/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts index 619af9f9bb7b..2624a06a30ea 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisVideoSignalingClientConfig } from "./KinesisVideoSignalingClient"; @@ -9,9 +8,9 @@ import { KinesisVideoSignalingClientConfig } from "./KinesisVideoSignalingClient */ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => ({ apiVersion: "2019-12-04", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis Video Signaling"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis Video Signaling", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.ts b/clients/client-kinesis-video-signaling/runtimeConfig.ts index 6f78bc3f5f8f..d88c64f9b99b 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video/runtimeConfig.browser.ts b/clients/client-kinesis-video/runtimeConfig.browser.ts index 2d82bad375ae..93ddaabb2d5c 100644 --- a/clients/client-kinesis-video/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis-video/runtimeConfig.native.ts b/clients/client-kinesis-video/runtimeConfig.native.ts index a669e2d9ab9f..f75bdcf96a3f 100644 --- a/clients/client-kinesis-video/runtimeConfig.native.ts +++ b/clients/client-kinesis-video/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisVideoClientConfig } from "./KinesisVideoClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis-video/runtimeConfig.shared.ts b/clients/client-kinesis-video/runtimeConfig.shared.ts index 06b4664be87b..066ff5635678 100644 --- a/clients/client-kinesis-video/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisVideoClientConfig } from "./KinesisVideoClient"; @@ -9,9 +8,9 @@ import { KinesisVideoClientConfig } from "./KinesisVideoClient"; */ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => ({ apiVersion: "2017-09-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis Video"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis Video", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis-video/runtimeConfig.ts b/clients/client-kinesis-video/runtimeConfig.ts index 3c0200b97cc9..9fcb23352e77 100644 --- a/clients/client-kinesis-video/runtimeConfig.ts +++ b/clients/client-kinesis-video/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis/runtimeConfig.browser.ts b/clients/client-kinesis/runtimeConfig.browser.ts index 2700b3fd05ba..f6451b061ed8 100644 --- a/clients/client-kinesis/runtimeConfig.browser.ts +++ b/clients/client-kinesis/runtimeConfig.browser.ts @@ -5,7 +5,6 @@ import { eventStreamSerdeProvider } from "@aws-sdk/eventstream-serde-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -21,25 +20,22 @@ export const getRuntimeConfig = (config: KinesisClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kinesis/runtimeConfig.native.ts b/clients/client-kinesis/runtimeConfig.native.ts index 276f093ebcbd..c1b4ac75be1c 100644 --- a/clients/client-kinesis/runtimeConfig.native.ts +++ b/clients/client-kinesis/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KinesisClientConfig } from "./KinesisClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KinesisClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kinesis/runtimeConfig.shared.ts b/clients/client-kinesis/runtimeConfig.shared.ts index b53b7b1a1615..1c87d24ceb37 100644 --- a/clients/client-kinesis/runtimeConfig.shared.ts +++ b/clients/client-kinesis/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KinesisClientConfig } from "./KinesisClient"; @@ -9,9 +8,9 @@ import { KinesisClientConfig } from "./KinesisClient"; */ export const getRuntimeConfig = (config: KinesisClientConfig) => ({ apiVersion: "2013-12-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Kinesis"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Kinesis", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kinesis/runtimeConfig.ts b/clients/client-kinesis/runtimeConfig.ts index 3087e7b8802b..bf125444536c 100644 --- a/clients/client-kinesis/runtimeConfig.ts +++ b/clients/client-kinesis/runtimeConfig.ts @@ -8,7 +8,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -24,25 +23,22 @@ export const getRuntimeConfig = (config: KinesisClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kms/runtimeConfig.browser.ts b/clients/client-kms/runtimeConfig.browser.ts index abbddc234695..5e9cd1e53625 100644 --- a/clients/client-kms/runtimeConfig.browser.ts +++ b/clients/client-kms/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: KMSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-kms/runtimeConfig.native.ts b/clients/client-kms/runtimeConfig.native.ts index e426e6f27890..4dc49db068a0 100644 --- a/clients/client-kms/runtimeConfig.native.ts +++ b/clients/client-kms/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { KMSClientConfig } from "./KMSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: KMSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-kms/runtimeConfig.shared.ts b/clients/client-kms/runtimeConfig.shared.ts index 5274f00a8609..c151af1a1b14 100644 --- a/clients/client-kms/runtimeConfig.shared.ts +++ b/clients/client-kms/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { KMSClientConfig } from "./KMSClient"; @@ -9,9 +8,9 @@ import { KMSClientConfig } from "./KMSClient"; */ export const getRuntimeConfig = (config: KMSClientConfig) => ({ apiVersion: "2014-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "KMS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "KMS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-kms/runtimeConfig.ts b/clients/client-kms/runtimeConfig.ts index fa8bb2dc76b7..84021cb128e5 100644 --- a/clients/client-kms/runtimeConfig.ts +++ b/clients/client-kms/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: KMSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lakeformation/runtimeConfig.browser.ts b/clients/client-lakeformation/runtimeConfig.browser.ts index 418ea4aca129..eb2eb0b01a94 100644 --- a/clients/client-lakeformation/runtimeConfig.browser.ts +++ b/clients/client-lakeformation/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lakeformation/runtimeConfig.native.ts b/clients/client-lakeformation/runtimeConfig.native.ts index 7397564ce63c..666de6800766 100644 --- a/clients/client-lakeformation/runtimeConfig.native.ts +++ b/clients/client-lakeformation/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LakeFormationClientConfig } from "./LakeFormationClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lakeformation/runtimeConfig.shared.ts b/clients/client-lakeformation/runtimeConfig.shared.ts index cceb1836053b..935ea38cb4a6 100644 --- a/clients/client-lakeformation/runtimeConfig.shared.ts +++ b/clients/client-lakeformation/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LakeFormationClientConfig } from "./LakeFormationClient"; @@ -9,9 +8,9 @@ import { LakeFormationClientConfig } from "./LakeFormationClient"; */ export const getRuntimeConfig = (config: LakeFormationClientConfig) => ({ apiVersion: "2017-03-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "LakeFormation"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "LakeFormation", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lakeformation/runtimeConfig.ts b/clients/client-lakeformation/runtimeConfig.ts index 3b44eb8934f4..31ef1a348783 100644 --- a/clients/client-lakeformation/runtimeConfig.ts +++ b/clients/client-lakeformation/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lambda/runtimeConfig.browser.ts b/clients/client-lambda/runtimeConfig.browser.ts index 1b6fc13cb50f..d565d68ed084 100644 --- a/clients/client-lambda/runtimeConfig.browser.ts +++ b/clients/client-lambda/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LambdaClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lambda/runtimeConfig.native.ts b/clients/client-lambda/runtimeConfig.native.ts index 4368e814724c..068ce95d4f57 100644 --- a/clients/client-lambda/runtimeConfig.native.ts +++ b/clients/client-lambda/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LambdaClientConfig } from "./LambdaClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LambdaClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lambda/runtimeConfig.shared.ts b/clients/client-lambda/runtimeConfig.shared.ts index 8f46c4192aa0..63c56ec86933 100644 --- a/clients/client-lambda/runtimeConfig.shared.ts +++ b/clients/client-lambda/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LambdaClientConfig } from "./LambdaClient"; @@ -9,9 +8,9 @@ import { LambdaClientConfig } from "./LambdaClient"; */ export const getRuntimeConfig = (config: LambdaClientConfig) => ({ apiVersion: "2015-03-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Lambda"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Lambda", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lambda/runtimeConfig.ts b/clients/client-lambda/runtimeConfig.ts index 5b9a549a9765..50aa6e7335d1 100644 --- a/clients/client-lambda/runtimeConfig.ts +++ b/clients/client-lambda/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LambdaClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-model-building-service/runtimeConfig.browser.ts b/clients/client-lex-model-building-service/runtimeConfig.browser.ts index 3e3a44465621..033fc0bf126d 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.browser.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-model-building-service/runtimeConfig.native.ts b/clients/client-lex-model-building-service/runtimeConfig.native.ts index 10e6cf5ff294..5cb29cdaf215 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.native.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LexModelBuildingServiceClientConfig } from "./LexModelBuildingServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lex-model-building-service/runtimeConfig.shared.ts b/clients/client-lex-model-building-service/runtimeConfig.shared.ts index a12436040ee1..375e02df6627 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.shared.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LexModelBuildingServiceClientConfig } from "./LexModelBuildingServiceClient"; @@ -9,9 +8,9 @@ import { LexModelBuildingServiceClientConfig } from "./LexModelBuildingServiceCl */ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => ({ apiVersion: "2017-04-19", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Lex Model Building Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Lex Model Building Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lex-model-building-service/runtimeConfig.ts b/clients/client-lex-model-building-service/runtimeConfig.ts index 1f5c2b0f6a33..d46ba64b929b 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-models-v2/runtimeConfig.browser.ts b/clients/client-lex-models-v2/runtimeConfig.browser.ts index 040ca250a947..13070113f4fe 100644 --- a/clients/client-lex-models-v2/runtimeConfig.browser.ts +++ b/clients/client-lex-models-v2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-models-v2/runtimeConfig.native.ts b/clients/client-lex-models-v2/runtimeConfig.native.ts index e5d45a76662d..5709cd2413da 100644 --- a/clients/client-lex-models-v2/runtimeConfig.native.ts +++ b/clients/client-lex-models-v2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LexModelsV2ClientConfig } from "./LexModelsV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lex-models-v2/runtimeConfig.shared.ts b/clients/client-lex-models-v2/runtimeConfig.shared.ts index d9bb45695592..40a3a1fd6576 100644 --- a/clients/client-lex-models-v2/runtimeConfig.shared.ts +++ b/clients/client-lex-models-v2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LexModelsV2ClientConfig } from "./LexModelsV2Client"; @@ -9,9 +8,9 @@ import { LexModelsV2ClientConfig } from "./LexModelsV2Client"; */ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => ({ apiVersion: "2020-08-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Lex Models V2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Lex Models V2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lex-models-v2/runtimeConfig.ts b/clients/client-lex-models-v2/runtimeConfig.ts index ef8b50e62704..156018f85951 100644 --- a/clients/client-lex-models-v2/runtimeConfig.ts +++ b/clients/client-lex-models-v2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-runtime-service/runtimeConfig.browser.ts b/clients/client-lex-runtime-service/runtimeConfig.browser.ts index f44745868a7a..fa946e6d4a55 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-runtime-service/runtimeConfig.native.ts b/clients/client-lex-runtime-service/runtimeConfig.native.ts index 3c19d736f890..2fc68aba5d96 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.native.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lex-runtime-service/runtimeConfig.shared.ts b/clients/client-lex-runtime-service/runtimeConfig.shared.ts index fe280a6f9615..95d4cfecfdde 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.shared.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; @@ -9,9 +8,9 @@ import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; */ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Lex Runtime Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Lex Runtime Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lex-runtime-service/runtimeConfig.ts b/clients/client-lex-runtime-service/runtimeConfig.ts index 39754a4cf842..19f173d42b47 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-runtime-v2/runtimeConfig.browser.ts b/clients/client-lex-runtime-v2/runtimeConfig.browser.ts index 76b49e3feab6..4fce14bae264 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.browser.ts @@ -5,7 +5,6 @@ import { eventStreamSerdeProvider } from "@aws-sdk/eventstream-serde-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidFunction, invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -21,28 +20,25 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamPayloadHandlerProvider: coalesce(config.eventStreamPayloadHandlerProvider, () => ({ - handle: invalidFunction("event stream request is not supported in browser."), - })), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamPayloadHandlerProvider: + config.eventStreamPayloadHandlerProvider ?? + (() => ({ handle: invalidFunction("event stream request is not supported in browser.") })), + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lex-runtime-v2/runtimeConfig.native.ts b/clients/client-lex-runtime-v2/runtimeConfig.native.ts index 3b172e775593..bd3b739eb0ed 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.native.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.native.ts @@ -1,6 +1,5 @@ import { Sha256 } from "@aws-crypto/sha256-js"; import { invalidFunction } from "@aws-sdk/invalid-dependency"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -12,9 +11,9 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - eventStreamPayloadHandlerProvider: coalesce(config.eventStreamPayloadHandlerProvider, () => ({ - handle: invalidFunction("event stream request is not supported in ReactNative."), - })), - sha256: coalesce(config.sha256, Sha256), + eventStreamPayloadHandlerProvider: + config.eventStreamPayloadHandlerProvider ?? + (() => ({ handle: invalidFunction("event stream request is not supported in ReactNative.") })), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lex-runtime-v2/runtimeConfig.shared.ts b/clients/client-lex-runtime-v2/runtimeConfig.shared.ts index 5352fdc5acf6..5f49afca340b 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.shared.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; @@ -9,9 +8,9 @@ import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; */ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => ({ apiVersion: "2020-08-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Lex Runtime V2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Lex Runtime V2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lex-runtime-v2/runtimeConfig.ts b/clients/client-lex-runtime-v2/runtimeConfig.ts index f3ae75d4fa2e..c952856655e2 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.ts @@ -9,7 +9,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttp2Handler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -25,29 +24,23 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamPayloadHandlerProvider: coalesce( - config.eventStreamPayloadHandlerProvider, - eventStreamPayloadHandlerProvider - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttp2Handler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamPayloadHandlerProvider: config.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider, + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttp2Handler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-license-manager/runtimeConfig.browser.ts b/clients/client-license-manager/runtimeConfig.browser.ts index 3fbf35e9bc9e..4338716c7d43 100644 --- a/clients/client-license-manager/runtimeConfig.browser.ts +++ b/clients/client-license-manager/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-license-manager/runtimeConfig.native.ts b/clients/client-license-manager/runtimeConfig.native.ts index 6d71cdb1608b..bda51354b66a 100644 --- a/clients/client-license-manager/runtimeConfig.native.ts +++ b/clients/client-license-manager/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LicenseManagerClientConfig } from "./LicenseManagerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-license-manager/runtimeConfig.shared.ts b/clients/client-license-manager/runtimeConfig.shared.ts index 0b8d1cc98cf9..f58e465766d7 100644 --- a/clients/client-license-manager/runtimeConfig.shared.ts +++ b/clients/client-license-manager/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LicenseManagerClientConfig } from "./LicenseManagerClient"; @@ -9,9 +8,9 @@ import { LicenseManagerClientConfig } from "./LicenseManagerClient"; */ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => ({ apiVersion: "2018-08-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "License Manager"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "License Manager", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-license-manager/runtimeConfig.ts b/clients/client-license-manager/runtimeConfig.ts index 21c061cb189d..05f676d3d5cf 100644 --- a/clients/client-license-manager/runtimeConfig.ts +++ b/clients/client-license-manager/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lightsail/runtimeConfig.browser.ts b/clients/client-lightsail/runtimeConfig.browser.ts index 0ec8c11082e1..d4abdac9bda9 100644 --- a/clients/client-lightsail/runtimeConfig.browser.ts +++ b/clients/client-lightsail/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LightsailClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lightsail/runtimeConfig.native.ts b/clients/client-lightsail/runtimeConfig.native.ts index ca0c181cd9de..d22e9608f7c1 100644 --- a/clients/client-lightsail/runtimeConfig.native.ts +++ b/clients/client-lightsail/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LightsailClientConfig } from "./LightsailClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LightsailClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lightsail/runtimeConfig.shared.ts b/clients/client-lightsail/runtimeConfig.shared.ts index 4e974352baf7..5891055cb9ba 100644 --- a/clients/client-lightsail/runtimeConfig.shared.ts +++ b/clients/client-lightsail/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LightsailClientConfig } from "./LightsailClient"; @@ -9,9 +8,9 @@ import { LightsailClientConfig } from "./LightsailClient"; */ export const getRuntimeConfig = (config: LightsailClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Lightsail"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Lightsail", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lightsail/runtimeConfig.ts b/clients/client-lightsail/runtimeConfig.ts index e1b6bf5d16e1..a39ded4572e7 100644 --- a/clients/client-lightsail/runtimeConfig.ts +++ b/clients/client-lightsail/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LightsailClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-location/runtimeConfig.browser.ts b/clients/client-location/runtimeConfig.browser.ts index ef8555b91d42..aa568adb37b9 100644 --- a/clients/client-location/runtimeConfig.browser.ts +++ b/clients/client-location/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LocationClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-location/runtimeConfig.native.ts b/clients/client-location/runtimeConfig.native.ts index 105e0ca05d7b..bf6581a1ce41 100644 --- a/clients/client-location/runtimeConfig.native.ts +++ b/clients/client-location/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LocationClientConfig } from "./LocationClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LocationClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-location/runtimeConfig.shared.ts b/clients/client-location/runtimeConfig.shared.ts index 8d9816594226..e1465543f59e 100644 --- a/clients/client-location/runtimeConfig.shared.ts +++ b/clients/client-location/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LocationClientConfig } from "./LocationClient"; @@ -9,9 +8,9 @@ import { LocationClientConfig } from "./LocationClient"; */ export const getRuntimeConfig = (config: LocationClientConfig) => ({ apiVersion: "2020-11-19", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Location"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Location", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-location/runtimeConfig.ts b/clients/client-location/runtimeConfig.ts index c3bcafd0c81b..eeed2876c2c1 100644 --- a/clients/client-location/runtimeConfig.ts +++ b/clients/client-location/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LocationClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lookoutequipment/runtimeConfig.browser.ts b/clients/client-lookoutequipment/runtimeConfig.browser.ts index bd25dbbbab89..74add981eb0d 100644 --- a/clients/client-lookoutequipment/runtimeConfig.browser.ts +++ b/clients/client-lookoutequipment/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lookoutequipment/runtimeConfig.native.ts b/clients/client-lookoutequipment/runtimeConfig.native.ts index 98ebe3cde284..fa758311a031 100644 --- a/clients/client-lookoutequipment/runtimeConfig.native.ts +++ b/clients/client-lookoutequipment/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LookoutEquipmentClientConfig } from "./LookoutEquipmentClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lookoutequipment/runtimeConfig.shared.ts b/clients/client-lookoutequipment/runtimeConfig.shared.ts index df973247d649..0150d461a461 100644 --- a/clients/client-lookoutequipment/runtimeConfig.shared.ts +++ b/clients/client-lookoutequipment/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LookoutEquipmentClientConfig } from "./LookoutEquipmentClient"; @@ -9,9 +8,9 @@ import { LookoutEquipmentClientConfig } from "./LookoutEquipmentClient"; */ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => ({ apiVersion: "2020-12-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "LookoutEquipment"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "LookoutEquipment", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lookoutequipment/runtimeConfig.ts b/clients/client-lookoutequipment/runtimeConfig.ts index f2b562a73c5a..9c3eacbcf832 100644 --- a/clients/client-lookoutequipment/runtimeConfig.ts +++ b/clients/client-lookoutequipment/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lookoutmetrics/runtimeConfig.browser.ts b/clients/client-lookoutmetrics/runtimeConfig.browser.ts index e5afd986b30e..f0e81766318f 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.browser.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lookoutmetrics/runtimeConfig.native.ts b/clients/client-lookoutmetrics/runtimeConfig.native.ts index 3e390f95bf0c..3f754d99668f 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.native.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LookoutMetricsClientConfig } from "./LookoutMetricsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lookoutmetrics/runtimeConfig.shared.ts b/clients/client-lookoutmetrics/runtimeConfig.shared.ts index 98a8ee63bb9f..69eb25ecbce1 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.shared.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LookoutMetricsClientConfig } from "./LookoutMetricsClient"; @@ -9,9 +8,9 @@ import { LookoutMetricsClientConfig } from "./LookoutMetricsClient"; */ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "LookoutMetrics"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "LookoutMetrics", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lookoutmetrics/runtimeConfig.ts b/clients/client-lookoutmetrics/runtimeConfig.ts index 4f3751477755..4bb505d3a742 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lookoutvision/runtimeConfig.browser.ts b/clients/client-lookoutvision/runtimeConfig.browser.ts index 008c8091a976..ede630012a76 100644 --- a/clients/client-lookoutvision/runtimeConfig.browser.ts +++ b/clients/client-lookoutvision/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-lookoutvision/runtimeConfig.native.ts b/clients/client-lookoutvision/runtimeConfig.native.ts index f1f298346b0d..32002583ad34 100644 --- a/clients/client-lookoutvision/runtimeConfig.native.ts +++ b/clients/client-lookoutvision/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { LookoutVisionClientConfig } from "./LookoutVisionClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-lookoutvision/runtimeConfig.shared.ts b/clients/client-lookoutvision/runtimeConfig.shared.ts index c683032c00f8..2b92cd9bd350 100644 --- a/clients/client-lookoutvision/runtimeConfig.shared.ts +++ b/clients/client-lookoutvision/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { LookoutVisionClientConfig } from "./LookoutVisionClient"; @@ -9,9 +8,9 @@ import { LookoutVisionClientConfig } from "./LookoutVisionClient"; */ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => ({ apiVersion: "2020-11-20", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "LookoutVision"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "LookoutVision", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-lookoutvision/runtimeConfig.ts b/clients/client-lookoutvision/runtimeConfig.ts index 6793ca40a4c2..789c573146de 100644 --- a/clients/client-lookoutvision/runtimeConfig.ts +++ b/clients/client-lookoutvision/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-machine-learning/runtimeConfig.browser.ts b/clients/client-machine-learning/runtimeConfig.browser.ts index aaf82a9a5cfd..4700269bd2a4 100644 --- a/clients/client-machine-learning/runtimeConfig.browser.ts +++ b/clients/client-machine-learning/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MachineLearningClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-machine-learning/runtimeConfig.native.ts b/clients/client-machine-learning/runtimeConfig.native.ts index 9b2e162015dc..d6673fb6f895 100644 --- a/clients/client-machine-learning/runtimeConfig.native.ts +++ b/clients/client-machine-learning/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MachineLearningClientConfig } from "./MachineLearningClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MachineLearningClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-machine-learning/runtimeConfig.shared.ts b/clients/client-machine-learning/runtimeConfig.shared.ts index 2b32916e6c22..5c7984e2685b 100644 --- a/clients/client-machine-learning/runtimeConfig.shared.ts +++ b/clients/client-machine-learning/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MachineLearningClientConfig } from "./MachineLearningClient"; @@ -9,9 +8,9 @@ import { MachineLearningClientConfig } from "./MachineLearningClient"; */ export const getRuntimeConfig = (config: MachineLearningClientConfig) => ({ apiVersion: "2014-12-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Machine Learning"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Machine Learning", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-machine-learning/runtimeConfig.ts b/clients/client-machine-learning/runtimeConfig.ts index 3b56ca294a62..59c8044ace35 100644 --- a/clients/client-machine-learning/runtimeConfig.ts +++ b/clients/client-machine-learning/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MachineLearningClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-macie/runtimeConfig.browser.ts b/clients/client-macie/runtimeConfig.browser.ts index ef5c6be00d28..80ea8a615083 100644 --- a/clients/client-macie/runtimeConfig.browser.ts +++ b/clients/client-macie/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MacieClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-macie/runtimeConfig.native.ts b/clients/client-macie/runtimeConfig.native.ts index 084dac955977..b2e0cf8dc18c 100644 --- a/clients/client-macie/runtimeConfig.native.ts +++ b/clients/client-macie/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MacieClientConfig } from "./MacieClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MacieClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-macie/runtimeConfig.shared.ts b/clients/client-macie/runtimeConfig.shared.ts index c22bfe26ba8b..cdfcde30d263 100644 --- a/clients/client-macie/runtimeConfig.shared.ts +++ b/clients/client-macie/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MacieClientConfig } from "./MacieClient"; @@ -9,9 +8,9 @@ import { MacieClientConfig } from "./MacieClient"; */ export const getRuntimeConfig = (config: MacieClientConfig) => ({ apiVersion: "2017-12-19", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Macie"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Macie", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-macie/runtimeConfig.ts b/clients/client-macie/runtimeConfig.ts index 8cd81972763c..fe9550718dae 100644 --- a/clients/client-macie/runtimeConfig.ts +++ b/clients/client-macie/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MacieClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-macie2/runtimeConfig.browser.ts b/clients/client-macie2/runtimeConfig.browser.ts index cb057712c8fd..cfc4f709a0d6 100644 --- a/clients/client-macie2/runtimeConfig.browser.ts +++ b/clients/client-macie2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: Macie2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-macie2/runtimeConfig.native.ts b/clients/client-macie2/runtimeConfig.native.ts index 3a751b4b222d..2fc35ac9381b 100644 --- a/clients/client-macie2/runtimeConfig.native.ts +++ b/clients/client-macie2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Macie2ClientConfig } from "./Macie2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: Macie2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-macie2/runtimeConfig.shared.ts b/clients/client-macie2/runtimeConfig.shared.ts index 669ea733c60a..0d668c406a63 100644 --- a/clients/client-macie2/runtimeConfig.shared.ts +++ b/clients/client-macie2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { Macie2ClientConfig } from "./Macie2Client"; @@ -9,9 +8,9 @@ import { Macie2ClientConfig } from "./Macie2Client"; */ export const getRuntimeConfig = (config: Macie2ClientConfig) => ({ apiVersion: "2020-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Macie2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Macie2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-macie2/runtimeConfig.ts b/clients/client-macie2/runtimeConfig.ts index d5934c07b281..4d0fc28831a7 100644 --- a/clients/client-macie2/runtimeConfig.ts +++ b/clients/client-macie2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: Macie2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-managedblockchain/runtimeConfig.browser.ts b/clients/client-managedblockchain/runtimeConfig.browser.ts index 6ef6d68b02ec..18c269ce94cf 100644 --- a/clients/client-managedblockchain/runtimeConfig.browser.ts +++ b/clients/client-managedblockchain/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-managedblockchain/runtimeConfig.native.ts b/clients/client-managedblockchain/runtimeConfig.native.ts index 25cbecb27bbf..ca9333a714b0 100644 --- a/clients/client-managedblockchain/runtimeConfig.native.ts +++ b/clients/client-managedblockchain/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ManagedBlockchainClientConfig } from "./ManagedBlockchainClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-managedblockchain/runtimeConfig.shared.ts b/clients/client-managedblockchain/runtimeConfig.shared.ts index 3e2c9cb58765..eaa5d25fbd36 100644 --- a/clients/client-managedblockchain/runtimeConfig.shared.ts +++ b/clients/client-managedblockchain/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ManagedBlockchainClientConfig } from "./ManagedBlockchainClient"; @@ -9,9 +8,9 @@ import { ManagedBlockchainClientConfig } from "./ManagedBlockchainClient"; */ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => ({ apiVersion: "2018-09-24", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ManagedBlockchain"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ManagedBlockchain", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-managedblockchain/runtimeConfig.ts b/clients/client-managedblockchain/runtimeConfig.ts index 9599151ef9d2..d38f4ba011b9 100644 --- a/clients/client-managedblockchain/runtimeConfig.ts +++ b/clients/client-managedblockchain/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-catalog/runtimeConfig.browser.ts b/clients/client-marketplace-catalog/runtimeConfig.browser.ts index a9617495216a..0997608db769 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.browser.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-catalog/runtimeConfig.native.ts b/clients/client-marketplace-catalog/runtimeConfig.native.ts index 4c3289e2ab14..123677904e75 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.native.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MarketplaceCatalogClientConfig } from "./MarketplaceCatalogClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-marketplace-catalog/runtimeConfig.shared.ts b/clients/client-marketplace-catalog/runtimeConfig.shared.ts index 4d4ead6fe67d..2ea07c1177d6 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.shared.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MarketplaceCatalogClientConfig } from "./MarketplaceCatalogClient"; @@ -9,9 +8,9 @@ import { MarketplaceCatalogClientConfig } from "./MarketplaceCatalogClient"; */ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => ({ apiVersion: "2018-09-17", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Marketplace Catalog"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Marketplace Catalog", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-marketplace-catalog/runtimeConfig.ts b/clients/client-marketplace-catalog/runtimeConfig.ts index 4563ea96c1be..9cf794aa2b27 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts index 8ea84f28f861..c7c8757cc19c 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfi return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts index c7c3ca189128..8b6528944b62 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MarketplaceCommerceAnalyticsClientConfig } from "./MarketplaceCommerceAnalyticsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfi return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts index 6dac3f383e79..063c145fc639 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MarketplaceCommerceAnalyticsClientConfig } from "./MarketplaceCommerceAnalyticsClient"; @@ -9,9 +8,9 @@ import { MarketplaceCommerceAnalyticsClientConfig } from "./MarketplaceCommerceA */ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfig) => ({ apiVersion: "2015-07-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Marketplace Commerce Analytics"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Marketplace Commerce Analytics", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.ts index 5fc431332652..b9e885ca7645 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfi return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts index 2ccedecaa547..4110308e5316 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConf return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts index 44c82053812b..21419bebe7e3 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MarketplaceEntitlementServiceClientConfig } from "./MarketplaceEntitlementServiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConf return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts index 728f474f18ec..7d12cdb07b53 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MarketplaceEntitlementServiceClientConfig } from "./MarketplaceEntitlementServiceClient"; @@ -9,9 +8,9 @@ import { MarketplaceEntitlementServiceClientConfig } from "./MarketplaceEntitlem */ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConfig) => ({ apiVersion: "2017-01-11", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Marketplace Entitlement Service"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Marketplace Entitlement Service", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.ts index d523b69a87e9..4151534fa6ec 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConf return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-metering/runtimeConfig.browser.ts b/clients/client-marketplace-metering/runtimeConfig.browser.ts index a3495633c3c2..6bf2305cd942 100644 --- a/clients/client-marketplace-metering/runtimeConfig.browser.ts +++ b/clients/client-marketplace-metering/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-marketplace-metering/runtimeConfig.native.ts b/clients/client-marketplace-metering/runtimeConfig.native.ts index 792d30700b48..a7cb857ad09b 100644 --- a/clients/client-marketplace-metering/runtimeConfig.native.ts +++ b/clients/client-marketplace-metering/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MarketplaceMeteringClientConfig } from "./MarketplaceMeteringClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-marketplace-metering/runtimeConfig.shared.ts b/clients/client-marketplace-metering/runtimeConfig.shared.ts index 7001f097788a..259ea3e789a7 100644 --- a/clients/client-marketplace-metering/runtimeConfig.shared.ts +++ b/clients/client-marketplace-metering/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MarketplaceMeteringClientConfig } from "./MarketplaceMeteringClient"; @@ -9,9 +8,9 @@ import { MarketplaceMeteringClientConfig } from "./MarketplaceMeteringClient"; */ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => ({ apiVersion: "2016-01-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Marketplace Metering"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Marketplace Metering", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-marketplace-metering/runtimeConfig.ts b/clients/client-marketplace-metering/runtimeConfig.ts index 326a7e962712..dbb5d54dca04 100644 --- a/clients/client-marketplace-metering/runtimeConfig.ts +++ b/clients/client-marketplace-metering/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediaconnect/runtimeConfig.browser.ts b/clients/client-mediaconnect/runtimeConfig.browser.ts index 5fe79d1e8c56..f5e420954751 100644 --- a/clients/client-mediaconnect/runtimeConfig.browser.ts +++ b/clients/client-mediaconnect/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaConnectClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediaconnect/runtimeConfig.native.ts b/clients/client-mediaconnect/runtimeConfig.native.ts index da5e58626666..3c1f5fe33ecd 100644 --- a/clients/client-mediaconnect/runtimeConfig.native.ts +++ b/clients/client-mediaconnect/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaConnectClientConfig } from "./MediaConnectClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaConnectClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediaconnect/runtimeConfig.shared.ts b/clients/client-mediaconnect/runtimeConfig.shared.ts index 6bb9382910e1..8cecb4ab28ac 100644 --- a/clients/client-mediaconnect/runtimeConfig.shared.ts +++ b/clients/client-mediaconnect/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaConnectClientConfig } from "./MediaConnectClient"; @@ -9,9 +8,9 @@ import { MediaConnectClientConfig } from "./MediaConnectClient"; */ export const getRuntimeConfig = (config: MediaConnectClientConfig) => ({ apiVersion: "2018-11-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaConnect"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaConnect", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediaconnect/runtimeConfig.ts b/clients/client-mediaconnect/runtimeConfig.ts index 7dad56947cc2..7a81c2614a26 100644 --- a/clients/client-mediaconnect/runtimeConfig.ts +++ b/clients/client-mediaconnect/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaConnectClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediaconvert/runtimeConfig.browser.ts b/clients/client-mediaconvert/runtimeConfig.browser.ts index efe9f90db4f3..bda05ea2741b 100644 --- a/clients/client-mediaconvert/runtimeConfig.browser.ts +++ b/clients/client-mediaconvert/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaConvertClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediaconvert/runtimeConfig.native.ts b/clients/client-mediaconvert/runtimeConfig.native.ts index e3dbbfa23474..12b5f834f04b 100644 --- a/clients/client-mediaconvert/runtimeConfig.native.ts +++ b/clients/client-mediaconvert/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaConvertClientConfig } from "./MediaConvertClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaConvertClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediaconvert/runtimeConfig.shared.ts b/clients/client-mediaconvert/runtimeConfig.shared.ts index 4b3c9c238e16..4e0273b13b51 100644 --- a/clients/client-mediaconvert/runtimeConfig.shared.ts +++ b/clients/client-mediaconvert/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaConvertClientConfig } from "./MediaConvertClient"; @@ -9,9 +8,9 @@ import { MediaConvertClientConfig } from "./MediaConvertClient"; */ export const getRuntimeConfig = (config: MediaConvertClientConfig) => ({ apiVersion: "2017-08-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaConvert"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaConvert", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediaconvert/runtimeConfig.ts b/clients/client-mediaconvert/runtimeConfig.ts index dc53526af52d..05ad709c93a0 100644 --- a/clients/client-mediaconvert/runtimeConfig.ts +++ b/clients/client-mediaconvert/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaConvertClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-medialive/runtimeConfig.browser.ts b/clients/client-medialive/runtimeConfig.browser.ts index 84380f92e173..d968931bef9b 100644 --- a/clients/client-medialive/runtimeConfig.browser.ts +++ b/clients/client-medialive/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-medialive/runtimeConfig.native.ts b/clients/client-medialive/runtimeConfig.native.ts index 8f5e5d84a8af..1058d93bf5c1 100644 --- a/clients/client-medialive/runtimeConfig.native.ts +++ b/clients/client-medialive/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaLiveClientConfig } from "./MediaLiveClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-medialive/runtimeConfig.shared.ts b/clients/client-medialive/runtimeConfig.shared.ts index c461ea8dec50..9135f59d2cba 100644 --- a/clients/client-medialive/runtimeConfig.shared.ts +++ b/clients/client-medialive/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaLiveClientConfig } from "./MediaLiveClient"; @@ -9,9 +8,9 @@ import { MediaLiveClientConfig } from "./MediaLiveClient"; */ export const getRuntimeConfig = (config: MediaLiveClientConfig) => ({ apiVersion: "2017-10-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaLive"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaLive", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-medialive/runtimeConfig.ts b/clients/client-medialive/runtimeConfig.ts index 00cd0b6005c9..6f65abb4f1e2 100644 --- a/clients/client-medialive/runtimeConfig.ts +++ b/clients/client-medialive/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediapackage-vod/runtimeConfig.browser.ts b/clients/client-mediapackage-vod/runtimeConfig.browser.ts index 5f00924e2a74..4f7dcce4dbb4 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.browser.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediapackage-vod/runtimeConfig.native.ts b/clients/client-mediapackage-vod/runtimeConfig.native.ts index d838283f8620..c0be50b57dac 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.native.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaPackageVodClientConfig } from "./MediaPackageVodClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediapackage-vod/runtimeConfig.shared.ts b/clients/client-mediapackage-vod/runtimeConfig.shared.ts index 1b3211ed0ff1..4a0a7d0f0202 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.shared.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaPackageVodClientConfig } from "./MediaPackageVodClient"; @@ -9,9 +8,9 @@ import { MediaPackageVodClientConfig } from "./MediaPackageVodClient"; */ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => ({ apiVersion: "2018-11-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaPackage Vod"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaPackage Vod", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediapackage-vod/runtimeConfig.ts b/clients/client-mediapackage-vod/runtimeConfig.ts index 3ab63f8ce191..52251d69b89d 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediapackage/runtimeConfig.browser.ts b/clients/client-mediapackage/runtimeConfig.browser.ts index ac40489f0e23..8e65970580fb 100644 --- a/clients/client-mediapackage/runtimeConfig.browser.ts +++ b/clients/client-mediapackage/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaPackageClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediapackage/runtimeConfig.native.ts b/clients/client-mediapackage/runtimeConfig.native.ts index 0825a2ab1c98..6cf299daa526 100644 --- a/clients/client-mediapackage/runtimeConfig.native.ts +++ b/clients/client-mediapackage/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaPackageClientConfig } from "./MediaPackageClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaPackageClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediapackage/runtimeConfig.shared.ts b/clients/client-mediapackage/runtimeConfig.shared.ts index 56d7908e2e5e..458c7ed64426 100644 --- a/clients/client-mediapackage/runtimeConfig.shared.ts +++ b/clients/client-mediapackage/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaPackageClientConfig } from "./MediaPackageClient"; @@ -9,9 +8,9 @@ import { MediaPackageClientConfig } from "./MediaPackageClient"; */ export const getRuntimeConfig = (config: MediaPackageClientConfig) => ({ apiVersion: "2017-10-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaPackage"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaPackage", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediapackage/runtimeConfig.ts b/clients/client-mediapackage/runtimeConfig.ts index 6d8bcf9d9d9d..50155d71f7da 100644 --- a/clients/client-mediapackage/runtimeConfig.ts +++ b/clients/client-mediapackage/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaPackageClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediastore-data/runtimeConfig.browser.ts b/clients/client-mediastore-data/runtimeConfig.browser.ts index ed32721bb852..e72709e87ca1 100644 --- a/clients/client-mediastore-data/runtimeConfig.browser.ts +++ b/clients/client-mediastore-data/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediastore-data/runtimeConfig.native.ts b/clients/client-mediastore-data/runtimeConfig.native.ts index 7025fda54b31..7693357b511a 100644 --- a/clients/client-mediastore-data/runtimeConfig.native.ts +++ b/clients/client-mediastore-data/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediastore-data/runtimeConfig.shared.ts b/clients/client-mediastore-data/runtimeConfig.shared.ts index 9d285c35af90..9511d38fbdc7 100644 --- a/clients/client-mediastore-data/runtimeConfig.shared.ts +++ b/clients/client-mediastore-data/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; @@ -9,9 +8,9 @@ import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; */ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => ({ apiVersion: "2017-09-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaStore Data"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaStore Data", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediastore-data/runtimeConfig.ts b/clients/client-mediastore-data/runtimeConfig.ts index 1ab1c8a49c89..a9443fff210a 100644 --- a/clients/client-mediastore-data/runtimeConfig.ts +++ b/clients/client-mediastore-data/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediastore/runtimeConfig.browser.ts b/clients/client-mediastore/runtimeConfig.browser.ts index 7c7d4a8853d6..4b7cdaacdc43 100644 --- a/clients/client-mediastore/runtimeConfig.browser.ts +++ b/clients/client-mediastore/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaStoreClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediastore/runtimeConfig.native.ts b/clients/client-mediastore/runtimeConfig.native.ts index a63434794260..dc283a2c28e2 100644 --- a/clients/client-mediastore/runtimeConfig.native.ts +++ b/clients/client-mediastore/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaStoreClientConfig } from "./MediaStoreClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaStoreClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediastore/runtimeConfig.shared.ts b/clients/client-mediastore/runtimeConfig.shared.ts index c703dbd8f466..e7fb05c9eaf7 100644 --- a/clients/client-mediastore/runtimeConfig.shared.ts +++ b/clients/client-mediastore/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaStoreClientConfig } from "./MediaStoreClient"; @@ -9,9 +8,9 @@ import { MediaStoreClientConfig } from "./MediaStoreClient"; */ export const getRuntimeConfig = (config: MediaStoreClientConfig) => ({ apiVersion: "2017-09-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaStore"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaStore", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediastore/runtimeConfig.ts b/clients/client-mediastore/runtimeConfig.ts index 785ca0e3ec60..6325f63ef7a1 100644 --- a/clients/client-mediastore/runtimeConfig.ts +++ b/clients/client-mediastore/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaStoreClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediatailor/runtimeConfig.browser.ts b/clients/client-mediatailor/runtimeConfig.browser.ts index f7920aa825c6..228fcd9ece7e 100644 --- a/clients/client-mediatailor/runtimeConfig.browser.ts +++ b/clients/client-mediatailor/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MediaTailorClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mediatailor/runtimeConfig.native.ts b/clients/client-mediatailor/runtimeConfig.native.ts index 9e43b514ab16..49522ca7f95d 100644 --- a/clients/client-mediatailor/runtimeConfig.native.ts +++ b/clients/client-mediatailor/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MediaTailorClientConfig } from "./MediaTailorClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MediaTailorClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mediatailor/runtimeConfig.shared.ts b/clients/client-mediatailor/runtimeConfig.shared.ts index 29e80ed508cc..29adcafc4a74 100644 --- a/clients/client-mediatailor/runtimeConfig.shared.ts +++ b/clients/client-mediatailor/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MediaTailorClientConfig } from "./MediaTailorClient"; @@ -9,9 +8,9 @@ import { MediaTailorClientConfig } from "./MediaTailorClient"; */ export const getRuntimeConfig = (config: MediaTailorClientConfig) => ({ apiVersion: "2018-04-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MediaTailor"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MediaTailor", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mediatailor/runtimeConfig.ts b/clients/client-mediatailor/runtimeConfig.ts index ce36af66e5ae..ba98168a1938 100644 --- a/clients/client-mediatailor/runtimeConfig.ts +++ b/clients/client-mediatailor/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MediaTailorClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mgn/runtimeConfig.browser.ts b/clients/client-mgn/runtimeConfig.browser.ts index bc171a2746de..af22c936e7c2 100644 --- a/clients/client-mgn/runtimeConfig.browser.ts +++ b/clients/client-mgn/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MgnClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mgn/runtimeConfig.native.ts b/clients/client-mgn/runtimeConfig.native.ts index 485f148418d7..3637313f7063 100644 --- a/clients/client-mgn/runtimeConfig.native.ts +++ b/clients/client-mgn/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MgnClientConfig } from "./MgnClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MgnClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mgn/runtimeConfig.shared.ts b/clients/client-mgn/runtimeConfig.shared.ts index 64e8c940eacd..adcec5ac4db0 100644 --- a/clients/client-mgn/runtimeConfig.shared.ts +++ b/clients/client-mgn/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MgnClientConfig } from "./MgnClient"; @@ -9,9 +8,9 @@ import { MgnClientConfig } from "./MgnClient"; */ export const getRuntimeConfig = (config: MgnClientConfig) => ({ apiVersion: "2020-02-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "mgn"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "mgn", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mgn/runtimeConfig.ts b/clients/client-mgn/runtimeConfig.ts index 87c1d41fc0ce..3299fe1cbe48 100644 --- a/clients/client-mgn/runtimeConfig.ts +++ b/clients/client-mgn/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MgnClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-migration-hub/runtimeConfig.browser.ts b/clients/client-migration-hub/runtimeConfig.browser.ts index 16a9d505d7a7..a9fe13486347 100644 --- a/clients/client-migration-hub/runtimeConfig.browser.ts +++ b/clients/client-migration-hub/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MigrationHubClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-migration-hub/runtimeConfig.native.ts b/clients/client-migration-hub/runtimeConfig.native.ts index 69cff771ce68..4cfd771c0d6c 100644 --- a/clients/client-migration-hub/runtimeConfig.native.ts +++ b/clients/client-migration-hub/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MigrationHubClientConfig } from "./MigrationHubClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MigrationHubClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-migration-hub/runtimeConfig.shared.ts b/clients/client-migration-hub/runtimeConfig.shared.ts index 603cc97185fb..33d7600f6eaf 100644 --- a/clients/client-migration-hub/runtimeConfig.shared.ts +++ b/clients/client-migration-hub/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MigrationHubClientConfig } from "./MigrationHubClient"; @@ -9,9 +8,9 @@ import { MigrationHubClientConfig } from "./MigrationHubClient"; */ export const getRuntimeConfig = (config: MigrationHubClientConfig) => ({ apiVersion: "2017-05-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Migration Hub"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Migration Hub", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-migration-hub/runtimeConfig.ts b/clients/client-migration-hub/runtimeConfig.ts index ccf1c50a576d..820b6544d5e8 100644 --- a/clients/client-migration-hub/runtimeConfig.ts +++ b/clients/client-migration-hub/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MigrationHubClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-migrationhub-config/runtimeConfig.browser.ts b/clients/client-migrationhub-config/runtimeConfig.browser.ts index 153aa8c45af0..55ec9b506f6c 100644 --- a/clients/client-migrationhub-config/runtimeConfig.browser.ts +++ b/clients/client-migrationhub-config/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-migrationhub-config/runtimeConfig.native.ts b/clients/client-migrationhub-config/runtimeConfig.native.ts index 3d6f6a4a45d5..5ba5d70b74ef 100644 --- a/clients/client-migrationhub-config/runtimeConfig.native.ts +++ b/clients/client-migrationhub-config/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MigrationHubConfigClientConfig } from "./MigrationHubConfigClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-migrationhub-config/runtimeConfig.shared.ts b/clients/client-migrationhub-config/runtimeConfig.shared.ts index 5a839ed0f96f..99e7cc3ed331 100644 --- a/clients/client-migrationhub-config/runtimeConfig.shared.ts +++ b/clients/client-migrationhub-config/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MigrationHubConfigClientConfig } from "./MigrationHubConfigClient"; @@ -9,9 +8,9 @@ import { MigrationHubConfigClientConfig } from "./MigrationHubConfigClient"; */ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => ({ apiVersion: "2019-06-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MigrationHub Config"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MigrationHub Config", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-migrationhub-config/runtimeConfig.ts b/clients/client-migrationhub-config/runtimeConfig.ts index e3311b66ab3e..4f59f538b990 100644 --- a/clients/client-migrationhub-config/runtimeConfig.ts +++ b/clients/client-migrationhub-config/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mobile/runtimeConfig.browser.ts b/clients/client-mobile/runtimeConfig.browser.ts index 865321e6e99c..7835ffe8c011 100644 --- a/clients/client-mobile/runtimeConfig.browser.ts +++ b/clients/client-mobile/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MobileClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mobile/runtimeConfig.native.ts b/clients/client-mobile/runtimeConfig.native.ts index 471b293ad0a1..e1580f4a5bd3 100644 --- a/clients/client-mobile/runtimeConfig.native.ts +++ b/clients/client-mobile/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MobileClientConfig } from "./MobileClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MobileClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mobile/runtimeConfig.shared.ts b/clients/client-mobile/runtimeConfig.shared.ts index b10f89b16265..c2fa7896ea0b 100644 --- a/clients/client-mobile/runtimeConfig.shared.ts +++ b/clients/client-mobile/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MobileClientConfig } from "./MobileClient"; @@ -9,9 +8,9 @@ import { MobileClientConfig } from "./MobileClient"; */ export const getRuntimeConfig = (config: MobileClientConfig) => ({ apiVersion: "2017-07-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Mobile"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Mobile", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mobile/runtimeConfig.ts b/clients/client-mobile/runtimeConfig.ts index 2b6e88a5da01..5aed0aa81dda 100644 --- a/clients/client-mobile/runtimeConfig.ts +++ b/clients/client-mobile/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MobileClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mq/runtimeConfig.browser.ts b/clients/client-mq/runtimeConfig.browser.ts index e4fc13fa6f3f..114fd9a69ca8 100644 --- a/clients/client-mq/runtimeConfig.browser.ts +++ b/clients/client-mq/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MqClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mq/runtimeConfig.native.ts b/clients/client-mq/runtimeConfig.native.ts index f67d42e6c059..94db10392a7f 100644 --- a/clients/client-mq/runtimeConfig.native.ts +++ b/clients/client-mq/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MqClientConfig } from "./MqClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MqClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mq/runtimeConfig.shared.ts b/clients/client-mq/runtimeConfig.shared.ts index e05c5fb038c4..b6b3d86ac06a 100644 --- a/clients/client-mq/runtimeConfig.shared.ts +++ b/clients/client-mq/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MqClientConfig } from "./MqClient"; @@ -9,9 +8,9 @@ import { MqClientConfig } from "./MqClient"; */ export const getRuntimeConfig = (config: MqClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "mq"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "mq", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mq/runtimeConfig.ts b/clients/client-mq/runtimeConfig.ts index a538f8f42bc7..024a66c3a3ab 100644 --- a/clients/client-mq/runtimeConfig.ts +++ b/clients/client-mq/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MqClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mturk/runtimeConfig.browser.ts b/clients/client-mturk/runtimeConfig.browser.ts index 41c0a0c96528..623cb67bbdc8 100644 --- a/clients/client-mturk/runtimeConfig.browser.ts +++ b/clients/client-mturk/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MTurkClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mturk/runtimeConfig.native.ts b/clients/client-mturk/runtimeConfig.native.ts index d3517fa03fc1..92ab9d313184 100644 --- a/clients/client-mturk/runtimeConfig.native.ts +++ b/clients/client-mturk/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MTurkClientConfig } from "./MTurkClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MTurkClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mturk/runtimeConfig.shared.ts b/clients/client-mturk/runtimeConfig.shared.ts index f5f8398866df..354d5b5996b5 100644 --- a/clients/client-mturk/runtimeConfig.shared.ts +++ b/clients/client-mturk/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MTurkClientConfig } from "./MTurkClient"; @@ -9,9 +8,9 @@ import { MTurkClientConfig } from "./MTurkClient"; */ export const getRuntimeConfig = (config: MTurkClientConfig) => ({ apiVersion: "2017-01-17", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MTurk"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MTurk", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mturk/runtimeConfig.ts b/clients/client-mturk/runtimeConfig.ts index aba42ad80470..090fb22b5598 100644 --- a/clients/client-mturk/runtimeConfig.ts +++ b/clients/client-mturk/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MTurkClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mwaa/runtimeConfig.browser.ts b/clients/client-mwaa/runtimeConfig.browser.ts index 9055ca8cd910..9e01bf68450c 100644 --- a/clients/client-mwaa/runtimeConfig.browser.ts +++ b/clients/client-mwaa/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: MWAAClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-mwaa/runtimeConfig.native.ts b/clients/client-mwaa/runtimeConfig.native.ts index ec15971d92fe..50f9a66db5ab 100644 --- a/clients/client-mwaa/runtimeConfig.native.ts +++ b/clients/client-mwaa/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { MWAAClientConfig } from "./MWAAClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: MWAAClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-mwaa/runtimeConfig.shared.ts b/clients/client-mwaa/runtimeConfig.shared.ts index b869a3b7c957..ae4802e378d4 100644 --- a/clients/client-mwaa/runtimeConfig.shared.ts +++ b/clients/client-mwaa/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { MWAAClientConfig } from "./MWAAClient"; @@ -9,9 +8,9 @@ import { MWAAClientConfig } from "./MWAAClient"; */ export const getRuntimeConfig = (config: MWAAClientConfig) => ({ apiVersion: "2020-07-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "MWAA"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "MWAA", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-mwaa/runtimeConfig.ts b/clients/client-mwaa/runtimeConfig.ts index 806a74c47848..c8c281611d1d 100644 --- a/clients/client-mwaa/runtimeConfig.ts +++ b/clients/client-mwaa/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: MWAAClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-neptune/runtimeConfig.browser.ts b/clients/client-neptune/runtimeConfig.browser.ts index dde7a4e057b3..4dd19dbcceee 100644 --- a/clients/client-neptune/runtimeConfig.browser.ts +++ b/clients/client-neptune/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: NeptuneClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-neptune/runtimeConfig.native.ts b/clients/client-neptune/runtimeConfig.native.ts index 628624017a9d..a57f6a1ec2a2 100644 --- a/clients/client-neptune/runtimeConfig.native.ts +++ b/clients/client-neptune/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { NeptuneClientConfig } from "./NeptuneClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: NeptuneClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-neptune/runtimeConfig.shared.ts b/clients/client-neptune/runtimeConfig.shared.ts index 97a8fe60841a..2089db65bf85 100644 --- a/clients/client-neptune/runtimeConfig.shared.ts +++ b/clients/client-neptune/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { NeptuneClientConfig } from "./NeptuneClient"; @@ -9,9 +8,9 @@ import { NeptuneClientConfig } from "./NeptuneClient"; */ export const getRuntimeConfig = (config: NeptuneClientConfig) => ({ apiVersion: "2014-10-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Neptune"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Neptune", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-neptune/runtimeConfig.ts b/clients/client-neptune/runtimeConfig.ts index a9257ead0917..34e1481a1c99 100644 --- a/clients/client-neptune/runtimeConfig.ts +++ b/clients/client-neptune/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: NeptuneClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-network-firewall/runtimeConfig.browser.ts b/clients/client-network-firewall/runtimeConfig.browser.ts index e5336c66a5cc..5b3e345bf22b 100644 --- a/clients/client-network-firewall/runtimeConfig.browser.ts +++ b/clients/client-network-firewall/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-network-firewall/runtimeConfig.native.ts b/clients/client-network-firewall/runtimeConfig.native.ts index 7607f909a6df..e2aa538bc36f 100644 --- a/clients/client-network-firewall/runtimeConfig.native.ts +++ b/clients/client-network-firewall/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { NetworkFirewallClientConfig } from "./NetworkFirewallClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-network-firewall/runtimeConfig.shared.ts b/clients/client-network-firewall/runtimeConfig.shared.ts index 22ae53fecafb..0872b41a1543 100644 --- a/clients/client-network-firewall/runtimeConfig.shared.ts +++ b/clients/client-network-firewall/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { NetworkFirewallClientConfig } from "./NetworkFirewallClient"; @@ -9,9 +8,9 @@ import { NetworkFirewallClientConfig } from "./NetworkFirewallClient"; */ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => ({ apiVersion: "2020-11-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Network Firewall"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Network Firewall", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-network-firewall/runtimeConfig.ts b/clients/client-network-firewall/runtimeConfig.ts index 601b85ac7038..8a72ab60f70f 100644 --- a/clients/client-network-firewall/runtimeConfig.ts +++ b/clients/client-network-firewall/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-networkmanager/runtimeConfig.browser.ts b/clients/client-networkmanager/runtimeConfig.browser.ts index 4c665a6c8888..0c4389d14de0 100644 --- a/clients/client-networkmanager/runtimeConfig.browser.ts +++ b/clients/client-networkmanager/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-networkmanager/runtimeConfig.native.ts b/clients/client-networkmanager/runtimeConfig.native.ts index f7b537855324..fbf849c13917 100644 --- a/clients/client-networkmanager/runtimeConfig.native.ts +++ b/clients/client-networkmanager/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { NetworkManagerClientConfig } from "./NetworkManagerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-networkmanager/runtimeConfig.shared.ts b/clients/client-networkmanager/runtimeConfig.shared.ts index 71c30bad757f..dfeec1ecb789 100644 --- a/clients/client-networkmanager/runtimeConfig.shared.ts +++ b/clients/client-networkmanager/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { NetworkManagerClientConfig } from "./NetworkManagerClient"; @@ -9,9 +8,9 @@ import { NetworkManagerClientConfig } from "./NetworkManagerClient"; */ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => ({ apiVersion: "2019-07-05", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "NetworkManager"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "NetworkManager", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-networkmanager/runtimeConfig.ts b/clients/client-networkmanager/runtimeConfig.ts index 27206d3731dd..432282e92d04 100644 --- a/clients/client-networkmanager/runtimeConfig.ts +++ b/clients/client-networkmanager/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-nimble/runtimeConfig.browser.ts b/clients/client-nimble/runtimeConfig.browser.ts index 20a9b404e978..3edadab78af5 100644 --- a/clients/client-nimble/runtimeConfig.browser.ts +++ b/clients/client-nimble/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: NimbleClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-nimble/runtimeConfig.native.ts b/clients/client-nimble/runtimeConfig.native.ts index da8de8eb267a..9924d221b642 100644 --- a/clients/client-nimble/runtimeConfig.native.ts +++ b/clients/client-nimble/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { NimbleClientConfig } from "./NimbleClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: NimbleClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-nimble/runtimeConfig.shared.ts b/clients/client-nimble/runtimeConfig.shared.ts index 7c5e202fc453..014bc7e31a80 100644 --- a/clients/client-nimble/runtimeConfig.shared.ts +++ b/clients/client-nimble/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { NimbleClientConfig } from "./NimbleClient"; @@ -9,9 +8,9 @@ import { NimbleClientConfig } from "./NimbleClient"; */ export const getRuntimeConfig = (config: NimbleClientConfig) => ({ apiVersion: "2020-08-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "nimble"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "nimble", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-nimble/runtimeConfig.ts b/clients/client-nimble/runtimeConfig.ts index d9d9cc004182..4591a51e6a33 100644 --- a/clients/client-nimble/runtimeConfig.ts +++ b/clients/client-nimble/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: NimbleClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-opsworks/runtimeConfig.browser.ts b/clients/client-opsworks/runtimeConfig.browser.ts index 8d2c10edb360..a29b44085408 100644 --- a/clients/client-opsworks/runtimeConfig.browser.ts +++ b/clients/client-opsworks/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: OpsWorksClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-opsworks/runtimeConfig.native.ts b/clients/client-opsworks/runtimeConfig.native.ts index f8f2c12423fb..398257d03f1b 100644 --- a/clients/client-opsworks/runtimeConfig.native.ts +++ b/clients/client-opsworks/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { OpsWorksClientConfig } from "./OpsWorksClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: OpsWorksClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-opsworks/runtimeConfig.shared.ts b/clients/client-opsworks/runtimeConfig.shared.ts index 20781da0ea8c..4fabc99fb3d9 100644 --- a/clients/client-opsworks/runtimeConfig.shared.ts +++ b/clients/client-opsworks/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { OpsWorksClientConfig } from "./OpsWorksClient"; @@ -9,9 +8,9 @@ import { OpsWorksClientConfig } from "./OpsWorksClient"; */ export const getRuntimeConfig = (config: OpsWorksClientConfig) => ({ apiVersion: "2013-02-18", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "OpsWorks"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "OpsWorks", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-opsworks/runtimeConfig.ts b/clients/client-opsworks/runtimeConfig.ts index 1706e94ccedd..9b4bc0de2938 100644 --- a/clients/client-opsworks/runtimeConfig.ts +++ b/clients/client-opsworks/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: OpsWorksClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-opsworkscm/runtimeConfig.browser.ts b/clients/client-opsworkscm/runtimeConfig.browser.ts index 67c77040358a..0b93ad83dc66 100644 --- a/clients/client-opsworkscm/runtimeConfig.browser.ts +++ b/clients/client-opsworkscm/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-opsworkscm/runtimeConfig.native.ts b/clients/client-opsworkscm/runtimeConfig.native.ts index 0e56e7650f4a..ce26b10b44b8 100644 --- a/clients/client-opsworkscm/runtimeConfig.native.ts +++ b/clients/client-opsworkscm/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { OpsWorksCMClientConfig } from "./OpsWorksCMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-opsworkscm/runtimeConfig.shared.ts b/clients/client-opsworkscm/runtimeConfig.shared.ts index a132b93eb621..767b9edaba2b 100644 --- a/clients/client-opsworkscm/runtimeConfig.shared.ts +++ b/clients/client-opsworkscm/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { OpsWorksCMClientConfig } from "./OpsWorksCMClient"; @@ -9,9 +8,9 @@ import { OpsWorksCMClientConfig } from "./OpsWorksCMClient"; */ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => ({ apiVersion: "2016-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "OpsWorksCM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "OpsWorksCM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-opsworkscm/runtimeConfig.ts b/clients/client-opsworkscm/runtimeConfig.ts index 20fa04b02446..8775c2072496 100644 --- a/clients/client-opsworkscm/runtimeConfig.ts +++ b/clients/client-opsworkscm/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-organizations/runtimeConfig.browser.ts b/clients/client-organizations/runtimeConfig.browser.ts index 49df9cac86aa..ceebf16cc519 100644 --- a/clients/client-organizations/runtimeConfig.browser.ts +++ b/clients/client-organizations/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: OrganizationsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-organizations/runtimeConfig.native.ts b/clients/client-organizations/runtimeConfig.native.ts index 9f17d2db5bb7..cc354aaefc56 100644 --- a/clients/client-organizations/runtimeConfig.native.ts +++ b/clients/client-organizations/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { OrganizationsClientConfig } from "./OrganizationsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: OrganizationsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-organizations/runtimeConfig.shared.ts b/clients/client-organizations/runtimeConfig.shared.ts index 3c7259ec78f6..11da91c92f16 100644 --- a/clients/client-organizations/runtimeConfig.shared.ts +++ b/clients/client-organizations/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { OrganizationsClientConfig } from "./OrganizationsClient"; @@ -9,9 +8,9 @@ import { OrganizationsClientConfig } from "./OrganizationsClient"; */ export const getRuntimeConfig = (config: OrganizationsClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Organizations"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Organizations", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-organizations/runtimeConfig.ts b/clients/client-organizations/runtimeConfig.ts index 747a282932c6..31e0dba0ff0b 100644 --- a/clients/client-organizations/runtimeConfig.ts +++ b/clients/client-organizations/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: OrganizationsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-outposts/runtimeConfig.browser.ts b/clients/client-outposts/runtimeConfig.browser.ts index 0d922925cdb4..71fb1d38b857 100644 --- a/clients/client-outposts/runtimeConfig.browser.ts +++ b/clients/client-outposts/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: OutpostsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-outposts/runtimeConfig.native.ts b/clients/client-outposts/runtimeConfig.native.ts index 4c0667c4243e..a71d28378fc5 100644 --- a/clients/client-outposts/runtimeConfig.native.ts +++ b/clients/client-outposts/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { OutpostsClientConfig } from "./OutpostsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: OutpostsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-outposts/runtimeConfig.shared.ts b/clients/client-outposts/runtimeConfig.shared.ts index 4f2e4256725a..1e7a9fcb75b6 100644 --- a/clients/client-outposts/runtimeConfig.shared.ts +++ b/clients/client-outposts/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { OutpostsClientConfig } from "./OutpostsClient"; @@ -9,9 +8,9 @@ import { OutpostsClientConfig } from "./OutpostsClient"; */ export const getRuntimeConfig = (config: OutpostsClientConfig) => ({ apiVersion: "2019-12-03", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Outposts"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Outposts", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-outposts/runtimeConfig.ts b/clients/client-outposts/runtimeConfig.ts index 07467e00a47b..56b7c5443ea6 100644 --- a/clients/client-outposts/runtimeConfig.ts +++ b/clients/client-outposts/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: OutpostsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-personalize-events/runtimeConfig.browser.ts b/clients/client-personalize-events/runtimeConfig.browser.ts index 1177cb74d56c..805326fa8fdc 100644 --- a/clients/client-personalize-events/runtimeConfig.browser.ts +++ b/clients/client-personalize-events/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-personalize-events/runtimeConfig.native.ts b/clients/client-personalize-events/runtimeConfig.native.ts index aa08b29d5104..23953cabe172 100644 --- a/clients/client-personalize-events/runtimeConfig.native.ts +++ b/clients/client-personalize-events/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-personalize-events/runtimeConfig.shared.ts b/clients/client-personalize-events/runtimeConfig.shared.ts index 779410622d2a..3c77f09768ff 100644 --- a/clients/client-personalize-events/runtimeConfig.shared.ts +++ b/clients/client-personalize-events/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient"; @@ -9,9 +8,9 @@ import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient"; */ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => ({ apiVersion: "2018-03-22", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Personalize Events"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Personalize Events", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-personalize-events/runtimeConfig.ts b/clients/client-personalize-events/runtimeConfig.ts index 3658495c1e83..094590baa564 100644 --- a/clients/client-personalize-events/runtimeConfig.ts +++ b/clients/client-personalize-events/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-personalize-runtime/runtimeConfig.browser.ts b/clients/client-personalize-runtime/runtimeConfig.browser.ts index 61e5cf3ce6a7..3ac83afab8e3 100644 --- a/clients/client-personalize-runtime/runtimeConfig.browser.ts +++ b/clients/client-personalize-runtime/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-personalize-runtime/runtimeConfig.native.ts b/clients/client-personalize-runtime/runtimeConfig.native.ts index 87fa4a6f0b34..970d3989b14a 100644 --- a/clients/client-personalize-runtime/runtimeConfig.native.ts +++ b/clients/client-personalize-runtime/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-personalize-runtime/runtimeConfig.shared.ts b/clients/client-personalize-runtime/runtimeConfig.shared.ts index f35cd83510d7..17879be9c2fa 100644 --- a/clients/client-personalize-runtime/runtimeConfig.shared.ts +++ b/clients/client-personalize-runtime/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient"; @@ -9,9 +8,9 @@ import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient"; */ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => ({ apiVersion: "2018-05-22", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Personalize Runtime"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Personalize Runtime", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-personalize-runtime/runtimeConfig.ts b/clients/client-personalize-runtime/runtimeConfig.ts index c249f5ab53d3..009c93a3ff08 100644 --- a/clients/client-personalize-runtime/runtimeConfig.ts +++ b/clients/client-personalize-runtime/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-personalize/runtimeConfig.browser.ts b/clients/client-personalize/runtimeConfig.browser.ts index a440e5069db1..c0283e9c7df6 100644 --- a/clients/client-personalize/runtimeConfig.browser.ts +++ b/clients/client-personalize/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PersonalizeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-personalize/runtimeConfig.native.ts b/clients/client-personalize/runtimeConfig.native.ts index a727655a2f51..ad38344a46fb 100644 --- a/clients/client-personalize/runtimeConfig.native.ts +++ b/clients/client-personalize/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PersonalizeClientConfig } from "./PersonalizeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PersonalizeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-personalize/runtimeConfig.shared.ts b/clients/client-personalize/runtimeConfig.shared.ts index 3d2a62b64e04..9fa72c876aa8 100644 --- a/clients/client-personalize/runtimeConfig.shared.ts +++ b/clients/client-personalize/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PersonalizeClientConfig } from "./PersonalizeClient"; @@ -9,9 +8,9 @@ import { PersonalizeClientConfig } from "./PersonalizeClient"; */ export const getRuntimeConfig = (config: PersonalizeClientConfig) => ({ apiVersion: "2018-05-22", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Personalize"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Personalize", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-personalize/runtimeConfig.ts b/clients/client-personalize/runtimeConfig.ts index f026a0a3e4b0..d3d6a246c069 100644 --- a/clients/client-personalize/runtimeConfig.ts +++ b/clients/client-personalize/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PersonalizeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pi/runtimeConfig.browser.ts b/clients/client-pi/runtimeConfig.browser.ts index 58e8cf8ad8f4..fb579d40154c 100644 --- a/clients/client-pi/runtimeConfig.browser.ts +++ b/clients/client-pi/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PIClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pi/runtimeConfig.native.ts b/clients/client-pi/runtimeConfig.native.ts index 4015f2544017..9d6147b0e952 100644 --- a/clients/client-pi/runtimeConfig.native.ts +++ b/clients/client-pi/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PIClientConfig } from "./PIClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PIClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-pi/runtimeConfig.shared.ts b/clients/client-pi/runtimeConfig.shared.ts index d1c0828d25a0..5ce6edc9bc93 100644 --- a/clients/client-pi/runtimeConfig.shared.ts +++ b/clients/client-pi/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PIClientConfig } from "./PIClient"; @@ -9,9 +8,9 @@ import { PIClientConfig } from "./PIClient"; */ export const getRuntimeConfig = (config: PIClientConfig) => ({ apiVersion: "2018-02-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "PI"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "PI", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-pi/runtimeConfig.ts b/clients/client-pi/runtimeConfig.ts index f638ef945510..11b550e290ba 100644 --- a/clients/client-pi/runtimeConfig.ts +++ b/clients/client-pi/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PIClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pinpoint-email/runtimeConfig.browser.ts b/clients/client-pinpoint-email/runtimeConfig.browser.ts index 044f652b2c44..fedf5201ca20 100644 --- a/clients/client-pinpoint-email/runtimeConfig.browser.ts +++ b/clients/client-pinpoint-email/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pinpoint-email/runtimeConfig.native.ts b/clients/client-pinpoint-email/runtimeConfig.native.ts index b4fce4cb0e12..ae4e4ae823a4 100644 --- a/clients/client-pinpoint-email/runtimeConfig.native.ts +++ b/clients/client-pinpoint-email/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PinpointEmailClientConfig } from "./PinpointEmailClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-pinpoint-email/runtimeConfig.shared.ts b/clients/client-pinpoint-email/runtimeConfig.shared.ts index 999604c9bef4..6770b3806a1d 100644 --- a/clients/client-pinpoint-email/runtimeConfig.shared.ts +++ b/clients/client-pinpoint-email/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PinpointEmailClientConfig } from "./PinpointEmailClient"; @@ -9,9 +8,9 @@ import { PinpointEmailClientConfig } from "./PinpointEmailClient"; */ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => ({ apiVersion: "2018-07-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Pinpoint Email"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Pinpoint Email", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-pinpoint-email/runtimeConfig.ts b/clients/client-pinpoint-email/runtimeConfig.ts index 767db04f3ab6..dffeb68a9fa9 100644 --- a/clients/client-pinpoint-email/runtimeConfig.ts +++ b/clients/client-pinpoint-email/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts index b94b6be0fb4d..a1a4a0cd1ee0 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts index 8765ff11cd6b..b5c1e7ebd780 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PinpointSMSVoiceClientConfig } from "./PinpointSMSVoiceClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts index d977240ead36..5a26506585a2 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PinpointSMSVoiceClientConfig } from "./PinpointSMSVoiceClient"; @@ -9,9 +8,9 @@ import { PinpointSMSVoiceClientConfig } from "./PinpointSMSVoiceClient"; */ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => ({ apiVersion: "2018-09-05", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Pinpoint SMS Voice"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Pinpoint SMS Voice", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.ts index 9b463beb8401..d2f8f8d1858c 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pinpoint/runtimeConfig.browser.ts b/clients/client-pinpoint/runtimeConfig.browser.ts index 065ccf920a7e..6a00541adb7e 100644 --- a/clients/client-pinpoint/runtimeConfig.browser.ts +++ b/clients/client-pinpoint/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PinpointClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pinpoint/runtimeConfig.native.ts b/clients/client-pinpoint/runtimeConfig.native.ts index a0ff77228c81..36887aedff5a 100644 --- a/clients/client-pinpoint/runtimeConfig.native.ts +++ b/clients/client-pinpoint/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PinpointClientConfig } from "./PinpointClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PinpointClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-pinpoint/runtimeConfig.shared.ts b/clients/client-pinpoint/runtimeConfig.shared.ts index c79df02063ca..a4c2c867f307 100644 --- a/clients/client-pinpoint/runtimeConfig.shared.ts +++ b/clients/client-pinpoint/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PinpointClientConfig } from "./PinpointClient"; @@ -9,9 +8,9 @@ import { PinpointClientConfig } from "./PinpointClient"; */ export const getRuntimeConfig = (config: PinpointClientConfig) => ({ apiVersion: "2016-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Pinpoint"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Pinpoint", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-pinpoint/runtimeConfig.ts b/clients/client-pinpoint/runtimeConfig.ts index 9eba058728c0..f1b369469fdd 100644 --- a/clients/client-pinpoint/runtimeConfig.ts +++ b/clients/client-pinpoint/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PinpointClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-polly/runtimeConfig.browser.ts b/clients/client-polly/runtimeConfig.browser.ts index 4f9870929b46..67b251451301 100644 --- a/clients/client-polly/runtimeConfig.browser.ts +++ b/clients/client-polly/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-polly/runtimeConfig.native.ts b/clients/client-polly/runtimeConfig.native.ts index 8b2c6c14e77f..fa24a372671c 100644 --- a/clients/client-polly/runtimeConfig.native.ts +++ b/clients/client-polly/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PollyClientConfig } from "./PollyClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-polly/runtimeConfig.shared.ts b/clients/client-polly/runtimeConfig.shared.ts index 9ad20ca4a96e..ecf27e50dc57 100644 --- a/clients/client-polly/runtimeConfig.shared.ts +++ b/clients/client-polly/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PollyClientConfig } from "./PollyClient"; @@ -9,9 +8,9 @@ import { PollyClientConfig } from "./PollyClient"; */ export const getRuntimeConfig = (config: PollyClientConfig) => ({ apiVersion: "2016-06-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Polly"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Polly", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-polly/runtimeConfig.ts b/clients/client-polly/runtimeConfig.ts index a7f9e0f378f3..a914d91fec8d 100644 --- a/clients/client-polly/runtimeConfig.ts +++ b/clients/client-polly/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pricing/runtimeConfig.browser.ts b/clients/client-pricing/runtimeConfig.browser.ts index 23a123eefc17..839647f20d2e 100644 --- a/clients/client-pricing/runtimeConfig.browser.ts +++ b/clients/client-pricing/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: PricingClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-pricing/runtimeConfig.native.ts b/clients/client-pricing/runtimeConfig.native.ts index 7d2ae936ec5e..78921837f11f 100644 --- a/clients/client-pricing/runtimeConfig.native.ts +++ b/clients/client-pricing/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { PricingClientConfig } from "./PricingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: PricingClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-pricing/runtimeConfig.shared.ts b/clients/client-pricing/runtimeConfig.shared.ts index e0f5f13d2fd1..dbb218d0b2a8 100644 --- a/clients/client-pricing/runtimeConfig.shared.ts +++ b/clients/client-pricing/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { PricingClientConfig } from "./PricingClient"; @@ -9,9 +8,9 @@ import { PricingClientConfig } from "./PricingClient"; */ export const getRuntimeConfig = (config: PricingClientConfig) => ({ apiVersion: "2017-10-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Pricing"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Pricing", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-pricing/runtimeConfig.ts b/clients/client-pricing/runtimeConfig.ts index 809a741c840b..d677f5f4a320 100644 --- a/clients/client-pricing/runtimeConfig.ts +++ b/clients/client-pricing/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: PricingClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-proton/runtimeConfig.browser.ts b/clients/client-proton/runtimeConfig.browser.ts index 37363e5753d9..ebf1f47ce871 100644 --- a/clients/client-proton/runtimeConfig.browser.ts +++ b/clients/client-proton/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ProtonClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-proton/runtimeConfig.native.ts b/clients/client-proton/runtimeConfig.native.ts index d4c88e4e15d6..acf001c36ae9 100644 --- a/clients/client-proton/runtimeConfig.native.ts +++ b/clients/client-proton/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ProtonClientConfig } from "./ProtonClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ProtonClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-proton/runtimeConfig.shared.ts b/clients/client-proton/runtimeConfig.shared.ts index e8adb689433e..0926c4fac30a 100644 --- a/clients/client-proton/runtimeConfig.shared.ts +++ b/clients/client-proton/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ProtonClientConfig } from "./ProtonClient"; @@ -9,9 +8,9 @@ import { ProtonClientConfig } from "./ProtonClient"; */ export const getRuntimeConfig = (config: ProtonClientConfig) => ({ apiVersion: "2020-07-20", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Proton"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Proton", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-proton/runtimeConfig.ts b/clients/client-proton/runtimeConfig.ts index 64b1c5f789a9..5cc4bcd6af6d 100644 --- a/clients/client-proton/runtimeConfig.ts +++ b/clients/client-proton/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ProtonClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-qldb-session/runtimeConfig.browser.ts b/clients/client-qldb-session/runtimeConfig.browser.ts index 67f7f77fb639..00861c48e689 100644 --- a/clients/client-qldb-session/runtimeConfig.browser.ts +++ b/clients/client-qldb-session/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-qldb-session/runtimeConfig.native.ts b/clients/client-qldb-session/runtimeConfig.native.ts index 55bd445cc116..a44c6c4121cc 100644 --- a/clients/client-qldb-session/runtimeConfig.native.ts +++ b/clients/client-qldb-session/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { QLDBSessionClientConfig } from "./QLDBSessionClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-qldb-session/runtimeConfig.shared.ts b/clients/client-qldb-session/runtimeConfig.shared.ts index 98f169fb8f64..56b95c40ee52 100644 --- a/clients/client-qldb-session/runtimeConfig.shared.ts +++ b/clients/client-qldb-session/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { QLDBSessionClientConfig } from "./QLDBSessionClient"; @@ -9,9 +8,9 @@ import { QLDBSessionClientConfig } from "./QLDBSessionClient"; */ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => ({ apiVersion: "2019-07-11", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "QLDB Session"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "QLDB Session", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-qldb-session/runtimeConfig.ts b/clients/client-qldb-session/runtimeConfig.ts index 894b7573b477..c96f108bdcb0 100644 --- a/clients/client-qldb-session/runtimeConfig.ts +++ b/clients/client-qldb-session/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-qldb/runtimeConfig.browser.ts b/clients/client-qldb/runtimeConfig.browser.ts index 6b21628b8fc3..4bff1490e1f0 100644 --- a/clients/client-qldb/runtimeConfig.browser.ts +++ b/clients/client-qldb/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: QLDBClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-qldb/runtimeConfig.native.ts b/clients/client-qldb/runtimeConfig.native.ts index c5aa5cd97bb8..a1c69a276eb5 100644 --- a/clients/client-qldb/runtimeConfig.native.ts +++ b/clients/client-qldb/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { QLDBClientConfig } from "./QLDBClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: QLDBClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-qldb/runtimeConfig.shared.ts b/clients/client-qldb/runtimeConfig.shared.ts index 927d2bedc039..41a3fda07474 100644 --- a/clients/client-qldb/runtimeConfig.shared.ts +++ b/clients/client-qldb/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { QLDBClientConfig } from "./QLDBClient"; @@ -9,9 +8,9 @@ import { QLDBClientConfig } from "./QLDBClient"; */ export const getRuntimeConfig = (config: QLDBClientConfig) => ({ apiVersion: "2019-01-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "QLDB"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "QLDB", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-qldb/runtimeConfig.ts b/clients/client-qldb/runtimeConfig.ts index 1dcf0b86b271..4885571e663a 100644 --- a/clients/client-qldb/runtimeConfig.ts +++ b/clients/client-qldb/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: QLDBClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-quicksight/runtimeConfig.browser.ts b/clients/client-quicksight/runtimeConfig.browser.ts index e377a4a75d1e..b5bef039d97b 100644 --- a/clients/client-quicksight/runtimeConfig.browser.ts +++ b/clients/client-quicksight/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: QuickSightClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-quicksight/runtimeConfig.native.ts b/clients/client-quicksight/runtimeConfig.native.ts index 32c13d7598c0..a4e260b60406 100644 --- a/clients/client-quicksight/runtimeConfig.native.ts +++ b/clients/client-quicksight/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { QuickSightClientConfig } from "./QuickSightClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: QuickSightClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-quicksight/runtimeConfig.shared.ts b/clients/client-quicksight/runtimeConfig.shared.ts index 82fa0be9b2ab..9f2d3198267a 100644 --- a/clients/client-quicksight/runtimeConfig.shared.ts +++ b/clients/client-quicksight/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { QuickSightClientConfig } from "./QuickSightClient"; @@ -9,9 +8,9 @@ import { QuickSightClientConfig } from "./QuickSightClient"; */ export const getRuntimeConfig = (config: QuickSightClientConfig) => ({ apiVersion: "2018-04-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "QuickSight"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "QuickSight", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-quicksight/runtimeConfig.ts b/clients/client-quicksight/runtimeConfig.ts index 9f4507e7aa59..5fc211137a1a 100644 --- a/clients/client-quicksight/runtimeConfig.ts +++ b/clients/client-quicksight/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: QuickSightClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ram/runtimeConfig.browser.ts b/clients/client-ram/runtimeConfig.browser.ts index 4fe6da9bf39f..afaad4cfa3c4 100644 --- a/clients/client-ram/runtimeConfig.browser.ts +++ b/clients/client-ram/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RAMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ram/runtimeConfig.native.ts b/clients/client-ram/runtimeConfig.native.ts index a8a57b775c4b..2a2884a3e327 100644 --- a/clients/client-ram/runtimeConfig.native.ts +++ b/clients/client-ram/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RAMClientConfig } from "./RAMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RAMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ram/runtimeConfig.shared.ts b/clients/client-ram/runtimeConfig.shared.ts index e990b456242e..cd94f0fba434 100644 --- a/clients/client-ram/runtimeConfig.shared.ts +++ b/clients/client-ram/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RAMClientConfig } from "./RAMClient"; @@ -9,9 +8,9 @@ import { RAMClientConfig } from "./RAMClient"; */ export const getRuntimeConfig = (config: RAMClientConfig) => ({ apiVersion: "2018-01-04", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "RAM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "RAM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ram/runtimeConfig.ts b/clients/client-ram/runtimeConfig.ts index 343db7124c77..7e2843fa6b57 100644 --- a/clients/client-ram/runtimeConfig.ts +++ b/clients/client-ram/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RAMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-rds-data/runtimeConfig.browser.ts b/clients/client-rds-data/runtimeConfig.browser.ts index ca2776424a65..c9eb07fab559 100644 --- a/clients/client-rds-data/runtimeConfig.browser.ts +++ b/clients/client-rds-data/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RDSDataClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-rds-data/runtimeConfig.native.ts b/clients/client-rds-data/runtimeConfig.native.ts index c80a2658d80e..d23027f09cd3 100644 --- a/clients/client-rds-data/runtimeConfig.native.ts +++ b/clients/client-rds-data/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RDSDataClientConfig } from "./RDSDataClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RDSDataClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-rds-data/runtimeConfig.shared.ts b/clients/client-rds-data/runtimeConfig.shared.ts index e1d555a38cac..9b3ed733470a 100644 --- a/clients/client-rds-data/runtimeConfig.shared.ts +++ b/clients/client-rds-data/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RDSDataClientConfig } from "./RDSDataClient"; @@ -9,9 +8,9 @@ import { RDSDataClientConfig } from "./RDSDataClient"; */ export const getRuntimeConfig = (config: RDSDataClientConfig) => ({ apiVersion: "2018-08-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "RDS Data"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "RDS Data", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-rds-data/runtimeConfig.ts b/clients/client-rds-data/runtimeConfig.ts index bc666e2d58c0..12b90ee7d3ec 100644 --- a/clients/client-rds-data/runtimeConfig.ts +++ b/clients/client-rds-data/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RDSDataClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-rds/runtimeConfig.browser.ts b/clients/client-rds/runtimeConfig.browser.ts index b4dba2df9990..c9548e8db2e8 100644 --- a/clients/client-rds/runtimeConfig.browser.ts +++ b/clients/client-rds/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-rds/runtimeConfig.native.ts b/clients/client-rds/runtimeConfig.native.ts index 98df5a5eb18a..c930926ad42e 100644 --- a/clients/client-rds/runtimeConfig.native.ts +++ b/clients/client-rds/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RDSClientConfig } from "./RDSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-rds/runtimeConfig.shared.ts b/clients/client-rds/runtimeConfig.shared.ts index be3380eace31..b3f26db10e55 100644 --- a/clients/client-rds/runtimeConfig.shared.ts +++ b/clients/client-rds/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RDSClientConfig } from "./RDSClient"; @@ -9,9 +8,9 @@ import { RDSClientConfig } from "./RDSClient"; */ export const getRuntimeConfig = (config: RDSClientConfig) => ({ apiVersion: "2014-10-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "RDS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "RDS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-rds/runtimeConfig.ts b/clients/client-rds/runtimeConfig.ts index 45876c0b79d8..df44d7066509 100644 --- a/clients/client-rds/runtimeConfig.ts +++ b/clients/client-rds/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-redshift-data/runtimeConfig.browser.ts b/clients/client-redshift-data/runtimeConfig.browser.ts index c0c0706d18a2..03b6b8c512ca 100644 --- a/clients/client-redshift-data/runtimeConfig.browser.ts +++ b/clients/client-redshift-data/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-redshift-data/runtimeConfig.native.ts b/clients/client-redshift-data/runtimeConfig.native.ts index 0cf75193ab47..9432cc08026b 100644 --- a/clients/client-redshift-data/runtimeConfig.native.ts +++ b/clients/client-redshift-data/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RedshiftDataClientConfig } from "./RedshiftDataClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-redshift-data/runtimeConfig.shared.ts b/clients/client-redshift-data/runtimeConfig.shared.ts index f93ca644acdc..4bfb1f7a10e1 100644 --- a/clients/client-redshift-data/runtimeConfig.shared.ts +++ b/clients/client-redshift-data/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RedshiftDataClientConfig } from "./RedshiftDataClient"; @@ -9,9 +8,9 @@ import { RedshiftDataClientConfig } from "./RedshiftDataClient"; */ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => ({ apiVersion: "2019-12-20", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Redshift Data"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Redshift Data", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-redshift-data/runtimeConfig.ts b/clients/client-redshift-data/runtimeConfig.ts index ef6d2dbd9976..a266ae22e33a 100644 --- a/clients/client-redshift-data/runtimeConfig.ts +++ b/clients/client-redshift-data/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-redshift/runtimeConfig.browser.ts b/clients/client-redshift/runtimeConfig.browser.ts index e0564e5a8238..744f84174cc3 100644 --- a/clients/client-redshift/runtimeConfig.browser.ts +++ b/clients/client-redshift/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RedshiftClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-redshift/runtimeConfig.native.ts b/clients/client-redshift/runtimeConfig.native.ts index d5aec847b22d..71c1aff64ef2 100644 --- a/clients/client-redshift/runtimeConfig.native.ts +++ b/clients/client-redshift/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RedshiftClientConfig } from "./RedshiftClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RedshiftClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-redshift/runtimeConfig.shared.ts b/clients/client-redshift/runtimeConfig.shared.ts index c081a64650bd..9e9d6d2c4293 100644 --- a/clients/client-redshift/runtimeConfig.shared.ts +++ b/clients/client-redshift/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RedshiftClientConfig } from "./RedshiftClient"; @@ -9,9 +8,9 @@ import { RedshiftClientConfig } from "./RedshiftClient"; */ export const getRuntimeConfig = (config: RedshiftClientConfig) => ({ apiVersion: "2012-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Redshift"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Redshift", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-redshift/runtimeConfig.ts b/clients/client-redshift/runtimeConfig.ts index 335a35f02382..8355360e0625 100644 --- a/clients/client-redshift/runtimeConfig.ts +++ b/clients/client-redshift/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RedshiftClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-rekognition/runtimeConfig.browser.ts b/clients/client-rekognition/runtimeConfig.browser.ts index 67dd6e59172e..f45a649fe17b 100644 --- a/clients/client-rekognition/runtimeConfig.browser.ts +++ b/clients/client-rekognition/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RekognitionClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-rekognition/runtimeConfig.native.ts b/clients/client-rekognition/runtimeConfig.native.ts index 00b1a3ceb69c..fd19fde869f9 100644 --- a/clients/client-rekognition/runtimeConfig.native.ts +++ b/clients/client-rekognition/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RekognitionClientConfig } from "./RekognitionClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RekognitionClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-rekognition/runtimeConfig.shared.ts b/clients/client-rekognition/runtimeConfig.shared.ts index bc069be4e9fc..87c181841e9e 100644 --- a/clients/client-rekognition/runtimeConfig.shared.ts +++ b/clients/client-rekognition/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RekognitionClientConfig } from "./RekognitionClient"; @@ -9,9 +8,9 @@ import { RekognitionClientConfig } from "./RekognitionClient"; */ export const getRuntimeConfig = (config: RekognitionClientConfig) => ({ apiVersion: "2016-06-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Rekognition"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Rekognition", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-rekognition/runtimeConfig.ts b/clients/client-rekognition/runtimeConfig.ts index b8a13cb64327..07e718653551 100644 --- a/clients/client-rekognition/runtimeConfig.ts +++ b/clients/client-rekognition/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RekognitionClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts index 2cf0c6ef5825..dbd9763efea3 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) = return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts index 72971da9999e..63b6fee7525b 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ResourceGroupsTaggingAPIClientConfig } from "./ResourceGroupsTaggingAPIClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) = return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.shared.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.shared.ts index 6faf5ebddc06..c6e0e5157049 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.shared.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ResourceGroupsTaggingAPIClientConfig } from "./ResourceGroupsTaggingAPIClient"; @@ -9,9 +8,9 @@ import { ResourceGroupsTaggingAPIClientConfig } from "./ResourceGroupsTaggingAPI */ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) => ({ apiVersion: "2017-01-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Resource Groups Tagging API"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Resource Groups Tagging API", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.ts index abdcd189ba88..844cee839595 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) = return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-resource-groups/runtimeConfig.browser.ts b/clients/client-resource-groups/runtimeConfig.browser.ts index ce9b088e5c68..de5c20dd8e04 100644 --- a/clients/client-resource-groups/runtimeConfig.browser.ts +++ b/clients/client-resource-groups/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-resource-groups/runtimeConfig.native.ts b/clients/client-resource-groups/runtimeConfig.native.ts index d3ebdd2048ad..f4262dc56358 100644 --- a/clients/client-resource-groups/runtimeConfig.native.ts +++ b/clients/client-resource-groups/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ResourceGroupsClientConfig } from "./ResourceGroupsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-resource-groups/runtimeConfig.shared.ts b/clients/client-resource-groups/runtimeConfig.shared.ts index dc8652e37e10..b147faad5ce7 100644 --- a/clients/client-resource-groups/runtimeConfig.shared.ts +++ b/clients/client-resource-groups/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ResourceGroupsClientConfig } from "./ResourceGroupsClient"; @@ -9,9 +8,9 @@ import { ResourceGroupsClientConfig } from "./ResourceGroupsClient"; */ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Resource Groups"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Resource Groups", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-resource-groups/runtimeConfig.ts b/clients/client-resource-groups/runtimeConfig.ts index c21da395d270..8ad8425dd225 100644 --- a/clients/client-resource-groups/runtimeConfig.ts +++ b/clients/client-resource-groups/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-robomaker/runtimeConfig.browser.ts b/clients/client-robomaker/runtimeConfig.browser.ts index 767652fb3038..f833a3c7b0f7 100644 --- a/clients/client-robomaker/runtimeConfig.browser.ts +++ b/clients/client-robomaker/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: RoboMakerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-robomaker/runtimeConfig.native.ts b/clients/client-robomaker/runtimeConfig.native.ts index 420ef059da3f..0e0646e9542c 100644 --- a/clients/client-robomaker/runtimeConfig.native.ts +++ b/clients/client-robomaker/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RoboMakerClientConfig } from "./RoboMakerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RoboMakerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-robomaker/runtimeConfig.shared.ts b/clients/client-robomaker/runtimeConfig.shared.ts index 21258d2b06c0..216921710538 100644 --- a/clients/client-robomaker/runtimeConfig.shared.ts +++ b/clients/client-robomaker/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RoboMakerClientConfig } from "./RoboMakerClient"; @@ -9,9 +8,9 @@ import { RoboMakerClientConfig } from "./RoboMakerClient"; */ export const getRuntimeConfig = (config: RoboMakerClientConfig) => ({ apiVersion: "2018-06-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "RoboMaker"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "RoboMaker", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-robomaker/runtimeConfig.ts b/clients/client-robomaker/runtimeConfig.ts index 64f5ef11b546..d592d717c4ae 100644 --- a/clients/client-robomaker/runtimeConfig.ts +++ b/clients/client-robomaker/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: RoboMakerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-route-53-domains/runtimeConfig.browser.ts b/clients/client-route-53-domains/runtimeConfig.browser.ts index 25a08e2ba207..606ee7ac2e16 100644 --- a/clients/client-route-53-domains/runtimeConfig.browser.ts +++ b/clients/client-route-53-domains/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-route-53-domains/runtimeConfig.native.ts b/clients/client-route-53-domains/runtimeConfig.native.ts index 1e6f1fbe9851..aaf795bb4fb9 100644 --- a/clients/client-route-53-domains/runtimeConfig.native.ts +++ b/clients/client-route-53-domains/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Route53DomainsClientConfig } from "./Route53DomainsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-route-53-domains/runtimeConfig.shared.ts b/clients/client-route-53-domains/runtimeConfig.shared.ts index bd7104fee816..c891f5d58892 100644 --- a/clients/client-route-53-domains/runtimeConfig.shared.ts +++ b/clients/client-route-53-domains/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { Route53DomainsClientConfig } from "./Route53DomainsClient"; @@ -9,9 +8,9 @@ import { Route53DomainsClientConfig } from "./Route53DomainsClient"; */ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => ({ apiVersion: "2014-05-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Route 53 Domains"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Route 53 Domains", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-route-53-domains/runtimeConfig.ts b/clients/client-route-53-domains/runtimeConfig.ts index 302f646f9d10..01af7a7ba392 100644 --- a/clients/client-route-53-domains/runtimeConfig.ts +++ b/clients/client-route-53-domains/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-route-53/runtimeConfig.browser.ts b/clients/client-route-53/runtimeConfig.browser.ts index efac281faf8f..015fe85a5dc3 100644 --- a/clients/client-route-53/runtimeConfig.browser.ts +++ b/clients/client-route-53/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: Route53ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-route-53/runtimeConfig.native.ts b/clients/client-route-53/runtimeConfig.native.ts index 64f58f4e9d11..b494702cfa89 100644 --- a/clients/client-route-53/runtimeConfig.native.ts +++ b/clients/client-route-53/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Route53ClientConfig } from "./Route53Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: Route53ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-route-53/runtimeConfig.shared.ts b/clients/client-route-53/runtimeConfig.shared.ts index f943de048d1c..c8a06cb888fb 100644 --- a/clients/client-route-53/runtimeConfig.shared.ts +++ b/clients/client-route-53/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { Route53ClientConfig } from "./Route53Client"; @@ -9,9 +8,9 @@ import { Route53ClientConfig } from "./Route53Client"; */ export const getRuntimeConfig = (config: Route53ClientConfig) => ({ apiVersion: "2013-04-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Route 53"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Route 53", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-route-53/runtimeConfig.ts b/clients/client-route-53/runtimeConfig.ts index 5b8e1c442b1d..e4865992e51a 100644 --- a/clients/client-route-53/runtimeConfig.ts +++ b/clients/client-route-53/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: Route53ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-route53resolver/runtimeConfig.browser.ts b/clients/client-route53resolver/runtimeConfig.browser.ts index e29da76721d1..abe4bf378dd1 100644 --- a/clients/client-route53resolver/runtimeConfig.browser.ts +++ b/clients/client-route53resolver/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-route53resolver/runtimeConfig.native.ts b/clients/client-route53resolver/runtimeConfig.native.ts index d6985490e34f..ef7fe6dcd34d 100644 --- a/clients/client-route53resolver/runtimeConfig.native.ts +++ b/clients/client-route53resolver/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Route53ResolverClientConfig } from "./Route53ResolverClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-route53resolver/runtimeConfig.shared.ts b/clients/client-route53resolver/runtimeConfig.shared.ts index e3517c2243a4..4492b5845167 100644 --- a/clients/client-route53resolver/runtimeConfig.shared.ts +++ b/clients/client-route53resolver/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { Route53ResolverClientConfig } from "./Route53ResolverClient"; @@ -9,9 +8,9 @@ import { Route53ResolverClientConfig } from "./Route53ResolverClient"; */ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => ({ apiVersion: "2018-04-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Route53Resolver"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Route53Resolver", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-route53resolver/runtimeConfig.ts b/clients/client-route53resolver/runtimeConfig.ts index ccde1fd096ca..43b8a123642a 100644 --- a/clients/client-route53resolver/runtimeConfig.ts +++ b/clients/client-route53resolver/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-s3-control/runtimeConfig.browser.ts b/clients/client-s3-control/runtimeConfig.browser.ts index e2ebfee2f28d..a0e26f34412d 100644 --- a/clients/client-s3-control/runtimeConfig.browser.ts +++ b/clients/client-s3-control/runtimeConfig.browser.ts @@ -6,7 +6,6 @@ import { blobHasher as streamHasher } from "@aws-sdk/hash-blob-browser"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { Md5 } from "@aws-sdk/md5-js"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -22,26 +21,23 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - md5: coalesce(config.md5, Md5), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - streamHasher: coalesce(config.streamHasher, streamHasher), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + md5: config.md5 ?? Md5, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + streamHasher: config.streamHasher ?? streamHasher, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-s3-control/runtimeConfig.native.ts b/clients/client-s3-control/runtimeConfig.native.ts index a7d1ac2fb9cd..9a8b4135c55f 100644 --- a/clients/client-s3-control/runtimeConfig.native.ts +++ b/clients/client-s3-control/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { S3ControlClientConfig } from "./S3ControlClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-s3-control/runtimeConfig.shared.ts b/clients/client-s3-control/runtimeConfig.shared.ts index 31de9c02513c..7ec8a6d6b123 100644 --- a/clients/client-s3-control/runtimeConfig.shared.ts +++ b/clients/client-s3-control/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { S3ControlClientConfig } from "./S3ControlClient"; @@ -9,9 +8,9 @@ import { S3ControlClientConfig } from "./S3ControlClient"; */ export const getRuntimeConfig = (config: S3ControlClientConfig) => ({ apiVersion: "2018-08-20", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "S3 Control"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "S3 Control", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-s3-control/runtimeConfig.ts b/clients/client-s3-control/runtimeConfig.ts index e4cc864de224..78c9d8f27f4b 100644 --- a/clients/client-s3-control/runtimeConfig.ts +++ b/clients/client-s3-control/runtimeConfig.ts @@ -8,7 +8,6 @@ import { fileStreamHasher as streamHasher } from "@aws-sdk/hash-stream-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; @@ -25,26 +24,23 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - md5: coalesce(config.md5, Hash.bind(null, "md5")), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - streamHasher: coalesce(config.streamHasher, streamHasher), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + md5: config.md5 ?? Hash.bind(null, "md5"), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + streamHasher: config.streamHasher ?? streamHasher, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-s3/runtimeConfig.browser.ts b/clients/client-s3/runtimeConfig.browser.ts index e2d776265092..668341bc3ec9 100644 --- a/clients/client-s3/runtimeConfig.browser.ts +++ b/clients/client-s3/runtimeConfig.browser.ts @@ -7,7 +7,6 @@ import { blobHasher as streamHasher } from "@aws-sdk/hash-blob-browser"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { Md5 } from "@aws-sdk/md5-js"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -23,27 +22,24 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - md5: coalesce(config.md5, Md5), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - streamHasher: coalesce(config.streamHasher, streamHasher), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + md5: config.md5 ?? Md5, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + streamHasher: config.streamHasher ?? streamHasher, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-s3/runtimeConfig.native.ts b/clients/client-s3/runtimeConfig.native.ts index 8efb9ec87db3..b38d48466e14 100644 --- a/clients/client-s3/runtimeConfig.native.ts +++ b/clients/client-s3/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { S3ClientConfig } from "./S3Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-s3/runtimeConfig.shared.ts b/clients/client-s3/runtimeConfig.shared.ts index 092315d57639..9d5ae1dc693d 100644 --- a/clients/client-s3/runtimeConfig.shared.ts +++ b/clients/client-s3/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { S3ClientConfig } from "./S3Client"; @@ -9,11 +8,11 @@ import { S3ClientConfig } from "./S3Client"; */ export const getRuntimeConfig = (config: S3ClientConfig) => ({ apiVersion: "2006-03-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "S3"), - signingEscapePath: coalesce(config.signingEscapePath, false), - urlParser: coalesce(config.urlParser, parseUrl), - useArnRegion: coalesce(config.useArnRegion, false), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "S3", + signingEscapePath: config.signingEscapePath ?? false, + urlParser: config.urlParser ?? parseUrl, + useArnRegion: config.useArnRegion ?? false, }); diff --git a/clients/client-s3/runtimeConfig.ts b/clients/client-s3/runtimeConfig.ts index efbf888ece9c..1a368ecfb515 100644 --- a/clients/client-s3/runtimeConfig.ts +++ b/clients/client-s3/runtimeConfig.ts @@ -10,7 +10,6 @@ import { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-e import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; @@ -27,28 +26,25 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - md5: coalesce(config.md5, Hash.bind(null, "md5")), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - streamHasher: coalesce(config.streamHasher, streamHasher), - useArnRegion: coalesce(config.useArnRegion, loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS)), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + md5: config.md5 ?? Hash.bind(null, "md5"), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + streamHasher: config.streamHasher ?? streamHasher, + useArnRegion: config.useArnRegion ?? loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS), + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-s3outposts/runtimeConfig.browser.ts b/clients/client-s3outposts/runtimeConfig.browser.ts index 6b85b3db64a0..c075ba67897a 100644 --- a/clients/client-s3outposts/runtimeConfig.browser.ts +++ b/clients/client-s3outposts/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-s3outposts/runtimeConfig.native.ts b/clients/client-s3outposts/runtimeConfig.native.ts index d182168dbc5b..bb9446cf50ff 100644 --- a/clients/client-s3outposts/runtimeConfig.native.ts +++ b/clients/client-s3outposts/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { S3OutpostsClientConfig } from "./S3OutpostsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-s3outposts/runtimeConfig.shared.ts b/clients/client-s3outposts/runtimeConfig.shared.ts index d4984129669d..7e2056de6197 100644 --- a/clients/client-s3outposts/runtimeConfig.shared.ts +++ b/clients/client-s3outposts/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { S3OutpostsClientConfig } from "./S3OutpostsClient"; @@ -9,9 +8,9 @@ import { S3OutpostsClientConfig } from "./S3OutpostsClient"; */ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "S3Outposts"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "S3Outposts", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-s3outposts/runtimeConfig.ts b/clients/client-s3outposts/runtimeConfig.ts index 4f333a5049ed..0f18ef3fb2f4 100644 --- a/clients/client-s3outposts/runtimeConfig.ts +++ b/clients/client-s3outposts/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts index 2018025cfc0c..efa640e5b9f5 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts index 36fc446f16d8..7e67981ac68c 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SageMakerA2IRuntimeClientConfig } from "./SageMakerA2IRuntimeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts index 796d751ad1d1..97fa844e91c9 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SageMakerA2IRuntimeClientConfig } from "./SageMakerA2IRuntimeClient"; @@ -9,9 +8,9 @@ import { SageMakerA2IRuntimeClientConfig } from "./SageMakerA2IRuntimeClient"; */ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => ({ apiVersion: "2019-11-07", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SageMaker A2I Runtime"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SageMaker A2I Runtime", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts index 7bb8c5fb3a94..6a1da302b0d1 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-edge/runtimeConfig.browser.ts b/clients/client-sagemaker-edge/runtimeConfig.browser.ts index 0bca073628be..4124dce7bed6 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-edge/runtimeConfig.native.ts b/clients/client-sagemaker-edge/runtimeConfig.native.ts index f25034e47995..065c4d97995a 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.native.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sagemaker-edge/runtimeConfig.shared.ts b/clients/client-sagemaker-edge/runtimeConfig.shared.ts index 8d3ce59c69b5..92ed0520ec6c 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient"; @@ -9,9 +8,9 @@ import { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient"; */ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => ({ apiVersion: "2020-09-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Sagemaker Edge"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Sagemaker Edge", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sagemaker-edge/runtimeConfig.ts b/clients/client-sagemaker-edge/runtimeConfig.ts index 60f546bb05e1..bf7ff9a5e396 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts index dc78beb9c19d..469231b51bdf 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfi return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts index 4b37f7bb7f88..5b7ceae1fb05 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SageMakerFeatureStoreRuntimeClientConfig } from "./SageMakerFeatureStoreRuntimeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfi return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts index 508c7214ef53..34be1771f9ed 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SageMakerFeatureStoreRuntimeClientConfig } from "./SageMakerFeatureStoreRuntimeClient"; @@ -9,9 +8,9 @@ import { SageMakerFeatureStoreRuntimeClientConfig } from "./SageMakerFeatureStor */ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfig) => ({ apiVersion: "2020-07-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SageMaker FeatureStore Runtime"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SageMaker FeatureStore Runtime", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts index f536787204c9..d99ada3d60ae 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfi return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-runtime/runtimeConfig.browser.ts index b8a2f96f9c87..e547ad865d08 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-runtime/runtimeConfig.native.ts index a97a0f1d4c7a..1adb304caabc 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sagemaker-runtime/runtimeConfig.shared.ts b/clients/client-sagemaker-runtime/runtimeConfig.shared.ts index 43c8684ed0e9..69521077eed4 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient"; @@ -9,9 +8,9 @@ import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient"; */ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => ({ apiVersion: "2017-05-13", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SageMaker Runtime"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SageMaker Runtime", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sagemaker-runtime/runtimeConfig.ts b/clients/client-sagemaker-runtime/runtimeConfig.ts index 1c26b0a1abc6..aac945ff0ee4 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker/runtimeConfig.browser.ts b/clients/client-sagemaker/runtimeConfig.browser.ts index be22313138b4..f2eda3b5da41 100644 --- a/clients/client-sagemaker/runtimeConfig.browser.ts +++ b/clients/client-sagemaker/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SageMakerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sagemaker/runtimeConfig.native.ts b/clients/client-sagemaker/runtimeConfig.native.ts index b556688a4e0d..fd42e8a9f29e 100644 --- a/clients/client-sagemaker/runtimeConfig.native.ts +++ b/clients/client-sagemaker/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SageMakerClientConfig } from "./SageMakerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SageMakerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sagemaker/runtimeConfig.shared.ts b/clients/client-sagemaker/runtimeConfig.shared.ts index 175584c27044..15f6a80c9dad 100644 --- a/clients/client-sagemaker/runtimeConfig.shared.ts +++ b/clients/client-sagemaker/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SageMakerClientConfig } from "./SageMakerClient"; @@ -9,9 +8,9 @@ import { SageMakerClientConfig } from "./SageMakerClient"; */ export const getRuntimeConfig = (config: SageMakerClientConfig) => ({ apiVersion: "2017-07-24", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SageMaker"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SageMaker", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sagemaker/runtimeConfig.ts b/clients/client-sagemaker/runtimeConfig.ts index 0b8b485ce4cd..5e6e3b0ee28e 100644 --- a/clients/client-sagemaker/runtimeConfig.ts +++ b/clients/client-sagemaker/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SageMakerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-savingsplans/runtimeConfig.browser.ts b/clients/client-savingsplans/runtimeConfig.browser.ts index 45f5967ffbb7..f9e4e459e84e 100644 --- a/clients/client-savingsplans/runtimeConfig.browser.ts +++ b/clients/client-savingsplans/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SavingsplansClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-savingsplans/runtimeConfig.native.ts b/clients/client-savingsplans/runtimeConfig.native.ts index bf3759005ba9..caf23ab9cb5d 100644 --- a/clients/client-savingsplans/runtimeConfig.native.ts +++ b/clients/client-savingsplans/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SavingsplansClientConfig } from "./SavingsplansClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SavingsplansClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-savingsplans/runtimeConfig.shared.ts b/clients/client-savingsplans/runtimeConfig.shared.ts index 98f5cf4e93ed..a02d35d1680e 100644 --- a/clients/client-savingsplans/runtimeConfig.shared.ts +++ b/clients/client-savingsplans/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SavingsplansClientConfig } from "./SavingsplansClient"; @@ -9,9 +8,9 @@ import { SavingsplansClientConfig } from "./SavingsplansClient"; */ export const getRuntimeConfig = (config: SavingsplansClientConfig) => ({ apiVersion: "2019-06-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "savingsplans"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "savingsplans", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-savingsplans/runtimeConfig.ts b/clients/client-savingsplans/runtimeConfig.ts index 52c572fef626..e7fff7ea5f08 100644 --- a/clients/client-savingsplans/runtimeConfig.ts +++ b/clients/client-savingsplans/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SavingsplansClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-schemas/runtimeConfig.browser.ts b/clients/client-schemas/runtimeConfig.browser.ts index 6364c5699d11..a85f4b3c1fcd 100644 --- a/clients/client-schemas/runtimeConfig.browser.ts +++ b/clients/client-schemas/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SchemasClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-schemas/runtimeConfig.native.ts b/clients/client-schemas/runtimeConfig.native.ts index 9ba5924e7b1a..bd76413b58ac 100644 --- a/clients/client-schemas/runtimeConfig.native.ts +++ b/clients/client-schemas/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SchemasClientConfig } from "./SchemasClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SchemasClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-schemas/runtimeConfig.shared.ts b/clients/client-schemas/runtimeConfig.shared.ts index ee08e57f34bf..3623abe9e665 100644 --- a/clients/client-schemas/runtimeConfig.shared.ts +++ b/clients/client-schemas/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SchemasClientConfig } from "./SchemasClient"; @@ -9,9 +8,9 @@ import { SchemasClientConfig } from "./SchemasClient"; */ export const getRuntimeConfig = (config: SchemasClientConfig) => ({ apiVersion: "2019-12-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "schemas"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "schemas", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-schemas/runtimeConfig.ts b/clients/client-schemas/runtimeConfig.ts index 293220c6081e..720b2f347059 100644 --- a/clients/client-schemas/runtimeConfig.ts +++ b/clients/client-schemas/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SchemasClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-secrets-manager/runtimeConfig.browser.ts b/clients/client-secrets-manager/runtimeConfig.browser.ts index 3298a80df5ac..e2d3c8880448 100644 --- a/clients/client-secrets-manager/runtimeConfig.browser.ts +++ b/clients/client-secrets-manager/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-secrets-manager/runtimeConfig.native.ts b/clients/client-secrets-manager/runtimeConfig.native.ts index 1ccaf3355f1f..7cde3cc687e2 100644 --- a/clients/client-secrets-manager/runtimeConfig.native.ts +++ b/clients/client-secrets-manager/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SecretsManagerClientConfig } from "./SecretsManagerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-secrets-manager/runtimeConfig.shared.ts b/clients/client-secrets-manager/runtimeConfig.shared.ts index 54481603122b..a39e27bbf482 100644 --- a/clients/client-secrets-manager/runtimeConfig.shared.ts +++ b/clients/client-secrets-manager/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SecretsManagerClientConfig } from "./SecretsManagerClient"; @@ -9,9 +8,9 @@ import { SecretsManagerClientConfig } from "./SecretsManagerClient"; */ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => ({ apiVersion: "2017-10-17", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Secrets Manager"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Secrets Manager", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-secrets-manager/runtimeConfig.ts b/clients/client-secrets-manager/runtimeConfig.ts index 3e32b0d41c9e..5b1dc7792bf6 100644 --- a/clients/client-secrets-manager/runtimeConfig.ts +++ b/clients/client-secrets-manager/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-securityhub/runtimeConfig.browser.ts b/clients/client-securityhub/runtimeConfig.browser.ts index 11025a3644da..eb67b5226435 100644 --- a/clients/client-securityhub/runtimeConfig.browser.ts +++ b/clients/client-securityhub/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SecurityHubClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-securityhub/runtimeConfig.native.ts b/clients/client-securityhub/runtimeConfig.native.ts index 7038eac096f3..e6396937aaea 100644 --- a/clients/client-securityhub/runtimeConfig.native.ts +++ b/clients/client-securityhub/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SecurityHubClientConfig } from "./SecurityHubClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SecurityHubClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-securityhub/runtimeConfig.shared.ts b/clients/client-securityhub/runtimeConfig.shared.ts index 0d54fd69fde5..f46bb72d4410 100644 --- a/clients/client-securityhub/runtimeConfig.shared.ts +++ b/clients/client-securityhub/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SecurityHubClientConfig } from "./SecurityHubClient"; @@ -9,9 +8,9 @@ import { SecurityHubClientConfig } from "./SecurityHubClient"; */ export const getRuntimeConfig = (config: SecurityHubClientConfig) => ({ apiVersion: "2018-10-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SecurityHub"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SecurityHub", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-securityhub/runtimeConfig.ts b/clients/client-securityhub/runtimeConfig.ts index 1cd4fed73595..8ba6d8799447 100644 --- a/clients/client-securityhub/runtimeConfig.ts +++ b/clients/client-securityhub/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SecurityHubClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts index 63774eeb34b5..ce890e22370d 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientCo return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts index a35d12455b58..5fbaa0e3ffe5 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ServerlessApplicationRepositoryClientConfig } from "./ServerlessApplicationRepositoryClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientCo return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts index 01afcc816eac..21466de3636b 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ServerlessApplicationRepositoryClientConfig } from "./ServerlessApplicationRepositoryClient"; @@ -9,9 +8,9 @@ import { ServerlessApplicationRepositoryClientConfig } from "./ServerlessApplica */ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientConfig) => ({ apiVersion: "2017-09-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ServerlessApplicationRepository"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ServerlessApplicationRepository", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.ts index f1914b2d98a2..0da9428b54bd 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientCo return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts b/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts index 80e5dbe76215..d0170ae61e53 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.native.ts b/clients/client-service-catalog-appregistry/runtimeConfig.native.ts index 83be1797fa2a..b8b27934fcea 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.native.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ServiceCatalogAppRegistryClientConfig } from "./ServiceCatalogAppRegistryClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts b/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts index 6ae09cc64c45..ea2d942814c2 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ServiceCatalogAppRegistryClientConfig } from "./ServiceCatalogAppRegistryClient"; @@ -9,9 +8,9 @@ import { ServiceCatalogAppRegistryClientConfig } from "./ServiceCatalogAppRegist */ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) => ({ apiVersion: "2020-06-24", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Service Catalog AppRegistry"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Service Catalog AppRegistry", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.ts b/clients/client-service-catalog-appregistry/runtimeConfig.ts index 9bc57d96e425..d386a510d55b 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-service-catalog/runtimeConfig.browser.ts b/clients/client-service-catalog/runtimeConfig.browser.ts index 6b0567f5bac4..3dc8e4ec387d 100644 --- a/clients/client-service-catalog/runtimeConfig.browser.ts +++ b/clients/client-service-catalog/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-service-catalog/runtimeConfig.native.ts b/clients/client-service-catalog/runtimeConfig.native.ts index c9f4d428bb4e..16fd0b48e170 100644 --- a/clients/client-service-catalog/runtimeConfig.native.ts +++ b/clients/client-service-catalog/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ServiceCatalogClientConfig } from "./ServiceCatalogClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-service-catalog/runtimeConfig.shared.ts b/clients/client-service-catalog/runtimeConfig.shared.ts index 30221f33faec..97cb2331e478 100644 --- a/clients/client-service-catalog/runtimeConfig.shared.ts +++ b/clients/client-service-catalog/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ServiceCatalogClientConfig } from "./ServiceCatalogClient"; @@ -9,9 +8,9 @@ import { ServiceCatalogClientConfig } from "./ServiceCatalogClient"; */ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => ({ apiVersion: "2015-12-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Service Catalog"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Service Catalog", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-service-catalog/runtimeConfig.ts b/clients/client-service-catalog/runtimeConfig.ts index de21008ccece..a1d8a60e83cc 100644 --- a/clients/client-service-catalog/runtimeConfig.ts +++ b/clients/client-service-catalog/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-service-quotas/runtimeConfig.browser.ts b/clients/client-service-quotas/runtimeConfig.browser.ts index 2ca15836a718..e45809a11815 100644 --- a/clients/client-service-quotas/runtimeConfig.browser.ts +++ b/clients/client-service-quotas/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-service-quotas/runtimeConfig.native.ts b/clients/client-service-quotas/runtimeConfig.native.ts index 98e211579e0d..cc1a203d22e7 100644 --- a/clients/client-service-quotas/runtimeConfig.native.ts +++ b/clients/client-service-quotas/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ServiceQuotasClientConfig } from "./ServiceQuotasClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-service-quotas/runtimeConfig.shared.ts b/clients/client-service-quotas/runtimeConfig.shared.ts index 14e5b4fce867..298cdea303d6 100644 --- a/clients/client-service-quotas/runtimeConfig.shared.ts +++ b/clients/client-service-quotas/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ServiceQuotasClientConfig } from "./ServiceQuotasClient"; @@ -9,9 +8,9 @@ import { ServiceQuotasClientConfig } from "./ServiceQuotasClient"; */ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => ({ apiVersion: "2019-06-24", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Service Quotas"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Service Quotas", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-service-quotas/runtimeConfig.ts b/clients/client-service-quotas/runtimeConfig.ts index be7cf1d95416..bc18e3d32f51 100644 --- a/clients/client-service-quotas/runtimeConfig.ts +++ b/clients/client-service-quotas/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-servicediscovery/runtimeConfig.browser.ts b/clients/client-servicediscovery/runtimeConfig.browser.ts index 42c8cfcd7bbb..9ed4b5eded4f 100644 --- a/clients/client-servicediscovery/runtimeConfig.browser.ts +++ b/clients/client-servicediscovery/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-servicediscovery/runtimeConfig.native.ts b/clients/client-servicediscovery/runtimeConfig.native.ts index f2a99154fbc1..98d4eb79875e 100644 --- a/clients/client-servicediscovery/runtimeConfig.native.ts +++ b/clients/client-servicediscovery/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ServiceDiscoveryClientConfig } from "./ServiceDiscoveryClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-servicediscovery/runtimeConfig.shared.ts b/clients/client-servicediscovery/runtimeConfig.shared.ts index 7feed2fbf4ff..5a6736b460aa 100644 --- a/clients/client-servicediscovery/runtimeConfig.shared.ts +++ b/clients/client-servicediscovery/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ServiceDiscoveryClientConfig } from "./ServiceDiscoveryClient"; @@ -9,9 +8,9 @@ import { ServiceDiscoveryClientConfig } from "./ServiceDiscoveryClient"; */ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => ({ apiVersion: "2017-03-14", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "ServiceDiscovery"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "ServiceDiscovery", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-servicediscovery/runtimeConfig.ts b/clients/client-servicediscovery/runtimeConfig.ts index 06adc9c67b0a..b4fdad32e8ee 100644 --- a/clients/client-servicediscovery/runtimeConfig.ts +++ b/clients/client-servicediscovery/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ses/runtimeConfig.browser.ts b/clients/client-ses/runtimeConfig.browser.ts index 97bff76a99bb..b51f7361c90d 100644 --- a/clients/client-ses/runtimeConfig.browser.ts +++ b/clients/client-ses/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SESClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ses/runtimeConfig.native.ts b/clients/client-ses/runtimeConfig.native.ts index 649f29a9de63..b4ded618bc74 100644 --- a/clients/client-ses/runtimeConfig.native.ts +++ b/clients/client-ses/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SESClientConfig } from "./SESClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SESClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ses/runtimeConfig.shared.ts b/clients/client-ses/runtimeConfig.shared.ts index c9265b764940..edb372f6e8b7 100644 --- a/clients/client-ses/runtimeConfig.shared.ts +++ b/clients/client-ses/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SESClientConfig } from "./SESClient"; @@ -9,9 +8,9 @@ import { SESClientConfig } from "./SESClient"; */ export const getRuntimeConfig = (config: SESClientConfig) => ({ apiVersion: "2010-12-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SES"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SES", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ses/runtimeConfig.ts b/clients/client-ses/runtimeConfig.ts index b0be125b7d3a..44a38fb0ae2c 100644 --- a/clients/client-ses/runtimeConfig.ts +++ b/clients/client-ses/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SESClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sesv2/runtimeConfig.browser.ts b/clients/client-sesv2/runtimeConfig.browser.ts index 58febb05226e..410f70995732 100644 --- a/clients/client-sesv2/runtimeConfig.browser.ts +++ b/clients/client-sesv2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SESv2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sesv2/runtimeConfig.native.ts b/clients/client-sesv2/runtimeConfig.native.ts index e6590b83cc0a..04fb9d6765ec 100644 --- a/clients/client-sesv2/runtimeConfig.native.ts +++ b/clients/client-sesv2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SESv2ClientConfig } from "./SESv2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SESv2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sesv2/runtimeConfig.shared.ts b/clients/client-sesv2/runtimeConfig.shared.ts index ecf866367fb0..9f59f23ccdc8 100644 --- a/clients/client-sesv2/runtimeConfig.shared.ts +++ b/clients/client-sesv2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SESv2ClientConfig } from "./SESv2Client"; @@ -9,9 +8,9 @@ import { SESv2ClientConfig } from "./SESv2Client"; */ export const getRuntimeConfig = (config: SESv2ClientConfig) => ({ apiVersion: "2019-09-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SESv2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SESv2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sesv2/runtimeConfig.ts b/clients/client-sesv2/runtimeConfig.ts index c2a9a141a162..0c43975e9789 100644 --- a/clients/client-sesv2/runtimeConfig.ts +++ b/clients/client-sesv2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SESv2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sfn/runtimeConfig.browser.ts b/clients/client-sfn/runtimeConfig.browser.ts index f803a4e18efa..36621e75bf9b 100644 --- a/clients/client-sfn/runtimeConfig.browser.ts +++ b/clients/client-sfn/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SFNClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sfn/runtimeConfig.native.ts b/clients/client-sfn/runtimeConfig.native.ts index 896632286aef..ec3037c48d38 100644 --- a/clients/client-sfn/runtimeConfig.native.ts +++ b/clients/client-sfn/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SFNClientConfig } from "./SFNClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SFNClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sfn/runtimeConfig.shared.ts b/clients/client-sfn/runtimeConfig.shared.ts index 400a7a3e233f..869ac6e9a185 100644 --- a/clients/client-sfn/runtimeConfig.shared.ts +++ b/clients/client-sfn/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SFNClientConfig } from "./SFNClient"; @@ -9,9 +8,9 @@ import { SFNClientConfig } from "./SFNClient"; */ export const getRuntimeConfig = (config: SFNClientConfig) => ({ apiVersion: "2016-11-23", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SFN"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SFN", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sfn/runtimeConfig.ts b/clients/client-sfn/runtimeConfig.ts index 32b353f28802..7ac887f1813b 100644 --- a/clients/client-sfn/runtimeConfig.ts +++ b/clients/client-sfn/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SFNClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-shield/runtimeConfig.browser.ts b/clients/client-shield/runtimeConfig.browser.ts index 16e2f0fd4be0..3b001a687897 100644 --- a/clients/client-shield/runtimeConfig.browser.ts +++ b/clients/client-shield/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: ShieldClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-shield/runtimeConfig.native.ts b/clients/client-shield/runtimeConfig.native.ts index 03eaa0befec4..b923449c4df9 100644 --- a/clients/client-shield/runtimeConfig.native.ts +++ b/clients/client-shield/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { ShieldClientConfig } from "./ShieldClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: ShieldClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-shield/runtimeConfig.shared.ts b/clients/client-shield/runtimeConfig.shared.ts index 75c5f9551b6e..e80e574fe992 100644 --- a/clients/client-shield/runtimeConfig.shared.ts +++ b/clients/client-shield/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { ShieldClientConfig } from "./ShieldClient"; @@ -9,9 +8,9 @@ import { ShieldClientConfig } from "./ShieldClient"; */ export const getRuntimeConfig = (config: ShieldClientConfig) => ({ apiVersion: "2016-06-02", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Shield"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Shield", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-shield/runtimeConfig.ts b/clients/client-shield/runtimeConfig.ts index dbcada6f525c..c32f29b5da20 100644 --- a/clients/client-shield/runtimeConfig.ts +++ b/clients/client-shield/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: ShieldClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-signer/runtimeConfig.browser.ts b/clients/client-signer/runtimeConfig.browser.ts index c0b85031cbd3..f2b22e206414 100644 --- a/clients/client-signer/runtimeConfig.browser.ts +++ b/clients/client-signer/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SignerClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-signer/runtimeConfig.native.ts b/clients/client-signer/runtimeConfig.native.ts index e2a702e158b3..ce0dcb33a6f0 100644 --- a/clients/client-signer/runtimeConfig.native.ts +++ b/clients/client-signer/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SignerClientConfig } from "./SignerClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SignerClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-signer/runtimeConfig.shared.ts b/clients/client-signer/runtimeConfig.shared.ts index 7d77a2af1469..e607e33048dc 100644 --- a/clients/client-signer/runtimeConfig.shared.ts +++ b/clients/client-signer/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SignerClientConfig } from "./SignerClient"; @@ -9,9 +8,9 @@ import { SignerClientConfig } from "./SignerClient"; */ export const getRuntimeConfig = (config: SignerClientConfig) => ({ apiVersion: "2017-08-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "signer"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "signer", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-signer/runtimeConfig.ts b/clients/client-signer/runtimeConfig.ts index 3c061b253313..6a4fa58ae211 100644 --- a/clients/client-signer/runtimeConfig.ts +++ b/clients/client-signer/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SignerClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sms/runtimeConfig.browser.ts b/clients/client-sms/runtimeConfig.browser.ts index cd8475128f2c..2c4d73eaa4e9 100644 --- a/clients/client-sms/runtimeConfig.browser.ts +++ b/clients/client-sms/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SMSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sms/runtimeConfig.native.ts b/clients/client-sms/runtimeConfig.native.ts index 2e4c16b96633..3a4acb105dc3 100644 --- a/clients/client-sms/runtimeConfig.native.ts +++ b/clients/client-sms/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SMSClientConfig } from "./SMSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SMSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sms/runtimeConfig.shared.ts b/clients/client-sms/runtimeConfig.shared.ts index 680872d9349c..8eed773e9eea 100644 --- a/clients/client-sms/runtimeConfig.shared.ts +++ b/clients/client-sms/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SMSClientConfig } from "./SMSClient"; @@ -9,9 +8,9 @@ import { SMSClientConfig } from "./SMSClient"; */ export const getRuntimeConfig = (config: SMSClientConfig) => ({ apiVersion: "2016-10-24", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SMS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SMS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sms/runtimeConfig.ts b/clients/client-sms/runtimeConfig.ts index 7988e0eb1538..444bdee7ba8a 100644 --- a/clients/client-sms/runtimeConfig.ts +++ b/clients/client-sms/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SMSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-snowball/runtimeConfig.browser.ts b/clients/client-snowball/runtimeConfig.browser.ts index 9bf283274efa..67ea5ac0e920 100644 --- a/clients/client-snowball/runtimeConfig.browser.ts +++ b/clients/client-snowball/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SnowballClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-snowball/runtimeConfig.native.ts b/clients/client-snowball/runtimeConfig.native.ts index 80ffab53f4e2..45ca88d4dcc8 100644 --- a/clients/client-snowball/runtimeConfig.native.ts +++ b/clients/client-snowball/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SnowballClientConfig } from "./SnowballClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SnowballClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-snowball/runtimeConfig.shared.ts b/clients/client-snowball/runtimeConfig.shared.ts index c1378d3abd0f..5bbb4b923b95 100644 --- a/clients/client-snowball/runtimeConfig.shared.ts +++ b/clients/client-snowball/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SnowballClientConfig } from "./SnowballClient"; @@ -9,9 +8,9 @@ import { SnowballClientConfig } from "./SnowballClient"; */ export const getRuntimeConfig = (config: SnowballClientConfig) => ({ apiVersion: "2016-06-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Snowball"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Snowball", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-snowball/runtimeConfig.ts b/clients/client-snowball/runtimeConfig.ts index 91d340b352ae..26a3edf7c9b1 100644 --- a/clients/client-snowball/runtimeConfig.ts +++ b/clients/client-snowball/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SnowballClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sns/runtimeConfig.browser.ts b/clients/client-sns/runtimeConfig.browser.ts index 870fed24d271..378bd99a500d 100644 --- a/clients/client-sns/runtimeConfig.browser.ts +++ b/clients/client-sns/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SNSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sns/runtimeConfig.native.ts b/clients/client-sns/runtimeConfig.native.ts index d74d757d9b2c..26360b8e3e6b 100644 --- a/clients/client-sns/runtimeConfig.native.ts +++ b/clients/client-sns/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SNSClientConfig } from "./SNSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SNSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sns/runtimeConfig.shared.ts b/clients/client-sns/runtimeConfig.shared.ts index ce56e55d1f44..b5dad9ecbca3 100644 --- a/clients/client-sns/runtimeConfig.shared.ts +++ b/clients/client-sns/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SNSClientConfig } from "./SNSClient"; @@ -9,9 +8,9 @@ import { SNSClientConfig } from "./SNSClient"; */ export const getRuntimeConfig = (config: SNSClientConfig) => ({ apiVersion: "2010-03-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SNS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SNS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sns/runtimeConfig.ts b/clients/client-sns/runtimeConfig.ts index 61b5d998b284..c9fd7ad6e9da 100644 --- a/clients/client-sns/runtimeConfig.ts +++ b/clients/client-sns/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SNSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sqs/runtimeConfig.browser.ts b/clients/client-sqs/runtimeConfig.browser.ts index 0dd6079c42e5..97b796f978d7 100644 --- a/clients/client-sqs/runtimeConfig.browser.ts +++ b/clients/client-sqs/runtimeConfig.browser.ts @@ -5,7 +5,6 @@ import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { Md5 } from "@aws-sdk/md5-js"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -21,25 +20,22 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - md5: coalesce(config.md5, Md5), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + md5: config.md5 ?? Md5, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sqs/runtimeConfig.native.ts b/clients/client-sqs/runtimeConfig.native.ts index dccf3d4b5e68..9cf8c8ad0df5 100644 --- a/clients/client-sqs/runtimeConfig.native.ts +++ b/clients/client-sqs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SQSClientConfig } from "./SQSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sqs/runtimeConfig.shared.ts b/clients/client-sqs/runtimeConfig.shared.ts index 25f316d6c42b..1331b6fa83d7 100644 --- a/clients/client-sqs/runtimeConfig.shared.ts +++ b/clients/client-sqs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SQSClientConfig } from "./SQSClient"; @@ -9,9 +8,9 @@ import { SQSClientConfig } from "./SQSClient"; */ export const getRuntimeConfig = (config: SQSClientConfig) => ({ apiVersion: "2012-11-05", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SQS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SQS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sqs/runtimeConfig.ts b/clients/client-sqs/runtimeConfig.ts index 20f52f6e1287..e3f090188482 100644 --- a/clients/client-sqs/runtimeConfig.ts +++ b/clients/client-sqs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; @@ -24,25 +23,22 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - md5: coalesce(config.md5, Hash.bind(null, "md5")), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + md5: config.md5 ?? Hash.bind(null, "md5"), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ssm-contacts/runtimeConfig.browser.ts b/clients/client-ssm-contacts/runtimeConfig.browser.ts index c2f97e8dd279..fddf06063acb 100644 --- a/clients/client-ssm-contacts/runtimeConfig.browser.ts +++ b/clients/client-ssm-contacts/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SSMContactsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ssm-contacts/runtimeConfig.native.ts b/clients/client-ssm-contacts/runtimeConfig.native.ts index 45f8d5f7c991..13bb1298a07f 100644 --- a/clients/client-ssm-contacts/runtimeConfig.native.ts +++ b/clients/client-ssm-contacts/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SSMContactsClientConfig } from "./SSMContactsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SSMContactsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ssm-contacts/runtimeConfig.shared.ts b/clients/client-ssm-contacts/runtimeConfig.shared.ts index 8ec31254e6a0..660a260e8e1c 100644 --- a/clients/client-ssm-contacts/runtimeConfig.shared.ts +++ b/clients/client-ssm-contacts/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SSMContactsClientConfig } from "./SSMContactsClient"; @@ -9,9 +8,9 @@ import { SSMContactsClientConfig } from "./SSMContactsClient"; */ export const getRuntimeConfig = (config: SSMContactsClientConfig) => ({ apiVersion: "2021-05-03", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SSM Contacts"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SSM Contacts", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ssm-contacts/runtimeConfig.ts b/clients/client-ssm-contacts/runtimeConfig.ts index fab0909af83d..8eb01eaa3357 100644 --- a/clients/client-ssm-contacts/runtimeConfig.ts +++ b/clients/client-ssm-contacts/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SSMContactsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ssm-incidents/runtimeConfig.browser.ts b/clients/client-ssm-incidents/runtimeConfig.browser.ts index d389b5a7a946..44b28ff9ce84 100644 --- a/clients/client-ssm-incidents/runtimeConfig.browser.ts +++ b/clients/client-ssm-incidents/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ssm-incidents/runtimeConfig.native.ts b/clients/client-ssm-incidents/runtimeConfig.native.ts index 2bfe05135725..4cccc72dbc6e 100644 --- a/clients/client-ssm-incidents/runtimeConfig.native.ts +++ b/clients/client-ssm-incidents/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SSMIncidentsClientConfig } from "./SSMIncidentsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ssm-incidents/runtimeConfig.shared.ts b/clients/client-ssm-incidents/runtimeConfig.shared.ts index a9cdfed808ad..2d5247091727 100644 --- a/clients/client-ssm-incidents/runtimeConfig.shared.ts +++ b/clients/client-ssm-incidents/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SSMIncidentsClientConfig } from "./SSMIncidentsClient"; @@ -9,9 +8,9 @@ import { SSMIncidentsClientConfig } from "./SSMIncidentsClient"; */ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => ({ apiVersion: "2018-05-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SSM Incidents"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SSM Incidents", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ssm-incidents/runtimeConfig.ts b/clients/client-ssm-incidents/runtimeConfig.ts index 9dbba54c2898..56fba615e3e3 100644 --- a/clients/client-ssm-incidents/runtimeConfig.ts +++ b/clients/client-ssm-incidents/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ssm/runtimeConfig.browser.ts b/clients/client-ssm/runtimeConfig.browser.ts index 779f98e61ba1..5a538b7b3d92 100644 --- a/clients/client-ssm/runtimeConfig.browser.ts +++ b/clients/client-ssm/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SSMClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-ssm/runtimeConfig.native.ts b/clients/client-ssm/runtimeConfig.native.ts index ec07027d7456..d3adbe91a515 100644 --- a/clients/client-ssm/runtimeConfig.native.ts +++ b/clients/client-ssm/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SSMClientConfig } from "./SSMClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SSMClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-ssm/runtimeConfig.shared.ts b/clients/client-ssm/runtimeConfig.shared.ts index 592091516544..65558141959b 100644 --- a/clients/client-ssm/runtimeConfig.shared.ts +++ b/clients/client-ssm/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SSMClientConfig } from "./SSMClient"; @@ -9,9 +8,9 @@ import { SSMClientConfig } from "./SSMClient"; */ export const getRuntimeConfig = (config: SSMClientConfig) => ({ apiVersion: "2014-11-06", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SSM"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SSM", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-ssm/runtimeConfig.ts b/clients/client-ssm/runtimeConfig.ts index 6ab81a671fc8..29ddf902eb88 100644 --- a/clients/client-ssm/runtimeConfig.ts +++ b/clients/client-ssm/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SSMClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sso-admin/runtimeConfig.browser.ts b/clients/client-sso-admin/runtimeConfig.browser.ts index 9b739eaec324..503c6db98c5b 100644 --- a/clients/client-sso-admin/runtimeConfig.browser.ts +++ b/clients/client-sso-admin/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SSOAdminClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sso-admin/runtimeConfig.native.ts b/clients/client-sso-admin/runtimeConfig.native.ts index 3c90e1f3b228..f5b0a9171dd2 100644 --- a/clients/client-sso-admin/runtimeConfig.native.ts +++ b/clients/client-sso-admin/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SSOAdminClientConfig } from "./SSOAdminClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SSOAdminClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sso-admin/runtimeConfig.shared.ts b/clients/client-sso-admin/runtimeConfig.shared.ts index 97d8106dd019..5e9686124986 100644 --- a/clients/client-sso-admin/runtimeConfig.shared.ts +++ b/clients/client-sso-admin/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SSOAdminClientConfig } from "./SSOAdminClient"; @@ -9,9 +8,9 @@ import { SSOAdminClientConfig } from "./SSOAdminClient"; */ export const getRuntimeConfig = (config: SSOAdminClientConfig) => ({ apiVersion: "2020-07-20", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SSO Admin"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SSO Admin", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sso-admin/runtimeConfig.ts b/clients/client-sso-admin/runtimeConfig.ts index 294acfc53c83..ed17b62459eb 100644 --- a/clients/client-sso-admin/runtimeConfig.ts +++ b/clients/client-sso-admin/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SSOAdminClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sso-oidc/runtimeConfig.browser.ts b/clients/client-sso-oidc/runtimeConfig.browser.ts index 8664ef899474..244c3fa30fb1 100644 --- a/clients/client-sso-oidc/runtimeConfig.browser.ts +++ b/clients/client-sso-oidc/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,20 +19,19 @@ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sso-oidc/runtimeConfig.native.ts b/clients/client-sso-oidc/runtimeConfig.native.ts index 9a6943b356a8..fc30cb1b0590 100644 --- a/clients/client-sso-oidc/runtimeConfig.native.ts +++ b/clients/client-sso-oidc/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SSOOIDCClientConfig } from "./SSOOIDCClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sso-oidc/runtimeConfig.shared.ts b/clients/client-sso-oidc/runtimeConfig.shared.ts index 745e137718d1..b3829f8c8a5b 100644 --- a/clients/client-sso-oidc/runtimeConfig.shared.ts +++ b/clients/client-sso-oidc/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SSOOIDCClientConfig } from "./SSOOIDCClient"; @@ -9,9 +8,9 @@ import { SSOOIDCClientConfig } from "./SSOOIDCClient"; */ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => ({ apiVersion: "2019-06-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SSO OIDC"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SSO OIDC", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sso-oidc/runtimeConfig.ts b/clients/client-sso-oidc/runtimeConfig.ts index eeacc7681963..c0db11b6aaa8 100644 --- a/clients/client-sso-oidc/runtimeConfig.ts +++ b/clients/client-sso-oidc/runtimeConfig.ts @@ -5,7 +5,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -21,20 +20,19 @@ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sso/runtimeConfig.browser.ts b/clients/client-sso/runtimeConfig.browser.ts index 1dcb396ea01c..3894e6e30cec 100644 --- a/clients/client-sso/runtimeConfig.browser.ts +++ b/clients/client-sso/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,20 +19,19 @@ export const getRuntimeConfig = (config: SSOClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sso/runtimeConfig.native.ts b/clients/client-sso/runtimeConfig.native.ts index f4d246d93175..df75366396b0 100644 --- a/clients/client-sso/runtimeConfig.native.ts +++ b/clients/client-sso/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SSOClientConfig } from "./SSOClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SSOClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sso/runtimeConfig.shared.ts b/clients/client-sso/runtimeConfig.shared.ts index c1441744dea2..b4d8b853c2fe 100644 --- a/clients/client-sso/runtimeConfig.shared.ts +++ b/clients/client-sso/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SSOClientConfig } from "./SSOClient"; @@ -9,9 +8,9 @@ import { SSOClientConfig } from "./SSOClient"; */ export const getRuntimeConfig = (config: SSOClientConfig) => ({ apiVersion: "2019-06-10", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SSO"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SSO", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sso/runtimeConfig.ts b/clients/client-sso/runtimeConfig.ts index 21c2d15e9f24..607c005f11d6 100644 --- a/clients/client-sso/runtimeConfig.ts +++ b/clients/client-sso/runtimeConfig.ts @@ -5,7 +5,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -21,20 +20,19 @@ export const getRuntimeConfig = (config: SSOClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-storage-gateway/runtimeConfig.browser.ts b/clients/client-storage-gateway/runtimeConfig.browser.ts index 5565fe93308b..d2ccd98f6e45 100644 --- a/clients/client-storage-gateway/runtimeConfig.browser.ts +++ b/clients/client-storage-gateway/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-storage-gateway/runtimeConfig.native.ts b/clients/client-storage-gateway/runtimeConfig.native.ts index 62c924c70c08..64eca773ab1f 100644 --- a/clients/client-storage-gateway/runtimeConfig.native.ts +++ b/clients/client-storage-gateway/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { StorageGatewayClientConfig } from "./StorageGatewayClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-storage-gateway/runtimeConfig.shared.ts b/clients/client-storage-gateway/runtimeConfig.shared.ts index 05c945ea146c..6b6f838e8970 100644 --- a/clients/client-storage-gateway/runtimeConfig.shared.ts +++ b/clients/client-storage-gateway/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { StorageGatewayClientConfig } from "./StorageGatewayClient"; @@ -9,9 +8,9 @@ import { StorageGatewayClientConfig } from "./StorageGatewayClient"; */ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => ({ apiVersion: "2013-06-30", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Storage Gateway"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Storage Gateway", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-storage-gateway/runtimeConfig.ts b/clients/client-storage-gateway/runtimeConfig.ts index 81f6f5d3b83a..6da8752bd614 100644 --- a/clients/client-storage-gateway/runtimeConfig.ts +++ b/clients/client-storage-gateway/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sts/runtimeConfig.browser.ts b/clients/client-sts/runtimeConfig.browser.ts index 51160dde4fb1..6b2e9c6194d4 100644 --- a/clients/client-sts/runtimeConfig.browser.ts +++ b/clients/client-sts/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: STSClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-sts/runtimeConfig.native.ts b/clients/client-sts/runtimeConfig.native.ts index 7047a77a820f..a3921c0b95ca 100644 --- a/clients/client-sts/runtimeConfig.native.ts +++ b/clients/client-sts/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { STSClientConfig } from "./STSClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: STSClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-sts/runtimeConfig.shared.ts b/clients/client-sts/runtimeConfig.shared.ts index 777ec6fdfa73..14c6ba0e6bf4 100644 --- a/clients/client-sts/runtimeConfig.shared.ts +++ b/clients/client-sts/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { STSClientConfig } from "./STSClient"; @@ -9,9 +8,9 @@ import { STSClientConfig } from "./STSClient"; */ export const getRuntimeConfig = (config: STSClientConfig) => ({ apiVersion: "2011-06-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "STS"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "STS", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-sts/runtimeConfig.ts b/clients/client-sts/runtimeConfig.ts index 98af351b6ebb..2ad5a321cb70 100644 --- a/clients/client-sts/runtimeConfig.ts +++ b/clients/client-sts/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: STSClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-support/runtimeConfig.browser.ts b/clients/client-support/runtimeConfig.browser.ts index fc04f407df25..fc56d02697d7 100644 --- a/clients/client-support/runtimeConfig.browser.ts +++ b/clients/client-support/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SupportClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-support/runtimeConfig.native.ts b/clients/client-support/runtimeConfig.native.ts index 500fc82525e8..65731f7a39be 100644 --- a/clients/client-support/runtimeConfig.native.ts +++ b/clients/client-support/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SupportClientConfig } from "./SupportClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SupportClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-support/runtimeConfig.shared.ts b/clients/client-support/runtimeConfig.shared.ts index f16e15482f3e..faf5a2f3ec8f 100644 --- a/clients/client-support/runtimeConfig.shared.ts +++ b/clients/client-support/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SupportClientConfig } from "./SupportClient"; @@ -9,9 +8,9 @@ import { SupportClientConfig } from "./SupportClient"; */ export const getRuntimeConfig = (config: SupportClientConfig) => ({ apiVersion: "2013-04-15", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Support"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Support", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-support/runtimeConfig.ts b/clients/client-support/runtimeConfig.ts index 68b392eb17a6..fce88ef54a88 100644 --- a/clients/client-support/runtimeConfig.ts +++ b/clients/client-support/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SupportClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-swf/runtimeConfig.browser.ts b/clients/client-swf/runtimeConfig.browser.ts index 4eb4d3599319..439055d2d04a 100644 --- a/clients/client-swf/runtimeConfig.browser.ts +++ b/clients/client-swf/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SWFClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-swf/runtimeConfig.native.ts b/clients/client-swf/runtimeConfig.native.ts index 8201f02ac15b..b1672de682a0 100644 --- a/clients/client-swf/runtimeConfig.native.ts +++ b/clients/client-swf/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SWFClientConfig } from "./SWFClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SWFClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-swf/runtimeConfig.shared.ts b/clients/client-swf/runtimeConfig.shared.ts index 5c883695cf1c..77dcf6b234d2 100644 --- a/clients/client-swf/runtimeConfig.shared.ts +++ b/clients/client-swf/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SWFClientConfig } from "./SWFClient"; @@ -9,9 +8,9 @@ import { SWFClientConfig } from "./SWFClient"; */ export const getRuntimeConfig = (config: SWFClientConfig) => ({ apiVersion: "2012-01-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "SWF"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "SWF", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-swf/runtimeConfig.ts b/clients/client-swf/runtimeConfig.ts index 06f63b2bb6d8..ac3228f04d76 100644 --- a/clients/client-swf/runtimeConfig.ts +++ b/clients/client-swf/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SWFClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-synthetics/runtimeConfig.browser.ts b/clients/client-synthetics/runtimeConfig.browser.ts index 31cd8600f4cb..5dbfd2cada88 100644 --- a/clients/client-synthetics/runtimeConfig.browser.ts +++ b/clients/client-synthetics/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: SyntheticsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-synthetics/runtimeConfig.native.ts b/clients/client-synthetics/runtimeConfig.native.ts index cc722ef73066..7a44381e0fb9 100644 --- a/clients/client-synthetics/runtimeConfig.native.ts +++ b/clients/client-synthetics/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { SyntheticsClientConfig } from "./SyntheticsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: SyntheticsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-synthetics/runtimeConfig.shared.ts b/clients/client-synthetics/runtimeConfig.shared.ts index ab83cb758257..785a0b1571f0 100644 --- a/clients/client-synthetics/runtimeConfig.shared.ts +++ b/clients/client-synthetics/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { SyntheticsClientConfig } from "./SyntheticsClient"; @@ -9,9 +8,9 @@ import { SyntheticsClientConfig } from "./SyntheticsClient"; */ export const getRuntimeConfig = (config: SyntheticsClientConfig) => ({ apiVersion: "2017-10-11", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "synthetics"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "synthetics", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-synthetics/runtimeConfig.ts b/clients/client-synthetics/runtimeConfig.ts index a7879849e904..97f441bf5a47 100644 --- a/clients/client-synthetics/runtimeConfig.ts +++ b/clients/client-synthetics/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: SyntheticsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-textract/runtimeConfig.browser.ts b/clients/client-textract/runtimeConfig.browser.ts index bb1305a14bda..f4ba29ed5ca9 100644 --- a/clients/client-textract/runtimeConfig.browser.ts +++ b/clients/client-textract/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: TextractClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-textract/runtimeConfig.native.ts b/clients/client-textract/runtimeConfig.native.ts index d76dfdc9941d..4ba5631077fd 100644 --- a/clients/client-textract/runtimeConfig.native.ts +++ b/clients/client-textract/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TextractClientConfig } from "./TextractClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: TextractClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-textract/runtimeConfig.shared.ts b/clients/client-textract/runtimeConfig.shared.ts index 240dd093378e..4e61159d2c0e 100644 --- a/clients/client-textract/runtimeConfig.shared.ts +++ b/clients/client-textract/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TextractClientConfig } from "./TextractClient"; @@ -9,9 +8,9 @@ import { TextractClientConfig } from "./TextractClient"; */ export const getRuntimeConfig = (config: TextractClientConfig) => ({ apiVersion: "2018-06-27", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Textract"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Textract", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-textract/runtimeConfig.ts b/clients/client-textract/runtimeConfig.ts index 5ab08585e150..0e357fe98937 100644 --- a/clients/client-textract/runtimeConfig.ts +++ b/clients/client-textract/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: TextractClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-timestream-query/runtimeConfig.browser.ts b/clients/client-timestream-query/runtimeConfig.browser.ts index 5e38480f0819..5326c3a9b051 100644 --- a/clients/client-timestream-query/runtimeConfig.browser.ts +++ b/clients/client-timestream-query/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,27 +19,22 @@ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - endpointDiscoveryEnabledProvider: coalesce(config.endpointDiscoveryEnabledProvider, () => - Promise.resolve(undefined) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + endpointDiscoveryEnabledProvider: config.endpointDiscoveryEnabledProvider ?? (() => Promise.resolve(undefined)), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-timestream-query/runtimeConfig.native.ts b/clients/client-timestream-query/runtimeConfig.native.ts index 3b0920787d3b..2bfdc7616f0e 100644 --- a/clients/client-timestream-query/runtimeConfig.native.ts +++ b/clients/client-timestream-query/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TimestreamQueryClientConfig } from "./TimestreamQueryClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-timestream-query/runtimeConfig.shared.ts b/clients/client-timestream-query/runtimeConfig.shared.ts index eb199ba32ad9..e798be9fccdb 100644 --- a/clients/client-timestream-query/runtimeConfig.shared.ts +++ b/clients/client-timestream-query/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TimestreamQueryClientConfig } from "./TimestreamQueryClient"; @@ -9,9 +8,9 @@ import { TimestreamQueryClientConfig } from "./TimestreamQueryClient"; */ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => ({ apiVersion: "2018-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Timestream Query"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Timestream Query", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-timestream-query/runtimeConfig.ts b/clients/client-timestream-query/runtimeConfig.ts index 7d7d178e3a7b..3f5c28d78d16 100644 --- a/clients/client-timestream-query/runtimeConfig.ts +++ b/clients/client-timestream-query/runtimeConfig.ts @@ -8,7 +8,6 @@ import { NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS } from "@aws-sdk/middleware-endp import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -24,28 +23,23 @@ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - endpointDiscoveryEnabledProvider: coalesce( - config.endpointDiscoveryEnabledProvider, - loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + endpointDiscoveryEnabledProvider: + config.endpointDiscoveryEnabledProvider ?? loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-timestream-write/runtimeConfig.browser.ts b/clients/client-timestream-write/runtimeConfig.browser.ts index 0643e5a866da..8b143e47108b 100644 --- a/clients/client-timestream-write/runtimeConfig.browser.ts +++ b/clients/client-timestream-write/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,27 +19,22 @@ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - endpointDiscoveryEnabledProvider: coalesce(config.endpointDiscoveryEnabledProvider, () => - Promise.resolve(undefined) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + endpointDiscoveryEnabledProvider: config.endpointDiscoveryEnabledProvider ?? (() => Promise.resolve(undefined)), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-timestream-write/runtimeConfig.native.ts b/clients/client-timestream-write/runtimeConfig.native.ts index 20800593eea3..c9fd4f0ecef2 100644 --- a/clients/client-timestream-write/runtimeConfig.native.ts +++ b/clients/client-timestream-write/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TimestreamWriteClientConfig } from "./TimestreamWriteClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-timestream-write/runtimeConfig.shared.ts b/clients/client-timestream-write/runtimeConfig.shared.ts index 0a9677839d3e..5fc1f5a6964a 100644 --- a/clients/client-timestream-write/runtimeConfig.shared.ts +++ b/clients/client-timestream-write/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TimestreamWriteClientConfig } from "./TimestreamWriteClient"; @@ -9,9 +8,9 @@ import { TimestreamWriteClientConfig } from "./TimestreamWriteClient"; */ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => ({ apiVersion: "2018-11-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Timestream Write"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Timestream Write", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-timestream-write/runtimeConfig.ts b/clients/client-timestream-write/runtimeConfig.ts index c935344cb349..e81e92431330 100644 --- a/clients/client-timestream-write/runtimeConfig.ts +++ b/clients/client-timestream-write/runtimeConfig.ts @@ -8,7 +8,6 @@ import { NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS } from "@aws-sdk/middleware-endp import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -24,28 +23,23 @@ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - endpointDiscoveryEnabledProvider: coalesce( - config.endpointDiscoveryEnabledProvider, - loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + endpointDiscoveryEnabledProvider: + config.endpointDiscoveryEnabledProvider ?? loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-transcribe-streaming/runtimeConfig.browser.ts b/clients/client-transcribe-streaming/runtimeConfig.browser.ts index 81e2c09d1e33..7c23ad59edfa 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.browser.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.browser.ts @@ -6,7 +6,6 @@ import { streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { WebSocketHandler, eventStreamPayloadHandler } from "@aws-sdk/middleware-sdk-transcribe-streaming"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -22,29 +21,23 @@ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamPayloadHandlerProvider: coalesce( - config.eventStreamPayloadHandlerProvider, - () => eventStreamPayloadHandler - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new WebSocketHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamPayloadHandlerProvider: config.eventStreamPayloadHandlerProvider ?? (() => eventStreamPayloadHandler), + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new WebSocketHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-transcribe-streaming/runtimeConfig.native.ts b/clients/client-transcribe-streaming/runtimeConfig.native.ts index f23d625d6f8b..fbca279ab002 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.native.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.native.ts @@ -1,6 +1,5 @@ import { Sha256 } from "@aws-crypto/sha256-js"; import { WebSocketHandler, eventStreamPayloadHandler } from "@aws-sdk/middleware-sdk-transcribe-streaming"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TranscribeStreamingClientConfig } from "./TranscribeStreamingClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -12,11 +11,8 @@ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { return { ...browserDefaults, runtime: "react-native", - eventStreamPayloadHandlerProvider: coalesce( - config.eventStreamPayloadHandlerProvider, - () => eventStreamPayloadHandler - ), - requestHandler: coalesce(config.requestHandler, new WebSocketHandler()), - sha256: coalesce(config.sha256, Sha256), + eventStreamPayloadHandlerProvider: config.eventStreamPayloadHandlerProvider ?? (() => eventStreamPayloadHandler), + requestHandler: config.requestHandler ?? new WebSocketHandler(), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-transcribe-streaming/runtimeConfig.shared.ts b/clients/client-transcribe-streaming/runtimeConfig.shared.ts index 8c7110d1f876..7f210dd95861 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.shared.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TranscribeStreamingClientConfig } from "./TranscribeStreamingClient"; @@ -9,9 +8,9 @@ import { TranscribeStreamingClientConfig } from "./TranscribeStreamingClient"; */ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => ({ apiVersion: "2017-10-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Transcribe Streaming"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Transcribe Streaming", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-transcribe-streaming/runtimeConfig.ts b/clients/client-transcribe-streaming/runtimeConfig.ts index 393cf487309d..65f9786befca 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.ts @@ -9,7 +9,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttp2Handler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -25,29 +24,23 @@ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - eventStreamPayloadHandlerProvider: coalesce( - config.eventStreamPayloadHandlerProvider, - eventStreamPayloadHandlerProvider - ), - eventStreamSerdeProvider: coalesce(config.eventStreamSerdeProvider, eventStreamSerdeProvider), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttp2Handler({ disableConcurrentStreams: true })), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + eventStreamPayloadHandlerProvider: config.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider, + eventStreamSerdeProvider: config.eventStreamSerdeProvider ?? eventStreamSerdeProvider, + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttp2Handler({ disableConcurrentStreams: true }), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-transcribe/runtimeConfig.browser.ts b/clients/client-transcribe/runtimeConfig.browser.ts index d3f706bb4924..d8a590fbbdbe 100644 --- a/clients/client-transcribe/runtimeConfig.browser.ts +++ b/clients/client-transcribe/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: TranscribeClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-transcribe/runtimeConfig.native.ts b/clients/client-transcribe/runtimeConfig.native.ts index d4fde6829f2b..09e552977d4e 100644 --- a/clients/client-transcribe/runtimeConfig.native.ts +++ b/clients/client-transcribe/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TranscribeClientConfig } from "./TranscribeClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: TranscribeClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-transcribe/runtimeConfig.shared.ts b/clients/client-transcribe/runtimeConfig.shared.ts index 5526af727829..14f75f01a029 100644 --- a/clients/client-transcribe/runtimeConfig.shared.ts +++ b/clients/client-transcribe/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TranscribeClientConfig } from "./TranscribeClient"; @@ -9,9 +8,9 @@ import { TranscribeClientConfig } from "./TranscribeClient"; */ export const getRuntimeConfig = (config: TranscribeClientConfig) => ({ apiVersion: "2017-10-26", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Transcribe"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Transcribe", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-transcribe/runtimeConfig.ts b/clients/client-transcribe/runtimeConfig.ts index 655db52b9eab..80f34e9467fa 100644 --- a/clients/client-transcribe/runtimeConfig.ts +++ b/clients/client-transcribe/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: TranscribeClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-transfer/runtimeConfig.browser.ts b/clients/client-transfer/runtimeConfig.browser.ts index 21871088e47a..ff090c6a6c62 100644 --- a/clients/client-transfer/runtimeConfig.browser.ts +++ b/clients/client-transfer/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: TransferClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-transfer/runtimeConfig.native.ts b/clients/client-transfer/runtimeConfig.native.ts index 5262e3c42aa7..998720b189aa 100644 --- a/clients/client-transfer/runtimeConfig.native.ts +++ b/clients/client-transfer/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TransferClientConfig } from "./TransferClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: TransferClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-transfer/runtimeConfig.shared.ts b/clients/client-transfer/runtimeConfig.shared.ts index d736fdbddfe0..81f21593a83b 100644 --- a/clients/client-transfer/runtimeConfig.shared.ts +++ b/clients/client-transfer/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TransferClientConfig } from "./TransferClient"; @@ -9,9 +8,9 @@ import { TransferClientConfig } from "./TransferClient"; */ export const getRuntimeConfig = (config: TransferClientConfig) => ({ apiVersion: "2018-11-05", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Transfer"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Transfer", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-transfer/runtimeConfig.ts b/clients/client-transfer/runtimeConfig.ts index 9478e7b53fa2..088ec05b468a 100644 --- a/clients/client-transfer/runtimeConfig.ts +++ b/clients/client-transfer/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: TransferClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-translate/runtimeConfig.browser.ts b/clients/client-translate/runtimeConfig.browser.ts index 831f83e11288..f5d9de40c6c0 100644 --- a/clients/client-translate/runtimeConfig.browser.ts +++ b/clients/client-translate/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: TranslateClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-translate/runtimeConfig.native.ts b/clients/client-translate/runtimeConfig.native.ts index 3000fdd06a9f..d9e89d5b7b8b 100644 --- a/clients/client-translate/runtimeConfig.native.ts +++ b/clients/client-translate/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { TranslateClientConfig } from "./TranslateClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: TranslateClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-translate/runtimeConfig.shared.ts b/clients/client-translate/runtimeConfig.shared.ts index 665409ef182b..84193d8988d5 100644 --- a/clients/client-translate/runtimeConfig.shared.ts +++ b/clients/client-translate/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { TranslateClientConfig } from "./TranslateClient"; @@ -9,9 +8,9 @@ import { TranslateClientConfig } from "./TranslateClient"; */ export const getRuntimeConfig = (config: TranslateClientConfig) => ({ apiVersion: "2017-07-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Translate"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Translate", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-translate/runtimeConfig.ts b/clients/client-translate/runtimeConfig.ts index d8a93a892334..5aa2f463abf6 100644 --- a/clients/client-translate/runtimeConfig.ts +++ b/clients/client-translate/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: TranslateClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-waf-regional/runtimeConfig.browser.ts b/clients/client-waf-regional/runtimeConfig.browser.ts index 20ff9e8f7c46..72d9eae09ed1 100644 --- a/clients/client-waf-regional/runtimeConfig.browser.ts +++ b/clients/client-waf-regional/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-waf-regional/runtimeConfig.native.ts b/clients/client-waf-regional/runtimeConfig.native.ts index 75f51487e71e..57fab14d953c 100644 --- a/clients/client-waf-regional/runtimeConfig.native.ts +++ b/clients/client-waf-regional/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WAFRegionalClientConfig } from "./WAFRegionalClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-waf-regional/runtimeConfig.shared.ts b/clients/client-waf-regional/runtimeConfig.shared.ts index 435f962d3fdf..73afd7903ca3 100644 --- a/clients/client-waf-regional/runtimeConfig.shared.ts +++ b/clients/client-waf-regional/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WAFRegionalClientConfig } from "./WAFRegionalClient"; @@ -9,9 +8,9 @@ import { WAFRegionalClientConfig } from "./WAFRegionalClient"; */ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WAF Regional"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WAF Regional", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-waf-regional/runtimeConfig.ts b/clients/client-waf-regional/runtimeConfig.ts index 8b568f175109..49624837c050 100644 --- a/clients/client-waf-regional/runtimeConfig.ts +++ b/clients/client-waf-regional/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-waf/runtimeConfig.browser.ts b/clients/client-waf/runtimeConfig.browser.ts index 3e977bd97de9..762a454a54d8 100644 --- a/clients/client-waf/runtimeConfig.browser.ts +++ b/clients/client-waf/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WAFClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-waf/runtimeConfig.native.ts b/clients/client-waf/runtimeConfig.native.ts index 8067dbeff294..fa8c97dc6e38 100644 --- a/clients/client-waf/runtimeConfig.native.ts +++ b/clients/client-waf/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WAFClientConfig } from "./WAFClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WAFClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-waf/runtimeConfig.shared.ts b/clients/client-waf/runtimeConfig.shared.ts index 666c095ad793..4b68edfd526c 100644 --- a/clients/client-waf/runtimeConfig.shared.ts +++ b/clients/client-waf/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WAFClientConfig } from "./WAFClient"; @@ -9,9 +8,9 @@ import { WAFClientConfig } from "./WAFClient"; */ export const getRuntimeConfig = (config: WAFClientConfig) => ({ apiVersion: "2015-08-24", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WAF"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WAF", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-waf/runtimeConfig.ts b/clients/client-waf/runtimeConfig.ts index 6e88163458e9..b33b1d713ce2 100644 --- a/clients/client-waf/runtimeConfig.ts +++ b/clients/client-waf/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WAFClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-wafv2/runtimeConfig.browser.ts b/clients/client-wafv2/runtimeConfig.browser.ts index 8fafd5563714..df3b0dc232d0 100644 --- a/clients/client-wafv2/runtimeConfig.browser.ts +++ b/clients/client-wafv2/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WAFV2ClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-wafv2/runtimeConfig.native.ts b/clients/client-wafv2/runtimeConfig.native.ts index 86c51fd783bd..2f4a6cdb182d 100644 --- a/clients/client-wafv2/runtimeConfig.native.ts +++ b/clients/client-wafv2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WAFV2ClientConfig } from "./WAFV2Client"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WAFV2ClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-wafv2/runtimeConfig.shared.ts b/clients/client-wafv2/runtimeConfig.shared.ts index c919ba5d2e24..bf895f24b387 100644 --- a/clients/client-wafv2/runtimeConfig.shared.ts +++ b/clients/client-wafv2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WAFV2ClientConfig } from "./WAFV2Client"; @@ -9,9 +8,9 @@ import { WAFV2ClientConfig } from "./WAFV2Client"; */ export const getRuntimeConfig = (config: WAFV2ClientConfig) => ({ apiVersion: "2019-07-29", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WAFV2"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WAFV2", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-wafv2/runtimeConfig.ts b/clients/client-wafv2/runtimeConfig.ts index 666dcb9e9026..3baa535aa9b1 100644 --- a/clients/client-wafv2/runtimeConfig.ts +++ b/clients/client-wafv2/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WAFV2ClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-wellarchitected/runtimeConfig.browser.ts b/clients/client-wellarchitected/runtimeConfig.browser.ts index 41c548e4195a..0e550520c5d7 100644 --- a/clients/client-wellarchitected/runtimeConfig.browser.ts +++ b/clients/client-wellarchitected/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-wellarchitected/runtimeConfig.native.ts b/clients/client-wellarchitected/runtimeConfig.native.ts index fe7fa9d41a6a..90eb74678793 100644 --- a/clients/client-wellarchitected/runtimeConfig.native.ts +++ b/clients/client-wellarchitected/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WellArchitectedClientConfig } from "./WellArchitectedClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-wellarchitected/runtimeConfig.shared.ts b/clients/client-wellarchitected/runtimeConfig.shared.ts index d3fafac440cf..e76acfdeeb88 100644 --- a/clients/client-wellarchitected/runtimeConfig.shared.ts +++ b/clients/client-wellarchitected/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WellArchitectedClientConfig } from "./WellArchitectedClient"; @@ -9,9 +8,9 @@ import { WellArchitectedClientConfig } from "./WellArchitectedClient"; */ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => ({ apiVersion: "2020-03-31", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WellArchitected"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WellArchitected", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-wellarchitected/runtimeConfig.ts b/clients/client-wellarchitected/runtimeConfig.ts index 7474155cd9ad..c287bba64998 100644 --- a/clients/client-wellarchitected/runtimeConfig.ts +++ b/clients/client-wellarchitected/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workdocs/runtimeConfig.browser.ts b/clients/client-workdocs/runtimeConfig.browser.ts index 78b9167a0201..3a92cce4795a 100644 --- a/clients/client-workdocs/runtimeConfig.browser.ts +++ b/clients/client-workdocs/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WorkDocsClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workdocs/runtimeConfig.native.ts b/clients/client-workdocs/runtimeConfig.native.ts index cb415fef94ae..8fd81cd63cd5 100644 --- a/clients/client-workdocs/runtimeConfig.native.ts +++ b/clients/client-workdocs/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WorkDocsClientConfig } from "./WorkDocsClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WorkDocsClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-workdocs/runtimeConfig.shared.ts b/clients/client-workdocs/runtimeConfig.shared.ts index 7f963d040b92..0e5273436ed9 100644 --- a/clients/client-workdocs/runtimeConfig.shared.ts +++ b/clients/client-workdocs/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WorkDocsClientConfig } from "./WorkDocsClient"; @@ -9,9 +8,9 @@ import { WorkDocsClientConfig } from "./WorkDocsClient"; */ export const getRuntimeConfig = (config: WorkDocsClientConfig) => ({ apiVersion: "2016-05-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WorkDocs"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WorkDocs", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-workdocs/runtimeConfig.ts b/clients/client-workdocs/runtimeConfig.ts index edd73435c1d5..f5b5baf3f3f6 100644 --- a/clients/client-workdocs/runtimeConfig.ts +++ b/clients/client-workdocs/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WorkDocsClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-worklink/runtimeConfig.browser.ts b/clients/client-worklink/runtimeConfig.browser.ts index f9610014752c..7bec8729fc9a 100644 --- a/clients/client-worklink/runtimeConfig.browser.ts +++ b/clients/client-worklink/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WorkLinkClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-worklink/runtimeConfig.native.ts b/clients/client-worklink/runtimeConfig.native.ts index 456492b61b64..190eac1bbc63 100644 --- a/clients/client-worklink/runtimeConfig.native.ts +++ b/clients/client-worklink/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WorkLinkClientConfig } from "./WorkLinkClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WorkLinkClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-worklink/runtimeConfig.shared.ts b/clients/client-worklink/runtimeConfig.shared.ts index 4a63088482c1..ef47be7e3d06 100644 --- a/clients/client-worklink/runtimeConfig.shared.ts +++ b/clients/client-worklink/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WorkLinkClientConfig } from "./WorkLinkClient"; @@ -9,9 +8,9 @@ import { WorkLinkClientConfig } from "./WorkLinkClient"; */ export const getRuntimeConfig = (config: WorkLinkClientConfig) => ({ apiVersion: "2018-09-25", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WorkLink"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WorkLink", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-worklink/runtimeConfig.ts b/clients/client-worklink/runtimeConfig.ts index 876372d6c77b..435144d99655 100644 --- a/clients/client-worklink/runtimeConfig.ts +++ b/clients/client-worklink/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WorkLinkClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workmail/runtimeConfig.browser.ts b/clients/client-workmail/runtimeConfig.browser.ts index dae1040ee6fd..a23b63e38cab 100644 --- a/clients/client-workmail/runtimeConfig.browser.ts +++ b/clients/client-workmail/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WorkMailClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workmail/runtimeConfig.native.ts b/clients/client-workmail/runtimeConfig.native.ts index 85ca4e5c72e4..d055816d988c 100644 --- a/clients/client-workmail/runtimeConfig.native.ts +++ b/clients/client-workmail/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WorkMailClientConfig } from "./WorkMailClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WorkMailClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-workmail/runtimeConfig.shared.ts b/clients/client-workmail/runtimeConfig.shared.ts index cc8baefeae03..6225607d715f 100644 --- a/clients/client-workmail/runtimeConfig.shared.ts +++ b/clients/client-workmail/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WorkMailClientConfig } from "./WorkMailClient"; @@ -9,9 +8,9 @@ import { WorkMailClientConfig } from "./WorkMailClient"; */ export const getRuntimeConfig = (config: WorkMailClientConfig) => ({ apiVersion: "2017-10-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WorkMail"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WorkMail", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-workmail/runtimeConfig.ts b/clients/client-workmail/runtimeConfig.ts index 65ca0e7616d9..3d550c3e6d55 100644 --- a/clients/client-workmail/runtimeConfig.ts +++ b/clients/client-workmail/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WorkMailClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workmailmessageflow/runtimeConfig.browser.ts b/clients/client-workmailmessageflow/runtimeConfig.browser.ts index fbf455b7f1e9..82d3a1cd3f34 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.browser.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workmailmessageflow/runtimeConfig.native.ts b/clients/client-workmailmessageflow/runtimeConfig.native.ts index dd18da03ced8..0a95c5bc8fa1 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.native.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-workmailmessageflow/runtimeConfig.shared.ts b/clients/client-workmailmessageflow/runtimeConfig.shared.ts index c07187a5594e..afd6df75ff59 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.shared.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; @@ -9,9 +8,9 @@ import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; */ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => ({ apiVersion: "2019-05-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WorkMailMessageFlow"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WorkMailMessageFlow", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-workmailmessageflow/runtimeConfig.ts b/clients/client-workmailmessageflow/runtimeConfig.ts index 9b94c9027ad2..84de55eb4862 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workspaces/runtimeConfig.browser.ts b/clients/client-workspaces/runtimeConfig.browser.ts index 7932c62aa844..f218ec877cfb 100644 --- a/clients/client-workspaces/runtimeConfig.browser.ts +++ b/clients/client-workspaces/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-workspaces/runtimeConfig.native.ts b/clients/client-workspaces/runtimeConfig.native.ts index 8f7a3d0afb66..1fb7f78c6a3e 100644 --- a/clients/client-workspaces/runtimeConfig.native.ts +++ b/clients/client-workspaces/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { WorkSpacesClientConfig } from "./WorkSpacesClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-workspaces/runtimeConfig.shared.ts b/clients/client-workspaces/runtimeConfig.shared.ts index 69f67b1e144e..920fabf5eaea 100644 --- a/clients/client-workspaces/runtimeConfig.shared.ts +++ b/clients/client-workspaces/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { WorkSpacesClientConfig } from "./WorkSpacesClient"; @@ -9,9 +8,9 @@ import { WorkSpacesClientConfig } from "./WorkSpacesClient"; */ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => ({ apiVersion: "2015-04-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "WorkSpaces"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "WorkSpaces", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-workspaces/runtimeConfig.ts b/clients/client-workspaces/runtimeConfig.ts index 4ae8cc7c1ca4..1dec89ee7108 100644 --- a/clients/client-workspaces/runtimeConfig.ts +++ b/clients/client-workspaces/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-xray/runtimeConfig.browser.ts b/clients/client-xray/runtimeConfig.browser.ts index c714f84eb8a6..8cbf5640d875 100644 --- a/clients/client-xray/runtimeConfig.browser.ts +++ b/clients/client-xray/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: XRayClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/clients/client-xray/runtimeConfig.native.ts b/clients/client-xray/runtimeConfig.native.ts index e84fedd14c95..18fff60e860f 100644 --- a/clients/client-xray/runtimeConfig.native.ts +++ b/clients/client-xray/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { XRayClientConfig } from "./XRayClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: XRayClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/clients/client-xray/runtimeConfig.shared.ts b/clients/client-xray/runtimeConfig.shared.ts index 3dd54b561127..4bba2bbb8952 100644 --- a/clients/client-xray/runtimeConfig.shared.ts +++ b/clients/client-xray/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { XRayClientConfig } from "./XRayClient"; @@ -9,9 +8,9 @@ import { XRayClientConfig } from "./XRayClient"; */ export const getRuntimeConfig = (config: XRayClientConfig) => ({ apiVersion: "2016-04-12", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "XRay"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "XRay", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/clients/client-xray/runtimeConfig.ts b/clients/client-xray/runtimeConfig.ts index c4fc372102c8..708d53bc56f5 100644 --- a/clients/client-xray/runtimeConfig.ts +++ b/clients/client-xray/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: XRayClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-ec2/runtimeConfig.browser.ts b/protocol_tests/aws-ec2/runtimeConfig.browser.ts index 68da984870c0..1939fcce2074 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.browser.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.browser.ts @@ -3,7 +3,6 @@ import packageInfo from "./package.json"; import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -19,19 +18,18 @@ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-ec2/runtimeConfig.native.ts b/protocol_tests/aws-ec2/runtimeConfig.native.ts index 6b75cc64d253..f468922b2b00 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.native.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/protocol_tests/aws-ec2/runtimeConfig.shared.ts b/protocol_tests/aws-ec2/runtimeConfig.shared.ts index 096e7be6ce9d..e6edff2e1ed3 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.shared.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; @@ -9,9 +8,9 @@ import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; */ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => ({ apiVersion: "2020-01-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "EC2 Protocol"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "EC2 Protocol", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/protocol_tests/aws-ec2/runtimeConfig.ts b/protocol_tests/aws-ec2/runtimeConfig.ts index 7024dff3ee08..5d8b2cdf772e 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.ts @@ -4,7 +4,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -20,19 +19,18 @@ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-json/runtimeConfig.browser.ts b/protocol_tests/aws-json/runtimeConfig.browser.ts index b9b10c500e0e..11ed8d938354 100644 --- a/protocol_tests/aws-json/runtimeConfig.browser.ts +++ b/protocol_tests/aws-json/runtimeConfig.browser.ts @@ -4,7 +4,6 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -20,24 +19,21 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - (_: unknown) => () => Promise.reject(new Error("Credential is missing")) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - region: coalesce(config.region, invalidProvider("Region is missing")), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + region: config.region ?? invalidProvider("Region is missing"), + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-json/runtimeConfig.native.ts b/protocol_tests/aws-json/runtimeConfig.native.ts index 8dc3fe2581ca..16b874f11e45 100644 --- a/protocol_tests/aws-json/runtimeConfig.native.ts +++ b/protocol_tests/aws-json/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { JsonProtocolClientConfig } from "./JsonProtocolClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/protocol_tests/aws-json/runtimeConfig.shared.ts b/protocol_tests/aws-json/runtimeConfig.shared.ts index 43f6dea5e272..273795b696f9 100644 --- a/protocol_tests/aws-json/runtimeConfig.shared.ts +++ b/protocol_tests/aws-json/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { JsonProtocolClientConfig } from "./JsonProtocolClient"; @@ -9,9 +8,9 @@ import { JsonProtocolClientConfig } from "./JsonProtocolClient"; */ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => ({ apiVersion: "2018-01-01", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Json Protocol"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Json Protocol", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/protocol_tests/aws-json/runtimeConfig.ts b/protocol_tests/aws-json/runtimeConfig.ts index 0e5503c96920..05554aad747e 100644 --- a/protocol_tests/aws-json/runtimeConfig.ts +++ b/protocol_tests/aws-json/runtimeConfig.ts @@ -7,7 +7,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -23,24 +22,21 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - credentialDefaultProvider: coalesce( - config.credentialDefaultProvider, - decorateDefaultCredentialProvider(credentialDefaultProvider) - ), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + credentialDefaultProvider: + config.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-query/runtimeConfig.browser.ts b/protocol_tests/aws-query/runtimeConfig.browser.ts index 2f471aea3d60..a326d696cc73 100644 --- a/protocol_tests/aws-query/runtimeConfig.browser.ts +++ b/protocol_tests/aws-query/runtimeConfig.browser.ts @@ -3,7 +3,6 @@ import packageInfo from "./package.json"; import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -19,19 +18,18 @@ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-query/runtimeConfig.native.ts b/protocol_tests/aws-query/runtimeConfig.native.ts index eb320f28d338..3eae6cafc0a2 100644 --- a/protocol_tests/aws-query/runtimeConfig.native.ts +++ b/protocol_tests/aws-query/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { QueryProtocolClientConfig } from "./QueryProtocolClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/protocol_tests/aws-query/runtimeConfig.shared.ts b/protocol_tests/aws-query/runtimeConfig.shared.ts index b29dc2a02d2d..86ac2fe07c66 100644 --- a/protocol_tests/aws-query/runtimeConfig.shared.ts +++ b/protocol_tests/aws-query/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { QueryProtocolClientConfig } from "./QueryProtocolClient"; @@ -9,9 +8,9 @@ import { QueryProtocolClientConfig } from "./QueryProtocolClient"; */ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => ({ apiVersion: "2020-01-08", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Query Protocol"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Query Protocol", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/protocol_tests/aws-query/runtimeConfig.ts b/protocol_tests/aws-query/runtimeConfig.ts index 78890da3c2fc..c31339d4e4f8 100644 --- a/protocol_tests/aws-query/runtimeConfig.ts +++ b/protocol_tests/aws-query/runtimeConfig.ts @@ -4,7 +4,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -20,19 +19,18 @@ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-restjson/runtimeConfig.browser.ts b/protocol_tests/aws-restjson/runtimeConfig.browser.ts index b99a9b674149..3c78225503de 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.browser.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.browser.ts @@ -3,7 +3,6 @@ import packageInfo from "./package.json"; import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -19,19 +18,18 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-restjson/runtimeConfig.native.ts b/protocol_tests/aws-restjson/runtimeConfig.native.ts index 978c64237b94..6bd6635f2547 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.native.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/protocol_tests/aws-restjson/runtimeConfig.shared.ts b/protocol_tests/aws-restjson/runtimeConfig.shared.ts index 9f0ad3a7fef5..98d03051adb9 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.shared.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; @@ -9,9 +8,9 @@ import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; */ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => ({ apiVersion: "2019-12-16", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Rest Json Protocol"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Rest Json Protocol", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/protocol_tests/aws-restjson/runtimeConfig.ts b/protocol_tests/aws-restjson/runtimeConfig.ts index 5e285bcb061d..3c82965fc08e 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.ts @@ -4,7 +4,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -20,19 +19,18 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-restxml/runtimeConfig.browser.ts b/protocol_tests/aws-restxml/runtimeConfig.browser.ts index 49803e04c297..ff3ee52ad04e 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.browser.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.browser.ts @@ -3,7 +3,6 @@ import packageInfo from "./package.json"; import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; @@ -19,19 +18,18 @@ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { return { ...clientSharedValues, runtime: "browser", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), - requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), - sha256: coalesce(config.sha256, Sha256), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, + requestHandler: config.requestHandler ?? new FetchHttpHandler(), + retryModeProvider: config.retryModeProvider ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: config.sha256 ?? Sha256, + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; }; diff --git a/protocol_tests/aws-restxml/runtimeConfig.native.ts b/protocol_tests/aws-restxml/runtimeConfig.native.ts index 8572900c816c..cb50ba51bcb8 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.native.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.native.ts @@ -1,5 +1,4 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; @@ -11,6 +10,6 @@ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { return { ...browserDefaults, runtime: "react-native", - sha256: coalesce(config.sha256, Sha256), + sha256: config.sha256 ?? Sha256, }; }; diff --git a/protocol_tests/aws-restxml/runtimeConfig.shared.ts b/protocol_tests/aws-restxml/runtimeConfig.shared.ts index 66a4b4725f53..d3d1efaee5ac 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.shared.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.shared.ts @@ -1,5 +1,4 @@ import { defaultRegionInfoProvider } from "./endpoints"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { Logger as __Logger } from "@aws-sdk/types"; import { parseUrl } from "@aws-sdk/url-parser"; import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; @@ -9,9 +8,9 @@ import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; */ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => ({ apiVersion: "2019-12-16", - disableHostPrefix: coalesce(config.disableHostPrefix, false), - logger: coalesce(config.logger, {} as __Logger), - regionInfoProvider: coalesce(config.regionInfoProvider, defaultRegionInfoProvider), - serviceId: coalesce(config.serviceId, "Rest Xml Protocol"), - urlParser: coalesce(config.urlParser, parseUrl), + disableHostPrefix: config.disableHostPrefix ?? false, + logger: config.logger ?? ({} as __Logger), + regionInfoProvider: config.regionInfoProvider ?? defaultRegionInfoProvider, + serviceId: config.serviceId ?? "Rest Xml Protocol", + urlParser: config.urlParser ?? parseUrl, }); diff --git a/protocol_tests/aws-restxml/runtimeConfig.ts b/protocol_tests/aws-restxml/runtimeConfig.ts index 3206b7e4092f..4c4f87baff9a 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.ts @@ -4,7 +4,6 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; -import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; @@ -20,19 +19,18 @@ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { return { ...clientSharedValues, runtime: "node", - base64Decoder: coalesce(config.base64Decoder, fromBase64), - base64Encoder: coalesce(config.base64Encoder, toBase64), - bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), - defaultUserAgentProvider: coalesce( - config.defaultUserAgentProvider, - defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) - ), - maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), - requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), - retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), - sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), - streamCollector: coalesce(config.streamCollector, streamCollector), - utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), - utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + base64Decoder: config.base64Decoder ?? fromBase64, + base64Encoder: config.base64Encoder ?? toBase64, + bodyLengthChecker: config.bodyLengthChecker ?? calculateBodyLength, + defaultUserAgentProvider: + config.defaultUserAgentProvider ?? + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), + maxAttempts: config.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + requestHandler: config.requestHandler ?? new NodeHttpHandler(), + retryModeProvider: config.retryModeProvider ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), + sha256: config.sha256 ?? Hash.bind(null, "sha256"), + streamCollector: config.streamCollector ?? streamCollector, + utf8Decoder: config.utf8Decoder ?? fromUtf8, + utf8Encoder: config.utf8Encoder ?? toUtf8, }; };