From 04d90d4ece6a795015d9ccaaa5c7e9481c295ed4 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Mon, 12 Jul 2021 22:53:30 +0000 Subject: [PATCH 1/6] chore: update codegen to make runtime config functional --- .../aws/typescript/codegen/AddAwsAuthPlugin.java | 9 +++------ .../aws/typescript/codegen/AddAwsRuntimeConfig.java | 6 +++--- .../codegen/AddBodyChecksumGeneratorDependency.java | 4 ++-- .../aws/typescript/codegen/AddClientRuntimeConfig.java | 10 +++++----- .../typescript/codegen/AddEndpointDiscoveryPlugin.java | 5 ++--- .../codegen/AddEventStreamHandlingDependency.java | 6 +++--- .../aws/typescript/codegen/AddHttp2Dependency.java | 2 +- .../smithy/aws/typescript/codegen/AddS3Config.java | 6 +++--- .../aws/typescript/codegen/AddSqsDependency.java | 4 ++-- .../codegen/AddTranscribeStreamingDependency.java | 6 +++--- .../aws/typescript/codegen/AddUserAgentDependency.java | 6 +++--- .../codegen/AwsEndpointGeneratorIntegration.java | 2 +- packages/smithy-client/src/index.ts | 1 + packages/smithy-client/src/nullish-coalescing.ts | 7 +++++++ 14 files changed, 39 insertions(+), 35 deletions(-) create mode 100644 packages/smithy-client/src/nullish-coalescing.ts diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java index 59171c15217f..69f22c4e0af3 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java @@ -161,15 +161,13 @@ public Map> getRuntimeConfigWriters( String signingService = service.getTrait(SigV4Trait.class).get().getName(); return MapUtils.of( "signingName", writer -> { - writer.write("signingName: $S,", signingService); + writer.write("$S", signingService); } ); case BROWSER: return MapUtils.of( "credentialDefaultProvider", writer -> { - writer.write( - "credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error(" - + "\"Credential is missing\")),"); + writer.write("((_: unknown) => () => Promise.reject(new Error(\"Credential is missing\")))"); } ); case NODE: @@ -186,8 +184,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(AwsDependency.CREDENTIAL_PROVIDER_NODE); writer.addImport("defaultProvider", "credentialDefaultProvider", AwsDependency.CREDENTIAL_PROVIDER_NODE.packageName); - writer.write("credentialDefaultProvider: decorateDefaultCredentialProvider(" - + "credentialDefaultProvider),"); + writer.write("decorateDefaultCredentialProvider(credentialDefaultProvider)"); } ); default: diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfig.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfig.java index 7cb7a0d0273d..02a87f5645ff 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfig.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfig.java @@ -103,7 +103,7 @@ public Map> getRuntimeConfigWriters( .orElse(null); if (serviceId != null) { runtimeConfigs.put("serviceId", writer -> { - writer.write("serviceId: $S,", serviceId); + writer.write("$S", serviceId); }); } else { LOGGER.info("Cannot generate a serivce ID for the client because no aws.api#Service " @@ -128,7 +128,7 @@ private Map> getDefaultConfig( writer.addDependency(TypeScriptDependency.INVALID_DEPENDENCY); writer.addImport("invalidProvider", "invalidProvider", TypeScriptDependency.INVALID_DEPENDENCY.packageName); - writer.write("region: invalidProvider(\"Region is missing\"),"); + writer.write("invalidProvider(\"Region is missing\")"); }); case NODE: return MapUtils.of("region", writer -> { @@ -141,7 +141,7 @@ private Map> getDefaultConfig( writer.addImport("NODE_REGION_CONFIG_FILE_OPTIONS", "NODE_REGION_CONFIG_FILE_OPTIONS", TypeScriptDependency.CONFIG_RESOLVER.packageName); writer.write( - "region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),"); + "loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)"); }); default: return Collections.emptyMap(); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddBodyChecksumGeneratorDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddBodyChecksumGeneratorDependency.java index 7a15762a5298..4fa386c2ab9a 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddBodyChecksumGeneratorDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddBodyChecksumGeneratorDependency.java @@ -72,14 +72,14 @@ public Map> getRuntimeConfigWriters( writer.addDependency(AwsDependency.BODY_CHECKSUM_GENERATOR_NODE); writer.addImport("bodyChecksumGenerator", "bodyChecksumGenerator", AwsDependency.BODY_CHECKSUM_GENERATOR_NODE.packageName); - writer.write("bodyChecksumGenerator,"); + writer.write("bodyChecksumGenerator"); }); case BROWSER: return MapUtils.of("bodyChecksumGenerator", writer -> { writer.addDependency(AwsDependency.BODY_CHECKSUM_GENERATOR_BROWSER); writer.addImport("bodyChecksumGenerator", "bodyChecksumGenerator", AwsDependency.BODY_CHECKSUM_GENERATOR_BROWSER.packageName); - writer.write("bodyChecksumGenerator,"); + writer.write("bodyChecksumGenerator"); }); default: return Collections.emptyMap(); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddClientRuntimeConfig.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddClientRuntimeConfig.java index 4b7c648dd540..b0254f0ab363 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddClientRuntimeConfig.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddClientRuntimeConfig.java @@ -91,7 +91,7 @@ public Map> getRuntimeConfigWriters( return MapUtils.of( "logger", writer -> { writer.addImport("Logger", "__Logger", TypeScriptDependency.AWS_SDK_TYPES.packageName); - writer.write("logger: {} as __Logger,"); + writer.write("{} as __Logger"); } ); case BROWSER: @@ -100,13 +100,13 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.MIDDLEWARE_RETRY); writer.addImport("DEFAULT_MAX_ATTEMPTS", "DEFAULT_MAX_ATTEMPTS", TypeScriptDependency.MIDDLEWARE_RETRY.packageName); - writer.write("maxAttempts: DEFAULT_MAX_ATTEMPTS,"); + writer.write("DEFAULT_MAX_ATTEMPTS"); }, "retryModeProvider", writer -> { writer.addDependency(TypeScriptDependency.MIDDLEWARE_RETRY); writer.addImport("DEFAULT_RETRY_MODE", "DEFAULT_RETRY_MODE", TypeScriptDependency.MIDDLEWARE_RETRY.packageName); - writer.write("retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE),"); + writer.write("(() => Promise.resolve(DEFAULT_RETRY_MODE))"); } ); case NODE: @@ -117,7 +117,7 @@ public Map> getRuntimeConfigWriters( AwsDependency.NODE_CONFIG_PROVIDER.packageName); writer.addImport("NODE_MAX_ATTEMPT_CONFIG_OPTIONS", "NODE_MAX_ATTEMPT_CONFIG_OPTIONS", TypeScriptDependency.MIDDLEWARE_RETRY.packageName); - writer.write("maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),"); + writer.write("loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)"); }, "retryModeProvider", writer -> { writer.addDependency(AwsDependency.NODE_CONFIG_PROVIDER); @@ -126,7 +126,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.MIDDLEWARE_RETRY); writer.addImport("NODE_RETRY_MODE_CONFIG_OPTIONS", "NODE_RETRY_MODE_CONFIG_OPTIONS", TypeScriptDependency.MIDDLEWARE_RETRY.packageName); - writer.write("retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS),"); + writer.write("loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)"); } ); default: diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java index 3533b67ab3ea..0427a78ee3b1 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java @@ -108,7 +108,7 @@ public Map> getRuntimeConfigWriters( case BROWSER: return MapUtils.of( "endpointDiscoveryEnabledProvider", writer -> { - writer.write("endpointDiscoveryEnabledProvider: () => Promise.resolve(undefined),"); + writer.write("() => Promise.resolve(undefined)"); } ); case NODE: @@ -118,8 +118,7 @@ public Map> getRuntimeConfigWriters( writer.addImport("NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS", "NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS", AwsDependency.MIDDLEWARE_ENDPOINT_DISCOVERY.packageName); - writer.write("endpointDiscoveryEnabledProvider: loadNodeConfig(" - + "NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS),"); + writer.write("loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS)"); } ); default: diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java index d4e53bdc0012..8eae90d83a93 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java @@ -95,7 +95,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(AwsDependency.AWS_SDK_EVENTSTREAM_HANDLER_NODE); writer.addImport("eventStreamPayloadHandlerProvider", "eventStreamPayloadHandlerProvider", AwsDependency.AWS_SDK_EVENTSTREAM_HANDLER_NODE.packageName); - writer.write("eventStreamPayloadHandlerProvider,"); + writer.write("eventStreamPayloadHandlerProvider"); }); case BROWSER: /** @@ -107,7 +107,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.INVALID_DEPENDENCY); writer.addImport("invalidFunction", "invalidFunction", TypeScriptDependency.INVALID_DEPENDENCY.packageName); - writer.openBlock("eventStreamPayloadHandlerProvider: () => ({", "}),", () -> { + writer.openBlock("() => ({", "})", () -> { writer.write("handle: invalidFunction(\"event stream request is not supported in browser.\"),"); }); }); @@ -121,7 +121,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.INVALID_DEPENDENCY); writer.addImport("invalidFunction", "invalidFunction", TypeScriptDependency.INVALID_DEPENDENCY.packageName); - writer.openBlock("eventStreamPayloadHandlerProvider: () => ({", "}),", () -> { + writer.openBlock("() => ({", "})", () -> { writer.write("handle: invalidFunction(\"event stream request " + "is not supported in ReactNative.\"),"); }); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttp2Dependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttp2Dependency.java index 93b00c534b3c..926f1726ef0a 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttp2Dependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttp2Dependency.java @@ -49,7 +49,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.AWS_SDK_NODE_HTTP_HANDLER); writer.addImport("NodeHttp2Handler", "NodeHttp2Handler", TypeScriptDependency.AWS_SDK_NODE_HTTP_HANDLER.packageName); - writer.write("requestHandler: new NodeHttp2Handler(),"); + writer.write("new NodeHttp2Handler()"); }); default: return Collections.emptyMap(); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java index dd06e1901ca4..78901ba5f5a7 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddS3Config.java @@ -84,9 +84,9 @@ public Map> getRuntimeConfigWriters(TypeScrip switch (target) { case SHARED: return MapUtils.of("signingEscapePath", writer -> { - writer.write("signingEscapePath: false,"); + writer.write("false"); }, "useArnRegion", writer -> { - writer.write("useArnRegion: false"); + writer.write("false"); }); case NODE: return MapUtils.of("useArnRegion", writer -> { @@ -95,7 +95,7 @@ public Map> getRuntimeConfigWriters(TypeScrip .addDependency(AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE) .addImport("NODE_USE_ARN_REGION_CONFIG_OPTIONS", "NODE_USE_ARN_REGION_CONFIG_OPTIONS", AwsDependency.BUCKET_ENDPOINT_MIDDLEWARE.packageName) - .write("useArnRegion: loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS),"); + .write("loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS)"); }); default: return Collections.emptyMap(); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddSqsDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddSqsDependency.java index 3eccae37277a..1869ef881733 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddSqsDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddSqsDependency.java @@ -97,13 +97,13 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.AWS_SDK_TYPES); writer.addImport("HashConstructor", "__HashConstructor", TypeScriptDependency.AWS_SDK_TYPES.packageName); - writer.write("md5: Hash.bind(null, \"md5\"),"); + writer.write("Hash.bind(null, \"md5\")"); }); case BROWSER: return MapUtils.of("md5", writer -> { writer.addDependency(TypeScriptDependency.MD5_BROWSER); writer.addImport("Md5", "Md5", TypeScriptDependency.MD5_BROWSER.packageName); - writer.write("md5: Md5,"); + writer.write("Md5"); }); default: return Collections.emptyMap(); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java index 67d99f870d1d..d50435617f21 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java @@ -67,13 +67,13 @@ public Map> getRuntimeConfigWriters( writer.addDependency(AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE); writer.addImport("eventStreamPayloadHandler", "eventStreamPayloadHandler", AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE.packageName); - writer.write("eventStreamPayloadHandlerProvider: () => eventStreamPayloadHandler,"); + writer.write("() => eventStreamPayloadHandler"); }, "requestHandler", writer -> { writer.addDependency(AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE); writer.addImport("WebSocketHandler", "WebSocketHandler", AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE.packageName); - writer.write("requestHandler: new WebSocketHandler(),"); + writer.write("new WebSocketHandler()"); }); switch (target) { @@ -83,7 +83,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.AWS_SDK_NODE_HTTP_HANDLER); writer.addImport("NodeHttp2Handler", "NodeHttp2Handler", TypeScriptDependency.AWS_SDK_NODE_HTTP_HANDLER.packageName); - writer.write("requestHandler: new NodeHttp2Handler({ disableConcurrentStreams: true }),"); + writer.write("new NodeHttp2Handler({ disableConcurrentStreams: true })"); }); case REACT_NATIVE: case BROWSER: diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependency.java index 8bf68ba0e2d9..999d0a1d35ff 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependency.java @@ -93,9 +93,9 @@ public Map> getRuntimeConfigWriters( } private void writeDefaultUserAgentProvider(TypeScriptWriter writer, TypeScriptSettings settings, Model model) { - writer.write("defaultUserAgentProvider: defaultUserAgent({" + writer.write("defaultUserAgent({" // serviceId is optional in defaultUserAgent. serviceId exists only for AWS services - + (isAwsService(settings, model) ? "serviceId: ClientSharedValues.serviceId, " : "") - + "clientVersion: packageInfo.version}),"); + + (isAwsService(settings, model) ? "serviceId: clientSharedValues.serviceId, " : "") + + "clientVersion: packageInfo.version})"); } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEndpointGeneratorIntegration.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEndpointGeneratorIntegration.java index 5cd58c868548..30ea604ea4cc 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEndpointGeneratorIntegration.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEndpointGeneratorIntegration.java @@ -84,7 +84,7 @@ public Map> getRuntimeConfigWriters( case SHARED: return MapUtils.of("regionInfoProvider", writer -> { writer.addImport("defaultRegionInfoProvider", "defaultRegionInfoProvider", "./endpoints"); - writer.write("regionInfoProvider: defaultRegionInfoProvider,"); + writer.write("defaultRegionInfoProvider"); }); default: return Collections.emptyMap(); diff --git a/packages/smithy-client/src/index.ts b/packages/smithy-client/src/index.ts index c72b2f3e0a18..bac6e85f3f90 100644 --- a/packages/smithy-client/src/index.ts +++ b/packages/smithy-client/src/index.ts @@ -4,6 +4,7 @@ export * from "./extended-encode-uri-component"; export * from "./get-array-if-single-item"; export * from "./get-value-from-text-node"; export * from "./lazy-json"; +export * from "./nullish-coalescing"; export * from "./parse-utils"; export * from "./ser-utils"; export * from "./date-utils"; diff --git a/packages/smithy-client/src/nullish-coalescing.ts b/packages/smithy-client/src/nullish-coalescing.ts new file mode 100644 index 000000000000..4bb50a7eab60 --- /dev/null +++ b/packages/smithy-client/src/nullish-coalescing.ts @@ -0,0 +1,7 @@ +/** + * Same to nullish coalescing operator(`??`). Used to safe code size of + * JavaScript code. + * + * @internal + */ +export const nullishCoalescing = (a: T | undefined | null, b: T) => (a !== null && a !== void 0 ? a : b); From ee3735d3b3b3efc53c3983d7873c072aeb863b9e Mon Sep 17 00:00:00 2001 From: Allan Zheng Date: Mon, 12 Jul 2021 18:02:58 -0700 Subject: [PATCH 2/6] feat(clients): change runtime config from constant to functional --- .../AccessAnalyzerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-accessanalyzer/runtimeConfig.ts | 49 +++++++++------- clients/client-acm-pca/ACMPCAClient.ts | 7 +-- .../client-acm-pca/runtimeConfig.browser.ts | 49 +++++++++------- .../client-acm-pca/runtimeConfig.native.ts | 16 ++++-- .../client-acm-pca/runtimeConfig.shared.ts | 16 +++--- clients/client-acm-pca/runtimeConfig.ts | 49 +++++++++------- clients/client-acm/ACMClient.ts | 7 +-- clients/client-acm/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-acm/runtimeConfig.native.ts | 16 ++++-- clients/client-acm/runtimeConfig.shared.ts | 16 +++--- clients/client-acm/runtimeConfig.ts | 49 +++++++++------- .../AlexaForBusinessClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-amp/AmpClient.ts | 7 +-- clients/client-amp/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-amp/runtimeConfig.native.ts | 16 ++++-- clients/client-amp/runtimeConfig.shared.ts | 16 +++--- clients/client-amp/runtimeConfig.ts | 49 +++++++++------- clients/client-amplify/AmplifyClient.ts | 7 +-- .../client-amplify/runtimeConfig.browser.ts | 49 +++++++++------- .../client-amplify/runtimeConfig.native.ts | 16 ++++-- .../client-amplify/runtimeConfig.shared.ts | 16 +++--- clients/client-amplify/runtimeConfig.ts | 49 +++++++++------- .../AmplifyBackendClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-amplifybackend/runtimeConfig.ts | 49 +++++++++------- .../client-api-gateway/APIGatewayClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-api-gateway/runtimeConfig.ts | 49 +++++++++------- .../ApiGatewayManagementApiClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-apigatewayv2/ApiGatewayV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-apigatewayv2/runtimeConfig.ts | 49 +++++++++------- clients/client-app-mesh/AppMeshClient.ts | 7 +-- .../client-app-mesh/runtimeConfig.browser.ts | 49 +++++++++------- .../client-app-mesh/runtimeConfig.native.ts | 16 ++++-- .../client-app-mesh/runtimeConfig.shared.ts | 16 +++--- clients/client-app-mesh/runtimeConfig.ts | 49 +++++++++------- clients/client-appconfig/AppConfigClient.ts | 7 +-- .../client-appconfig/runtimeConfig.browser.ts | 49 +++++++++------- .../client-appconfig/runtimeConfig.native.ts | 16 ++++-- .../client-appconfig/runtimeConfig.shared.ts | 16 +++--- clients/client-appconfig/runtimeConfig.ts | 49 +++++++++------- clients/client-appflow/AppflowClient.ts | 7 +-- .../client-appflow/runtimeConfig.browser.ts | 49 +++++++++------- .../client-appflow/runtimeConfig.native.ts | 16 ++++-- .../client-appflow/runtimeConfig.shared.ts | 16 +++--- clients/client-appflow/runtimeConfig.ts | 49 +++++++++------- .../AppIntegrationsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-appintegrations/runtimeConfig.ts | 49 +++++++++------- .../ApplicationAutoScalingClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ApplicationDiscoveryServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ApplicationInsightsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ApplicationCostProfilerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-apprunner/AppRunnerClient.ts | 7 +-- .../client-apprunner/runtimeConfig.browser.ts | 49 +++++++++------- .../client-apprunner/runtimeConfig.native.ts | 16 ++++-- .../client-apprunner/runtimeConfig.shared.ts | 16 +++--- clients/client-apprunner/runtimeConfig.ts | 49 +++++++++------- clients/client-appstream/AppStreamClient.ts | 7 +-- .../client-appstream/runtimeConfig.browser.ts | 49 +++++++++------- .../client-appstream/runtimeConfig.native.ts | 16 ++++-- .../client-appstream/runtimeConfig.shared.ts | 16 +++--- clients/client-appstream/runtimeConfig.ts | 49 +++++++++------- clients/client-appsync/AppSyncClient.ts | 7 +-- .../client-appsync/runtimeConfig.browser.ts | 49 +++++++++------- .../client-appsync/runtimeConfig.native.ts | 16 ++++-- .../client-appsync/runtimeConfig.shared.ts | 16 +++--- clients/client-appsync/runtimeConfig.ts | 49 +++++++++------- clients/client-athena/AthenaClient.ts | 7 +-- .../client-athena/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-athena/runtimeConfig.native.ts | 16 ++++-- clients/client-athena/runtimeConfig.shared.ts | 16 +++--- clients/client-athena/runtimeConfig.ts | 49 +++++++++------- .../client-auditmanager/AuditManagerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-auditmanager/runtimeConfig.ts | 49 +++++++++------- .../AutoScalingPlansClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-auto-scaling/AutoScalingClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-auto-scaling/runtimeConfig.ts | 49 +++++++++------- clients/client-backup/BackupClient.ts | 7 +-- .../client-backup/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-backup/runtimeConfig.native.ts | 16 ++++-- clients/client-backup/runtimeConfig.shared.ts | 16 +++--- clients/client-backup/runtimeConfig.ts | 49 +++++++++------- clients/client-batch/BatchClient.ts | 7 +-- clients/client-batch/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-batch/runtimeConfig.native.ts | 16 ++++-- clients/client-batch/runtimeConfig.shared.ts | 16 +++--- clients/client-batch/runtimeConfig.ts | 49 +++++++++------- clients/client-braket/BraketClient.ts | 7 +-- .../client-braket/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-braket/runtimeConfig.native.ts | 16 ++++-- clients/client-braket/runtimeConfig.shared.ts | 16 +++--- clients/client-braket/runtimeConfig.ts | 49 +++++++++------- clients/client-budgets/BudgetsClient.ts | 7 +-- .../client-budgets/runtimeConfig.browser.ts | 49 +++++++++------- .../client-budgets/runtimeConfig.native.ts | 16 ++++-- .../client-budgets/runtimeConfig.shared.ts | 16 +++--- clients/client-budgets/runtimeConfig.ts | 49 +++++++++------- clients/client-chime/ChimeClient.ts | 7 +-- clients/client-chime/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-chime/runtimeConfig.native.ts | 16 ++++-- clients/client-chime/runtimeConfig.shared.ts | 16 +++--- clients/client-chime/runtimeConfig.ts | 49 +++++++++------- clients/client-cloud9/Cloud9Client.ts | 7 +-- .../client-cloud9/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-cloud9/runtimeConfig.native.ts | 16 ++++-- clients/client-cloud9/runtimeConfig.shared.ts | 16 +++--- clients/client-cloud9/runtimeConfig.ts | 49 +++++++++------- .../CloudDirectoryClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-clouddirectory/runtimeConfig.ts | 49 +++++++++------- .../CloudFormationClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-cloudformation/runtimeConfig.ts | 49 +++++++++------- clients/client-cloudfront/CloudFrontClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-cloudfront/runtimeConfig.native.ts | 16 ++++-- .../client-cloudfront/runtimeConfig.shared.ts | 16 +++--- clients/client-cloudfront/runtimeConfig.ts | 49 +++++++++------- .../client-cloudhsm-v2/CloudHSMV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-cloudhsm-v2/runtimeConfig.ts | 49 +++++++++------- clients/client-cloudhsm/CloudHSMClient.ts | 7 +-- .../client-cloudhsm/runtimeConfig.browser.ts | 49 +++++++++------- .../client-cloudhsm/runtimeConfig.native.ts | 16 ++++-- .../client-cloudhsm/runtimeConfig.shared.ts | 16 +++--- clients/client-cloudhsm/runtimeConfig.ts | 49 +++++++++------- .../CloudSearchDomainClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-cloudsearch/CloudSearchClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-cloudsearch/runtimeConfig.ts | 49 +++++++++------- clients/client-cloudtrail/CloudTrailClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-cloudtrail/runtimeConfig.native.ts | 16 ++++-- .../client-cloudtrail/runtimeConfig.shared.ts | 16 +++--- clients/client-cloudtrail/runtimeConfig.ts | 49 +++++++++------- .../CloudWatchEventsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-cloudwatch-events/runtimeConfig.ts | 49 +++++++++------- .../CloudWatchLogsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-cloudwatch-logs/runtimeConfig.ts | 49 +++++++++------- clients/client-cloudwatch/CloudWatchClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-cloudwatch/runtimeConfig.native.ts | 16 ++++-- .../client-cloudwatch/runtimeConfig.shared.ts | 16 +++--- clients/client-cloudwatch/runtimeConfig.ts | 49 +++++++++------- .../client-codeartifact/CodeartifactClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-codeartifact/runtimeConfig.ts | 49 +++++++++------- clients/client-codebuild/CodeBuildClient.ts | 7 +-- .../client-codebuild/runtimeConfig.browser.ts | 49 +++++++++------- .../client-codebuild/runtimeConfig.native.ts | 16 ++++-- .../client-codebuild/runtimeConfig.shared.ts | 16 +++--- clients/client-codebuild/runtimeConfig.ts | 49 +++++++++------- clients/client-codecommit/CodeCommitClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-codecommit/runtimeConfig.native.ts | 16 ++++-- .../client-codecommit/runtimeConfig.shared.ts | 16 +++--- clients/client-codecommit/runtimeConfig.ts | 49 +++++++++------- clients/client-codedeploy/CodeDeployClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-codedeploy/runtimeConfig.native.ts | 16 ++++-- .../client-codedeploy/runtimeConfig.shared.ts | 16 +++--- clients/client-codedeploy/runtimeConfig.ts | 49 +++++++++------- .../CodeGuruReviewerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-codeguru-reviewer/runtimeConfig.ts | 49 +++++++++------- .../CodeGuruProfilerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-codeguruprofiler/runtimeConfig.ts | 49 +++++++++------- .../client-codepipeline/CodePipelineClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-codepipeline/runtimeConfig.ts | 49 +++++++++------- .../CodeStarConnectionsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../CodestarNotificationsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-codestar/CodeStarClient.ts | 7 +-- .../client-codestar/runtimeConfig.browser.ts | 49 +++++++++------- .../client-codestar/runtimeConfig.native.ts | 16 ++++-- .../client-codestar/runtimeConfig.shared.ts | 16 +++--- clients/client-codestar/runtimeConfig.ts | 49 +++++++++------- .../CognitoIdentityProviderClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../CognitoIdentityClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-cognito-identity/runtimeConfig.ts | 49 +++++++++------- .../client-cognito-sync/CognitoSyncClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-cognito-sync/runtimeConfig.ts | 49 +++++++++------- clients/client-comprehend/ComprehendClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-comprehend/runtimeConfig.native.ts | 16 ++++-- .../client-comprehend/runtimeConfig.shared.ts | 16 +++--- clients/client-comprehend/runtimeConfig.ts | 49 +++++++++------- .../ComprehendMedicalClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-comprehendmedical/runtimeConfig.ts | 49 +++++++++------- .../ComputeOptimizerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-compute-optimizer/runtimeConfig.ts | 49 +++++++++------- .../ConfigServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-config-service/runtimeConfig.ts | 49 +++++++++------- .../ConnectContactLensClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-connect/ConnectClient.ts | 7 +-- .../client-connect/runtimeConfig.browser.ts | 49 +++++++++------- .../client-connect/runtimeConfig.native.ts | 16 ++++-- .../client-connect/runtimeConfig.shared.ts | 16 +++--- clients/client-connect/runtimeConfig.ts | 49 +++++++++------- .../ConnectParticipantClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../CostAndUsageReportServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../CostExplorerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-cost-explorer/runtimeConfig.ts | 49 +++++++++------- .../CustomerProfilesClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-customer-profiles/runtimeConfig.ts | 49 +++++++++------- .../DataPipelineClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-data-pipeline/runtimeConfig.ts | 49 +++++++++------- .../DatabaseMigrationServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-databrew/DataBrewClient.ts | 7 +-- .../client-databrew/runtimeConfig.browser.ts | 49 +++++++++------- .../client-databrew/runtimeConfig.native.ts | 16 ++++-- .../client-databrew/runtimeConfig.shared.ts | 16 +++--- clients/client-databrew/runtimeConfig.ts | 49 +++++++++------- .../client-dataexchange/DataExchangeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-dataexchange/runtimeConfig.ts | 49 +++++++++------- clients/client-datasync/DataSyncClient.ts | 7 +-- .../client-datasync/runtimeConfig.browser.ts | 49 +++++++++------- .../client-datasync/runtimeConfig.native.ts | 16 ++++-- .../client-datasync/runtimeConfig.shared.ts | 16 +++--- clients/client-datasync/runtimeConfig.ts | 49 +++++++++------- clients/client-dax/DAXClient.ts | 7 +-- clients/client-dax/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-dax/runtimeConfig.native.ts | 16 ++++-- clients/client-dax/runtimeConfig.shared.ts | 16 +++--- clients/client-dax/runtimeConfig.ts | 49 +++++++++------- clients/client-detective/DetectiveClient.ts | 7 +-- .../client-detective/runtimeConfig.browser.ts | 49 +++++++++------- .../client-detective/runtimeConfig.native.ts | 16 ++++-- .../client-detective/runtimeConfig.shared.ts | 16 +++--- clients/client-detective/runtimeConfig.ts | 49 +++++++++------- .../client-device-farm/DeviceFarmClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-device-farm/runtimeConfig.ts | 49 +++++++++------- .../client-devops-guru/DevOpsGuruClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-devops-guru/runtimeConfig.ts | 49 +++++++++------- .../DirectConnectClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-direct-connect/runtimeConfig.ts | 49 +++++++++------- .../DirectoryServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-directory-service/runtimeConfig.ts | 49 +++++++++------- clients/client-dlm/DLMClient.ts | 7 +-- clients/client-dlm/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-dlm/runtimeConfig.native.ts | 16 ++++-- clients/client-dlm/runtimeConfig.shared.ts | 16 +++--- clients/client-dlm/runtimeConfig.ts | 49 +++++++++------- clients/client-docdb/DocDBClient.ts | 7 +-- clients/client-docdb/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-docdb/runtimeConfig.native.ts | 16 ++++-- clients/client-docdb/runtimeConfig.shared.ts | 16 +++--- clients/client-docdb/runtimeConfig.ts | 49 +++++++++------- .../DynamoDBStreamsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-dynamodb-streams/runtimeConfig.ts | 49 +++++++++------- clients/client-dynamodb/DynamoDBClient.ts | 7 +-- .../client-dynamodb/runtimeConfig.browser.ts | 53 ++++++++++------- .../client-dynamodb/runtimeConfig.native.ts | 16 ++++-- .../client-dynamodb/runtimeConfig.shared.ts | 16 +++--- clients/client-dynamodb/runtimeConfig.ts | 54 +++++++++++------- clients/client-ebs/EBSClient.ts | 7 +-- clients/client-ebs/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ebs/runtimeConfig.native.ts | 16 ++++-- clients/client-ebs/runtimeConfig.shared.ts | 16 +++--- clients/client-ebs/runtimeConfig.ts | 49 +++++++++------- .../EC2InstanceConnectClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-ec2/EC2Client.ts | 7 +-- clients/client-ec2/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ec2/runtimeConfig.native.ts | 16 ++++-- clients/client-ec2/runtimeConfig.shared.ts | 16 +++--- clients/client-ec2/runtimeConfig.ts | 49 +++++++++------- clients/client-ecr-public/ECRPUBLICClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-ecr-public/runtimeConfig.native.ts | 16 ++++-- .../client-ecr-public/runtimeConfig.shared.ts | 16 +++--- clients/client-ecr-public/runtimeConfig.ts | 49 +++++++++------- clients/client-ecr/ECRClient.ts | 7 +-- clients/client-ecr/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ecr/runtimeConfig.native.ts | 16 ++++-- clients/client-ecr/runtimeConfig.shared.ts | 16 +++--- clients/client-ecr/runtimeConfig.ts | 49 +++++++++------- clients/client-ecs/ECSClient.ts | 7 +-- clients/client-ecs/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ecs/runtimeConfig.native.ts | 16 ++++-- clients/client-ecs/runtimeConfig.shared.ts | 16 +++--- clients/client-ecs/runtimeConfig.ts | 49 +++++++++------- clients/client-efs/EFSClient.ts | 7 +-- clients/client-efs/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-efs/runtimeConfig.native.ts | 16 ++++-- clients/client-efs/runtimeConfig.shared.ts | 16 +++--- clients/client-efs/runtimeConfig.ts | 49 +++++++++------- clients/client-eks/EKSClient.ts | 7 +-- clients/client-eks/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-eks/runtimeConfig.native.ts | 16 ++++-- clients/client-eks/runtimeConfig.shared.ts | 16 +++--- clients/client-eks/runtimeConfig.ts | 49 +++++++++------- .../ElasticBeanstalkClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-elastic-beanstalk/runtimeConfig.ts | 49 +++++++++------- .../ElasticInferenceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-elastic-inference/runtimeConfig.ts | 49 +++++++++------- .../ElasticLoadBalancingV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ElasticLoadBalancingClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ElasticTranscoderClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-elasticache/ElastiCacheClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-elasticache/runtimeConfig.ts | 49 +++++++++------- .../ElasticsearchServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../EMRContainersClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-emr-containers/runtimeConfig.ts | 49 +++++++++------- clients/client-emr/EMRClient.ts | 7 +-- clients/client-emr/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-emr/runtimeConfig.native.ts | 16 ++++-- clients/client-emr/runtimeConfig.shared.ts | 16 +++--- clients/client-emr/runtimeConfig.ts | 49 +++++++++------- .../client-eventbridge/EventBridgeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-eventbridge/runtimeConfig.ts | 49 +++++++++------- .../FinspaceDataClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-finspace-data/runtimeConfig.ts | 49 +++++++++------- clients/client-finspace/FinspaceClient.ts | 7 +-- .../client-finspace/runtimeConfig.browser.ts | 49 +++++++++------- .../client-finspace/runtimeConfig.native.ts | 16 ++++-- .../client-finspace/runtimeConfig.shared.ts | 16 +++--- clients/client-finspace/runtimeConfig.ts | 49 +++++++++------- clients/client-firehose/FirehoseClient.ts | 7 +-- .../client-firehose/runtimeConfig.browser.ts | 49 +++++++++------- .../client-firehose/runtimeConfig.native.ts | 16 ++++-- .../client-firehose/runtimeConfig.shared.ts | 16 +++--- clients/client-firehose/runtimeConfig.ts | 49 +++++++++------- clients/client-fis/FisClient.ts | 7 +-- clients/client-fis/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-fis/runtimeConfig.native.ts | 16 ++++-- clients/client-fis/runtimeConfig.shared.ts | 16 +++--- clients/client-fis/runtimeConfig.ts | 49 +++++++++------- clients/client-fms/FMSClient.ts | 7 +-- clients/client-fms/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-fms/runtimeConfig.native.ts | 16 ++++-- clients/client-fms/runtimeConfig.shared.ts | 16 +++--- clients/client-fms/runtimeConfig.ts | 49 +++++++++------- clients/client-forecast/ForecastClient.ts | 7 +-- .../client-forecast/runtimeConfig.browser.ts | 49 +++++++++------- .../client-forecast/runtimeConfig.native.ts | 16 ++++-- .../client-forecast/runtimeConfig.shared.ts | 16 +++--- clients/client-forecast/runtimeConfig.ts | 49 +++++++++------- .../ForecastqueryClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-forecastquery/runtimeConfig.ts | 49 +++++++++------- .../FraudDetectorClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-frauddetector/runtimeConfig.ts | 49 +++++++++------- clients/client-fsx/FSxClient.ts | 7 +-- clients/client-fsx/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-fsx/runtimeConfig.native.ts | 16 ++++-- clients/client-fsx/runtimeConfig.shared.ts | 16 +++--- clients/client-fsx/runtimeConfig.ts | 49 +++++++++------- clients/client-gamelift/GameLiftClient.ts | 7 +-- .../client-gamelift/runtimeConfig.browser.ts | 49 +++++++++------- .../client-gamelift/runtimeConfig.native.ts | 16 ++++-- .../client-gamelift/runtimeConfig.shared.ts | 16 +++--- clients/client-gamelift/runtimeConfig.ts | 49 +++++++++------- clients/client-glacier/GlacierClient.ts | 7 +-- .../client-glacier/runtimeConfig.browser.ts | 51 ++++++++++------- .../client-glacier/runtimeConfig.native.ts | 16 ++++-- .../client-glacier/runtimeConfig.shared.ts | 16 +++--- clients/client-glacier/runtimeConfig.ts | 51 ++++++++++------- .../GlobalAcceleratorClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-glue/GlueClient.ts | 7 +-- clients/client-glue/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-glue/runtimeConfig.native.ts | 16 ++++-- clients/client-glue/runtimeConfig.shared.ts | 16 +++--- clients/client-glue/runtimeConfig.ts | 49 +++++++++------- clients/client-greengrass/GreengrassClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-greengrass/runtimeConfig.native.ts | 16 ++++-- .../client-greengrass/runtimeConfig.shared.ts | 16 +++--- clients/client-greengrass/runtimeConfig.ts | 49 +++++++++------- .../client-greengrassv2/GreengrassV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-greengrassv2/runtimeConfig.ts | 49 +++++++++------- .../GroundStationClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-groundstation/runtimeConfig.ts | 49 +++++++++------- clients/client-guardduty/GuardDutyClient.ts | 7 +-- .../client-guardduty/runtimeConfig.browser.ts | 49 +++++++++------- .../client-guardduty/runtimeConfig.native.ts | 16 ++++-- .../client-guardduty/runtimeConfig.shared.ts | 16 +++--- clients/client-guardduty/runtimeConfig.ts | 49 +++++++++------- clients/client-health/HealthClient.ts | 7 +-- .../client-health/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-health/runtimeConfig.native.ts | 16 ++++-- clients/client-health/runtimeConfig.shared.ts | 16 +++--- clients/client-health/runtimeConfig.ts | 49 +++++++++------- clients/client-healthlake/HealthLakeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-healthlake/runtimeConfig.native.ts | 16 ++++-- .../client-healthlake/runtimeConfig.shared.ts | 16 +++--- clients/client-healthlake/runtimeConfig.ts | 49 +++++++++------- clients/client-honeycode/HoneycodeClient.ts | 7 +-- .../client-honeycode/runtimeConfig.browser.ts | 49 +++++++++------- .../client-honeycode/runtimeConfig.native.ts | 16 ++++-- .../client-honeycode/runtimeConfig.shared.ts | 16 +++--- clients/client-honeycode/runtimeConfig.ts | 49 +++++++++------- clients/client-iam/IAMClient.ts | 7 +-- clients/client-iam/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-iam/runtimeConfig.native.ts | 16 ++++-- clients/client-iam/runtimeConfig.shared.ts | 16 +++--- clients/client-iam/runtimeConfig.ts | 49 +++++++++------- .../IdentitystoreClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-identitystore/runtimeConfig.ts | 49 +++++++++------- .../client-imagebuilder/ImagebuilderClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-imagebuilder/runtimeConfig.ts | 49 +++++++++------- clients/client-inspector/InspectorClient.ts | 7 +-- .../client-inspector/runtimeConfig.browser.ts | 49 +++++++++------- .../client-inspector/runtimeConfig.native.ts | 16 ++++-- .../client-inspector/runtimeConfig.shared.ts | 16 +++--- clients/client-inspector/runtimeConfig.ts | 49 +++++++++------- .../IoT1ClickDevicesServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../IoT1ClickProjectsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../IoTDataPlaneClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-iot-data-plane/runtimeConfig.ts | 49 +++++++++------- .../IoTEventsDataClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-iot-events-data/runtimeConfig.ts | 49 +++++++++------- clients/client-iot-events/IoTEventsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-iot-events/runtimeConfig.native.ts | 16 ++++-- .../client-iot-events/runtimeConfig.shared.ts | 16 +++--- clients/client-iot-events/runtimeConfig.ts | 49 +++++++++------- .../IoTJobsDataPlaneClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-iot-wireless/IoTWirelessClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-iot-wireless/runtimeConfig.ts | 49 +++++++++------- clients/client-iot/IoTClient.ts | 7 +-- clients/client-iot/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-iot/runtimeConfig.native.ts | 16 ++++-- clients/client-iot/runtimeConfig.shared.ts | 16 +++--- clients/client-iot/runtimeConfig.ts | 49 +++++++++------- .../client-iotanalytics/IoTAnalyticsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-iotanalytics/runtimeConfig.ts | 49 +++++++++------- .../IotDeviceAdvisorClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-iotdeviceadvisor/runtimeConfig.ts | 49 +++++++++------- .../client-iotfleethub/IoTFleetHubClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-iotfleethub/runtimeConfig.ts | 49 +++++++++------- .../IoTSecureTunnelingClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-iotsitewise/IoTSiteWiseClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-iotsitewise/runtimeConfig.ts | 49 +++++++++------- .../IoTThingsGraphClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-iotthingsgraph/runtimeConfig.ts | 49 +++++++++------- clients/client-ivs/IvsClient.ts | 7 +-- clients/client-ivs/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ivs/runtimeConfig.native.ts | 16 ++++-- clients/client-ivs/runtimeConfig.shared.ts | 16 +++--- clients/client-ivs/runtimeConfig.ts | 49 +++++++++------- clients/client-kafka/KafkaClient.ts | 7 +-- clients/client-kafka/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-kafka/runtimeConfig.native.ts | 16 ++++-- clients/client-kafka/runtimeConfig.shared.ts | 16 +++--- clients/client-kafka/runtimeConfig.ts | 49 +++++++++------- clients/client-kendra/KendraClient.ts | 7 +-- .../client-kendra/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-kendra/runtimeConfig.native.ts | 16 ++++-- clients/client-kendra/runtimeConfig.shared.ts | 16 +++--- clients/client-kendra/runtimeConfig.ts | 49 +++++++++------- .../KinesisAnalyticsV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../KinesisAnalyticsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-kinesis-analytics/runtimeConfig.ts | 49 +++++++++------- .../KinesisVideoArchivedMediaClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../KinesisVideoMediaClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../KinesisVideoSignalingClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../KinesisVideoClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-kinesis-video/runtimeConfig.ts | 49 +++++++++------- clients/client-kinesis/KinesisClient.ts | 7 +-- .../client-kinesis/runtimeConfig.browser.ts | 51 ++++++++++------- .../client-kinesis/runtimeConfig.native.ts | 16 ++++-- .../client-kinesis/runtimeConfig.shared.ts | 16 +++--- clients/client-kinesis/runtimeConfig.ts | 51 ++++++++++------- clients/client-kms/KMSClient.ts | 7 +-- clients/client-kms/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-kms/runtimeConfig.native.ts | 16 ++++-- clients/client-kms/runtimeConfig.shared.ts | 16 +++--- clients/client-kms/runtimeConfig.ts | 49 +++++++++------- .../LakeFormationClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-lakeformation/runtimeConfig.ts | 49 +++++++++------- clients/client-lambda/LambdaClient.ts | 7 +-- .../client-lambda/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-lambda/runtimeConfig.native.ts | 16 ++++-- clients/client-lambda/runtimeConfig.shared.ts | 16 +++--- clients/client-lambda/runtimeConfig.ts | 49 +++++++++------- .../LexModelBuildingServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-lex-models-v2/LexModelsV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-lex-models-v2/runtimeConfig.ts | 49 +++++++++------- .../LexRuntimeServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../LexRuntimeV2Client.ts | 7 +-- .../runtimeConfig.browser.ts | 57 +++++++++++-------- .../runtimeConfig.native.ts | 22 ++++--- .../runtimeConfig.shared.ts | 16 +++--- .../client-lex-runtime-v2/runtimeConfig.ts | 56 ++++++++++-------- .../LicenseManagerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-license-manager/runtimeConfig.ts | 49 +++++++++------- clients/client-lightsail/LightsailClient.ts | 7 +-- .../client-lightsail/runtimeConfig.browser.ts | 49 +++++++++------- .../client-lightsail/runtimeConfig.native.ts | 16 ++++-- .../client-lightsail/runtimeConfig.shared.ts | 16 +++--- clients/client-lightsail/runtimeConfig.ts | 49 +++++++++------- clients/client-location/LocationClient.ts | 7 +-- .../client-location/runtimeConfig.browser.ts | 49 +++++++++------- .../client-location/runtimeConfig.native.ts | 16 ++++-- .../client-location/runtimeConfig.shared.ts | 16 +++--- clients/client-location/runtimeConfig.ts | 49 +++++++++------- .../LookoutEquipmentClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-lookoutequipment/runtimeConfig.ts | 49 +++++++++------- .../LookoutMetricsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-lookoutmetrics/runtimeConfig.ts | 49 +++++++++------- .../LookoutVisionClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-lookoutvision/runtimeConfig.ts | 49 +++++++++------- .../MachineLearningClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-machine-learning/runtimeConfig.ts | 49 +++++++++------- clients/client-macie/MacieClient.ts | 7 +-- clients/client-macie/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-macie/runtimeConfig.native.ts | 16 ++++-- clients/client-macie/runtimeConfig.shared.ts | 16 +++--- clients/client-macie/runtimeConfig.ts | 49 +++++++++------- clients/client-macie2/Macie2Client.ts | 7 +-- .../client-macie2/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-macie2/runtimeConfig.native.ts | 16 ++++-- clients/client-macie2/runtimeConfig.shared.ts | 16 +++--- clients/client-macie2/runtimeConfig.ts | 49 +++++++++------- .../ManagedBlockchainClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-managedblockchain/runtimeConfig.ts | 49 +++++++++------- .../MarketplaceCatalogClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../MarketplaceCommerceAnalyticsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../MarketplaceEntitlementServiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../MarketplaceMeteringClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-mediaconnect/MediaConnectClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-mediaconnect/runtimeConfig.ts | 49 +++++++++------- .../client-mediaconvert/MediaConvertClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-mediaconvert/runtimeConfig.ts | 49 +++++++++------- clients/client-medialive/MediaLiveClient.ts | 7 +-- .../client-medialive/runtimeConfig.browser.ts | 49 +++++++++------- .../client-medialive/runtimeConfig.native.ts | 16 ++++-- .../client-medialive/runtimeConfig.shared.ts | 16 +++--- clients/client-medialive/runtimeConfig.ts | 49 +++++++++------- .../MediaPackageVodClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-mediapackage-vod/runtimeConfig.ts | 49 +++++++++------- .../client-mediapackage/MediaPackageClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-mediapackage/runtimeConfig.ts | 49 +++++++++------- .../MediaStoreDataClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-mediastore-data/runtimeConfig.ts | 49 +++++++++------- clients/client-mediastore/MediaStoreClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-mediastore/runtimeConfig.native.ts | 16 ++++-- .../client-mediastore/runtimeConfig.shared.ts | 16 +++--- clients/client-mediastore/runtimeConfig.ts | 49 +++++++++------- .../client-mediatailor/MediaTailorClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-mediatailor/runtimeConfig.ts | 49 +++++++++------- clients/client-mgn/MgnClient.ts | 7 +-- clients/client-mgn/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-mgn/runtimeConfig.native.ts | 16 ++++-- clients/client-mgn/runtimeConfig.shared.ts | 16 +++--- clients/client-mgn/runtimeConfig.ts | 49 +++++++++------- .../MigrationHubClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-migration-hub/runtimeConfig.ts | 49 +++++++++------- .../MigrationHubConfigClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-mobile/MobileClient.ts | 7 +-- .../client-mobile/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-mobile/runtimeConfig.native.ts | 16 ++++-- clients/client-mobile/runtimeConfig.shared.ts | 16 +++--- clients/client-mobile/runtimeConfig.ts | 49 +++++++++------- clients/client-mq/MqClient.ts | 7 +-- clients/client-mq/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-mq/runtimeConfig.native.ts | 16 ++++-- clients/client-mq/runtimeConfig.shared.ts | 16 +++--- clients/client-mq/runtimeConfig.ts | 49 +++++++++------- clients/client-mturk/MTurkClient.ts | 7 +-- clients/client-mturk/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-mturk/runtimeConfig.native.ts | 16 ++++-- clients/client-mturk/runtimeConfig.shared.ts | 16 +++--- clients/client-mturk/runtimeConfig.ts | 49 +++++++++------- clients/client-mwaa/MWAAClient.ts | 7 +-- clients/client-mwaa/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-mwaa/runtimeConfig.native.ts | 16 ++++-- clients/client-mwaa/runtimeConfig.shared.ts | 16 +++--- clients/client-mwaa/runtimeConfig.ts | 49 +++++++++------- clients/client-neptune/NeptuneClient.ts | 7 +-- .../client-neptune/runtimeConfig.browser.ts | 49 +++++++++------- .../client-neptune/runtimeConfig.native.ts | 16 ++++-- .../client-neptune/runtimeConfig.shared.ts | 16 +++--- clients/client-neptune/runtimeConfig.ts | 49 +++++++++------- .../NetworkFirewallClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-network-firewall/runtimeConfig.ts | 49 +++++++++------- .../NetworkManagerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-networkmanager/runtimeConfig.ts | 49 +++++++++------- clients/client-nimble/NimbleClient.ts | 7 +-- .../client-nimble/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-nimble/runtimeConfig.native.ts | 16 ++++-- clients/client-nimble/runtimeConfig.shared.ts | 16 +++--- clients/client-nimble/runtimeConfig.ts | 49 +++++++++------- clients/client-opsworks/OpsWorksClient.ts | 7 +-- .../client-opsworks/runtimeConfig.browser.ts | 49 +++++++++------- .../client-opsworks/runtimeConfig.native.ts | 16 ++++-- .../client-opsworks/runtimeConfig.shared.ts | 16 +++--- clients/client-opsworks/runtimeConfig.ts | 49 +++++++++------- clients/client-opsworkscm/OpsWorksCMClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-opsworkscm/runtimeConfig.native.ts | 16 ++++-- .../client-opsworkscm/runtimeConfig.shared.ts | 16 +++--- clients/client-opsworkscm/runtimeConfig.ts | 49 +++++++++------- .../OrganizationsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-organizations/runtimeConfig.ts | 49 +++++++++------- clients/client-outposts/OutpostsClient.ts | 7 +-- .../client-outposts/runtimeConfig.browser.ts | 49 +++++++++------- .../client-outposts/runtimeConfig.native.ts | 16 ++++-- .../client-outposts/runtimeConfig.shared.ts | 16 +++--- clients/client-outposts/runtimeConfig.ts | 49 +++++++++------- .../PersonalizeEventsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../PersonalizeRuntimeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../client-personalize/PersonalizeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-personalize/runtimeConfig.ts | 49 +++++++++------- clients/client-pi/PIClient.ts | 7 +-- clients/client-pi/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-pi/runtimeConfig.native.ts | 16 ++++-- clients/client-pi/runtimeConfig.shared.ts | 16 +++--- clients/client-pi/runtimeConfig.ts | 49 +++++++++------- .../PinpointEmailClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-pinpoint-email/runtimeConfig.ts | 49 +++++++++------- .../PinpointSMSVoiceClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-pinpoint/PinpointClient.ts | 7 +-- .../client-pinpoint/runtimeConfig.browser.ts | 49 +++++++++------- .../client-pinpoint/runtimeConfig.native.ts | 16 ++++-- .../client-pinpoint/runtimeConfig.shared.ts | 16 +++--- clients/client-pinpoint/runtimeConfig.ts | 49 +++++++++------- clients/client-polly/PollyClient.ts | 7 +-- clients/client-polly/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-polly/runtimeConfig.native.ts | 16 ++++-- clients/client-polly/runtimeConfig.shared.ts | 16 +++--- clients/client-polly/runtimeConfig.ts | 49 +++++++++------- clients/client-pricing/PricingClient.ts | 7 +-- .../client-pricing/runtimeConfig.browser.ts | 49 +++++++++------- .../client-pricing/runtimeConfig.native.ts | 16 ++++-- .../client-pricing/runtimeConfig.shared.ts | 16 +++--- clients/client-pricing/runtimeConfig.ts | 49 +++++++++------- clients/client-proton/ProtonClient.ts | 7 +-- .../client-proton/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-proton/runtimeConfig.native.ts | 16 ++++-- clients/client-proton/runtimeConfig.shared.ts | 16 +++--- clients/client-proton/runtimeConfig.ts | 49 +++++++++------- .../client-qldb-session/QLDBSessionClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-qldb-session/runtimeConfig.ts | 49 +++++++++------- clients/client-qldb/QLDBClient.ts | 7 +-- clients/client-qldb/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-qldb/runtimeConfig.native.ts | 16 ++++-- clients/client-qldb/runtimeConfig.shared.ts | 16 +++--- clients/client-qldb/runtimeConfig.ts | 49 +++++++++------- clients/client-quicksight/QuickSightClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-quicksight/runtimeConfig.native.ts | 16 ++++-- .../client-quicksight/runtimeConfig.shared.ts | 16 +++--- clients/client-quicksight/runtimeConfig.ts | 49 +++++++++------- clients/client-ram/RAMClient.ts | 7 +-- clients/client-ram/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ram/runtimeConfig.native.ts | 16 ++++-- clients/client-ram/runtimeConfig.shared.ts | 16 +++--- clients/client-ram/runtimeConfig.ts | 49 +++++++++------- clients/client-rds-data/RDSDataClient.ts | 7 +-- .../client-rds-data/runtimeConfig.browser.ts | 49 +++++++++------- .../client-rds-data/runtimeConfig.native.ts | 16 ++++-- .../client-rds-data/runtimeConfig.shared.ts | 16 +++--- clients/client-rds-data/runtimeConfig.ts | 49 +++++++++------- clients/client-rds/RDSClient.ts | 7 +-- clients/client-rds/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-rds/runtimeConfig.native.ts | 16 ++++-- clients/client-rds/runtimeConfig.shared.ts | 16 +++--- clients/client-rds/runtimeConfig.ts | 49 +++++++++------- .../RedshiftDataClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-redshift-data/runtimeConfig.ts | 49 +++++++++------- clients/client-redshift/RedshiftClient.ts | 7 +-- .../client-redshift/runtimeConfig.browser.ts | 49 +++++++++------- .../client-redshift/runtimeConfig.native.ts | 16 ++++-- .../client-redshift/runtimeConfig.shared.ts | 16 +++--- clients/client-redshift/runtimeConfig.ts | 49 +++++++++------- .../client-rekognition/RekognitionClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-rekognition/runtimeConfig.ts | 49 +++++++++------- .../ResourceGroupsTaggingAPIClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ResourceGroupsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-resource-groups/runtimeConfig.ts | 49 +++++++++------- clients/client-robomaker/RoboMakerClient.ts | 7 +-- .../client-robomaker/runtimeConfig.browser.ts | 49 +++++++++------- .../client-robomaker/runtimeConfig.native.ts | 16 ++++-- .../client-robomaker/runtimeConfig.shared.ts | 16 +++--- clients/client-robomaker/runtimeConfig.ts | 49 +++++++++------- .../Route53DomainsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-route-53-domains/runtimeConfig.ts | 49 +++++++++------- clients/client-route-53/Route53Client.ts | 7 +-- .../client-route-53/runtimeConfig.browser.ts | 49 +++++++++------- .../client-route-53/runtimeConfig.native.ts | 16 ++++-- .../client-route-53/runtimeConfig.shared.ts | 16 +++--- clients/client-route-53/runtimeConfig.ts | 49 +++++++++------- .../Route53ResolverClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-route53resolver/runtimeConfig.ts | 49 +++++++++------- clients/client-s3-control/S3ControlClient.ts | 7 +-- .../runtimeConfig.browser.ts | 53 +++++++++-------- .../client-s3-control/runtimeConfig.native.ts | 16 ++++-- .../client-s3-control/runtimeConfig.shared.ts | 16 +++--- clients/client-s3-control/runtimeConfig.ts | 53 +++++++++-------- clients/client-s3/S3Client.ts | 7 +-- clients/client-s3/runtimeConfig.browser.ts | 55 ++++++++++-------- clients/client-s3/runtimeConfig.native.ts | 16 ++++-- clients/client-s3/runtimeConfig.shared.ts | 20 ++++--- clients/client-s3/runtimeConfig.ts | 57 +++++++++++-------- clients/client-s3outposts/S3OutpostsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-s3outposts/runtimeConfig.native.ts | 16 ++++-- .../client-s3outposts/runtimeConfig.shared.ts | 16 +++--- clients/client-s3outposts/runtimeConfig.ts | 49 +++++++++------- .../SageMakerA2IRuntimeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../SagemakerEdgeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-sagemaker-edge/runtimeConfig.ts | 49 +++++++++------- .../SageMakerFeatureStoreRuntimeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../SageMakerRuntimeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-sagemaker-runtime/runtimeConfig.ts | 49 +++++++++------- clients/client-sagemaker/SageMakerClient.ts | 7 +-- .../client-sagemaker/runtimeConfig.browser.ts | 49 +++++++++------- .../client-sagemaker/runtimeConfig.native.ts | 16 ++++-- .../client-sagemaker/runtimeConfig.shared.ts | 16 +++--- clients/client-sagemaker/runtimeConfig.ts | 49 +++++++++------- .../client-savingsplans/SavingsplansClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-savingsplans/runtimeConfig.ts | 49 +++++++++------- clients/client-schemas/SchemasClient.ts | 7 +-- .../client-schemas/runtimeConfig.browser.ts | 49 +++++++++------- .../client-schemas/runtimeConfig.native.ts | 16 ++++-- .../client-schemas/runtimeConfig.shared.ts | 16 +++--- clients/client-schemas/runtimeConfig.ts | 49 +++++++++------- .../SecretsManagerClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-secrets-manager/runtimeConfig.ts | 49 +++++++++------- .../client-securityhub/SecurityHubClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-securityhub/runtimeConfig.ts | 49 +++++++++------- .../ServerlessApplicationRepositoryClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ServiceCatalogAppRegistryClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- .../ServiceCatalogClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-service-catalog/runtimeConfig.ts | 49 +++++++++------- .../ServiceQuotasClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-service-quotas/runtimeConfig.ts | 49 +++++++++------- .../ServiceDiscoveryClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-servicediscovery/runtimeConfig.ts | 49 +++++++++------- clients/client-ses/SESClient.ts | 7 +-- clients/client-ses/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ses/runtimeConfig.native.ts | 16 ++++-- clients/client-ses/runtimeConfig.shared.ts | 16 +++--- clients/client-ses/runtimeConfig.ts | 49 +++++++++------- clients/client-sesv2/SESv2Client.ts | 7 +-- clients/client-sesv2/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-sesv2/runtimeConfig.native.ts | 16 ++++-- clients/client-sesv2/runtimeConfig.shared.ts | 16 +++--- clients/client-sesv2/runtimeConfig.ts | 49 +++++++++------- clients/client-sfn/SFNClient.ts | 7 +-- clients/client-sfn/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-sfn/runtimeConfig.native.ts | 16 ++++-- clients/client-sfn/runtimeConfig.shared.ts | 16 +++--- clients/client-sfn/runtimeConfig.ts | 49 +++++++++------- clients/client-shield/ShieldClient.ts | 7 +-- .../client-shield/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-shield/runtimeConfig.native.ts | 16 ++++-- clients/client-shield/runtimeConfig.shared.ts | 16 +++--- clients/client-shield/runtimeConfig.ts | 49 +++++++++------- clients/client-signer/SignerClient.ts | 7 +-- .../client-signer/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-signer/runtimeConfig.native.ts | 16 ++++-- clients/client-signer/runtimeConfig.shared.ts | 16 +++--- clients/client-signer/runtimeConfig.ts | 49 +++++++++------- clients/client-sms/SMSClient.ts | 7 +-- clients/client-sms/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-sms/runtimeConfig.native.ts | 16 ++++-- clients/client-sms/runtimeConfig.shared.ts | 16 +++--- clients/client-sms/runtimeConfig.ts | 49 +++++++++------- clients/client-snowball/SnowballClient.ts | 7 +-- .../client-snowball/runtimeConfig.browser.ts | 49 +++++++++------- .../client-snowball/runtimeConfig.native.ts | 16 ++++-- .../client-snowball/runtimeConfig.shared.ts | 16 +++--- clients/client-snowball/runtimeConfig.ts | 49 +++++++++------- clients/client-sns/SNSClient.ts | 7 +-- clients/client-sns/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-sns/runtimeConfig.native.ts | 16 ++++-- clients/client-sns/runtimeConfig.shared.ts | 16 +++--- clients/client-sns/runtimeConfig.ts | 49 +++++++++------- clients/client-sqs/SQSClient.ts | 7 +-- clients/client-sqs/runtimeConfig.browser.ts | 51 ++++++++++------- clients/client-sqs/runtimeConfig.native.ts | 16 ++++-- clients/client-sqs/runtimeConfig.shared.ts | 16 +++--- clients/client-sqs/runtimeConfig.ts | 51 ++++++++++------- .../client-ssm-contacts/SSMContactsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-ssm-contacts/runtimeConfig.ts | 49 +++++++++------- .../SSMIncidentsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-ssm-incidents/runtimeConfig.ts | 49 +++++++++------- clients/client-ssm/SSMClient.ts | 7 +-- clients/client-ssm/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-ssm/runtimeConfig.native.ts | 16 ++++-- clients/client-ssm/runtimeConfig.shared.ts | 16 +++--- clients/client-ssm/runtimeConfig.ts | 49 +++++++++------- clients/client-sso-admin/SSOAdminClient.ts | 7 +-- .../client-sso-admin/runtimeConfig.browser.ts | 49 +++++++++------- .../client-sso-admin/runtimeConfig.native.ts | 16 ++++-- .../client-sso-admin/runtimeConfig.shared.ts | 16 +++--- clients/client-sso-admin/runtimeConfig.ts | 49 +++++++++------- clients/client-sso-oidc/SSOOIDCClient.ts | 7 +-- .../client-sso-oidc/runtimeConfig.browser.ts | 44 +++++++------- .../client-sso-oidc/runtimeConfig.native.ts | 16 ++++-- .../client-sso-oidc/runtimeConfig.shared.ts | 16 +++--- clients/client-sso-oidc/runtimeConfig.ts | 44 +++++++------- clients/client-sso/SSOClient.ts | 7 +-- clients/client-sso/runtimeConfig.browser.ts | 44 +++++++------- clients/client-sso/runtimeConfig.native.ts | 16 ++++-- clients/client-sso/runtimeConfig.shared.ts | 16 +++--- clients/client-sso/runtimeConfig.ts | 44 +++++++------- .../StorageGatewayClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-storage-gateway/runtimeConfig.ts | 49 +++++++++------- clients/client-sts/STSClient.ts | 7 +-- clients/client-sts/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-sts/runtimeConfig.native.ts | 16 ++++-- clients/client-sts/runtimeConfig.shared.ts | 16 +++--- clients/client-sts/runtimeConfig.ts | 49 +++++++++------- clients/client-support/SupportClient.ts | 7 +-- .../client-support/runtimeConfig.browser.ts | 49 +++++++++------- .../client-support/runtimeConfig.native.ts | 16 ++++-- .../client-support/runtimeConfig.shared.ts | 16 +++--- clients/client-support/runtimeConfig.ts | 49 +++++++++------- clients/client-swf/SWFClient.ts | 7 +-- clients/client-swf/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-swf/runtimeConfig.native.ts | 16 ++++-- clients/client-swf/runtimeConfig.shared.ts | 16 +++--- clients/client-swf/runtimeConfig.ts | 49 +++++++++------- clients/client-synthetics/SyntheticsClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-synthetics/runtimeConfig.native.ts | 16 ++++-- .../client-synthetics/runtimeConfig.shared.ts | 16 +++--- clients/client-synthetics/runtimeConfig.ts | 49 +++++++++------- clients/client-textract/TextractClient.ts | 7 +-- .../client-textract/runtimeConfig.browser.ts | 49 +++++++++------- .../client-textract/runtimeConfig.native.ts | 16 ++++-- .../client-textract/runtimeConfig.shared.ts | 16 +++--- clients/client-textract/runtimeConfig.ts | 49 +++++++++------- .../TimestreamQueryClient.ts | 7 +-- .../runtimeConfig.browser.ts | 53 ++++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-timestream-query/runtimeConfig.ts | 54 +++++++++++------- .../TimestreamWriteClient.ts | 7 +-- .../runtimeConfig.browser.ts | 53 ++++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-timestream-write/runtimeConfig.ts | 54 +++++++++++------- .../TranscribeStreamingClient.ts | 7 +-- .../runtimeConfig.browser.ts | 56 ++++++++++-------- .../runtimeConfig.native.ts | 23 +++++--- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 56 ++++++++++-------- clients/client-transcribe/TranscribeClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-transcribe/runtimeConfig.native.ts | 16 ++++-- .../client-transcribe/runtimeConfig.shared.ts | 16 +++--- clients/client-transcribe/runtimeConfig.ts | 49 +++++++++------- clients/client-transfer/TransferClient.ts | 7 +-- .../client-transfer/runtimeConfig.browser.ts | 49 +++++++++------- .../client-transfer/runtimeConfig.native.ts | 16 ++++-- .../client-transfer/runtimeConfig.shared.ts | 16 +++--- clients/client-transfer/runtimeConfig.ts | 49 +++++++++------- clients/client-translate/TranslateClient.ts | 7 +-- .../client-translate/runtimeConfig.browser.ts | 49 +++++++++------- .../client-translate/runtimeConfig.native.ts | 16 ++++-- .../client-translate/runtimeConfig.shared.ts | 16 +++--- clients/client-translate/runtimeConfig.ts | 49 +++++++++------- .../client-waf-regional/WAFRegionalClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- clients/client-waf-regional/runtimeConfig.ts | 49 +++++++++------- clients/client-waf/WAFClient.ts | 7 +-- clients/client-waf/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-waf/runtimeConfig.native.ts | 16 ++++-- clients/client-waf/runtimeConfig.shared.ts | 16 +++--- clients/client-waf/runtimeConfig.ts | 49 +++++++++------- clients/client-wafv2/WAFV2Client.ts | 7 +-- clients/client-wafv2/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-wafv2/runtimeConfig.native.ts | 16 ++++-- clients/client-wafv2/runtimeConfig.shared.ts | 16 +++--- clients/client-wafv2/runtimeConfig.ts | 49 +++++++++------- .../WellArchitectedClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../client-wellarchitected/runtimeConfig.ts | 49 +++++++++------- clients/client-workdocs/WorkDocsClient.ts | 7 +-- .../client-workdocs/runtimeConfig.browser.ts | 49 +++++++++------- .../client-workdocs/runtimeConfig.native.ts | 16 ++++-- .../client-workdocs/runtimeConfig.shared.ts | 16 +++--- clients/client-workdocs/runtimeConfig.ts | 49 +++++++++------- clients/client-worklink/WorkLinkClient.ts | 7 +-- .../client-worklink/runtimeConfig.browser.ts | 49 +++++++++------- .../client-worklink/runtimeConfig.native.ts | 16 ++++-- .../client-worklink/runtimeConfig.shared.ts | 16 +++--- clients/client-worklink/runtimeConfig.ts | 49 +++++++++------- clients/client-workmail/WorkMailClient.ts | 7 +-- .../client-workmail/runtimeConfig.browser.ts | 49 +++++++++------- .../client-workmail/runtimeConfig.native.ts | 16 ++++-- .../client-workmail/runtimeConfig.shared.ts | 16 +++--- clients/client-workmail/runtimeConfig.ts | 49 +++++++++------- .../WorkMailMessageFlowClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../runtimeConfig.native.ts | 16 ++++-- .../runtimeConfig.shared.ts | 16 +++--- .../runtimeConfig.ts | 49 +++++++++------- clients/client-workspaces/WorkSpacesClient.ts | 7 +-- .../runtimeConfig.browser.ts | 49 +++++++++------- .../client-workspaces/runtimeConfig.native.ts | 16 ++++-- .../client-workspaces/runtimeConfig.shared.ts | 16 +++--- clients/client-workspaces/runtimeConfig.ts | 49 +++++++++------- clients/client-xray/XRayClient.ts | 7 +-- clients/client-xray/runtimeConfig.browser.ts | 49 +++++++++------- clients/client-xray/runtimeConfig.native.ts | 16 ++++-- clients/client-xray/runtimeConfig.shared.ts | 16 +++--- clients/client-xray/runtimeConfig.ts | 49 +++++++++------- protocol_tests/aws-ec2/EC2ProtocolClient.ts | 7 +-- .../aws-ec2/runtimeConfig.browser.ts | 42 +++++++------- .../aws-ec2/runtimeConfig.native.ts | 16 ++++-- .../aws-ec2/runtimeConfig.shared.ts | 16 +++--- protocol_tests/aws-ec2/runtimeConfig.ts | 42 +++++++------- protocol_tests/aws-json/JsonProtocolClient.ts | 7 +-- .../aws-json/runtimeConfig.browser.ts | 49 +++++++++------- .../aws-json/runtimeConfig.native.ts | 16 ++++-- .../aws-json/runtimeConfig.shared.ts | 16 +++--- protocol_tests/aws-json/runtimeConfig.ts | 49 +++++++++------- .../aws-query/QueryProtocolClient.ts | 7 +-- .../aws-query/runtimeConfig.browser.ts | 42 +++++++------- .../aws-query/runtimeConfig.native.ts | 16 ++++-- .../aws-query/runtimeConfig.shared.ts | 16 +++--- protocol_tests/aws-query/runtimeConfig.ts | 42 +++++++------- .../aws-restjson/RestJsonProtocolClient.ts | 7 +-- .../aws-restjson/runtimeConfig.browser.ts | 42 +++++++------- .../aws-restjson/runtimeConfig.native.ts | 16 ++++-- .../aws-restjson/runtimeConfig.shared.ts | 16 +++--- protocol_tests/aws-restjson/runtimeConfig.ts | 42 +++++++------- .../aws-restxml/RestXmlProtocolClient.ts | 7 +-- .../aws-restxml/runtimeConfig.browser.ts | 42 +++++++------- .../aws-restxml/runtimeConfig.native.ts | 16 ++++-- .../aws-restxml/runtimeConfig.shared.ts | 16 +++--- protocol_tests/aws-restxml/runtimeConfig.ts | 42 +++++++------- 1370 files changed, 21109 insertions(+), 16460 deletions(-) diff --git a/clients/client-accessanalyzer/AccessAnalyzerClient.ts b/clients/client-accessanalyzer/AccessAnalyzerClient.ts index 7c38bbf8bba9..187f566dbada 100644 --- a/clients/client-accessanalyzer/AccessAnalyzerClient.ts +++ b/clients/client-accessanalyzer/AccessAnalyzerClient.ts @@ -50,7 +50,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateArchiveRuleCommandInput, UpdateArchiveRuleCommandOutput } from "./commands/UpdateArchiveRuleCommand"; import { UpdateFindingsCommandInput, UpdateFindingsCommandOutput } from "./commands/UpdateFindingsCommand"; import { ValidatePolicyCommandInput, ValidatePolicyCommandOutput } from "./commands/ValidatePolicyCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -324,10 +324,7 @@ export class AccessAnalyzerClient extends __Client< readonly config: AccessAnalyzerClientResolvedConfig; constructor(configuration: AccessAnalyzerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-accessanalyzer/runtimeConfig.browser.ts b/clients/client-accessanalyzer/runtimeConfig.browser.ts index 424548636beb..d3895fe48b5c 100644 --- a/clients/client-accessanalyzer/runtimeConfig.browser.ts +++ b/clients/client-accessanalyzer/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AccessAnalyzerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-accessanalyzer/runtimeConfig.native.ts b/clients/client-accessanalyzer/runtimeConfig.native.ts index c00042379c21..266c4ac75f48 100644 --- a/clients/client-accessanalyzer/runtimeConfig.native.ts +++ b/clients/client-accessanalyzer/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AccessAnalyzerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-accessanalyzer/runtimeConfig.shared.ts b/clients/client-accessanalyzer/runtimeConfig.shared.ts index 01dd2a1e5c34..8ccf5c5f00ec 100644 --- a/clients/client-accessanalyzer/runtimeConfig.shared.ts +++ b/clients/client-accessanalyzer/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => ({ apiVersion: "2019-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AccessAnalyzer", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-accessanalyzer/runtimeConfig.ts b/clients/client-accessanalyzer/runtimeConfig.ts index 8dee0cccc716..b19d12b03015 100644 --- a/clients/client-accessanalyzer/runtimeConfig.ts +++ b/clients/client-accessanalyzer/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AccessAnalyzerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AccessAnalyzerClientConfig } from "./AccessAnalyzerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-acm-pca/ACMPCAClient.ts b/clients/client-acm-pca/ACMPCAClient.ts index a81181e9044f..31f7aed7c148 100644 --- a/clients/client-acm-pca/ACMPCAClient.ts +++ b/clients/client-acm-pca/ACMPCAClient.ts @@ -60,7 +60,7 @@ import { UpdateCertificateAuthorityCommandInput, UpdateCertificateAuthorityCommandOutput, } from "./commands/UpdateCertificateAuthorityCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -328,10 +328,7 @@ export class ACMPCAClient extends __Client< readonly config: ACMPCAClientResolvedConfig; constructor(configuration: ACMPCAClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-acm-pca/runtimeConfig.browser.ts b/clients/client-acm-pca/runtimeConfig.browser.ts index 582df9b694dc..19438c479c92 100644 --- a/clients/client-acm-pca/runtimeConfig.browser.ts +++ b/clients/client-acm-pca/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ACMPCAClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ACMPCAClientConfig } from "./ACMPCAClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ACMPCAClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-acm-pca/runtimeConfig.native.ts b/clients/client-acm-pca/runtimeConfig.native.ts index adda57a36ef7..540388f283c0 100644 --- a/clients/client-acm-pca/runtimeConfig.native.ts +++ b/clients/client-acm-pca/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ACMPCAClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ACMPCAClientConfig } from "./ACMPCAClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ACMPCAClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-acm-pca/runtimeConfig.shared.ts b/clients/client-acm-pca/runtimeConfig.shared.ts index e1132dfa7421..385564aacfb8 100644 --- a/clients/client-acm-pca/runtimeConfig.shared.ts +++ b/clients/client-acm-pca/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ACMPCAClientConfig) => ({ apiVersion: "2017-08-22", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ACM PCA", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-acm-pca/runtimeConfig.ts b/clients/client-acm-pca/runtimeConfig.ts index 2a361e683ad0..02576cf4a505 100644 --- a/clients/client-acm-pca/runtimeConfig.ts +++ b/clients/client-acm-pca/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ACMPCAClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ACMPCAClientConfig } from "./ACMPCAClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ACMPCAClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-acm/ACMClient.ts b/clients/client-acm/ACMClient.ts index ccf0c10e7462..28f34801de21 100644 --- a/clients/client-acm/ACMClient.ts +++ b/clients/client-acm/ACMClient.ts @@ -37,7 +37,7 @@ import { UpdateCertificateOptionsCommandInput, UpdateCertificateOptionsCommandOutput, } from "./commands/UpdateCertificateOptionsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -279,10 +279,7 @@ export class ACMClient extends __Client< readonly config: ACMClientResolvedConfig; constructor(configuration: ACMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-acm/runtimeConfig.browser.ts b/clients/client-acm/runtimeConfig.browser.ts index 9cc454e67885..24710fe5920f 100644 --- a/clients/client-acm/runtimeConfig.browser.ts +++ b/clients/client-acm/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ACMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ACMClientConfig } from "./ACMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ACMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-acm/runtimeConfig.native.ts b/clients/client-acm/runtimeConfig.native.ts index 8d784c0143c4..627bcdefb3ee 100644 --- a/clients/client-acm/runtimeConfig.native.ts +++ b/clients/client-acm/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ACMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ACMClientConfig } from "./ACMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ACMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-acm/runtimeConfig.shared.ts b/clients/client-acm/runtimeConfig.shared.ts index 8f2199bbf401..d3c954159b31 100644 --- a/clients/client-acm/runtimeConfig.shared.ts +++ b/clients/client-acm/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ACMClientConfig) => ({ apiVersion: "2015-12-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ACM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-acm/runtimeConfig.ts b/clients/client-acm/runtimeConfig.ts index 4459ad25aa6e..485d6d79d428 100644 --- a/clients/client-acm/runtimeConfig.ts +++ b/clients/client-acm/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ACMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ACMClientConfig } from "./ACMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ACMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-alexa-for-business/AlexaForBusinessClient.ts b/clients/client-alexa-for-business/AlexaForBusinessClient.ts index 02a93c1cbaa0..ffab5501f8fa 100644 --- a/clients/client-alexa-for-business/AlexaForBusinessClient.ts +++ b/clients/client-alexa-for-business/AlexaForBusinessClient.ts @@ -208,7 +208,7 @@ import { import { UpdateProfileCommandInput, UpdateProfileCommandOutput } from "./commands/UpdateProfileCommand"; import { UpdateRoomCommandInput, UpdateRoomCommandOutput } from "./commands/UpdateRoomCommand"; import { UpdateSkillGroupCommandInput, UpdateSkillGroupCommandOutput } from "./commands/UpdateSkillGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -611,10 +611,7 @@ export class AlexaForBusinessClient extends __Client< readonly config: AlexaForBusinessClientResolvedConfig; constructor(configuration: AlexaForBusinessClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-alexa-for-business/runtimeConfig.browser.ts b/clients/client-alexa-for-business/runtimeConfig.browser.ts index 185d9cba33cb..6a802f698c31 100644 --- a/clients/client-alexa-for-business/runtimeConfig.browser.ts +++ b/clients/client-alexa-for-business/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AlexaForBusinessClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AlexaForBusinessClientConfig } from "./AlexaForBusinessClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-alexa-for-business/runtimeConfig.native.ts b/clients/client-alexa-for-business/runtimeConfig.native.ts index 2dd6bc88b67c..37dbd643673d 100644 --- a/clients/client-alexa-for-business/runtimeConfig.native.ts +++ b/clients/client-alexa-for-business/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AlexaForBusinessClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AlexaForBusinessClientConfig } from "./AlexaForBusinessClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-alexa-for-business/runtimeConfig.shared.ts b/clients/client-alexa-for-business/runtimeConfig.shared.ts index ed0bf95faa71..79e3677b0911 100644 --- a/clients/client-alexa-for-business/runtimeConfig.shared.ts +++ b/clients/client-alexa-for-business/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => ({ apiVersion: "2017-11-09", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Alexa For Business", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-alexa-for-business/runtimeConfig.ts b/clients/client-alexa-for-business/runtimeConfig.ts index ca57bff0dd1f..7988b4f0c375 100644 --- a/clients/client-alexa-for-business/runtimeConfig.ts +++ b/clients/client-alexa-for-business/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AlexaForBusinessClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AlexaForBusinessClientConfig } from "./AlexaForBusinessClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-amp/AmpClient.ts b/clients/client-amp/AmpClient.ts index 82198302a14c..888697226e22 100644 --- a/clients/client-amp/AmpClient.ts +++ b/clients/client-amp/AmpClient.ts @@ -6,7 +6,7 @@ import { UpdateWorkspaceAliasCommandInput, UpdateWorkspaceAliasCommandOutput, } from "./commands/UpdateWorkspaceAliasCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -226,10 +226,7 @@ export class AmpClient extends __Client< readonly config: AmpClientResolvedConfig; constructor(configuration: AmpClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-amp/runtimeConfig.browser.ts b/clients/client-amp/runtimeConfig.browser.ts index 97386546ad4a..08cf24decd85 100644 --- a/clients/client-amp/runtimeConfig.browser.ts +++ b/clients/client-amp/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AmpClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AmpClientConfig } from "./AmpClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AmpClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-amp/runtimeConfig.native.ts b/clients/client-amp/runtimeConfig.native.ts index 65582f1b428b..04d7bef9f6fb 100644 --- a/clients/client-amp/runtimeConfig.native.ts +++ b/clients/client-amp/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AmpClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AmpClientConfig } from "./AmpClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AmpClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-amp/runtimeConfig.shared.ts b/clients/client-amp/runtimeConfig.shared.ts index f5585ff6309d..e1ff634c3061 100644 --- a/clients/client-amp/runtimeConfig.shared.ts +++ b/clients/client-amp/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AmpClientConfig) => ({ apiVersion: "2020-08-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "amp", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-amp/runtimeConfig.ts b/clients/client-amp/runtimeConfig.ts index e84a52827944..4cafe36391f6 100644 --- a/clients/client-amp/runtimeConfig.ts +++ b/clients/client-amp/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AmpClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AmpClientConfig } from "./AmpClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AmpClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-amplify/AmplifyClient.ts b/clients/client-amplify/AmplifyClient.ts index a3b0ec83704f..98fe2f7d0c5d 100644 --- a/clients/client-amplify/AmplifyClient.ts +++ b/clients/client-amplify/AmplifyClient.ts @@ -65,7 +65,7 @@ import { UpdateDomainAssociationCommandOutput, } from "./commands/UpdateDomainAssociationCommand"; import { UpdateWebhookCommandInput, UpdateWebhookCommandOutput } from "./commands/UpdateWebhookCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -354,10 +354,7 @@ export class AmplifyClient extends __Client< readonly config: AmplifyClientResolvedConfig; constructor(configuration: AmplifyClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-amplify/runtimeConfig.browser.ts b/clients/client-amplify/runtimeConfig.browser.ts index 71283152e05f..1aaddefb2186 100644 --- a/clients/client-amplify/runtimeConfig.browser.ts +++ b/clients/client-amplify/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AmplifyClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AmplifyClientConfig } from "./AmplifyClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AmplifyClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-amplify/runtimeConfig.native.ts b/clients/client-amplify/runtimeConfig.native.ts index 46e727aaaf7c..b92765b60ded 100644 --- a/clients/client-amplify/runtimeConfig.native.ts +++ b/clients/client-amplify/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AmplifyClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AmplifyClientConfig } from "./AmplifyClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AmplifyClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-amplify/runtimeConfig.shared.ts b/clients/client-amplify/runtimeConfig.shared.ts index da4c5954c7ed..6ed63c799d3d 100644 --- a/clients/client-amplify/runtimeConfig.shared.ts +++ b/clients/client-amplify/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AmplifyClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Amplify", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-amplify/runtimeConfig.ts b/clients/client-amplify/runtimeConfig.ts index 9b9da4cb4049..1228edc5ec7b 100644 --- a/clients/client-amplify/runtimeConfig.ts +++ b/clients/client-amplify/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AmplifyClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AmplifyClientConfig } from "./AmplifyClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AmplifyClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-amplifybackend/AmplifyBackendClient.ts b/clients/client-amplifybackend/AmplifyBackendClient.ts index a60805f815f5..54e6899124ce 100644 --- a/clients/client-amplifybackend/AmplifyBackendClient.ts +++ b/clients/client-amplifybackend/AmplifyBackendClient.ts @@ -38,7 +38,7 @@ import { UpdateBackendConfigCommandOutput, } from "./commands/UpdateBackendConfigCommand"; import { UpdateBackendJobCommandInput, UpdateBackendJobCommandOutput } from "./commands/UpdateBackendJobCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -298,10 +298,7 @@ export class AmplifyBackendClient extends __Client< readonly config: AmplifyBackendClientResolvedConfig; constructor(configuration: AmplifyBackendClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-amplifybackend/runtimeConfig.browser.ts b/clients/client-amplifybackend/runtimeConfig.browser.ts index 0c2b9d9f649f..3009695c225d 100644 --- a/clients/client-amplifybackend/runtimeConfig.browser.ts +++ b/clients/client-amplifybackend/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AmplifyBackendClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AmplifyBackendClientConfig } from "./AmplifyBackendClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-amplifybackend/runtimeConfig.native.ts b/clients/client-amplifybackend/runtimeConfig.native.ts index 2ec3163ae205..6a4cea8aeb9f 100644 --- a/clients/client-amplifybackend/runtimeConfig.native.ts +++ b/clients/client-amplifybackend/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AmplifyBackendClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AmplifyBackendClientConfig } from "./AmplifyBackendClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-amplifybackend/runtimeConfig.shared.ts b/clients/client-amplifybackend/runtimeConfig.shared.ts index 8d7253903bf3..d902bdb3ffed 100644 --- a/clients/client-amplifybackend/runtimeConfig.shared.ts +++ b/clients/client-amplifybackend/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => ({ apiVersion: "2020-08-11", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AmplifyBackend", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-amplifybackend/runtimeConfig.ts b/clients/client-amplifybackend/runtimeConfig.ts index b584fba461ff..ab777efdc529 100644 --- a/clients/client-amplifybackend/runtimeConfig.ts +++ b/clients/client-amplifybackend/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AmplifyBackendClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AmplifyBackendClientConfig } from "./AmplifyBackendClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-api-gateway/APIGatewayClient.ts b/clients/client-api-gateway/APIGatewayClient.ts index bf9613a50aa7..d6e779fd1339 100644 --- a/clients/client-api-gateway/APIGatewayClient.ts +++ b/clients/client-api-gateway/APIGatewayClient.ts @@ -226,7 +226,7 @@ import { UpdateStageCommandInput, UpdateStageCommandOutput } from "./commands/Up import { UpdateUsageCommandInput, UpdateUsageCommandOutput } from "./commands/UpdateUsageCommand"; import { UpdateUsagePlanCommandInput, UpdateUsagePlanCommandOutput } from "./commands/UpdateUsagePlanCommand"; import { UpdateVpcLinkCommandInput, UpdateVpcLinkCommandOutput } from "./commands/UpdateVpcLinkCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -678,10 +678,7 @@ export class APIGatewayClient extends __Client< readonly config: APIGatewayClientResolvedConfig; constructor(configuration: APIGatewayClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-api-gateway/runtimeConfig.browser.ts b/clients/client-api-gateway/runtimeConfig.browser.ts index 80c64fdb18cc..d6a8064caab1 100644 --- a/clients/client-api-gateway/runtimeConfig.browser.ts +++ b/clients/client-api-gateway/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./APIGatewayClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { APIGatewayClientConfig } from "./APIGatewayClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: APIGatewayClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-api-gateway/runtimeConfig.native.ts b/clients/client-api-gateway/runtimeConfig.native.ts index 49c8f907fda7..48a31a85f131 100644 --- a/clients/client-api-gateway/runtimeConfig.native.ts +++ b/clients/client-api-gateway/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./APIGatewayClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { APIGatewayClientConfig } from "./APIGatewayClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: APIGatewayClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-api-gateway/runtimeConfig.shared.ts b/clients/client-api-gateway/runtimeConfig.shared.ts index 1660821fa1be..831375ea5ab6 100644 --- a/clients/client-api-gateway/runtimeConfig.shared.ts +++ b/clients/client-api-gateway/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: APIGatewayClientConfig) => ({ apiVersion: "2015-07-09", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "API Gateway", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-api-gateway/runtimeConfig.ts b/clients/client-api-gateway/runtimeConfig.ts index a891c9534e31..fb069e599b62 100644 --- a/clients/client-api-gateway/runtimeConfig.ts +++ b/clients/client-api-gateway/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./APIGatewayClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { APIGatewayClientConfig } from "./APIGatewayClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: APIGatewayClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-apigatewaymanagementapi/ApiGatewayManagementApiClient.ts b/clients/client-apigatewaymanagementapi/ApiGatewayManagementApiClient.ts index fbbf0597278b..7fe5bb7b9714 100644 --- a/clients/client-apigatewaymanagementapi/ApiGatewayManagementApiClient.ts +++ b/clients/client-apigatewaymanagementapi/ApiGatewayManagementApiClient.ts @@ -1,7 +1,7 @@ import { DeleteConnectionCommandInput, DeleteConnectionCommandOutput } from "./commands/DeleteConnectionCommand"; import { GetConnectionCommandInput, GetConnectionCommandOutput } from "./commands/GetConnectionCommand"; import { PostToConnectionCommandInput, PostToConnectionCommandOutput } from "./commands/PostToConnectionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -214,10 +214,7 @@ export class ApiGatewayManagementApiClient extends __Client< readonly config: ApiGatewayManagementApiClientResolvedConfig; constructor(configuration: ApiGatewayManagementApiClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts index 20c197c4edd0..875de387d1d4 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ApiGatewayManagementApiClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApiGatewayManagementApiClientConfig } from "./ApiGatewayManagementApiClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts index f0b2d5154e55..07e8d18f5ef6 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ApiGatewayManagementApiClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ApiGatewayManagementApiClientConfig } from "./ApiGatewayManagementApiClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts index 0457c5ba6d61..2f903feda05a 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => ({ apiVersion: "2018-11-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ApiGatewayManagementApi", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.ts index 56df5c99a911..87fa950fb50b 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ApiGatewayManagementApiClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApiGatewayManagementApiClientConfig } from "./ApiGatewayManagementApiClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-apigatewayv2/ApiGatewayV2Client.ts b/clients/client-apigatewayv2/ApiGatewayV2Client.ts index 093898beeade..a8d88fa26d57 100644 --- a/clients/client-apigatewayv2/ApiGatewayV2Client.ts +++ b/clients/client-apigatewayv2/ApiGatewayV2Client.ts @@ -109,7 +109,7 @@ import { } from "./commands/UpdateRouteResponseCommand"; import { UpdateStageCommandInput, UpdateStageCommandOutput } from "./commands/UpdateStageCommand"; import { UpdateVpcLinkCommandInput, UpdateVpcLinkCommandOutput } from "./commands/UpdateVpcLinkCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -463,10 +463,7 @@ export class ApiGatewayV2Client extends __Client< readonly config: ApiGatewayV2ClientResolvedConfig; constructor(configuration: ApiGatewayV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-apigatewayv2/runtimeConfig.browser.ts b/clients/client-apigatewayv2/runtimeConfig.browser.ts index 616df18c5839..eb774107f37c 100644 --- a/clients/client-apigatewayv2/runtimeConfig.browser.ts +++ b/clients/client-apigatewayv2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ApiGatewayV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApiGatewayV2ClientConfig } from "./ApiGatewayV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-apigatewayv2/runtimeConfig.native.ts b/clients/client-apigatewayv2/runtimeConfig.native.ts index aa921337ba00..18dff7e1e68f 100644 --- a/clients/client-apigatewayv2/runtimeConfig.native.ts +++ b/clients/client-apigatewayv2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ApiGatewayV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ApiGatewayV2ClientConfig } from "./ApiGatewayV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-apigatewayv2/runtimeConfig.shared.ts b/clients/client-apigatewayv2/runtimeConfig.shared.ts index 47632773995b..83fc2d3ee399 100644 --- a/clients/client-apigatewayv2/runtimeConfig.shared.ts +++ b/clients/client-apigatewayv2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => ({ apiVersion: "2018-11-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ApiGatewayV2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-apigatewayv2/runtimeConfig.ts b/clients/client-apigatewayv2/runtimeConfig.ts index 9d8b4be85368..9741793fa852 100644 --- a/clients/client-apigatewayv2/runtimeConfig.ts +++ b/clients/client-apigatewayv2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ApiGatewayV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApiGatewayV2ClientConfig } from "./ApiGatewayV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-app-mesh/AppMeshClient.ts b/clients/client-app-mesh/AppMeshClient.ts index 0f3590e116fd..3b0c6a83e923 100644 --- a/clients/client-app-mesh/AppMeshClient.ts +++ b/clients/client-app-mesh/AppMeshClient.ts @@ -87,7 +87,7 @@ import { UpdateVirtualServiceCommandInput, UpdateVirtualServiceCommandOutput, } from "./commands/UpdateVirtualServiceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -385,10 +385,7 @@ export class AppMeshClient extends __Client< readonly config: AppMeshClientResolvedConfig; constructor(configuration: AppMeshClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-app-mesh/runtimeConfig.browser.ts b/clients/client-app-mesh/runtimeConfig.browser.ts index fcf6736ac87a..8e465cc48a04 100644 --- a/clients/client-app-mesh/runtimeConfig.browser.ts +++ b/clients/client-app-mesh/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppMeshClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppMeshClientConfig } from "./AppMeshClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppMeshClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-app-mesh/runtimeConfig.native.ts b/clients/client-app-mesh/runtimeConfig.native.ts index cdb957625fa2..a789dd2fe4f4 100644 --- a/clients/client-app-mesh/runtimeConfig.native.ts +++ b/clients/client-app-mesh/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppMeshClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppMeshClientConfig } from "./AppMeshClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppMeshClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-app-mesh/runtimeConfig.shared.ts b/clients/client-app-mesh/runtimeConfig.shared.ts index af2dadef3434..f38588afa141 100644 --- a/clients/client-app-mesh/runtimeConfig.shared.ts +++ b/clients/client-app-mesh/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppMeshClientConfig) => ({ apiVersion: "2019-01-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "App Mesh", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-app-mesh/runtimeConfig.ts b/clients/client-app-mesh/runtimeConfig.ts index ffa3a4f09a6e..324ba16bc204 100644 --- a/clients/client-app-mesh/runtimeConfig.ts +++ b/clients/client-app-mesh/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppMeshClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppMeshClientConfig } from "./AppMeshClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppMeshClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appconfig/AppConfigClient.ts b/clients/client-appconfig/AppConfigClient.ts index 196fe059ca4a..cf2a300f69ca 100644 --- a/clients/client-appconfig/AppConfigClient.ts +++ b/clients/client-appconfig/AppConfigClient.ts @@ -79,7 +79,7 @@ import { ValidateConfigurationCommandInput, ValidateConfigurationCommandOutput, } from "./commands/ValidateConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -403,10 +403,7 @@ export class AppConfigClient extends __Client< readonly config: AppConfigClientResolvedConfig; constructor(configuration: AppConfigClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-appconfig/runtimeConfig.browser.ts b/clients/client-appconfig/runtimeConfig.browser.ts index df97ada09ba9..51c0a8469e98 100644 --- a/clients/client-appconfig/runtimeConfig.browser.ts +++ b/clients/client-appconfig/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppConfigClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppConfigClientConfig } from "./AppConfigClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppConfigClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appconfig/runtimeConfig.native.ts b/clients/client-appconfig/runtimeConfig.native.ts index f9ab78513862..f7afb10a6c66 100644 --- a/clients/client-appconfig/runtimeConfig.native.ts +++ b/clients/client-appconfig/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppConfigClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppConfigClientConfig } from "./AppConfigClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppConfigClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-appconfig/runtimeConfig.shared.ts b/clients/client-appconfig/runtimeConfig.shared.ts index e1b514c1a150..64c719a9dc8e 100644 --- a/clients/client-appconfig/runtimeConfig.shared.ts +++ b/clients/client-appconfig/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppConfigClientConfig) => ({ apiVersion: "2019-10-09", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AppConfig", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-appconfig/runtimeConfig.ts b/clients/client-appconfig/runtimeConfig.ts index f125cb322bee..9e7b60f2dde0 100644 --- a/clients/client-appconfig/runtimeConfig.ts +++ b/clients/client-appconfig/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppConfigClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppConfigClientConfig } from "./AppConfigClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppConfigClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appflow/AppflowClient.ts b/clients/client-appflow/AppflowClient.ts index 3f5516c3eaaa..ec8688b3b127 100644 --- a/clients/client-appflow/AppflowClient.ts +++ b/clients/client-appflow/AppflowClient.ts @@ -40,7 +40,7 @@ import { UpdateConnectorProfileCommandOutput, } from "./commands/UpdateConnectorProfileCommand"; import { UpdateFlowCommandInput, UpdateFlowCommandOutput } from "./commands/UpdateFlowCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -326,10 +326,7 @@ export class AppflowClient extends __Client< readonly config: AppflowClientResolvedConfig; constructor(configuration: AppflowClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-appflow/runtimeConfig.browser.ts b/clients/client-appflow/runtimeConfig.browser.ts index b1639aaa4ee2..ac54e3e96ab1 100644 --- a/clients/client-appflow/runtimeConfig.browser.ts +++ b/clients/client-appflow/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppflowClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppflowClientConfig } from "./AppflowClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppflowClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appflow/runtimeConfig.native.ts b/clients/client-appflow/runtimeConfig.native.ts index 64fac1d075c3..1bf3cbfea880 100644 --- a/clients/client-appflow/runtimeConfig.native.ts +++ b/clients/client-appflow/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppflowClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppflowClientConfig } from "./AppflowClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppflowClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-appflow/runtimeConfig.shared.ts b/clients/client-appflow/runtimeConfig.shared.ts index 6d47bc2f6539..5f7399e6bf47 100644 --- a/clients/client-appflow/runtimeConfig.shared.ts +++ b/clients/client-appflow/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppflowClientConfig) => ({ apiVersion: "2020-08-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Appflow", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-appflow/runtimeConfig.ts b/clients/client-appflow/runtimeConfig.ts index 8afc8ff5a8b1..9657d05c985a 100644 --- a/clients/client-appflow/runtimeConfig.ts +++ b/clients/client-appflow/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppflowClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppflowClientConfig } from "./AppflowClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppflowClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appintegrations/AppIntegrationsClient.ts b/clients/client-appintegrations/AppIntegrationsClient.ts index 30b23cf6e6da..db2c277d13b8 100644 --- a/clients/client-appintegrations/AppIntegrationsClient.ts +++ b/clients/client-appintegrations/AppIntegrationsClient.ts @@ -28,7 +28,7 @@ import { UpdateEventIntegrationCommandInput, UpdateEventIntegrationCommandOutput, } from "./commands/UpdateEventIntegrationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -263,10 +263,7 @@ export class AppIntegrationsClient extends __Client< readonly config: AppIntegrationsClientResolvedConfig; constructor(configuration: AppIntegrationsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-appintegrations/runtimeConfig.browser.ts b/clients/client-appintegrations/runtimeConfig.browser.ts index 35e7150ee4ed..8de6bb23120f 100644 --- a/clients/client-appintegrations/runtimeConfig.browser.ts +++ b/clients/client-appintegrations/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppIntegrationsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppIntegrationsClientConfig } from "./AppIntegrationsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appintegrations/runtimeConfig.native.ts b/clients/client-appintegrations/runtimeConfig.native.ts index 9250dcb5f8dd..88367effd711 100644 --- a/clients/client-appintegrations/runtimeConfig.native.ts +++ b/clients/client-appintegrations/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppIntegrationsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppIntegrationsClientConfig } from "./AppIntegrationsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-appintegrations/runtimeConfig.shared.ts b/clients/client-appintegrations/runtimeConfig.shared.ts index bee7784252d8..18c3b85790c0 100644 --- a/clients/client-appintegrations/runtimeConfig.shared.ts +++ b/clients/client-appintegrations/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => ({ apiVersion: "2020-07-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AppIntegrations", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-appintegrations/runtimeConfig.ts b/clients/client-appintegrations/runtimeConfig.ts index cde7f7307cf8..a2a757663488 100644 --- a/clients/client-appintegrations/runtimeConfig.ts +++ b/clients/client-appintegrations/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppIntegrationsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppIntegrationsClientConfig } from "./AppIntegrationsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-application-auto-scaling/ApplicationAutoScalingClient.ts b/clients/client-application-auto-scaling/ApplicationAutoScalingClient.ts index 6adb9777b2a2..67b0e16fa9c4 100644 --- a/clients/client-application-auto-scaling/ApplicationAutoScalingClient.ts +++ b/clients/client-application-auto-scaling/ApplicationAutoScalingClient.ts @@ -32,7 +32,7 @@ import { RegisterScalableTargetCommandInput, RegisterScalableTargetCommandOutput, } from "./commands/RegisterScalableTargetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -329,10 +329,7 @@ export class ApplicationAutoScalingClient extends __Client< readonly config: ApplicationAutoScalingClientResolvedConfig; constructor(configuration: ApplicationAutoScalingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-application-auto-scaling/runtimeConfig.browser.ts b/clients/client-application-auto-scaling/runtimeConfig.browser.ts index 8a31a1ebe75a..9340fdce146b 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.browser.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ApplicationAutoScalingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationAutoScalingClientConfig } from "./ApplicationAutoScalingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-application-auto-scaling/runtimeConfig.native.ts b/clients/client-application-auto-scaling/runtimeConfig.native.ts index eb87b464afec..d1e15579df8f 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.native.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ApplicationAutoScalingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ApplicationAutoScalingClientConfig } from "./ApplicationAutoScalingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-application-auto-scaling/runtimeConfig.shared.ts b/clients/client-application-auto-scaling/runtimeConfig.shared.ts index 0cbe7f5cf847..620194a353aa 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.shared.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => ({ apiVersion: "2016-02-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Application Auto Scaling", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-application-auto-scaling/runtimeConfig.ts b/clients/client-application-auto-scaling/runtimeConfig.ts index 99b239089386..2340548fd805 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ApplicationAutoScalingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationAutoScalingClientConfig } from "./ApplicationAutoScalingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-application-discovery-service/ApplicationDiscoveryServiceClient.ts b/clients/client-application-discovery-service/ApplicationDiscoveryServiceClient.ts index f82527c5fccf..4afc236f7646 100644 --- a/clients/client-application-discovery-service/ApplicationDiscoveryServiceClient.ts +++ b/clients/client-application-discovery-service/ApplicationDiscoveryServiceClient.ts @@ -68,7 +68,7 @@ import { StopDataCollectionByAgentIdsCommandOutput, } from "./commands/StopDataCollectionByAgentIdsCommand"; import { UpdateApplicationCommandInput, UpdateApplicationCommandOutput } from "./commands/UpdateApplicationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -455,10 +455,7 @@ export class ApplicationDiscoveryServiceClient extends __Client< readonly config: ApplicationDiscoveryServiceClientResolvedConfig; constructor(configuration: ApplicationDiscoveryServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-application-discovery-service/runtimeConfig.browser.ts b/clients/client-application-discovery-service/runtimeConfig.browser.ts index d9fd2934ae04..154251d25a30 100644 --- a/clients/client-application-discovery-service/runtimeConfig.browser.ts +++ b/clients/client-application-discovery-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ApplicationDiscoveryServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationDiscoveryServiceClientConfig } from "./ApplicationDiscoveryServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-application-discovery-service/runtimeConfig.native.ts b/clients/client-application-discovery-service/runtimeConfig.native.ts index ecd0fd8e9b37..92b23d8c926b 100644 --- a/clients/client-application-discovery-service/runtimeConfig.native.ts +++ b/clients/client-application-discovery-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ApplicationDiscoveryServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ApplicationDiscoveryServiceClientConfig } from "./ApplicationDiscoveryServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-application-discovery-service/runtimeConfig.shared.ts b/clients/client-application-discovery-service/runtimeConfig.shared.ts index ecd4b72c4586..492b2b0a9244 100644 --- a/clients/client-application-discovery-service/runtimeConfig.shared.ts +++ b/clients/client-application-discovery-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig) => ({ apiVersion: "2015-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Application Discovery Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-application-discovery-service/runtimeConfig.ts b/clients/client-application-discovery-service/runtimeConfig.ts index 2f1838a59bc0..e165bc2d36ee 100644 --- a/clients/client-application-discovery-service/runtimeConfig.ts +++ b/clients/client-application-discovery-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ApplicationDiscoveryServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationDiscoveryServiceClientConfig } from "./ApplicationDiscoveryServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-application-insights/ApplicationInsightsClient.ts b/clients/client-application-insights/ApplicationInsightsClient.ts index 1829997eb20f..913dfef0bfa1 100644 --- a/clients/client-application-insights/ApplicationInsightsClient.ts +++ b/clients/client-application-insights/ApplicationInsightsClient.ts @@ -49,7 +49,7 @@ import { UpdateComponentConfigurationCommandOutput, } from "./commands/UpdateComponentConfigurationCommand"; import { UpdateLogPatternCommandInput, UpdateLogPatternCommandOutput } from "./commands/UpdateLogPatternCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -325,10 +325,7 @@ export class ApplicationInsightsClient extends __Client< readonly config: ApplicationInsightsClientResolvedConfig; constructor(configuration: ApplicationInsightsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-application-insights/runtimeConfig.browser.ts b/clients/client-application-insights/runtimeConfig.browser.ts index 44808d3aba0e..51c779f60f58 100644 --- a/clients/client-application-insights/runtimeConfig.browser.ts +++ b/clients/client-application-insights/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ApplicationInsightsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationInsightsClientConfig } from "./ApplicationInsightsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-application-insights/runtimeConfig.native.ts b/clients/client-application-insights/runtimeConfig.native.ts index 519b6c7c7983..fd1245431ea9 100644 --- a/clients/client-application-insights/runtimeConfig.native.ts +++ b/clients/client-application-insights/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ApplicationInsightsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ApplicationInsightsClientConfig } from "./ApplicationInsightsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-application-insights/runtimeConfig.shared.ts b/clients/client-application-insights/runtimeConfig.shared.ts index af2c71f44f57..91e509070dee 100644 --- a/clients/client-application-insights/runtimeConfig.shared.ts +++ b/clients/client-application-insights/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => ({ apiVersion: "2018-11-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Application Insights", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-application-insights/runtimeConfig.ts b/clients/client-application-insights/runtimeConfig.ts index 6b0a96d225aa..9dbb6863abd3 100644 --- a/clients/client-application-insights/runtimeConfig.ts +++ b/clients/client-application-insights/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ApplicationInsightsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationInsightsClientConfig } from "./ApplicationInsightsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-applicationcostprofiler/ApplicationCostProfilerClient.ts b/clients/client-applicationcostprofiler/ApplicationCostProfilerClient.ts index 19893871d5e9..fc7efb9f8925 100644 --- a/clients/client-applicationcostprofiler/ApplicationCostProfilerClient.ts +++ b/clients/client-applicationcostprofiler/ApplicationCostProfilerClient.ts @@ -22,7 +22,7 @@ import { UpdateReportDefinitionCommandInput, UpdateReportDefinitionCommandOutput, } from "./commands/UpdateReportDefinitionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -249,10 +249,7 @@ export class ApplicationCostProfilerClient extends __Client< readonly config: ApplicationCostProfilerClientResolvedConfig; constructor(configuration: ApplicationCostProfilerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-applicationcostprofiler/runtimeConfig.browser.ts b/clients/client-applicationcostprofiler/runtimeConfig.browser.ts index 4025cb9303e3..94afd4c69fd9 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.browser.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ApplicationCostProfilerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationCostProfilerClientConfig } from "./ApplicationCostProfilerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-applicationcostprofiler/runtimeConfig.native.ts b/clients/client-applicationcostprofiler/runtimeConfig.native.ts index c2c893ca1d7c..42b4c685d62c 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.native.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ApplicationCostProfilerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ApplicationCostProfilerClientConfig } from "./ApplicationCostProfilerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-applicationcostprofiler/runtimeConfig.shared.ts b/clients/client-applicationcostprofiler/runtimeConfig.shared.ts index 089777422507..41fc8c4d9cdd 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.shared.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => ({ apiVersion: "2020-09-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ApplicationCostProfiler", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-applicationcostprofiler/runtimeConfig.ts b/clients/client-applicationcostprofiler/runtimeConfig.ts index ab1dea0ef29f..e0106ca0ccc7 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ApplicationCostProfilerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ApplicationCostProfilerClientConfig } from "./ApplicationCostProfilerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-apprunner/AppRunnerClient.ts b/clients/client-apprunner/AppRunnerClient.ts index 4eeaa0684515..0c8a9cfcdfae 100644 --- a/clients/client-apprunner/AppRunnerClient.ts +++ b/clients/client-apprunner/AppRunnerClient.ts @@ -44,7 +44,7 @@ import { StartDeploymentCommandInput, StartDeploymentCommandOutput } from "./com import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateServiceCommandInput, UpdateServiceCommandOutput } from "./commands/UpdateServiceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -317,10 +317,7 @@ export class AppRunnerClient extends __Client< readonly config: AppRunnerClientResolvedConfig; constructor(configuration: AppRunnerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-apprunner/runtimeConfig.browser.ts b/clients/client-apprunner/runtimeConfig.browser.ts index d2d345831008..f1bcb1e465b6 100644 --- a/clients/client-apprunner/runtimeConfig.browser.ts +++ b/clients/client-apprunner/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppRunnerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppRunnerClientConfig } from "./AppRunnerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppRunnerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-apprunner/runtimeConfig.native.ts b/clients/client-apprunner/runtimeConfig.native.ts index 2e21b1f75054..1ab920a2547e 100644 --- a/clients/client-apprunner/runtimeConfig.native.ts +++ b/clients/client-apprunner/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppRunnerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppRunnerClientConfig } from "./AppRunnerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppRunnerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-apprunner/runtimeConfig.shared.ts b/clients/client-apprunner/runtimeConfig.shared.ts index ae8bf0c2889d..f303435e66c0 100644 --- a/clients/client-apprunner/runtimeConfig.shared.ts +++ b/clients/client-apprunner/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppRunnerClientConfig) => ({ apiVersion: "2020-05-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AppRunner", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-apprunner/runtimeConfig.ts b/clients/client-apprunner/runtimeConfig.ts index 55a1762ca309..c4948467f561 100644 --- a/clients/client-apprunner/runtimeConfig.ts +++ b/clients/client-apprunner/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppRunnerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppRunnerClientConfig } from "./AppRunnerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppRunnerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appstream/AppStreamClient.ts b/clients/client-appstream/AppStreamClient.ts index 851c57f03e57..ff69195c872e 100644 --- a/clients/client-appstream/AppStreamClient.ts +++ b/clients/client-appstream/AppStreamClient.ts @@ -100,7 +100,7 @@ import { UpdateImagePermissionsCommandOutput, } from "./commands/UpdateImagePermissionsCommand"; import { UpdateStackCommandInput, UpdateStackCommandOutput } from "./commands/UpdateStackCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -426,10 +426,7 @@ export class AppStreamClient extends __Client< readonly config: AppStreamClientResolvedConfig; constructor(configuration: AppStreamClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-appstream/runtimeConfig.browser.ts b/clients/client-appstream/runtimeConfig.browser.ts index 911620f684c8..fbe936e1ec3b 100644 --- a/clients/client-appstream/runtimeConfig.browser.ts +++ b/clients/client-appstream/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppStreamClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppStreamClientConfig } from "./AppStreamClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppStreamClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appstream/runtimeConfig.native.ts b/clients/client-appstream/runtimeConfig.native.ts index c1a80300960a..0b394c83570c 100644 --- a/clients/client-appstream/runtimeConfig.native.ts +++ b/clients/client-appstream/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppStreamClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppStreamClientConfig } from "./AppStreamClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppStreamClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-appstream/runtimeConfig.shared.ts b/clients/client-appstream/runtimeConfig.shared.ts index ed6cfaa3f35c..4834f533423f 100644 --- a/clients/client-appstream/runtimeConfig.shared.ts +++ b/clients/client-appstream/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppStreamClientConfig) => ({ apiVersion: "2016-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AppStream", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-appstream/runtimeConfig.ts b/clients/client-appstream/runtimeConfig.ts index 77aa0598d1f6..a76c8c80bb87 100644 --- a/clients/client-appstream/runtimeConfig.ts +++ b/clients/client-appstream/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppStreamClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppStreamClientConfig } from "./AppStreamClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppStreamClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appsync/AppSyncClient.ts b/clients/client-appsync/AppSyncClient.ts index fb1b5e39a32f..5cfc6e736e32 100644 --- a/clients/client-appsync/AppSyncClient.ts +++ b/clients/client-appsync/AppSyncClient.ts @@ -54,7 +54,7 @@ import { UpdateFunctionCommandInput, UpdateFunctionCommandOutput } from "./comma import { UpdateGraphqlApiCommandInput, UpdateGraphqlApiCommandOutput } from "./commands/UpdateGraphqlApiCommand"; import { UpdateResolverCommandInput, UpdateResolverCommandOutput } from "./commands/UpdateResolverCommand"; import { UpdateTypeCommandInput, UpdateTypeCommandOutput } from "./commands/UpdateTypeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -347,10 +347,7 @@ export class AppSyncClient extends __Client< readonly config: AppSyncClientResolvedConfig; constructor(configuration: AppSyncClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-appsync/runtimeConfig.browser.ts b/clients/client-appsync/runtimeConfig.browser.ts index 5dc7aebe9344..318ee565e941 100644 --- a/clients/client-appsync/runtimeConfig.browser.ts +++ b/clients/client-appsync/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AppSyncClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppSyncClientConfig } from "./AppSyncClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppSyncClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-appsync/runtimeConfig.native.ts b/clients/client-appsync/runtimeConfig.native.ts index 654490b403a8..6b6bd4748415 100644 --- a/clients/client-appsync/runtimeConfig.native.ts +++ b/clients/client-appsync/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AppSyncClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AppSyncClientConfig } from "./AppSyncClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AppSyncClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-appsync/runtimeConfig.shared.ts b/clients/client-appsync/runtimeConfig.shared.ts index 0489f39874db..76614ea2cb7a 100644 --- a/clients/client-appsync/runtimeConfig.shared.ts +++ b/clients/client-appsync/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AppSyncClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AppSync", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-appsync/runtimeConfig.ts b/clients/client-appsync/runtimeConfig.ts index 1ea96d492d52..fd6f77e4a863 100644 --- a/clients/client-appsync/runtimeConfig.ts +++ b/clients/client-appsync/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AppSyncClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AppSyncClientConfig } from "./AppSyncClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AppSyncClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-athena/AthenaClient.ts b/clients/client-athena/AthenaClient.ts index 79ed0e075a53..2d5222790944 100644 --- a/clients/client-athena/AthenaClient.ts +++ b/clients/client-athena/AthenaClient.ts @@ -59,7 +59,7 @@ import { UpdatePreparedStatementCommandOutput, } from "./commands/UpdatePreparedStatementCommand"; import { UpdateWorkGroupCommandInput, UpdateWorkGroupCommandOutput } from "./commands/UpdateWorkGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -349,10 +349,7 @@ export class AthenaClient extends __Client< readonly config: AthenaClientResolvedConfig; constructor(configuration: AthenaClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-athena/runtimeConfig.browser.ts b/clients/client-athena/runtimeConfig.browser.ts index 4af4ba97c133..50a6d14a8312 100644 --- a/clients/client-athena/runtimeConfig.browser.ts +++ b/clients/client-athena/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AthenaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AthenaClientConfig } from "./AthenaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AthenaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-athena/runtimeConfig.native.ts b/clients/client-athena/runtimeConfig.native.ts index 52bf91eea9a3..68b91cd4a767 100644 --- a/clients/client-athena/runtimeConfig.native.ts +++ b/clients/client-athena/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AthenaClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AthenaClientConfig } from "./AthenaClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AthenaClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-athena/runtimeConfig.shared.ts b/clients/client-athena/runtimeConfig.shared.ts index c49b540b0da2..6bf9fafee104 100644 --- a/clients/client-athena/runtimeConfig.shared.ts +++ b/clients/client-athena/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AthenaClientConfig) => ({ apiVersion: "2017-05-18", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Athena", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-athena/runtimeConfig.ts b/clients/client-athena/runtimeConfig.ts index b09318a378dd..4a1cd0116c55 100644 --- a/clients/client-athena/runtimeConfig.ts +++ b/clients/client-athena/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AthenaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AthenaClientConfig } from "./AthenaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AthenaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-auditmanager/AuditManagerClient.ts b/clients/client-auditmanager/AuditManagerClient.ts index e550387e23de..8a14c251c326 100644 --- a/clients/client-auditmanager/AuditManagerClient.ts +++ b/clients/client-auditmanager/AuditManagerClient.ts @@ -133,7 +133,7 @@ import { ValidateAssessmentReportIntegrityCommandInput, ValidateAssessmentReportIntegrityCommandOutput, } from "./commands/ValidateAssessmentReportIntegrityCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -481,10 +481,7 @@ export class AuditManagerClient extends __Client< readonly config: AuditManagerClientResolvedConfig; constructor(configuration: AuditManagerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-auditmanager/runtimeConfig.browser.ts b/clients/client-auditmanager/runtimeConfig.browser.ts index 1b7fd7ef03e1..21881a3e84a6 100644 --- a/clients/client-auditmanager/runtimeConfig.browser.ts +++ b/clients/client-auditmanager/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AuditManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AuditManagerClientConfig } from "./AuditManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AuditManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-auditmanager/runtimeConfig.native.ts b/clients/client-auditmanager/runtimeConfig.native.ts index 39f3318e0fea..7d23d2466100 100644 --- a/clients/client-auditmanager/runtimeConfig.native.ts +++ b/clients/client-auditmanager/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AuditManagerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AuditManagerClientConfig } from "./AuditManagerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AuditManagerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-auditmanager/runtimeConfig.shared.ts b/clients/client-auditmanager/runtimeConfig.shared.ts index 4b1685d4eca6..e1256494cd52 100644 --- a/clients/client-auditmanager/runtimeConfig.shared.ts +++ b/clients/client-auditmanager/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AuditManagerClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "AuditManager", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-auditmanager/runtimeConfig.ts b/clients/client-auditmanager/runtimeConfig.ts index bbf4aa27a147..322ffd641f99 100644 --- a/clients/client-auditmanager/runtimeConfig.ts +++ b/clients/client-auditmanager/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AuditManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AuditManagerClientConfig } from "./AuditManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AuditManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-auto-scaling-plans/AutoScalingPlansClient.ts b/clients/client-auto-scaling-plans/AutoScalingPlansClient.ts index 7a46225fa09f..7afbff7a0c33 100644 --- a/clients/client-auto-scaling-plans/AutoScalingPlansClient.ts +++ b/clients/client-auto-scaling-plans/AutoScalingPlansClient.ts @@ -13,7 +13,7 @@ import { GetScalingPlanResourceForecastDataCommandOutput, } from "./commands/GetScalingPlanResourceForecastDataCommand"; import { UpdateScalingPlanCommandInput, UpdateScalingPlanCommandOutput } from "./commands/UpdateScalingPlanCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -269,10 +269,7 @@ export class AutoScalingPlansClient extends __Client< readonly config: AutoScalingPlansClientResolvedConfig; constructor(configuration: AutoScalingPlansClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-auto-scaling-plans/runtimeConfig.browser.ts b/clients/client-auto-scaling-plans/runtimeConfig.browser.ts index b7313c434d67..26ad2cd6dc1a 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.browser.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AutoScalingPlansClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AutoScalingPlansClientConfig } from "./AutoScalingPlansClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-auto-scaling-plans/runtimeConfig.native.ts b/clients/client-auto-scaling-plans/runtimeConfig.native.ts index 0905c5413195..9230a3edfe30 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.native.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AutoScalingPlansClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AutoScalingPlansClientConfig } from "./AutoScalingPlansClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-auto-scaling-plans/runtimeConfig.shared.ts b/clients/client-auto-scaling-plans/runtimeConfig.shared.ts index 50bc6d681c7e..8d44a1462c2a 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.shared.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => ({ apiVersion: "2018-01-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Auto Scaling Plans", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-auto-scaling-plans/runtimeConfig.ts b/clients/client-auto-scaling-plans/runtimeConfig.ts index 98519490369b..f6ac522cd856 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AutoScalingPlansClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AutoScalingPlansClientConfig } from "./AutoScalingPlansClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-auto-scaling/AutoScalingClient.ts b/clients/client-auto-scaling/AutoScalingClient.ts index 0fd90f9d6bd2..18535032fbd7 100644 --- a/clients/client-auto-scaling/AutoScalingClient.ts +++ b/clients/client-auto-scaling/AutoScalingClient.ts @@ -185,7 +185,7 @@ import { UpdateAutoScalingGroupCommandInput, UpdateAutoScalingGroupCommandOutput, } from "./commands/UpdateAutoScalingGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -530,10 +530,7 @@ export class AutoScalingClient extends __Client< readonly config: AutoScalingClientResolvedConfig; constructor(configuration: AutoScalingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-auto-scaling/runtimeConfig.browser.ts b/clients/client-auto-scaling/runtimeConfig.browser.ts index f08e8ec1df53..8a7981ef42a6 100644 --- a/clients/client-auto-scaling/runtimeConfig.browser.ts +++ b/clients/client-auto-scaling/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./AutoScalingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AutoScalingClientConfig } from "./AutoScalingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AutoScalingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-auto-scaling/runtimeConfig.native.ts b/clients/client-auto-scaling/runtimeConfig.native.ts index b8a92bbc4f9c..b33ea892e40b 100644 --- a/clients/client-auto-scaling/runtimeConfig.native.ts +++ b/clients/client-auto-scaling/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./AutoScalingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { AutoScalingClientConfig } from "./AutoScalingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: AutoScalingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-auto-scaling/runtimeConfig.shared.ts b/clients/client-auto-scaling/runtimeConfig.shared.ts index 340c7042ad91..6dedc161e346 100644 --- a/clients/client-auto-scaling/runtimeConfig.shared.ts +++ b/clients/client-auto-scaling/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: AutoScalingClientConfig) => ({ apiVersion: "2011-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Auto Scaling", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-auto-scaling/runtimeConfig.ts b/clients/client-auto-scaling/runtimeConfig.ts index 97ce8a17801b..cb24b9688838 100644 --- a/clients/client-auto-scaling/runtimeConfig.ts +++ b/clients/client-auto-scaling/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./AutoScalingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { AutoScalingClientConfig } from "./AutoScalingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: AutoScalingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-backup/BackupClient.ts b/clients/client-backup/BackupClient.ts index f1273e4bfbac..27c39804dd78 100644 --- a/clients/client-backup/BackupClient.ts +++ b/clients/client-backup/BackupClient.ts @@ -136,7 +136,7 @@ import { UpdateRegionSettingsCommandInput, UpdateRegionSettingsCommandOutput, } from "./commands/UpdateRegionSettingsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -451,10 +451,7 @@ export class BackupClient extends __Client< readonly config: BackupClientResolvedConfig; constructor(configuration: BackupClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-backup/runtimeConfig.browser.ts b/clients/client-backup/runtimeConfig.browser.ts index ad193624ad78..79315c3f0519 100644 --- a/clients/client-backup/runtimeConfig.browser.ts +++ b/clients/client-backup/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./BackupClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BackupClientConfig } from "./BackupClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BackupClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-backup/runtimeConfig.native.ts b/clients/client-backup/runtimeConfig.native.ts index 32126933e41a..263f86f04c7a 100644 --- a/clients/client-backup/runtimeConfig.native.ts +++ b/clients/client-backup/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./BackupClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { BackupClientConfig } from "./BackupClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: BackupClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-backup/runtimeConfig.shared.ts b/clients/client-backup/runtimeConfig.shared.ts index a91555241ba5..2db2d7d8d06d 100644 --- a/clients/client-backup/runtimeConfig.shared.ts +++ b/clients/client-backup/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: BackupClientConfig) => ({ apiVersion: "2018-11-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Backup", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-backup/runtimeConfig.ts b/clients/client-backup/runtimeConfig.ts index 03120297cd84..497334c10cd0 100644 --- a/clients/client-backup/runtimeConfig.ts +++ b/clients/client-backup/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./BackupClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BackupClientConfig } from "./BackupClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BackupClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-batch/BatchClient.ts b/clients/client-batch/BatchClient.ts index 15a8882a9a60..598907ae2be4 100644 --- a/clients/client-batch/BatchClient.ts +++ b/clients/client-batch/BatchClient.ts @@ -41,7 +41,7 @@ import { UpdateComputeEnvironmentCommandOutput, } from "./commands/UpdateComputeEnvironmentCommand"; import { UpdateJobQueueCommandInput, UpdateJobQueueCommandOutput } from "./commands/UpdateJobQueueCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -298,10 +298,7 @@ export class BatchClient extends __Client< readonly config: BatchClientResolvedConfig; constructor(configuration: BatchClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-batch/runtimeConfig.browser.ts b/clients/client-batch/runtimeConfig.browser.ts index 8fea008eae84..e209ad761646 100644 --- a/clients/client-batch/runtimeConfig.browser.ts +++ b/clients/client-batch/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./BatchClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BatchClientConfig } from "./BatchClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BatchClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-batch/runtimeConfig.native.ts b/clients/client-batch/runtimeConfig.native.ts index fdb8beb9d309..73bb573704c5 100644 --- a/clients/client-batch/runtimeConfig.native.ts +++ b/clients/client-batch/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./BatchClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { BatchClientConfig } from "./BatchClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: BatchClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-batch/runtimeConfig.shared.ts b/clients/client-batch/runtimeConfig.shared.ts index 9bcc09bfd0db..54ebdb65bc16 100644 --- a/clients/client-batch/runtimeConfig.shared.ts +++ b/clients/client-batch/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: BatchClientConfig) => ({ apiVersion: "2016-08-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Batch", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-batch/runtimeConfig.ts b/clients/client-batch/runtimeConfig.ts index ce60cebe443e..4cd9e04e7c27 100644 --- a/clients/client-batch/runtimeConfig.ts +++ b/clients/client-batch/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./BatchClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BatchClientConfig } from "./BatchClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BatchClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-braket/BraketClient.ts b/clients/client-braket/BraketClient.ts index a3b350f41712..67f2b2d9649b 100644 --- a/clients/client-braket/BraketClient.ts +++ b/clients/client-braket/BraketClient.ts @@ -10,7 +10,7 @@ import { SearchDevicesCommandInput, SearchDevicesCommandOutput } from "./command import { SearchQuantumTasksCommandInput, SearchQuantumTasksCommandOutput } from "./commands/SearchQuantumTasksCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -238,10 +238,7 @@ export class BraketClient extends __Client< readonly config: BraketClientResolvedConfig; constructor(configuration: BraketClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-braket/runtimeConfig.browser.ts b/clients/client-braket/runtimeConfig.browser.ts index 0cd448919840..5e68f9d18bdd 100644 --- a/clients/client-braket/runtimeConfig.browser.ts +++ b/clients/client-braket/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./BraketClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BraketClientConfig } from "./BraketClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BraketClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-braket/runtimeConfig.native.ts b/clients/client-braket/runtimeConfig.native.ts index 9854850cc854..d6d57fa580e3 100644 --- a/clients/client-braket/runtimeConfig.native.ts +++ b/clients/client-braket/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./BraketClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { BraketClientConfig } from "./BraketClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: BraketClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-braket/runtimeConfig.shared.ts b/clients/client-braket/runtimeConfig.shared.ts index cc025b8ef97b..ace8c7f5e937 100644 --- a/clients/client-braket/runtimeConfig.shared.ts +++ b/clients/client-braket/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: BraketClientConfig) => ({ apiVersion: "2019-09-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Braket", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-braket/runtimeConfig.ts b/clients/client-braket/runtimeConfig.ts index 86f82c0d44a5..d399205b0013 100644 --- a/clients/client-braket/runtimeConfig.ts +++ b/clients/client-braket/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./BraketClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BraketClientConfig } from "./BraketClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BraketClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-budgets/BudgetsClient.ts b/clients/client-budgets/BudgetsClient.ts index d381fc27962c..4774f477ea20 100644 --- a/clients/client-budgets/BudgetsClient.ts +++ b/clients/client-budgets/BudgetsClient.ts @@ -44,7 +44,7 @@ import { UpdateBudgetActionCommandInput, UpdateBudgetActionCommandOutput } from import { UpdateBudgetCommandInput, UpdateBudgetCommandOutput } from "./commands/UpdateBudgetCommand"; import { UpdateNotificationCommandInput, UpdateNotificationCommandOutput } from "./commands/UpdateNotificationCommand"; import { UpdateSubscriberCommandInput, UpdateSubscriberCommandOutput } from "./commands/UpdateSubscriberCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -340,10 +340,7 @@ export class BudgetsClient extends __Client< readonly config: BudgetsClientResolvedConfig; constructor(configuration: BudgetsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-budgets/runtimeConfig.browser.ts b/clients/client-budgets/runtimeConfig.browser.ts index 9c3f8ebe80e3..10ca56c80dad 100644 --- a/clients/client-budgets/runtimeConfig.browser.ts +++ b/clients/client-budgets/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./BudgetsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BudgetsClientConfig } from "./BudgetsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BudgetsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-budgets/runtimeConfig.native.ts b/clients/client-budgets/runtimeConfig.native.ts index 71ca5b3adbf2..1816ab11a6c4 100644 --- a/clients/client-budgets/runtimeConfig.native.ts +++ b/clients/client-budgets/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./BudgetsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { BudgetsClientConfig } from "./BudgetsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: BudgetsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-budgets/runtimeConfig.shared.ts b/clients/client-budgets/runtimeConfig.shared.ts index 5d821abfa43f..42d3b8d21f67 100644 --- a/clients/client-budgets/runtimeConfig.shared.ts +++ b/clients/client-budgets/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: BudgetsClientConfig) => ({ apiVersion: "2016-10-20", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Budgets", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-budgets/runtimeConfig.ts b/clients/client-budgets/runtimeConfig.ts index b2058eb29a75..9886143724d3 100644 --- a/clients/client-budgets/runtimeConfig.ts +++ b/clients/client-budgets/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./BudgetsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { BudgetsClientConfig } from "./BudgetsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: BudgetsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-chime/ChimeClient.ts b/clients/client-chime/ChimeClient.ts index e1eadb91c5d9..a2fd5db22231 100644 --- a/clients/client-chime/ChimeClient.ts +++ b/clients/client-chime/ChimeClient.ts @@ -522,7 +522,7 @@ import { UpdateVoiceConnectorGroupCommandInput, UpdateVoiceConnectorGroupCommandOutput, } from "./commands/UpdateVoiceConnectorGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -1147,10 +1147,7 @@ export class ChimeClient extends __Client< readonly config: ChimeClientResolvedConfig; constructor(configuration: ChimeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-chime/runtimeConfig.browser.ts b/clients/client-chime/runtimeConfig.browser.ts index 4e167a2b08b1..a5820b0e3c7e 100644 --- a/clients/client-chime/runtimeConfig.browser.ts +++ b/clients/client-chime/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ChimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ChimeClientConfig } from "./ChimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ChimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-chime/runtimeConfig.native.ts b/clients/client-chime/runtimeConfig.native.ts index 61c525ebffc4..e79da1753faf 100644 --- a/clients/client-chime/runtimeConfig.native.ts +++ b/clients/client-chime/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ChimeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ChimeClientConfig } from "./ChimeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ChimeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-chime/runtimeConfig.shared.ts b/clients/client-chime/runtimeConfig.shared.ts index a9d41c9d370f..e5d18e9f30b5 100644 --- a/clients/client-chime/runtimeConfig.shared.ts +++ b/clients/client-chime/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ChimeClientConfig) => ({ apiVersion: "2018-05-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Chime", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-chime/runtimeConfig.ts b/clients/client-chime/runtimeConfig.ts index 5e3e0ec21e9d..e562141a7ff3 100644 --- a/clients/client-chime/runtimeConfig.ts +++ b/clients/client-chime/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ChimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ChimeClientConfig } from "./ChimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ChimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloud9/Cloud9Client.ts b/clients/client-cloud9/Cloud9Client.ts index e3ec2f2050eb..8b4dc6184659 100644 --- a/clients/client-cloud9/Cloud9Client.ts +++ b/clients/client-cloud9/Cloud9Client.ts @@ -35,7 +35,7 @@ import { UpdateEnvironmentMembershipCommandInput, UpdateEnvironmentMembershipCommandOutput, } from "./commands/UpdateEnvironmentMembershipCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -337,10 +337,7 @@ export class Cloud9Client extends __Client< readonly config: Cloud9ClientResolvedConfig; constructor(configuration: Cloud9ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloud9/runtimeConfig.browser.ts b/clients/client-cloud9/runtimeConfig.browser.ts index 763cf2a11356..4eadc599c97b 100644 --- a/clients/client-cloud9/runtimeConfig.browser.ts +++ b/clients/client-cloud9/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./Cloud9Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Cloud9ClientConfig } from "./Cloud9Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Cloud9ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloud9/runtimeConfig.native.ts b/clients/client-cloud9/runtimeConfig.native.ts index b5bfa055e193..2db9112e9d3c 100644 --- a/clients/client-cloud9/runtimeConfig.native.ts +++ b/clients/client-cloud9/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./Cloud9Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { Cloud9ClientConfig } from "./Cloud9Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: Cloud9ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloud9/runtimeConfig.shared.ts b/clients/client-cloud9/runtimeConfig.shared.ts index f3e4ffb2e617..1bdb31db3fe5 100644 --- a/clients/client-cloud9/runtimeConfig.shared.ts +++ b/clients/client-cloud9/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: Cloud9ClientConfig) => ({ apiVersion: "2017-09-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Cloud9", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloud9/runtimeConfig.ts b/clients/client-cloud9/runtimeConfig.ts index be391363a211..33fda76e29cc 100644 --- a/clients/client-cloud9/runtimeConfig.ts +++ b/clients/client-cloud9/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./Cloud9Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Cloud9ClientConfig } from "./Cloud9Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Cloud9ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-clouddirectory/CloudDirectoryClient.ts b/clients/client-clouddirectory/CloudDirectoryClient.ts index 73afc3850e5f..a014dd9a1a78 100644 --- a/clients/client-clouddirectory/CloudDirectoryClient.ts +++ b/clients/client-clouddirectory/CloudDirectoryClient.ts @@ -142,7 +142,7 @@ import { UpgradePublishedSchemaCommandInput, UpgradePublishedSchemaCommandOutput, } from "./commands/UpgradePublishedSchemaCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -489,10 +489,7 @@ export class CloudDirectoryClient extends __Client< readonly config: CloudDirectoryClientResolvedConfig; constructor(configuration: CloudDirectoryClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-clouddirectory/runtimeConfig.browser.ts b/clients/client-clouddirectory/runtimeConfig.browser.ts index 4d1089cd137c..30cb36da4f60 100644 --- a/clients/client-clouddirectory/runtimeConfig.browser.ts +++ b/clients/client-clouddirectory/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudDirectoryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudDirectoryClientConfig } from "./CloudDirectoryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-clouddirectory/runtimeConfig.native.ts b/clients/client-clouddirectory/runtimeConfig.native.ts index 19d66ff266e0..e7ac4035e9f3 100644 --- a/clients/client-clouddirectory/runtimeConfig.native.ts +++ b/clients/client-clouddirectory/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudDirectoryClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudDirectoryClientConfig } from "./CloudDirectoryClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-clouddirectory/runtimeConfig.shared.ts b/clients/client-clouddirectory/runtimeConfig.shared.ts index e78dd55e2441..22af83c5b64a 100644 --- a/clients/client-clouddirectory/runtimeConfig.shared.ts +++ b/clients/client-clouddirectory/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => ({ apiVersion: "2017-01-11", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudDirectory", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-clouddirectory/runtimeConfig.ts b/clients/client-clouddirectory/runtimeConfig.ts index 3db5f431b337..c71ed505e0cb 100644 --- a/clients/client-clouddirectory/runtimeConfig.ts +++ b/clients/client-clouddirectory/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudDirectoryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudDirectoryClientConfig } from "./CloudDirectoryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudformation/CloudFormationClient.ts b/clients/client-cloudformation/CloudFormationClient.ts index 29615d337a6c..7b27d59e824c 100644 --- a/clients/client-cloudformation/CloudFormationClient.ts +++ b/clients/client-cloudformation/CloudFormationClient.ts @@ -136,7 +136,7 @@ import { UpdateTerminationProtectionCommandOutput, } from "./commands/UpdateTerminationProtectionCommand"; import { ValidateTemplateCommandInput, ValidateTemplateCommandOutput } from "./commands/ValidateTemplateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -486,10 +486,7 @@ export class CloudFormationClient extends __Client< readonly config: CloudFormationClientResolvedConfig; constructor(configuration: CloudFormationClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudformation/runtimeConfig.browser.ts b/clients/client-cloudformation/runtimeConfig.browser.ts index 4ab277aee21f..9a2267815670 100644 --- a/clients/client-cloudformation/runtimeConfig.browser.ts +++ b/clients/client-cloudformation/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudFormationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudFormationClientConfig } from "./CloudFormationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudFormationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudformation/runtimeConfig.native.ts b/clients/client-cloudformation/runtimeConfig.native.ts index d76c0e3c37bb..9b7e753d7549 100644 --- a/clients/client-cloudformation/runtimeConfig.native.ts +++ b/clients/client-cloudformation/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudFormationClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudFormationClientConfig } from "./CloudFormationClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudFormationClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudformation/runtimeConfig.shared.ts b/clients/client-cloudformation/runtimeConfig.shared.ts index b58bda278ff9..fdfbcee258aa 100644 --- a/clients/client-cloudformation/runtimeConfig.shared.ts +++ b/clients/client-cloudformation/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudFormationClientConfig) => ({ apiVersion: "2010-05-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudFormation", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudformation/runtimeConfig.ts b/clients/client-cloudformation/runtimeConfig.ts index f58933d7ee85..4b4234429245 100644 --- a/clients/client-cloudformation/runtimeConfig.ts +++ b/clients/client-cloudformation/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudFormationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudFormationClientConfig } from "./CloudFormationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudFormationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudfront/CloudFrontClient.ts b/clients/client-cloudfront/CloudFrontClient.ts index bd0cf3c95e00..7bc155d46859 100644 --- a/clients/client-cloudfront/CloudFrontClient.ts +++ b/clients/client-cloudfront/CloudFrontClient.ts @@ -230,7 +230,7 @@ import { UpdateStreamingDistributionCommandInput, UpdateStreamingDistributionCommandOutput, } from "./commands/UpdateStreamingDistributionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -613,10 +613,7 @@ export class CloudFrontClient extends __Client< readonly config: CloudFrontClientResolvedConfig; constructor(configuration: CloudFrontClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudfront/runtimeConfig.browser.ts b/clients/client-cloudfront/runtimeConfig.browser.ts index a76fb470340b..7935c014c867 100644 --- a/clients/client-cloudfront/runtimeConfig.browser.ts +++ b/clients/client-cloudfront/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudFrontClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudFrontClientConfig } from "./CloudFrontClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudFrontClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudfront/runtimeConfig.native.ts b/clients/client-cloudfront/runtimeConfig.native.ts index 772b6ed797b8..1310d0c9a673 100644 --- a/clients/client-cloudfront/runtimeConfig.native.ts +++ b/clients/client-cloudfront/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudFrontClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudFrontClientConfig } from "./CloudFrontClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudFrontClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudfront/runtimeConfig.shared.ts b/clients/client-cloudfront/runtimeConfig.shared.ts index 2a35df519d2c..a26a88d5c3c3 100644 --- a/clients/client-cloudfront/runtimeConfig.shared.ts +++ b/clients/client-cloudfront/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudFrontClientConfig) => ({ apiVersion: "2020-05-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudFront", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudfront/runtimeConfig.ts b/clients/client-cloudfront/runtimeConfig.ts index c4d953e3e47d..c8cb1e6fe6bb 100644 --- a/clients/client-cloudfront/runtimeConfig.ts +++ b/clients/client-cloudfront/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudFrontClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudFrontClientConfig } from "./CloudFrontClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudFrontClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudhsm-v2/CloudHSMV2Client.ts b/clients/client-cloudhsm-v2/CloudHSMV2Client.ts index 5dbd39d36371..4d3f3e4a80a5 100644 --- a/clients/client-cloudhsm-v2/CloudHSMV2Client.ts +++ b/clients/client-cloudhsm-v2/CloudHSMV2Client.ts @@ -16,7 +16,7 @@ import { ModifyClusterCommandInput, ModifyClusterCommandOutput } from "./command import { RestoreBackupCommandInput, RestoreBackupCommandOutput } from "./commands/RestoreBackupCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -257,10 +257,7 @@ export class CloudHSMV2Client extends __Client< readonly config: CloudHSMV2ClientResolvedConfig; constructor(configuration: CloudHSMV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudhsm-v2/runtimeConfig.browser.ts b/clients/client-cloudhsm-v2/runtimeConfig.browser.ts index f41d6b7616f5..de043bcaeb1c 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.browser.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudHSMV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudHSMV2ClientConfig } from "./CloudHSMV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudhsm-v2/runtimeConfig.native.ts b/clients/client-cloudhsm-v2/runtimeConfig.native.ts index 415b48dd6f42..a425ef3525c8 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.native.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudHSMV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudHSMV2ClientConfig } from "./CloudHSMV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudhsm-v2/runtimeConfig.shared.ts b/clients/client-cloudhsm-v2/runtimeConfig.shared.ts index f6765127fc69..e851195c6e2b 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.shared.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => ({ apiVersion: "2017-04-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudHSM V2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudhsm-v2/runtimeConfig.ts b/clients/client-cloudhsm-v2/runtimeConfig.ts index 84c861d78c56..011190a259af 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudHSMV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudHSMV2ClientConfig } from "./CloudHSMV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudhsm/CloudHSMClient.ts b/clients/client-cloudhsm/CloudHSMClient.ts index 15ca381aac4e..8c68235f2acd 100644 --- a/clients/client-cloudhsm/CloudHSMClient.ts +++ b/clients/client-cloudhsm/CloudHSMClient.ts @@ -24,7 +24,7 @@ import { RemoveTagsFromResourceCommandInput, RemoveTagsFromResourceCommandOutput, } from "./commands/RemoveTagsFromResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -284,10 +284,7 @@ export class CloudHSMClient extends __Client< readonly config: CloudHSMClientResolvedConfig; constructor(configuration: CloudHSMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudhsm/runtimeConfig.browser.ts b/clients/client-cloudhsm/runtimeConfig.browser.ts index 9a484bd1f275..13a780f7473d 100644 --- a/clients/client-cloudhsm/runtimeConfig.browser.ts +++ b/clients/client-cloudhsm/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudHSMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudHSMClientConfig } from "./CloudHSMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudHSMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudhsm/runtimeConfig.native.ts b/clients/client-cloudhsm/runtimeConfig.native.ts index 0f609ee33bc4..d9474da95fce 100644 --- a/clients/client-cloudhsm/runtimeConfig.native.ts +++ b/clients/client-cloudhsm/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudHSMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudHSMClientConfig } from "./CloudHSMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudHSMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudhsm/runtimeConfig.shared.ts b/clients/client-cloudhsm/runtimeConfig.shared.ts index bf88b243cf01..29e2dbb2fc3a 100644 --- a/clients/client-cloudhsm/runtimeConfig.shared.ts +++ b/clients/client-cloudhsm/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudHSMClientConfig) => ({ apiVersion: "2014-05-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudHSM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudhsm/runtimeConfig.ts b/clients/client-cloudhsm/runtimeConfig.ts index ca350d5fb9fa..ca0804209d78 100644 --- a/clients/client-cloudhsm/runtimeConfig.ts +++ b/clients/client-cloudhsm/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudHSMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudHSMClientConfig } from "./CloudHSMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudHSMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudsearch-domain/CloudSearchDomainClient.ts b/clients/client-cloudsearch-domain/CloudSearchDomainClient.ts index a73687c4e277..7f188a27256e 100644 --- a/clients/client-cloudsearch-domain/CloudSearchDomainClient.ts +++ b/clients/client-cloudsearch-domain/CloudSearchDomainClient.ts @@ -1,7 +1,7 @@ import { SearchCommandInput, SearchCommandOutput } from "./commands/SearchCommand"; import { SuggestCommandInput, SuggestCommandOutput } from "./commands/SuggestCommand"; import { UploadDocumentsCommandInput, UploadDocumentsCommandOutput } from "./commands/UploadDocumentsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -214,10 +214,7 @@ export class CloudSearchDomainClient extends __Client< readonly config: CloudSearchDomainClientResolvedConfig; constructor(configuration: CloudSearchDomainClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudsearch-domain/runtimeConfig.browser.ts b/clients/client-cloudsearch-domain/runtimeConfig.browser.ts index 4e82b9877e9a..ab13de455e01 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.browser.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudSearchDomainClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudsearch-domain/runtimeConfig.native.ts b/clients/client-cloudsearch-domain/runtimeConfig.native.ts index 471b3914c23b..a16cef2a5fe0 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.native.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudSearchDomainClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudsearch-domain/runtimeConfig.shared.ts b/clients/client-cloudsearch-domain/runtimeConfig.shared.ts index c64436bd76cf..80cff7c4880f 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.shared.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => ({ apiVersion: "2013-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudSearch Domain", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudsearch-domain/runtimeConfig.ts b/clients/client-cloudsearch-domain/runtimeConfig.ts index 3306c0d64de7..9ada80c26276 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudSearchDomainClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudsearch/CloudSearchClient.ts b/clients/client-cloudsearch/CloudSearchClient.ts index 82933c748f64..3ed1a77922a3 100644 --- a/clients/client-cloudsearch/CloudSearchClient.ts +++ b/clients/client-cloudsearch/CloudSearchClient.ts @@ -63,7 +63,7 @@ import { UpdateServiceAccessPoliciesCommandInput, UpdateServiceAccessPoliciesCommandOutput, } from "./commands/UpdateServiceAccessPoliciesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -331,10 +331,7 @@ export class CloudSearchClient extends __Client< readonly config: CloudSearchClientResolvedConfig; constructor(configuration: CloudSearchClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudsearch/runtimeConfig.browser.ts b/clients/client-cloudsearch/runtimeConfig.browser.ts index f6edeefbb800..f9f07dd88c22 100644 --- a/clients/client-cloudsearch/runtimeConfig.browser.ts +++ b/clients/client-cloudsearch/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudSearchClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudSearchClientConfig } from "./CloudSearchClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudSearchClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudsearch/runtimeConfig.native.ts b/clients/client-cloudsearch/runtimeConfig.native.ts index 205b2f37af34..57ec0d2df85c 100644 --- a/clients/client-cloudsearch/runtimeConfig.native.ts +++ b/clients/client-cloudsearch/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudSearchClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudSearchClientConfig } from "./CloudSearchClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudSearchClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudsearch/runtimeConfig.shared.ts b/clients/client-cloudsearch/runtimeConfig.shared.ts index 852e6819ff3f..c719753aca8e 100644 --- a/clients/client-cloudsearch/runtimeConfig.shared.ts +++ b/clients/client-cloudsearch/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudSearchClientConfig) => ({ apiVersion: "2013-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudSearch", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudsearch/runtimeConfig.ts b/clients/client-cloudsearch/runtimeConfig.ts index 093bef6056bc..15a5a2601061 100644 --- a/clients/client-cloudsearch/runtimeConfig.ts +++ b/clients/client-cloudsearch/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudSearchClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudSearchClientConfig } from "./CloudSearchClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudSearchClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudtrail/CloudTrailClient.ts b/clients/client-cloudtrail/CloudTrailClient.ts index 8f1846c3857c..e42ec7c1c3f5 100644 --- a/clients/client-cloudtrail/CloudTrailClient.ts +++ b/clients/client-cloudtrail/CloudTrailClient.ts @@ -22,7 +22,7 @@ import { RemoveTagsCommandInput, RemoveTagsCommandOutput } from "./commands/Remo import { StartLoggingCommandInput, StartLoggingCommandOutput } from "./commands/StartLoggingCommand"; import { StopLoggingCommandInput, StopLoggingCommandOutput } from "./commands/StopLoggingCommand"; import { UpdateTrailCommandInput, UpdateTrailCommandOutput } from "./commands/UpdateTrailCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -282,10 +282,7 @@ export class CloudTrailClient extends __Client< readonly config: CloudTrailClientResolvedConfig; constructor(configuration: CloudTrailClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudtrail/runtimeConfig.browser.ts b/clients/client-cloudtrail/runtimeConfig.browser.ts index 5f403f538ec0..9edcd1a78b43 100644 --- a/clients/client-cloudtrail/runtimeConfig.browser.ts +++ b/clients/client-cloudtrail/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudTrailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudTrailClientConfig } from "./CloudTrailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudTrailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudtrail/runtimeConfig.native.ts b/clients/client-cloudtrail/runtimeConfig.native.ts index 40b4e6f9107c..943d9bba92e0 100644 --- a/clients/client-cloudtrail/runtimeConfig.native.ts +++ b/clients/client-cloudtrail/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudTrailClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudTrailClientConfig } from "./CloudTrailClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudTrailClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudtrail/runtimeConfig.shared.ts b/clients/client-cloudtrail/runtimeConfig.shared.ts index 9d4a42f38086..27726fe72b7f 100644 --- a/clients/client-cloudtrail/runtimeConfig.shared.ts +++ b/clients/client-cloudtrail/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudTrailClientConfig) => ({ apiVersion: "2013-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudTrail", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudtrail/runtimeConfig.ts b/clients/client-cloudtrail/runtimeConfig.ts index f31e2148db17..68807c8a88be 100644 --- a/clients/client-cloudtrail/runtimeConfig.ts +++ b/clients/client-cloudtrail/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudTrailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudTrailClientConfig } from "./CloudTrailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudTrailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudwatch-events/CloudWatchEventsClient.ts b/clients/client-cloudwatch-events/CloudWatchEventsClient.ts index 73bca9851264..6ef0d741ce93 100644 --- a/clients/client-cloudwatch-events/CloudWatchEventsClient.ts +++ b/clients/client-cloudwatch-events/CloudWatchEventsClient.ts @@ -97,7 +97,7 @@ import { } from "./commands/UpdateApiDestinationCommand"; import { UpdateArchiveCommandInput, UpdateArchiveCommandOutput } from "./commands/UpdateArchiveCommand"; import { UpdateConnectionCommandInput, UpdateConnectionCommandOutput } from "./commands/UpdateConnectionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -429,10 +429,7 @@ export class CloudWatchEventsClient extends __Client< readonly config: CloudWatchEventsClientResolvedConfig; constructor(configuration: CloudWatchEventsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudwatch-events/runtimeConfig.browser.ts b/clients/client-cloudwatch-events/runtimeConfig.browser.ts index 8e08cf68614b..8f637477411b 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudWatchEventsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudWatchEventsClientConfig } from "./CloudWatchEventsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudwatch-events/runtimeConfig.native.ts b/clients/client-cloudwatch-events/runtimeConfig.native.ts index 0dbc524bed8b..14db27281f13 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.native.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudWatchEventsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudWatchEventsClientConfig } from "./CloudWatchEventsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudwatch-events/runtimeConfig.shared.ts b/clients/client-cloudwatch-events/runtimeConfig.shared.ts index 9a95c4c79057..ec42c45324e8 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.shared.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => ({ apiVersion: "2015-10-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudWatch Events", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudwatch-events/runtimeConfig.ts b/clients/client-cloudwatch-events/runtimeConfig.ts index d5c133ad4b43..0d454ec3f8c5 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudWatchEventsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudWatchEventsClientConfig } from "./CloudWatchEventsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudwatch-logs/CloudWatchLogsClient.ts b/clients/client-cloudwatch-logs/CloudWatchLogsClient.ts index 587d2fba7314..1f8c0bb8e1b1 100644 --- a/clients/client-cloudwatch-logs/CloudWatchLogsClient.ts +++ b/clients/client-cloudwatch-logs/CloudWatchLogsClient.ts @@ -76,7 +76,7 @@ import { StopQueryCommandInput, StopQueryCommandOutput } from "./commands/StopQu import { TagLogGroupCommandInput, TagLogGroupCommandOutput } from "./commands/TagLogGroupCommand"; import { TestMetricFilterCommandInput, TestMetricFilterCommandOutput } from "./commands/TestMetricFilterCommand"; import { UntagLogGroupCommandInput, UntagLogGroupCommandOutput } from "./commands/UntagLogGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -403,10 +403,7 @@ export class CloudWatchLogsClient extends __Client< readonly config: CloudWatchLogsClientResolvedConfig; constructor(configuration: CloudWatchLogsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudwatch-logs/runtimeConfig.browser.ts b/clients/client-cloudwatch-logs/runtimeConfig.browser.ts index b02831a9f718..00ad40d24293 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudWatchLogsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudWatchLogsClientConfig } from "./CloudWatchLogsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudwatch-logs/runtimeConfig.native.ts b/clients/client-cloudwatch-logs/runtimeConfig.native.ts index 1a77ed5444f4..9f09e9b9c7e9 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.native.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudWatchLogsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudWatchLogsClientConfig } from "./CloudWatchLogsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudwatch-logs/runtimeConfig.shared.ts b/clients/client-cloudwatch-logs/runtimeConfig.shared.ts index d2c3370f544f..f731ad3e1906 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.shared.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => ({ apiVersion: "2014-03-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudWatch Logs", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudwatch-logs/runtimeConfig.ts b/clients/client-cloudwatch-logs/runtimeConfig.ts index 8689bed11f69..a73e7590ca7a 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudWatchLogsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudWatchLogsClientConfig } from "./CloudWatchLogsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudwatch/CloudWatchClient.ts b/clients/client-cloudwatch/CloudWatchClient.ts index 84c4c949538c..e2ed81feed69 100644 --- a/clients/client-cloudwatch/CloudWatchClient.ts +++ b/clients/client-cloudwatch/CloudWatchClient.ts @@ -67,7 +67,7 @@ import { StartMetricStreamsCommandInput, StartMetricStreamsCommandOutput } from import { StopMetricStreamsCommandInput, StopMetricStreamsCommandOutput } from "./commands/StopMetricStreamsCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -363,10 +363,7 @@ export class CloudWatchClient extends __Client< readonly config: CloudWatchClientResolvedConfig; constructor(configuration: CloudWatchClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cloudwatch/runtimeConfig.browser.ts b/clients/client-cloudwatch/runtimeConfig.browser.ts index fbc9b8d902b9..e49595a4e64f 100644 --- a/clients/client-cloudwatch/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CloudWatchClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudWatchClientConfig } from "./CloudWatchClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudWatchClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cloudwatch/runtimeConfig.native.ts b/clients/client-cloudwatch/runtimeConfig.native.ts index 0eb815a0d741..f82a57c9d0ee 100644 --- a/clients/client-cloudwatch/runtimeConfig.native.ts +++ b/clients/client-cloudwatch/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CloudWatchClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CloudWatchClientConfig } from "./CloudWatchClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CloudWatchClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cloudwatch/runtimeConfig.shared.ts b/clients/client-cloudwatch/runtimeConfig.shared.ts index 388025d25281..4decbb65a59c 100644 --- a/clients/client-cloudwatch/runtimeConfig.shared.ts +++ b/clients/client-cloudwatch/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CloudWatchClientConfig) => ({ apiVersion: "2010-08-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CloudWatch", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cloudwatch/runtimeConfig.ts b/clients/client-cloudwatch/runtimeConfig.ts index 4936b432bd6e..35bc8b3ded7a 100644 --- a/clients/client-cloudwatch/runtimeConfig.ts +++ b/clients/client-cloudwatch/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CloudWatchClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CloudWatchClientConfig } from "./CloudWatchClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CloudWatchClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codeartifact/CodeartifactClient.ts b/clients/client-codeartifact/CodeartifactClient.ts index 848fce0dd5f0..e7e3034105fd 100644 --- a/clients/client-codeartifact/CodeartifactClient.ts +++ b/clients/client-codeartifact/CodeartifactClient.ts @@ -98,7 +98,7 @@ import { UpdatePackageVersionsStatusCommandOutput, } from "./commands/UpdatePackageVersionsStatusCommand"; import { UpdateRepositoryCommandInput, UpdateRepositoryCommandOutput } from "./commands/UpdateRepositoryCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -629,10 +629,7 @@ export class CodeartifactClient extends __Client< readonly config: CodeartifactClientResolvedConfig; constructor(configuration: CodeartifactClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codeartifact/runtimeConfig.browser.ts b/clients/client-codeartifact/runtimeConfig.browser.ts index 65686d7d6b9a..7549f9392956 100644 --- a/clients/client-codeartifact/runtimeConfig.browser.ts +++ b/clients/client-codeartifact/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeartifactClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeartifactClientConfig } from "./CodeartifactClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeartifactClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codeartifact/runtimeConfig.native.ts b/clients/client-codeartifact/runtimeConfig.native.ts index 09dbaa9b35b9..54e390612449 100644 --- a/clients/client-codeartifact/runtimeConfig.native.ts +++ b/clients/client-codeartifact/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeartifactClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeartifactClientConfig } from "./CodeartifactClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeartifactClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codeartifact/runtimeConfig.shared.ts b/clients/client-codeartifact/runtimeConfig.shared.ts index def84eea6166..a03875716efb 100644 --- a/clients/client-codeartifact/runtimeConfig.shared.ts +++ b/clients/client-codeartifact/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeartifactClientConfig) => ({ apiVersion: "2018-09-22", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "codeartifact", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codeartifact/runtimeConfig.ts b/clients/client-codeartifact/runtimeConfig.ts index 3b847acbca9f..3b4d921c8cac 100644 --- a/clients/client-codeartifact/runtimeConfig.ts +++ b/clients/client-codeartifact/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeartifactClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeartifactClientConfig } from "./CodeartifactClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeartifactClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codebuild/CodeBuildClient.ts b/clients/client-codebuild/CodeBuildClient.ts index 5598e8429353..f2d26c624b29 100644 --- a/clients/client-codebuild/CodeBuildClient.ts +++ b/clients/client-codebuild/CodeBuildClient.ts @@ -84,7 +84,7 @@ import { StopBuildCommandInput, StopBuildCommandOutput } from "./commands/StopBu import { UpdateProjectCommandInput, UpdateProjectCommandOutput } from "./commands/UpdateProjectCommand"; import { UpdateReportGroupCommandInput, UpdateReportGroupCommandOutput } from "./commands/UpdateReportGroupCommand"; import { UpdateWebhookCommandInput, UpdateWebhookCommandOutput } from "./commands/UpdateWebhookCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -391,10 +391,7 @@ export class CodeBuildClient extends __Client< readonly config: CodeBuildClientResolvedConfig; constructor(configuration: CodeBuildClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codebuild/runtimeConfig.browser.ts b/clients/client-codebuild/runtimeConfig.browser.ts index 4a002d788414..0bd5e5f00a93 100644 --- a/clients/client-codebuild/runtimeConfig.browser.ts +++ b/clients/client-codebuild/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeBuildClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeBuildClientConfig } from "./CodeBuildClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeBuildClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codebuild/runtimeConfig.native.ts b/clients/client-codebuild/runtimeConfig.native.ts index 73480f9e872e..a245856511e6 100644 --- a/clients/client-codebuild/runtimeConfig.native.ts +++ b/clients/client-codebuild/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeBuildClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeBuildClientConfig } from "./CodeBuildClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeBuildClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codebuild/runtimeConfig.shared.ts b/clients/client-codebuild/runtimeConfig.shared.ts index 910ff02aa6cc..d944bb9ab192 100644 --- a/clients/client-codebuild/runtimeConfig.shared.ts +++ b/clients/client-codebuild/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeBuildClientConfig) => ({ apiVersion: "2016-10-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeBuild", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codebuild/runtimeConfig.ts b/clients/client-codebuild/runtimeConfig.ts index ac6c23e3e75d..b713a7cf32ec 100644 --- a/clients/client-codebuild/runtimeConfig.ts +++ b/clients/client-codebuild/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeBuildClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeBuildClientConfig } from "./CodeBuildClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeBuildClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codecommit/CodeCommitClient.ts b/clients/client-codecommit/CodeCommitClient.ts index 8515e35001e6..1c2e24bffd63 100644 --- a/clients/client-codecommit/CodeCommitClient.ts +++ b/clients/client-codecommit/CodeCommitClient.ts @@ -219,7 +219,7 @@ import { UpdateRepositoryNameCommandInput, UpdateRepositoryNameCommandOutput, } from "./commands/UpdateRepositoryNameCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -979,10 +979,7 @@ export class CodeCommitClient extends __Client< readonly config: CodeCommitClientResolvedConfig; constructor(configuration: CodeCommitClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codecommit/runtimeConfig.browser.ts b/clients/client-codecommit/runtimeConfig.browser.ts index 5249e7334349..ceb3a613fe88 100644 --- a/clients/client-codecommit/runtimeConfig.browser.ts +++ b/clients/client-codecommit/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeCommitClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeCommitClientConfig } from "./CodeCommitClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeCommitClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codecommit/runtimeConfig.native.ts b/clients/client-codecommit/runtimeConfig.native.ts index 3c08ecc405cd..c9a651ce13db 100644 --- a/clients/client-codecommit/runtimeConfig.native.ts +++ b/clients/client-codecommit/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeCommitClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeCommitClientConfig } from "./CodeCommitClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeCommitClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codecommit/runtimeConfig.shared.ts b/clients/client-codecommit/runtimeConfig.shared.ts index 1a26140afa39..ad7b674af96a 100644 --- a/clients/client-codecommit/runtimeConfig.shared.ts +++ b/clients/client-codecommit/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeCommitClientConfig) => ({ apiVersion: "2015-04-13", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeCommit", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codecommit/runtimeConfig.ts b/clients/client-codecommit/runtimeConfig.ts index fa7883f23f0e..6ffb150c8680 100644 --- a/clients/client-codecommit/runtimeConfig.ts +++ b/clients/client-codecommit/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeCommitClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeCommitClientConfig } from "./CodeCommitClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeCommitClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codedeploy/CodeDeployClient.ts b/clients/client-codedeploy/CodeDeployClient.ts index 1535eb4c8b94..6e5e5d33dd51 100644 --- a/clients/client-codedeploy/CodeDeployClient.ts +++ b/clients/client-codedeploy/CodeDeployClient.ts @@ -147,7 +147,7 @@ import { UpdateDeploymentGroupCommandInput, UpdateDeploymentGroupCommandOutput, } from "./commands/UpdateDeploymentGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -550,10 +550,7 @@ export class CodeDeployClient extends __Client< readonly config: CodeDeployClientResolvedConfig; constructor(configuration: CodeDeployClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codedeploy/runtimeConfig.browser.ts b/clients/client-codedeploy/runtimeConfig.browser.ts index 5a7ed352bbb4..655fadfdcdf4 100644 --- a/clients/client-codedeploy/runtimeConfig.browser.ts +++ b/clients/client-codedeploy/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeDeployClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeDeployClientConfig } from "./CodeDeployClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeDeployClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codedeploy/runtimeConfig.native.ts b/clients/client-codedeploy/runtimeConfig.native.ts index 8f03b9716cb3..4c6d84fb67c9 100644 --- a/clients/client-codedeploy/runtimeConfig.native.ts +++ b/clients/client-codedeploy/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeDeployClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeDeployClientConfig } from "./CodeDeployClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeDeployClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codedeploy/runtimeConfig.shared.ts b/clients/client-codedeploy/runtimeConfig.shared.ts index 12c1fddcb439..5e4d2e6801ca 100644 --- a/clients/client-codedeploy/runtimeConfig.shared.ts +++ b/clients/client-codedeploy/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeDeployClientConfig) => ({ apiVersion: "2014-10-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeDeploy", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codedeploy/runtimeConfig.ts b/clients/client-codedeploy/runtimeConfig.ts index 08c108519e2d..202f773f1dbf 100644 --- a/clients/client-codedeploy/runtimeConfig.ts +++ b/clients/client-codedeploy/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeDeployClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeDeployClientConfig } from "./CodeDeployClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeDeployClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codeguru-reviewer/CodeGuruReviewerClient.ts b/clients/client-codeguru-reviewer/CodeGuruReviewerClient.ts index 66c09d5c4e17..02e84c0b2c0b 100644 --- a/clients/client-codeguru-reviewer/CodeGuruReviewerClient.ts +++ b/clients/client-codeguru-reviewer/CodeGuruReviewerClient.ts @@ -39,7 +39,7 @@ import { } from "./commands/PutRecommendationFeedbackCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -292,10 +292,7 @@ export class CodeGuruReviewerClient extends __Client< readonly config: CodeGuruReviewerClientResolvedConfig; constructor(configuration: CodeGuruReviewerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codeguru-reviewer/runtimeConfig.browser.ts b/clients/client-codeguru-reviewer/runtimeConfig.browser.ts index d84fcde5a873..02d5f070abe0 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.browser.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeGuruReviewerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeGuruReviewerClientConfig } from "./CodeGuruReviewerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codeguru-reviewer/runtimeConfig.native.ts b/clients/client-codeguru-reviewer/runtimeConfig.native.ts index 411f4596e892..1fda4dec9f43 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.native.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeGuruReviewerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeGuruReviewerClientConfig } from "./CodeGuruReviewerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codeguru-reviewer/runtimeConfig.shared.ts b/clients/client-codeguru-reviewer/runtimeConfig.shared.ts index 9c3c6e1b95c5..51a95b877b0d 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.shared.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => ({ apiVersion: "2019-09-19", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeGuru Reviewer", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codeguru-reviewer/runtimeConfig.ts b/clients/client-codeguru-reviewer/runtimeConfig.ts index 2e7514b0ce02..3bb9808fcc15 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeGuruReviewerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeGuruReviewerClientConfig } from "./CodeGuruReviewerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codeguruprofiler/CodeGuruProfilerClient.ts b/clients/client-codeguruprofiler/CodeGuruProfilerClient.ts index b5c12639a7fb..c432dec44098 100644 --- a/clients/client-codeguruprofiler/CodeGuruProfilerClient.ts +++ b/clients/client-codeguruprofiler/CodeGuruProfilerClient.ts @@ -57,7 +57,7 @@ import { UpdateProfilingGroupCommandInput, UpdateProfilingGroupCommandOutput, } from "./commands/UpdateProfilingGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -335,10 +335,7 @@ export class CodeGuruProfilerClient extends __Client< readonly config: CodeGuruProfilerClientResolvedConfig; constructor(configuration: CodeGuruProfilerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codeguruprofiler/runtimeConfig.browser.ts b/clients/client-codeguruprofiler/runtimeConfig.browser.ts index 90afb8ecd60d..d932c778f3cf 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.browser.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeGuruProfilerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeGuruProfilerClientConfig } from "./CodeGuruProfilerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codeguruprofiler/runtimeConfig.native.ts b/clients/client-codeguruprofiler/runtimeConfig.native.ts index 34339882b16b..f6fd36f66286 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.native.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeGuruProfilerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeGuruProfilerClientConfig } from "./CodeGuruProfilerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codeguruprofiler/runtimeConfig.shared.ts b/clients/client-codeguruprofiler/runtimeConfig.shared.ts index 9bd6c3da16d1..be62bd3a12f1 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.shared.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => ({ apiVersion: "2019-07-18", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeGuruProfiler", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codeguruprofiler/runtimeConfig.ts b/clients/client-codeguruprofiler/runtimeConfig.ts index 9608111e238e..b30ea3446443 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeGuruProfilerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeGuruProfilerClientConfig } from "./CodeGuruProfilerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codepipeline/CodePipelineClient.ts b/clients/client-codepipeline/CodePipelineClient.ts index af89ec4b47d2..dfc65dcac110 100644 --- a/clients/client-codepipeline/CodePipelineClient.ts +++ b/clients/client-codepipeline/CodePipelineClient.ts @@ -97,7 +97,7 @@ import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/Ta import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateActionTypeCommandInput, UpdateActionTypeCommandOutput } from "./commands/UpdateActionTypeCommand"; import { UpdatePipelineCommandInput, UpdatePipelineCommandOutput } from "./commands/UpdatePipelineCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -579,10 +579,7 @@ export class CodePipelineClient extends __Client< readonly config: CodePipelineClientResolvedConfig; constructor(configuration: CodePipelineClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codepipeline/runtimeConfig.browser.ts b/clients/client-codepipeline/runtimeConfig.browser.ts index 6d888c59b208..163fef31407d 100644 --- a/clients/client-codepipeline/runtimeConfig.browser.ts +++ b/clients/client-codepipeline/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodePipelineClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodePipelineClientConfig } from "./CodePipelineClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodePipelineClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codepipeline/runtimeConfig.native.ts b/clients/client-codepipeline/runtimeConfig.native.ts index 74ecdd9b7f52..dd5dd1e44dec 100644 --- a/clients/client-codepipeline/runtimeConfig.native.ts +++ b/clients/client-codepipeline/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodePipelineClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodePipelineClientConfig } from "./CodePipelineClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodePipelineClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codepipeline/runtimeConfig.shared.ts b/clients/client-codepipeline/runtimeConfig.shared.ts index f33bdbfdb92e..e4b3d1104438 100644 --- a/clients/client-codepipeline/runtimeConfig.shared.ts +++ b/clients/client-codepipeline/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodePipelineClientConfig) => ({ apiVersion: "2015-07-09", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodePipeline", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codepipeline/runtimeConfig.ts b/clients/client-codepipeline/runtimeConfig.ts index db4fcfe4d24e..0294567cafc7 100644 --- a/clients/client-codepipeline/runtimeConfig.ts +++ b/clients/client-codepipeline/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodePipelineClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodePipelineClientConfig } from "./CodePipelineClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodePipelineClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codestar-connections/CodeStarConnectionsClient.ts b/clients/client-codestar-connections/CodeStarConnectionsClient.ts index 6e9cf8382f83..bff3427512e5 100644 --- a/clients/client-codestar-connections/CodeStarConnectionsClient.ts +++ b/clients/client-codestar-connections/CodeStarConnectionsClient.ts @@ -13,7 +13,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateHostCommandInput, UpdateHostCommandOutput } from "./commands/UpdateHostCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -326,10 +326,7 @@ export class CodeStarConnectionsClient extends __Client< readonly config: CodeStarConnectionsClientResolvedConfig; constructor(configuration: CodeStarConnectionsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codestar-connections/runtimeConfig.browser.ts b/clients/client-codestar-connections/runtimeConfig.browser.ts index d06c2e73da6a..60af51e9f073 100644 --- a/clients/client-codestar-connections/runtimeConfig.browser.ts +++ b/clients/client-codestar-connections/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeStarConnectionsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeStarConnectionsClientConfig } from "./CodeStarConnectionsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codestar-connections/runtimeConfig.native.ts b/clients/client-codestar-connections/runtimeConfig.native.ts index 05c6e42ae502..8492a53129c5 100644 --- a/clients/client-codestar-connections/runtimeConfig.native.ts +++ b/clients/client-codestar-connections/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeStarConnectionsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeStarConnectionsClientConfig } from "./CodeStarConnectionsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codestar-connections/runtimeConfig.shared.ts b/clients/client-codestar-connections/runtimeConfig.shared.ts index 1952b4759c6a..18339da87c42 100644 --- a/clients/client-codestar-connections/runtimeConfig.shared.ts +++ b/clients/client-codestar-connections/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => ({ apiVersion: "2019-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeStar connections", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codestar-connections/runtimeConfig.ts b/clients/client-codestar-connections/runtimeConfig.ts index efc956150df3..7ed7813d34f1 100644 --- a/clients/client-codestar-connections/runtimeConfig.ts +++ b/clients/client-codestar-connections/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeStarConnectionsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeStarConnectionsClientConfig } from "./CodeStarConnectionsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codestar-notifications/CodestarNotificationsClient.ts b/clients/client-codestar-notifications/CodestarNotificationsClient.ts index 68cf9c515c26..4af57cd9ac58 100644 --- a/clients/client-codestar-notifications/CodestarNotificationsClient.ts +++ b/clients/client-codestar-notifications/CodestarNotificationsClient.ts @@ -29,7 +29,7 @@ import { UpdateNotificationRuleCommandInput, UpdateNotificationRuleCommandOutput, } from "./commands/UpdateNotificationRuleCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -348,10 +348,7 @@ export class CodestarNotificationsClient extends __Client< readonly config: CodestarNotificationsClientResolvedConfig; constructor(configuration: CodestarNotificationsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codestar-notifications/runtimeConfig.browser.ts b/clients/client-codestar-notifications/runtimeConfig.browser.ts index 37ab622b3bbb..bfedc47689fe 100644 --- a/clients/client-codestar-notifications/runtimeConfig.browser.ts +++ b/clients/client-codestar-notifications/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodestarNotificationsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodestarNotificationsClientConfig } from "./CodestarNotificationsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codestar-notifications/runtimeConfig.native.ts b/clients/client-codestar-notifications/runtimeConfig.native.ts index 93b13e027b12..d3821264ca56 100644 --- a/clients/client-codestar-notifications/runtimeConfig.native.ts +++ b/clients/client-codestar-notifications/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodestarNotificationsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodestarNotificationsClientConfig } from "./CodestarNotificationsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codestar-notifications/runtimeConfig.shared.ts b/clients/client-codestar-notifications/runtimeConfig.shared.ts index be5a576ac0a8..7aa426f5d4fe 100644 --- a/clients/client-codestar-notifications/runtimeConfig.shared.ts +++ b/clients/client-codestar-notifications/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => ({ apiVersion: "2019-10-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "codestar notifications", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codestar-notifications/runtimeConfig.ts b/clients/client-codestar-notifications/runtimeConfig.ts index 54742303c2ee..92690bf1686a 100644 --- a/clients/client-codestar-notifications/runtimeConfig.ts +++ b/clients/client-codestar-notifications/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodestarNotificationsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodestarNotificationsClientConfig } from "./CodestarNotificationsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codestar/CodeStarClient.ts b/clients/client-codestar/CodeStarClient.ts index f4efd5fbc6bc..59c34aeda7af 100644 --- a/clients/client-codestar/CodeStarClient.ts +++ b/clients/client-codestar/CodeStarClient.ts @@ -25,7 +25,7 @@ import { UntagProjectCommandInput, UntagProjectCommandOutput } from "./commands/ import { UpdateProjectCommandInput, UpdateProjectCommandOutput } from "./commands/UpdateProjectCommand"; import { UpdateTeamMemberCommandInput, UpdateTeamMemberCommandOutput } from "./commands/UpdateTeamMemberCommand"; import { UpdateUserProfileCommandInput, UpdateUserProfileCommandOutput } from "./commands/UpdateUserProfileCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -360,10 +360,7 @@ export class CodeStarClient extends __Client< readonly config: CodeStarClientResolvedConfig; constructor(configuration: CodeStarClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-codestar/runtimeConfig.browser.ts b/clients/client-codestar/runtimeConfig.browser.ts index 1daec203c0db..e3ec59ef5441 100644 --- a/clients/client-codestar/runtimeConfig.browser.ts +++ b/clients/client-codestar/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CodeStarClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeStarClientConfig } from "./CodeStarClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeStarClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-codestar/runtimeConfig.native.ts b/clients/client-codestar/runtimeConfig.native.ts index 46f6ee658851..6da04e101c95 100644 --- a/clients/client-codestar/runtimeConfig.native.ts +++ b/clients/client-codestar/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CodeStarClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CodeStarClientConfig } from "./CodeStarClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CodeStarClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-codestar/runtimeConfig.shared.ts b/clients/client-codestar/runtimeConfig.shared.ts index a512f719919c..ad2f8009b452 100644 --- a/clients/client-codestar/runtimeConfig.shared.ts +++ b/clients/client-codestar/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CodeStarClientConfig) => ({ apiVersion: "2017-04-19", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "CodeStar", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-codestar/runtimeConfig.ts b/clients/client-codestar/runtimeConfig.ts index 967830a5fdc6..ecf6fa2a2738 100644 --- a/clients/client-codestar/runtimeConfig.ts +++ b/clients/client-codestar/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CodeStarClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CodeStarClientConfig } from "./CodeStarClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CodeStarClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cognito-identity-provider/CognitoIdentityProviderClient.ts b/clients/client-cognito-identity-provider/CognitoIdentityProviderClient.ts index 31b99c2ce673..ebc24733bcaa 100644 --- a/clients/client-cognito-identity-provider/CognitoIdentityProviderClient.ts +++ b/clients/client-cognito-identity-provider/CognitoIdentityProviderClient.ts @@ -267,7 +267,7 @@ import { VerifyUserAttributeCommandInput, VerifyUserAttributeCommandOutput, } from "./commands/VerifyUserAttributeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -680,10 +680,7 @@ export class CognitoIdentityProviderClient extends __Client< readonly config: CognitoIdentityProviderClientResolvedConfig; constructor(configuration: CognitoIdentityProviderClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cognito-identity-provider/runtimeConfig.browser.ts b/clients/client-cognito-identity-provider/runtimeConfig.browser.ts index 023f2e2d10a5..afcc338daef5 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.browser.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CognitoIdentityProviderClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CognitoIdentityProviderClientConfig } from "./CognitoIdentityProviderClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cognito-identity-provider/runtimeConfig.native.ts b/clients/client-cognito-identity-provider/runtimeConfig.native.ts index b3a707e496f5..0a8e71f3a4a9 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.native.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CognitoIdentityProviderClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CognitoIdentityProviderClientConfig } from "./CognitoIdentityProviderClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cognito-identity-provider/runtimeConfig.shared.ts b/clients/client-cognito-identity-provider/runtimeConfig.shared.ts index a744bd0180e4..daab9efa6880 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.shared.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => ({ apiVersion: "2016-04-18", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Cognito Identity Provider", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cognito-identity-provider/runtimeConfig.ts b/clients/client-cognito-identity-provider/runtimeConfig.ts index 875ce54e9ca1..4bd6cd47a25b 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CognitoIdentityProviderClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CognitoIdentityProviderClientConfig } from "./CognitoIdentityProviderClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cognito-identity/CognitoIdentityClient.ts b/clients/client-cognito-identity/CognitoIdentityClient.ts index 0690b4118ce6..753b6011fd0a 100644 --- a/clients/client-cognito-identity/CognitoIdentityClient.ts +++ b/clients/client-cognito-identity/CognitoIdentityClient.ts @@ -54,7 +54,7 @@ import { import { UnlinkIdentityCommandInput, UnlinkIdentityCommandOutput } from "./commands/UnlinkIdentityCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateIdentityPoolCommandInput, UpdateIdentityPoolCommandOutput } from "./commands/UpdateIdentityPoolCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -318,10 +318,7 @@ export class CognitoIdentityClient extends __Client< readonly config: CognitoIdentityClientResolvedConfig; constructor(configuration: CognitoIdentityClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cognito-identity/runtimeConfig.browser.ts b/clients/client-cognito-identity/runtimeConfig.browser.ts index 368fc3c8b653..2b7d5f6d215b 100644 --- a/clients/client-cognito-identity/runtimeConfig.browser.ts +++ b/clients/client-cognito-identity/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CognitoIdentityClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CognitoIdentityClientConfig } from "./CognitoIdentityClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cognito-identity/runtimeConfig.native.ts b/clients/client-cognito-identity/runtimeConfig.native.ts index 7c3bc8ee9f4d..2661b9ea9cdb 100644 --- a/clients/client-cognito-identity/runtimeConfig.native.ts +++ b/clients/client-cognito-identity/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CognitoIdentityClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CognitoIdentityClientConfig } from "./CognitoIdentityClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cognito-identity/runtimeConfig.shared.ts b/clients/client-cognito-identity/runtimeConfig.shared.ts index 3dd89173fb1e..d37beb7a9b83 100644 --- a/clients/client-cognito-identity/runtimeConfig.shared.ts +++ b/clients/client-cognito-identity/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => ({ apiVersion: "2014-06-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Cognito Identity", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cognito-identity/runtimeConfig.ts b/clients/client-cognito-identity/runtimeConfig.ts index 46e75c271322..d88e33af0ee0 100644 --- a/clients/client-cognito-identity/runtimeConfig.ts +++ b/clients/client-cognito-identity/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CognitoIdentityClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CognitoIdentityClientConfig } from "./CognitoIdentityClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cognito-sync/CognitoSyncClient.ts b/clients/client-cognito-sync/CognitoSyncClient.ts index abd50fdbf200..6d19c030c151 100644 --- a/clients/client-cognito-sync/CognitoSyncClient.ts +++ b/clients/client-cognito-sync/CognitoSyncClient.ts @@ -36,7 +36,7 @@ import { UnsubscribeFromDatasetCommandOutput, } from "./commands/UnsubscribeFromDatasetCommand"; import { UpdateRecordsCommandInput, UpdateRecordsCommandOutput } from "./commands/UpdateRecordsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -292,10 +292,7 @@ export class CognitoSyncClient extends __Client< readonly config: CognitoSyncClientResolvedConfig; constructor(configuration: CognitoSyncClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cognito-sync/runtimeConfig.browser.ts b/clients/client-cognito-sync/runtimeConfig.browser.ts index 7d9e39c99f0f..63908d39bff7 100644 --- a/clients/client-cognito-sync/runtimeConfig.browser.ts +++ b/clients/client-cognito-sync/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CognitoSyncClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CognitoSyncClientConfig } from "./CognitoSyncClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cognito-sync/runtimeConfig.native.ts b/clients/client-cognito-sync/runtimeConfig.native.ts index d8faaf84d492..59c958d87fc8 100644 --- a/clients/client-cognito-sync/runtimeConfig.native.ts +++ b/clients/client-cognito-sync/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CognitoSyncClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CognitoSyncClientConfig } from "./CognitoSyncClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cognito-sync/runtimeConfig.shared.ts b/clients/client-cognito-sync/runtimeConfig.shared.ts index e3cf8cc06d49..b2aaf4ce2ca6 100644 --- a/clients/client-cognito-sync/runtimeConfig.shared.ts +++ b/clients/client-cognito-sync/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CognitoSyncClientConfig) => ({ apiVersion: "2014-06-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Cognito Sync", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cognito-sync/runtimeConfig.ts b/clients/client-cognito-sync/runtimeConfig.ts index 02adf48f7d42..61734a2dc09c 100644 --- a/clients/client-cognito-sync/runtimeConfig.ts +++ b/clients/client-cognito-sync/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CognitoSyncClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CognitoSyncClientConfig } from "./CognitoSyncClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-comprehend/ComprehendClient.ts b/clients/client-comprehend/ComprehendClient.ts index 195e6d671e9d..8919113c552e 100644 --- a/clients/client-comprehend/ComprehendClient.ts +++ b/clients/client-comprehend/ComprehendClient.ts @@ -200,7 +200,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateEndpointCommandInput, UpdateEndpointCommandOutput } from "./commands/UpdateEndpointCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -535,10 +535,7 @@ export class ComprehendClient extends __Client< readonly config: ComprehendClientResolvedConfig; constructor(configuration: ComprehendClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-comprehend/runtimeConfig.browser.ts b/clients/client-comprehend/runtimeConfig.browser.ts index bc007735c399..ce7dc33795c5 100644 --- a/clients/client-comprehend/runtimeConfig.browser.ts +++ b/clients/client-comprehend/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ComprehendClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ComprehendClientConfig } from "./ComprehendClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ComprehendClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-comprehend/runtimeConfig.native.ts b/clients/client-comprehend/runtimeConfig.native.ts index 10d05465863c..d924c8f13319 100644 --- a/clients/client-comprehend/runtimeConfig.native.ts +++ b/clients/client-comprehend/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ComprehendClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ComprehendClientConfig } from "./ComprehendClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ComprehendClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-comprehend/runtimeConfig.shared.ts b/clients/client-comprehend/runtimeConfig.shared.ts index 966396e7ce80..bca1aaa1f2f9 100644 --- a/clients/client-comprehend/runtimeConfig.shared.ts +++ b/clients/client-comprehend/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ComprehendClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Comprehend", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-comprehend/runtimeConfig.ts b/clients/client-comprehend/runtimeConfig.ts index 30fc42690c8a..9d12c1e05f2c 100644 --- a/clients/client-comprehend/runtimeConfig.ts +++ b/clients/client-comprehend/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ComprehendClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ComprehendClientConfig } from "./ComprehendClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ComprehendClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-comprehendmedical/ComprehendMedicalClient.ts b/clients/client-comprehendmedical/ComprehendMedicalClient.ts index 0645f8a31103..52438e7e378a 100644 --- a/clients/client-comprehendmedical/ComprehendMedicalClient.ts +++ b/clients/client-comprehendmedical/ComprehendMedicalClient.ts @@ -67,7 +67,7 @@ import { StopRxNormInferenceJobCommandInput, StopRxNormInferenceJobCommandOutput, } from "./commands/StopRxNormInferenceJobCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -320,10 +320,7 @@ export class ComprehendMedicalClient extends __Client< readonly config: ComprehendMedicalClientResolvedConfig; constructor(configuration: ComprehendMedicalClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-comprehendmedical/runtimeConfig.browser.ts b/clients/client-comprehendmedical/runtimeConfig.browser.ts index db0f9833bdcd..087acb0ba93b 100644 --- a/clients/client-comprehendmedical/runtimeConfig.browser.ts +++ b/clients/client-comprehendmedical/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ComprehendMedicalClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ComprehendMedicalClientConfig } from "./ComprehendMedicalClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-comprehendmedical/runtimeConfig.native.ts b/clients/client-comprehendmedical/runtimeConfig.native.ts index 32f69b1a4345..9cc51fa66449 100644 --- a/clients/client-comprehendmedical/runtimeConfig.native.ts +++ b/clients/client-comprehendmedical/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ComprehendMedicalClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ComprehendMedicalClientConfig } from "./ComprehendMedicalClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-comprehendmedical/runtimeConfig.shared.ts b/clients/client-comprehendmedical/runtimeConfig.shared.ts index 8e44db532b0e..da3bfc1fc5e7 100644 --- a/clients/client-comprehendmedical/runtimeConfig.shared.ts +++ b/clients/client-comprehendmedical/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => ({ apiVersion: "2018-10-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ComprehendMedical", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-comprehendmedical/runtimeConfig.ts b/clients/client-comprehendmedical/runtimeConfig.ts index a962ce13aee4..a73356177006 100644 --- a/clients/client-comprehendmedical/runtimeConfig.ts +++ b/clients/client-comprehendmedical/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ComprehendMedicalClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ComprehendMedicalClientConfig } from "./ComprehendMedicalClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-compute-optimizer/ComputeOptimizerClient.ts b/clients/client-compute-optimizer/ComputeOptimizerClient.ts index 56cb6413e500..40b66563b2a9 100644 --- a/clients/client-compute-optimizer/ComputeOptimizerClient.ts +++ b/clients/client-compute-optimizer/ComputeOptimizerClient.ts @@ -50,7 +50,7 @@ import { UpdateEnrollmentStatusCommandInput, UpdateEnrollmentStatusCommandOutput, } from "./commands/UpdateEnrollmentStatusCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -296,10 +296,7 @@ export class ComputeOptimizerClient extends __Client< readonly config: ComputeOptimizerClientResolvedConfig; constructor(configuration: ComputeOptimizerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-compute-optimizer/runtimeConfig.browser.ts b/clients/client-compute-optimizer/runtimeConfig.browser.ts index 074e3efb8553..cd4e889888ca 100644 --- a/clients/client-compute-optimizer/runtimeConfig.browser.ts +++ b/clients/client-compute-optimizer/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ComputeOptimizerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ComputeOptimizerClientConfig } from "./ComputeOptimizerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-compute-optimizer/runtimeConfig.native.ts b/clients/client-compute-optimizer/runtimeConfig.native.ts index 2c03cab12f39..05dce3f9c360 100644 --- a/clients/client-compute-optimizer/runtimeConfig.native.ts +++ b/clients/client-compute-optimizer/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ComputeOptimizerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ComputeOptimizerClientConfig } from "./ComputeOptimizerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-compute-optimizer/runtimeConfig.shared.ts b/clients/client-compute-optimizer/runtimeConfig.shared.ts index d1ec02ce08e4..b0db78e5d8fd 100644 --- a/clients/client-compute-optimizer/runtimeConfig.shared.ts +++ b/clients/client-compute-optimizer/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => ({ apiVersion: "2019-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Compute Optimizer", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-compute-optimizer/runtimeConfig.ts b/clients/client-compute-optimizer/runtimeConfig.ts index 27eeff3c3933..ec93bba0faac 100644 --- a/clients/client-compute-optimizer/runtimeConfig.ts +++ b/clients/client-compute-optimizer/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ComputeOptimizerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ComputeOptimizerClientConfig } from "./ComputeOptimizerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-config-service/ConfigServiceClient.ts b/clients/client-config-service/ConfigServiceClient.ts index 233fabfbdd42..60d6f41e46ec 100644 --- a/clients/client-config-service/ConfigServiceClient.ts +++ b/clients/client-config-service/ConfigServiceClient.ts @@ -306,7 +306,7 @@ import { } from "./commands/StopConfigurationRecorderCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -711,10 +711,7 @@ export class ConfigServiceClient extends __Client< readonly config: ConfigServiceClientResolvedConfig; constructor(configuration: ConfigServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-config-service/runtimeConfig.browser.ts b/clients/client-config-service/runtimeConfig.browser.ts index 1da63e4dd164..be9ac386865e 100644 --- a/clients/client-config-service/runtimeConfig.browser.ts +++ b/clients/client-config-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ConfigServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConfigServiceClientConfig } from "./ConfigServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-config-service/runtimeConfig.native.ts b/clients/client-config-service/runtimeConfig.native.ts index 99b7485dae97..74979d0d9825 100644 --- a/clients/client-config-service/runtimeConfig.native.ts +++ b/clients/client-config-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ConfigServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ConfigServiceClientConfig } from "./ConfigServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-config-service/runtimeConfig.shared.ts b/clients/client-config-service/runtimeConfig.shared.ts index 2283c820e398..663c06cbcdb2 100644 --- a/clients/client-config-service/runtimeConfig.shared.ts +++ b/clients/client-config-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ConfigServiceClientConfig) => ({ apiVersion: "2014-11-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Config Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-config-service/runtimeConfig.ts b/clients/client-config-service/runtimeConfig.ts index 5efed5c1cfcd..c254e970f9cc 100644 --- a/clients/client-config-service/runtimeConfig.ts +++ b/clients/client-config-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ConfigServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConfigServiceClientConfig } from "./ConfigServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-connect-contact-lens/ConnectContactLensClient.ts b/clients/client-connect-contact-lens/ConnectContactLensClient.ts index 9f946c980ef1..d2f88be2de42 100644 --- a/clients/client-connect-contact-lens/ConnectContactLensClient.ts +++ b/clients/client-connect-contact-lens/ConnectContactLensClient.ts @@ -2,7 +2,7 @@ import { ListRealtimeContactAnalysisSegmentsCommandInput, ListRealtimeContactAnalysisSegmentsCommandOutput, } from "./commands/ListRealtimeContactAnalysisSegmentsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -224,10 +224,7 @@ export class ConnectContactLensClient extends __Client< readonly config: ConnectContactLensClientResolvedConfig; constructor(configuration: ConnectContactLensClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-connect-contact-lens/runtimeConfig.browser.ts b/clients/client-connect-contact-lens/runtimeConfig.browser.ts index 13b72a06376b..5e00e6587103 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.browser.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ConnectContactLensClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConnectContactLensClientConfig } from "./ConnectContactLensClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-connect-contact-lens/runtimeConfig.native.ts b/clients/client-connect-contact-lens/runtimeConfig.native.ts index c5d9a7682d35..3f0422a76558 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.native.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ConnectContactLensClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ConnectContactLensClientConfig } from "./ConnectContactLensClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-connect-contact-lens/runtimeConfig.shared.ts b/clients/client-connect-contact-lens/runtimeConfig.shared.ts index b0347f717fe3..f6e2cbe89c77 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.shared.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => ({ apiVersion: "2020-08-21", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Connect Contact Lens", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-connect-contact-lens/runtimeConfig.ts b/clients/client-connect-contact-lens/runtimeConfig.ts index 9a78b6d7f011..cc250f0da546 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ConnectContactLensClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConnectContactLensClientConfig } from "./ConnectContactLensClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-connect/ConnectClient.ts b/clients/client-connect/ConnectClient.ts index 444f0276b15a..6a3defc66c0d 100644 --- a/clients/client-connect/ConnectClient.ts +++ b/clients/client-connect/ConnectClient.ts @@ -295,7 +295,7 @@ import { UpdateUserSecurityProfilesCommandInput, UpdateUserSecurityProfilesCommandOutput, } from "./commands/UpdateUserSecurityProfilesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -724,10 +724,7 @@ export class ConnectClient extends __Client< readonly config: ConnectClientResolvedConfig; constructor(configuration: ConnectClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-connect/runtimeConfig.browser.ts b/clients/client-connect/runtimeConfig.browser.ts index 8ec45caa820a..80b3ae9dc3b1 100644 --- a/clients/client-connect/runtimeConfig.browser.ts +++ b/clients/client-connect/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConnectClientConfig } from "./ConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-connect/runtimeConfig.native.ts b/clients/client-connect/runtimeConfig.native.ts index 3cc62baeca06..e30c65207a14 100644 --- a/clients/client-connect/runtimeConfig.native.ts +++ b/clients/client-connect/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ConnectClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ConnectClientConfig } from "./ConnectClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ConnectClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-connect/runtimeConfig.shared.ts b/clients/client-connect/runtimeConfig.shared.ts index 1ac6bb6741fe..ea772058db8a 100644 --- a/clients/client-connect/runtimeConfig.shared.ts +++ b/clients/client-connect/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ConnectClientConfig) => ({ apiVersion: "2017-08-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Connect", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-connect/runtimeConfig.ts b/clients/client-connect/runtimeConfig.ts index bfbf87ae7086..a7547acc1246 100644 --- a/clients/client-connect/runtimeConfig.ts +++ b/clients/client-connect/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConnectClientConfig } from "./ConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-connectparticipant/ConnectParticipantClient.ts b/clients/client-connectparticipant/ConnectParticipantClient.ts index 59afebdd5f5b..12737d70dfe5 100644 --- a/clients/client-connectparticipant/ConnectParticipantClient.ts +++ b/clients/client-connectparticipant/ConnectParticipantClient.ts @@ -18,7 +18,7 @@ import { StartAttachmentUploadCommandInput, StartAttachmentUploadCommandOutput, } from "./commands/StartAttachmentUploadCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -255,10 +255,7 @@ export class ConnectParticipantClient extends __Client< readonly config: ConnectParticipantClientResolvedConfig; constructor(configuration: ConnectParticipantClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-connectparticipant/runtimeConfig.browser.ts b/clients/client-connectparticipant/runtimeConfig.browser.ts index 7f8f88e7861d..5bad0de5183d 100644 --- a/clients/client-connectparticipant/runtimeConfig.browser.ts +++ b/clients/client-connectparticipant/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ConnectParticipantClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConnectParticipantClientConfig } from "./ConnectParticipantClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-connectparticipant/runtimeConfig.native.ts b/clients/client-connectparticipant/runtimeConfig.native.ts index b4396ff2db2b..5bfadbb3ef08 100644 --- a/clients/client-connectparticipant/runtimeConfig.native.ts +++ b/clients/client-connectparticipant/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ConnectParticipantClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ConnectParticipantClientConfig } from "./ConnectParticipantClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-connectparticipant/runtimeConfig.shared.ts b/clients/client-connectparticipant/runtimeConfig.shared.ts index b5ce95df6dbe..33b86ba14350 100644 --- a/clients/client-connectparticipant/runtimeConfig.shared.ts +++ b/clients/client-connectparticipant/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => ({ apiVersion: "2018-09-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ConnectParticipant", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-connectparticipant/runtimeConfig.ts b/clients/client-connectparticipant/runtimeConfig.ts index 9d1d4cbc24e0..53e9ad9e9cbb 100644 --- a/clients/client-connectparticipant/runtimeConfig.ts +++ b/clients/client-connectparticipant/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ConnectParticipantClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ConnectParticipantClientConfig } from "./ConnectParticipantClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cost-and-usage-report-service/CostAndUsageReportServiceClient.ts b/clients/client-cost-and-usage-report-service/CostAndUsageReportServiceClient.ts index f0c6744d3b72..dbe368d356b1 100644 --- a/clients/client-cost-and-usage-report-service/CostAndUsageReportServiceClient.ts +++ b/clients/client-cost-and-usage-report-service/CostAndUsageReportServiceClient.ts @@ -14,7 +14,7 @@ import { PutReportDefinitionCommandInput, PutReportDefinitionCommandOutput, } from "./commands/PutReportDefinitionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -250,10 +250,7 @@ export class CostAndUsageReportServiceClient extends __Client< readonly config: CostAndUsageReportServiceClientResolvedConfig; constructor(configuration: CostAndUsageReportServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); 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 b871b6f0d486..b91170c17a5b 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CostAndUsageReportServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CostAndUsageReportServiceClientConfig } from "./CostAndUsageReportServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 51d1cc77a460..d6d57a68583a 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CostAndUsageReportServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CostAndUsageReportServiceClientConfig } from "./CostAndUsageReportServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 793f70a37c35..3a3a30d1bbd9 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.shared.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) => ({ apiVersion: "2017-01-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Cost and Usage Report Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cost-and-usage-report-service/runtimeConfig.ts b/clients/client-cost-and-usage-report-service/runtimeConfig.ts index e39449ca38aa..030cef8c304d 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CostAndUsageReportServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CostAndUsageReportServiceClientConfig } from "./CostAndUsageReportServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cost-explorer/CostExplorerClient.ts b/clients/client-cost-explorer/CostExplorerClient.ts index 77154ae2d2c0..9ee518d00f3b 100644 --- a/clients/client-cost-explorer/CostExplorerClient.ts +++ b/clients/client-cost-explorer/CostExplorerClient.ts @@ -94,7 +94,7 @@ import { UpdateCostCategoryDefinitionCommandInput, UpdateCostCategoryDefinitionCommandOutput, } from "./commands/UpdateCostCategoryDefinitionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -377,10 +377,7 @@ export class CostExplorerClient extends __Client< readonly config: CostExplorerClientResolvedConfig; constructor(configuration: CostExplorerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-cost-explorer/runtimeConfig.browser.ts b/clients/client-cost-explorer/runtimeConfig.browser.ts index 70a649403b61..e2334efdc420 100644 --- a/clients/client-cost-explorer/runtimeConfig.browser.ts +++ b/clients/client-cost-explorer/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CostExplorerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CostExplorerClientConfig } from "./CostExplorerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CostExplorerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-cost-explorer/runtimeConfig.native.ts b/clients/client-cost-explorer/runtimeConfig.native.ts index 7353d1404bf8..34d16bea3ee5 100644 --- a/clients/client-cost-explorer/runtimeConfig.native.ts +++ b/clients/client-cost-explorer/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CostExplorerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CostExplorerClientConfig } from "./CostExplorerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CostExplorerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-cost-explorer/runtimeConfig.shared.ts b/clients/client-cost-explorer/runtimeConfig.shared.ts index 4cd5c7f91d7b..304751b45b9f 100644 --- a/clients/client-cost-explorer/runtimeConfig.shared.ts +++ b/clients/client-cost-explorer/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CostExplorerClientConfig) => ({ apiVersion: "2017-10-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Cost Explorer", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-cost-explorer/runtimeConfig.ts b/clients/client-cost-explorer/runtimeConfig.ts index 4bc744c46ccd..bd89a403be65 100644 --- a/clients/client-cost-explorer/runtimeConfig.ts +++ b/clients/client-cost-explorer/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CostExplorerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CostExplorerClientConfig } from "./CostExplorerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CostExplorerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-customer-profiles/CustomerProfilesClient.ts b/clients/client-customer-profiles/CustomerProfilesClient.ts index 2397b0e0d7dd..db282cb102f0 100644 --- a/clients/client-customer-profiles/CustomerProfilesClient.ts +++ b/clients/client-customer-profiles/CustomerProfilesClient.ts @@ -55,7 +55,7 @@ import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/Ta import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateDomainCommandInput, UpdateDomainCommandOutput } from "./commands/UpdateDomainCommand"; import { UpdateProfileCommandInput, UpdateProfileCommandOutput } from "./commands/UpdateProfileCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -340,10 +340,7 @@ export class CustomerProfilesClient extends __Client< readonly config: CustomerProfilesClientResolvedConfig; constructor(configuration: CustomerProfilesClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-customer-profiles/runtimeConfig.browser.ts b/clients/client-customer-profiles/runtimeConfig.browser.ts index 4cd665fb4df8..2d5528cde6cc 100644 --- a/clients/client-customer-profiles/runtimeConfig.browser.ts +++ b/clients/client-customer-profiles/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./CustomerProfilesClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CustomerProfilesClientConfig } from "./CustomerProfilesClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-customer-profiles/runtimeConfig.native.ts b/clients/client-customer-profiles/runtimeConfig.native.ts index fa03d6d5b0e5..2ad209846f25 100644 --- a/clients/client-customer-profiles/runtimeConfig.native.ts +++ b/clients/client-customer-profiles/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./CustomerProfilesClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { CustomerProfilesClientConfig } from "./CustomerProfilesClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-customer-profiles/runtimeConfig.shared.ts b/clients/client-customer-profiles/runtimeConfig.shared.ts index c37bcaa95679..0c2d2d4af17a 100644 --- a/clients/client-customer-profiles/runtimeConfig.shared.ts +++ b/clients/client-customer-profiles/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => ({ apiVersion: "2020-08-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Customer Profiles", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-customer-profiles/runtimeConfig.ts b/clients/client-customer-profiles/runtimeConfig.ts index b302036990df..f7c7ac30994a 100644 --- a/clients/client-customer-profiles/runtimeConfig.ts +++ b/clients/client-customer-profiles/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./CustomerProfilesClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { CustomerProfilesClientConfig } from "./CustomerProfilesClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-data-pipeline/DataPipelineClient.ts b/clients/client-data-pipeline/DataPipelineClient.ts index e92e45278424..f8989fb696bd 100644 --- a/clients/client-data-pipeline/DataPipelineClient.ts +++ b/clients/client-data-pipeline/DataPipelineClient.ts @@ -29,7 +29,7 @@ import { ValidatePipelineDefinitionCommandInput, ValidatePipelineDefinitionCommandOutput, } from "./commands/ValidatePipelineDefinitionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -293,10 +293,7 @@ export class DataPipelineClient extends __Client< readonly config: DataPipelineClientResolvedConfig; constructor(configuration: DataPipelineClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-data-pipeline/runtimeConfig.browser.ts b/clients/client-data-pipeline/runtimeConfig.browser.ts index 86a2a25be09d..c2a244cda7c5 100644 --- a/clients/client-data-pipeline/runtimeConfig.browser.ts +++ b/clients/client-data-pipeline/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DataPipelineClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataPipelineClientConfig } from "./DataPipelineClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataPipelineClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-data-pipeline/runtimeConfig.native.ts b/clients/client-data-pipeline/runtimeConfig.native.ts index 1185944d3675..0c61638e8cd9 100644 --- a/clients/client-data-pipeline/runtimeConfig.native.ts +++ b/clients/client-data-pipeline/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DataPipelineClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DataPipelineClientConfig } from "./DataPipelineClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DataPipelineClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-data-pipeline/runtimeConfig.shared.ts b/clients/client-data-pipeline/runtimeConfig.shared.ts index 7c4d849c03e0..a6ec2e7111b4 100644 --- a/clients/client-data-pipeline/runtimeConfig.shared.ts +++ b/clients/client-data-pipeline/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DataPipelineClientConfig) => ({ apiVersion: "2012-10-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Data Pipeline", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-data-pipeline/runtimeConfig.ts b/clients/client-data-pipeline/runtimeConfig.ts index c6b554990ae4..96195bef78f1 100644 --- a/clients/client-data-pipeline/runtimeConfig.ts +++ b/clients/client-data-pipeline/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DataPipelineClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataPipelineClientConfig } from "./DataPipelineClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataPipelineClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-database-migration-service/DatabaseMigrationServiceClient.ts b/clients/client-database-migration-service/DatabaseMigrationServiceClient.ts index 8814be8058c5..0ca3168094a2 100644 --- a/clients/client-database-migration-service/DatabaseMigrationServiceClient.ts +++ b/clients/client-database-migration-service/DatabaseMigrationServiceClient.ts @@ -179,7 +179,7 @@ import { StopReplicationTaskCommandOutput, } from "./commands/StopReplicationTaskCommand"; import { TestConnectionCommandInput, TestConnectionCommandOutput } from "./commands/TestConnectionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -509,10 +509,7 @@ export class DatabaseMigrationServiceClient extends __Client< readonly config: DatabaseMigrationServiceClientResolvedConfig; constructor(configuration: DatabaseMigrationServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-database-migration-service/runtimeConfig.browser.ts b/clients/client-database-migration-service/runtimeConfig.browser.ts index 6945588b47d7..c945aafce95a 100644 --- a/clients/client-database-migration-service/runtimeConfig.browser.ts +++ b/clients/client-database-migration-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DatabaseMigrationServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DatabaseMigrationServiceClientConfig } from "./DatabaseMigrationServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-database-migration-service/runtimeConfig.native.ts b/clients/client-database-migration-service/runtimeConfig.native.ts index dd49071b5c5b..048250220f71 100644 --- a/clients/client-database-migration-service/runtimeConfig.native.ts +++ b/clients/client-database-migration-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DatabaseMigrationServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DatabaseMigrationServiceClientConfig } from "./DatabaseMigrationServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-database-migration-service/runtimeConfig.shared.ts b/clients/client-database-migration-service/runtimeConfig.shared.ts index e8b649446586..e00aa4e19904 100644 --- a/clients/client-database-migration-service/runtimeConfig.shared.ts +++ b/clients/client-database-migration-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) => ({ apiVersion: "2016-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Database Migration Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-database-migration-service/runtimeConfig.ts b/clients/client-database-migration-service/runtimeConfig.ts index 6c4cdd66a0b0..e1d082b80715 100644 --- a/clients/client-database-migration-service/runtimeConfig.ts +++ b/clients/client-database-migration-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DatabaseMigrationServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DatabaseMigrationServiceClientConfig } from "./DatabaseMigrationServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-databrew/DataBrewClient.ts b/clients/client-databrew/DataBrewClient.ts index e3f00f218f1a..54c344831c82 100644 --- a/clients/client-databrew/DataBrewClient.ts +++ b/clients/client-databrew/DataBrewClient.ts @@ -52,7 +52,7 @@ import { UpdateProjectCommandInput, UpdateProjectCommandOutput } from "./command import { UpdateRecipeCommandInput, UpdateRecipeCommandOutput } from "./commands/UpdateRecipeCommand"; import { UpdateRecipeJobCommandInput, UpdateRecipeJobCommandOutput } from "./commands/UpdateRecipeJobCommand"; import { UpdateScheduleCommandInput, UpdateScheduleCommandOutput } from "./commands/UpdateScheduleCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -343,10 +343,7 @@ export class DataBrewClient extends __Client< readonly config: DataBrewClientResolvedConfig; constructor(configuration: DataBrewClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-databrew/runtimeConfig.browser.ts b/clients/client-databrew/runtimeConfig.browser.ts index 9af3e3743283..e5c053bf9c86 100644 --- a/clients/client-databrew/runtimeConfig.browser.ts +++ b/clients/client-databrew/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DataBrewClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataBrewClientConfig } from "./DataBrewClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataBrewClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-databrew/runtimeConfig.native.ts b/clients/client-databrew/runtimeConfig.native.ts index 77c385359392..b9e00b3d4c4c 100644 --- a/clients/client-databrew/runtimeConfig.native.ts +++ b/clients/client-databrew/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DataBrewClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DataBrewClientConfig } from "./DataBrewClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DataBrewClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-databrew/runtimeConfig.shared.ts b/clients/client-databrew/runtimeConfig.shared.ts index 5125d0b2b550..e4e8983fe35c 100644 --- a/clients/client-databrew/runtimeConfig.shared.ts +++ b/clients/client-databrew/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DataBrewClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DataBrew", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-databrew/runtimeConfig.ts b/clients/client-databrew/runtimeConfig.ts index 3de8fd1f9fe9..839e00f0db8a 100644 --- a/clients/client-databrew/runtimeConfig.ts +++ b/clients/client-databrew/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DataBrewClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataBrewClientConfig } from "./DataBrewClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataBrewClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dataexchange/DataExchangeClient.ts b/clients/client-dataexchange/DataExchangeClient.ts index a29f9e8ccc26..d1bda774a884 100644 --- a/clients/client-dataexchange/DataExchangeClient.ts +++ b/clients/client-dataexchange/DataExchangeClient.ts @@ -26,7 +26,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateAssetCommandInput, UpdateAssetCommandOutput } from "./commands/UpdateAssetCommand"; import { UpdateDataSetCommandInput, UpdateDataSetCommandOutput } from "./commands/UpdateDataSetCommand"; import { UpdateRevisionCommandInput, UpdateRevisionCommandOutput } from "./commands/UpdateRevisionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -280,10 +280,7 @@ export class DataExchangeClient extends __Client< readonly config: DataExchangeClientResolvedConfig; constructor(configuration: DataExchangeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-dataexchange/runtimeConfig.browser.ts b/clients/client-dataexchange/runtimeConfig.browser.ts index 42d89af617a0..c340db953111 100644 --- a/clients/client-dataexchange/runtimeConfig.browser.ts +++ b/clients/client-dataexchange/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DataExchangeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataExchangeClientConfig } from "./DataExchangeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataExchangeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dataexchange/runtimeConfig.native.ts b/clients/client-dataexchange/runtimeConfig.native.ts index a0b97945fb6e..bf308de7667e 100644 --- a/clients/client-dataexchange/runtimeConfig.native.ts +++ b/clients/client-dataexchange/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DataExchangeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DataExchangeClientConfig } from "./DataExchangeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DataExchangeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-dataexchange/runtimeConfig.shared.ts b/clients/client-dataexchange/runtimeConfig.shared.ts index 38aa43059167..215570e16ba9 100644 --- a/clients/client-dataexchange/runtimeConfig.shared.ts +++ b/clients/client-dataexchange/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DataExchangeClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DataExchange", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-dataexchange/runtimeConfig.ts b/clients/client-dataexchange/runtimeConfig.ts index cc1faf6447ef..e821ba9ad7f2 100644 --- a/clients/client-dataexchange/runtimeConfig.ts +++ b/clients/client-dataexchange/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DataExchangeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataExchangeClientConfig } from "./DataExchangeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataExchangeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-datasync/DataSyncClient.ts b/clients/client-datasync/DataSyncClient.ts index c86a8478f49a..0bd064683545 100644 --- a/clients/client-datasync/DataSyncClient.ts +++ b/clients/client-datasync/DataSyncClient.ts @@ -69,7 +69,7 @@ import { UpdateTaskExecutionCommandInput, UpdateTaskExecutionCommandOutput, } from "./commands/UpdateTaskExecutionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -355,10 +355,7 @@ export class DataSyncClient extends __Client< readonly config: DataSyncClientResolvedConfig; constructor(configuration: DataSyncClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-datasync/runtimeConfig.browser.ts b/clients/client-datasync/runtimeConfig.browser.ts index 8f2c94056ec1..74a2f5c4dff1 100644 --- a/clients/client-datasync/runtimeConfig.browser.ts +++ b/clients/client-datasync/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DataSyncClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataSyncClientConfig } from "./DataSyncClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataSyncClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-datasync/runtimeConfig.native.ts b/clients/client-datasync/runtimeConfig.native.ts index 812f2f29502b..29754840f0e4 100644 --- a/clients/client-datasync/runtimeConfig.native.ts +++ b/clients/client-datasync/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DataSyncClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DataSyncClientConfig } from "./DataSyncClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DataSyncClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-datasync/runtimeConfig.shared.ts b/clients/client-datasync/runtimeConfig.shared.ts index 2a7b3a2967c7..cb05a5a261fa 100644 --- a/clients/client-datasync/runtimeConfig.shared.ts +++ b/clients/client-datasync/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DataSyncClientConfig) => ({ apiVersion: "2018-11-09", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DataSync", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-datasync/runtimeConfig.ts b/clients/client-datasync/runtimeConfig.ts index db6dff098ec8..a3bea7d9b1e4 100644 --- a/clients/client-datasync/runtimeConfig.ts +++ b/clients/client-datasync/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DataSyncClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DataSyncClientConfig } from "./DataSyncClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DataSyncClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dax/DAXClient.ts b/clients/client-dax/DAXClient.ts index 0edd69a1f21d..4750c6e967e0 100644 --- a/clients/client-dax/DAXClient.ts +++ b/clients/client-dax/DAXClient.ts @@ -43,7 +43,7 @@ import { UpdateParameterGroupCommandOutput, } from "./commands/UpdateParameterGroupCommand"; import { UpdateSubnetGroupCommandInput, UpdateSubnetGroupCommandOutput } from "./commands/UpdateSubnetGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -300,10 +300,7 @@ export class DAXClient extends __Client< readonly config: DAXClientResolvedConfig; constructor(configuration: DAXClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-dax/runtimeConfig.browser.ts b/clients/client-dax/runtimeConfig.browser.ts index 0e864fba3229..6228da7cb30f 100644 --- a/clients/client-dax/runtimeConfig.browser.ts +++ b/clients/client-dax/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DAXClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DAXClientConfig } from "./DAXClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DAXClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dax/runtimeConfig.native.ts b/clients/client-dax/runtimeConfig.native.ts index d985d3630f05..1bdbbc26494b 100644 --- a/clients/client-dax/runtimeConfig.native.ts +++ b/clients/client-dax/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DAXClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DAXClientConfig } from "./DAXClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DAXClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-dax/runtimeConfig.shared.ts b/clients/client-dax/runtimeConfig.shared.ts index ed5ef0c8f7f6..4224d57db56d 100644 --- a/clients/client-dax/runtimeConfig.shared.ts +++ b/clients/client-dax/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DAXClientConfig) => ({ apiVersion: "2017-04-19", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DAX", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-dax/runtimeConfig.ts b/clients/client-dax/runtimeConfig.ts index 4967b7004b74..81e1e2917134 100644 --- a/clients/client-dax/runtimeConfig.ts +++ b/clients/client-dax/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DAXClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DAXClientConfig } from "./DAXClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DAXClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-detective/DetectiveClient.ts b/clients/client-detective/DetectiveClient.ts index 2d91fa9412c6..90fd68be7665 100644 --- a/clients/client-detective/DetectiveClient.ts +++ b/clients/client-detective/DetectiveClient.ts @@ -22,7 +22,7 @@ import { } from "./commands/StartMonitoringMemberCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -307,10 +307,7 @@ export class DetectiveClient extends __Client< readonly config: DetectiveClientResolvedConfig; constructor(configuration: DetectiveClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-detective/runtimeConfig.browser.ts b/clients/client-detective/runtimeConfig.browser.ts index a4a78abf2c95..911a92b5d918 100644 --- a/clients/client-detective/runtimeConfig.browser.ts +++ b/clients/client-detective/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DetectiveClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DetectiveClientConfig } from "./DetectiveClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DetectiveClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-detective/runtimeConfig.native.ts b/clients/client-detective/runtimeConfig.native.ts index 2a6de244fd74..59a82738976a 100644 --- a/clients/client-detective/runtimeConfig.native.ts +++ b/clients/client-detective/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DetectiveClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DetectiveClientConfig } from "./DetectiveClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DetectiveClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-detective/runtimeConfig.shared.ts b/clients/client-detective/runtimeConfig.shared.ts index 13b6170c0267..9727b9ba7e1d 100644 --- a/clients/client-detective/runtimeConfig.shared.ts +++ b/clients/client-detective/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DetectiveClientConfig) => ({ apiVersion: "2018-10-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Detective", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-detective/runtimeConfig.ts b/clients/client-detective/runtimeConfig.ts index 81842f084b1c..026f33698cf5 100644 --- a/clients/client-detective/runtimeConfig.ts +++ b/clients/client-detective/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DetectiveClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DetectiveClientConfig } from "./DetectiveClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DetectiveClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-device-farm/DeviceFarmClient.ts b/clients/client-device-farm/DeviceFarmClient.ts index 5ca7ae179b3a..09337e2fe8d5 100644 --- a/clients/client-device-farm/DeviceFarmClient.ts +++ b/clients/client-device-farm/DeviceFarmClient.ts @@ -171,7 +171,7 @@ import { UpdateVPCEConfigurationCommandInput, UpdateVPCEConfigurationCommandOutput, } from "./commands/UpdateVPCEConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -549,10 +549,7 @@ export class DeviceFarmClient extends __Client< readonly config: DeviceFarmClientResolvedConfig; constructor(configuration: DeviceFarmClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-device-farm/runtimeConfig.browser.ts b/clients/client-device-farm/runtimeConfig.browser.ts index 69de5c982d93..b07fe815dacf 100644 --- a/clients/client-device-farm/runtimeConfig.browser.ts +++ b/clients/client-device-farm/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DeviceFarmClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DeviceFarmClientConfig } from "./DeviceFarmClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-device-farm/runtimeConfig.native.ts b/clients/client-device-farm/runtimeConfig.native.ts index 3c54769f9c51..5dc204a62e75 100644 --- a/clients/client-device-farm/runtimeConfig.native.ts +++ b/clients/client-device-farm/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DeviceFarmClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DeviceFarmClientConfig } from "./DeviceFarmClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-device-farm/runtimeConfig.shared.ts b/clients/client-device-farm/runtimeConfig.shared.ts index 268a31a044c7..5af9a28fec9c 100644 --- a/clients/client-device-farm/runtimeConfig.shared.ts +++ b/clients/client-device-farm/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DeviceFarmClientConfig) => ({ apiVersion: "2015-06-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Device Farm", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-device-farm/runtimeConfig.ts b/clients/client-device-farm/runtimeConfig.ts index 4a03cfd160cf..9aade7e0d6f1 100644 --- a/clients/client-device-farm/runtimeConfig.ts +++ b/clients/client-device-farm/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DeviceFarmClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DeviceFarmClientConfig } from "./DeviceFarmClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-devops-guru/DevOpsGuruClient.ts b/clients/client-devops-guru/DevOpsGuruClient.ts index e9e29fda59a2..05ef011bec36 100644 --- a/clients/client-devops-guru/DevOpsGuruClient.ts +++ b/clients/client-devops-guru/DevOpsGuruClient.ts @@ -58,7 +58,7 @@ import { UpdateServiceIntegrationCommandInput, UpdateServiceIntegrationCommandOutput, } from "./commands/UpdateServiceIntegrationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -331,10 +331,7 @@ export class DevOpsGuruClient extends __Client< readonly config: DevOpsGuruClientResolvedConfig; constructor(configuration: DevOpsGuruClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-devops-guru/runtimeConfig.browser.ts b/clients/client-devops-guru/runtimeConfig.browser.ts index b32119957d43..b58ac961424e 100644 --- a/clients/client-devops-guru/runtimeConfig.browser.ts +++ b/clients/client-devops-guru/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DevOpsGuruClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DevOpsGuruClientConfig } from "./DevOpsGuruClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-devops-guru/runtimeConfig.native.ts b/clients/client-devops-guru/runtimeConfig.native.ts index c15cf752f9da..c40957151a73 100644 --- a/clients/client-devops-guru/runtimeConfig.native.ts +++ b/clients/client-devops-guru/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DevOpsGuruClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DevOpsGuruClientConfig } from "./DevOpsGuruClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-devops-guru/runtimeConfig.shared.ts b/clients/client-devops-guru/runtimeConfig.shared.ts index e397449f6b1e..e9190049064f 100644 --- a/clients/client-devops-guru/runtimeConfig.shared.ts +++ b/clients/client-devops-guru/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => ({ apiVersion: "2020-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DevOps Guru", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-devops-guru/runtimeConfig.ts b/clients/client-devops-guru/runtimeConfig.ts index bc159a866139..2e498ab0f6ce 100644 --- a/clients/client-devops-guru/runtimeConfig.ts +++ b/clients/client-devops-guru/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DevOpsGuruClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DevOpsGuruClientConfig } from "./DevOpsGuruClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-direct-connect/DirectConnectClient.ts b/clients/client-direct-connect/DirectConnectClient.ts index ae2cc72a8fe7..ef8f8ea595f7 100644 --- a/clients/client-direct-connect/DirectConnectClient.ts +++ b/clients/client-direct-connect/DirectConnectClient.ts @@ -180,7 +180,7 @@ import { UpdateVirtualInterfaceAttributesCommandInput, UpdateVirtualInterfaceAttributesCommandOutput, } from "./commands/UpdateVirtualInterfaceAttributesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -513,10 +513,7 @@ export class DirectConnectClient extends __Client< readonly config: DirectConnectClientResolvedConfig; constructor(configuration: DirectConnectClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-direct-connect/runtimeConfig.browser.ts b/clients/client-direct-connect/runtimeConfig.browser.ts index 5c73175a0f1e..824482a976b0 100644 --- a/clients/client-direct-connect/runtimeConfig.browser.ts +++ b/clients/client-direct-connect/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DirectConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DirectConnectClientConfig } from "./DirectConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DirectConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-direct-connect/runtimeConfig.native.ts b/clients/client-direct-connect/runtimeConfig.native.ts index 72ff897f0597..3341c93d1d5b 100644 --- a/clients/client-direct-connect/runtimeConfig.native.ts +++ b/clients/client-direct-connect/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DirectConnectClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DirectConnectClientConfig } from "./DirectConnectClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DirectConnectClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-direct-connect/runtimeConfig.shared.ts b/clients/client-direct-connect/runtimeConfig.shared.ts index 5c79ef8e4ccd..791d2ac74bcf 100644 --- a/clients/client-direct-connect/runtimeConfig.shared.ts +++ b/clients/client-direct-connect/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DirectConnectClientConfig) => ({ apiVersion: "2012-10-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Direct Connect", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-direct-connect/runtimeConfig.ts b/clients/client-direct-connect/runtimeConfig.ts index 3f42d57b867f..87bb983a4d72 100644 --- a/clients/client-direct-connect/runtimeConfig.ts +++ b/clients/client-direct-connect/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DirectConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DirectConnectClientConfig } from "./DirectConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DirectConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-directory-service/DirectoryServiceClient.ts b/clients/client-directory-service/DirectoryServiceClient.ts index 8f0e25a49d99..73fcaf153606 100644 --- a/clients/client-directory-service/DirectoryServiceClient.ts +++ b/clients/client-directory-service/DirectoryServiceClient.ts @@ -141,7 +141,7 @@ import { import { UpdateRadiusCommandInput, UpdateRadiusCommandOutput } from "./commands/UpdateRadiusCommand"; import { UpdateTrustCommandInput, UpdateTrustCommandOutput } from "./commands/UpdateTrustCommand"; import { VerifyTrustCommandInput, VerifyTrustCommandOutput } from "./commands/VerifyTrustCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -480,10 +480,7 @@ export class DirectoryServiceClient extends __Client< readonly config: DirectoryServiceClientResolvedConfig; constructor(configuration: DirectoryServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-directory-service/runtimeConfig.browser.ts b/clients/client-directory-service/runtimeConfig.browser.ts index 3d668fe6f913..b4a7a8759618 100644 --- a/clients/client-directory-service/runtimeConfig.browser.ts +++ b/clients/client-directory-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DirectoryServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DirectoryServiceClientConfig } from "./DirectoryServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-directory-service/runtimeConfig.native.ts b/clients/client-directory-service/runtimeConfig.native.ts index 5a76cbb5d1db..14fd0adae2b6 100644 --- a/clients/client-directory-service/runtimeConfig.native.ts +++ b/clients/client-directory-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DirectoryServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DirectoryServiceClientConfig } from "./DirectoryServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-directory-service/runtimeConfig.shared.ts b/clients/client-directory-service/runtimeConfig.shared.ts index 07d7a1e9e7a5..36fe6b411619 100644 --- a/clients/client-directory-service/runtimeConfig.shared.ts +++ b/clients/client-directory-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => ({ apiVersion: "2015-04-16", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Directory Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-directory-service/runtimeConfig.ts b/clients/client-directory-service/runtimeConfig.ts index cc518d794a70..284f9105f49f 100644 --- a/clients/client-directory-service/runtimeConfig.ts +++ b/clients/client-directory-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DirectoryServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DirectoryServiceClientConfig } from "./DirectoryServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dlm/DLMClient.ts b/clients/client-dlm/DLMClient.ts index 3a6028d35d83..38f1d877f32c 100644 --- a/clients/client-dlm/DLMClient.ts +++ b/clients/client-dlm/DLMClient.ts @@ -21,7 +21,7 @@ import { UpdateLifecyclePolicyCommandInput, UpdateLifecyclePolicyCommandOutput, } from "./commands/UpdateLifecyclePolicyCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -253,10 +253,7 @@ export class DLMClient extends __Client< readonly config: DLMClientResolvedConfig; constructor(configuration: DLMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-dlm/runtimeConfig.browser.ts b/clients/client-dlm/runtimeConfig.browser.ts index ee0272809cc2..24fd476ad78f 100644 --- a/clients/client-dlm/runtimeConfig.browser.ts +++ b/clients/client-dlm/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DLMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DLMClientConfig } from "./DLMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DLMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dlm/runtimeConfig.native.ts b/clients/client-dlm/runtimeConfig.native.ts index 8774d206f873..19d3d7c44435 100644 --- a/clients/client-dlm/runtimeConfig.native.ts +++ b/clients/client-dlm/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DLMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DLMClientConfig } from "./DLMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DLMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-dlm/runtimeConfig.shared.ts b/clients/client-dlm/runtimeConfig.shared.ts index 981e364b33bf..f69992be4b8a 100644 --- a/clients/client-dlm/runtimeConfig.shared.ts +++ b/clients/client-dlm/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DLMClientConfig) => ({ apiVersion: "2018-01-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DLM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-dlm/runtimeConfig.ts b/clients/client-dlm/runtimeConfig.ts index 169355c1e4fe..c9239cb7424b 100644 --- a/clients/client-dlm/runtimeConfig.ts +++ b/clients/client-dlm/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DLMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DLMClientConfig } from "./DLMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DLMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-docdb/DocDBClient.ts b/clients/client-docdb/DocDBClient.ts index f34fdfecf09a..20f7e9afef85 100644 --- a/clients/client-docdb/DocDBClient.ts +++ b/clients/client-docdb/DocDBClient.ts @@ -171,7 +171,7 @@ import { } from "./commands/RestoreDBClusterToPointInTimeCommand"; import { StartDBClusterCommandInput, StartDBClusterCommandOutput } from "./commands/StartDBClusterCommand"; import { StopDBClusterCommandInput, StopDBClusterCommandOutput } from "./commands/StopDBClusterCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -487,10 +487,7 @@ export class DocDBClient extends __Client< readonly config: DocDBClientResolvedConfig; constructor(configuration: DocDBClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-docdb/runtimeConfig.browser.ts b/clients/client-docdb/runtimeConfig.browser.ts index 67944469964b..0d6993865827 100644 --- a/clients/client-docdb/runtimeConfig.browser.ts +++ b/clients/client-docdb/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DocDBClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DocDBClientConfig } from "./DocDBClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DocDBClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-docdb/runtimeConfig.native.ts b/clients/client-docdb/runtimeConfig.native.ts index 44a73e5f7fc5..76cc64843994 100644 --- a/clients/client-docdb/runtimeConfig.native.ts +++ b/clients/client-docdb/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DocDBClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DocDBClientConfig } from "./DocDBClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DocDBClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-docdb/runtimeConfig.shared.ts b/clients/client-docdb/runtimeConfig.shared.ts index 4dde6e3728c1..084c2ca80b6f 100644 --- a/clients/client-docdb/runtimeConfig.shared.ts +++ b/clients/client-docdb/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DocDBClientConfig) => ({ apiVersion: "2014-10-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DocDB", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-docdb/runtimeConfig.ts b/clients/client-docdb/runtimeConfig.ts index 91ca625b1413..4e405ac5778b 100644 --- a/clients/client-docdb/runtimeConfig.ts +++ b/clients/client-docdb/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DocDBClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DocDBClientConfig } from "./DocDBClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DocDBClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dynamodb-streams/DynamoDBStreamsClient.ts b/clients/client-dynamodb-streams/DynamoDBStreamsClient.ts index 2afd1b949e4f..b803b43e752d 100644 --- a/clients/client-dynamodb-streams/DynamoDBStreamsClient.ts +++ b/clients/client-dynamodb-streams/DynamoDBStreamsClient.ts @@ -2,7 +2,7 @@ import { DescribeStreamCommandInput, DescribeStreamCommandOutput } from "./comma import { GetRecordsCommandInput, GetRecordsCommandOutput } from "./commands/GetRecordsCommand"; import { GetShardIteratorCommandInput, GetShardIteratorCommandOutput } from "./commands/GetShardIteratorCommand"; import { ListStreamsCommandInput, ListStreamsCommandOutput } from "./commands/ListStreamsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -225,10 +225,7 @@ export class DynamoDBStreamsClient extends __Client< readonly config: DynamoDBStreamsClientResolvedConfig; constructor(configuration: DynamoDBStreamsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-dynamodb-streams/runtimeConfig.browser.ts b/clients/client-dynamodb-streams/runtimeConfig.browser.ts index e822e4b1946c..b7cda4136388 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.browser.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DynamoDBStreamsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DynamoDBStreamsClientConfig } from "./DynamoDBStreamsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dynamodb-streams/runtimeConfig.native.ts b/clients/client-dynamodb-streams/runtimeConfig.native.ts index e81307c07981..f6a066129dba 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.native.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DynamoDBStreamsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DynamoDBStreamsClientConfig } from "./DynamoDBStreamsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-dynamodb-streams/runtimeConfig.shared.ts b/clients/client-dynamodb-streams/runtimeConfig.shared.ts index 66dafc22a41b..ca6917dcc646 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.shared.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => ({ apiVersion: "2012-08-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DynamoDB Streams", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-dynamodb-streams/runtimeConfig.ts b/clients/client-dynamodb-streams/runtimeConfig.ts index fb3f614d080a..017a0c90033d 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DynamoDBStreamsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DynamoDBStreamsClientConfig } from "./DynamoDBStreamsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-dynamodb/DynamoDBClient.ts b/clients/client-dynamodb/DynamoDBClient.ts index 34ca25b9e3e6..b4eb1e13d4e7 100644 --- a/clients/client-dynamodb/DynamoDBClient.ts +++ b/clients/client-dynamodb/DynamoDBClient.ts @@ -103,7 +103,7 @@ import { UpdateTableReplicaAutoScalingCommandOutput, } from "./commands/UpdateTableReplicaAutoScalingCommand"; import { UpdateTimeToLiveCommandInput, UpdateTimeToLiveCommandOutput } from "./commands/UpdateTimeToLiveCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -445,10 +445,7 @@ export class DynamoDBClient extends __Client< readonly config: DynamoDBClientResolvedConfig; constructor(configuration: DynamoDBClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-dynamodb/runtimeConfig.browser.ts b/clients/client-dynamodb/runtimeConfig.browser.ts index 1374402a4c12..8fc83b6151b1 100644 --- a/clients/client-dynamodb/runtimeConfig.browser.ts +++ b/clients/client-dynamodb/runtimeConfig.browser.ts @@ -4,34 +4,43 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./DynamoDBClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DynamoDBClientConfig } from "./DynamoDBClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - endpointDiscoveryEnabledProvider: () => Promise.resolve(undefined), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DynamoDBClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-dynamodb/runtimeConfig.native.ts b/clients/client-dynamodb/runtimeConfig.native.ts index 77aa4a1b032d..25740861703b 100644 --- a/clients/client-dynamodb/runtimeConfig.native.ts +++ b/clients/client-dynamodb/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./DynamoDBClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { DynamoDBClientConfig } from "./DynamoDBClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: DynamoDBClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-dynamodb/runtimeConfig.shared.ts b/clients/client-dynamodb/runtimeConfig.shared.ts index fb606da58f17..50db37959f50 100644 --- a/clients/client-dynamodb/runtimeConfig.shared.ts +++ b/clients/client-dynamodb/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: DynamoDBClientConfig) => ({ apiVersion: "2012-08-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "DynamoDB", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-dynamodb/runtimeConfig.ts b/clients/client-dynamodb/runtimeConfig.ts index 06896480e607..02062b80f4dc 100644 --- a/clients/client-dynamodb/runtimeConfig.ts +++ b/clients/client-dynamodb/runtimeConfig.ts @@ -8,34 +8,44 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./DynamoDBClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { DynamoDBClientConfig } from "./DynamoDBClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - endpointDiscoveryEnabledProvider: loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: DynamoDBClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-ebs/EBSClient.ts b/clients/client-ebs/EBSClient.ts index 3f9351a26a03..b3fadc5fb50e 100644 --- a/clients/client-ebs/EBSClient.ts +++ b/clients/client-ebs/EBSClient.ts @@ -4,7 +4,7 @@ import { ListChangedBlocksCommandInput, ListChangedBlocksCommandOutput } from ". import { ListSnapshotBlocksCommandInput, ListSnapshotBlocksCommandOutput } from "./commands/ListSnapshotBlocksCommand"; import { PutSnapshotBlockCommandInput, PutSnapshotBlockCommandOutput } from "./commands/PutSnapshotBlockCommand"; import { StartSnapshotCommandInput, StartSnapshotCommandOutput } from "./commands/StartSnapshotCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -245,10 +245,7 @@ export class EBSClient extends __Client< readonly config: EBSClientResolvedConfig; constructor(configuration: EBSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ebs/runtimeConfig.browser.ts b/clients/client-ebs/runtimeConfig.browser.ts index d93476c9c27d..be9b4ebe64fc 100644 --- a/clients/client-ebs/runtimeConfig.browser.ts +++ b/clients/client-ebs/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EBSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EBSClientConfig } from "./EBSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EBSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ebs/runtimeConfig.native.ts b/clients/client-ebs/runtimeConfig.native.ts index 2c68b014c66a..4fbda83098a6 100644 --- a/clients/client-ebs/runtimeConfig.native.ts +++ b/clients/client-ebs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EBSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EBSClientConfig } from "./EBSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EBSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ebs/runtimeConfig.shared.ts b/clients/client-ebs/runtimeConfig.shared.ts index a89212ea7a92..bf7683b8458a 100644 --- a/clients/client-ebs/runtimeConfig.shared.ts +++ b/clients/client-ebs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EBSClientConfig) => ({ apiVersion: "2019-11-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EBS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ebs/runtimeConfig.ts b/clients/client-ebs/runtimeConfig.ts index 0f3f211f3ba0..b0dbf48d137e 100644 --- a/clients/client-ebs/runtimeConfig.ts +++ b/clients/client-ebs/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EBSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EBSClientConfig } from "./EBSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EBSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ec2-instance-connect/EC2InstanceConnectClient.ts b/clients/client-ec2-instance-connect/EC2InstanceConnectClient.ts index 6310cb4c5727..2806b97d2e91 100644 --- a/clients/client-ec2-instance-connect/EC2InstanceConnectClient.ts +++ b/clients/client-ec2-instance-connect/EC2InstanceConnectClient.ts @@ -3,7 +3,7 @@ import { SendSerialConsoleSSHPublicKeyCommandInput, SendSerialConsoleSSHPublicKeyCommandOutput, } from "./commands/SendSerialConsoleSSHPublicKeyCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -215,10 +215,7 @@ export class EC2InstanceConnectClient extends __Client< readonly config: EC2InstanceConnectClientResolvedConfig; constructor(configuration: EC2InstanceConnectClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ec2-instance-connect/runtimeConfig.browser.ts b/clients/client-ec2-instance-connect/runtimeConfig.browser.ts index e9f024237b48..430c6992e516 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.browser.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EC2InstanceConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EC2InstanceConnectClientConfig } from "./EC2InstanceConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ec2-instance-connect/runtimeConfig.native.ts b/clients/client-ec2-instance-connect/runtimeConfig.native.ts index db01c030653a..f31e91adfba2 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.native.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EC2InstanceConnectClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EC2InstanceConnectClientConfig } from "./EC2InstanceConnectClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ec2-instance-connect/runtimeConfig.shared.ts b/clients/client-ec2-instance-connect/runtimeConfig.shared.ts index b58e602477ed..e9369207b967 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.shared.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => ({ apiVersion: "2018-04-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EC2 Instance Connect", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ec2-instance-connect/runtimeConfig.ts b/clients/client-ec2-instance-connect/runtimeConfig.ts index 5481c078f58a..51c9a952aa2c 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EC2InstanceConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EC2InstanceConnectClientConfig } from "./EC2InstanceConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ec2/EC2Client.ts b/clients/client-ec2/EC2Client.ts index 1c08b47994e0..3de64d03d6f6 100644 --- a/clients/client-ec2/EC2Client.ts +++ b/clients/client-ec2/EC2Client.ts @@ -1543,7 +1543,7 @@ import { UpdateSecurityGroupRuleDescriptionsIngressCommandOutput, } from "./commands/UpdateSecurityGroupRuleDescriptionsIngressCommand"; import { WithdrawByoipCidrCommandInput, WithdrawByoipCidrCommandOutput } from "./commands/WithdrawByoipCidrCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -2702,10 +2702,7 @@ export class EC2Client extends __Client< readonly config: EC2ClientResolvedConfig; constructor(configuration: EC2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ec2/runtimeConfig.browser.ts b/clients/client-ec2/runtimeConfig.browser.ts index ec3f75488865..b3334bc42482 100644 --- a/clients/client-ec2/runtimeConfig.browser.ts +++ b/clients/client-ec2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EC2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EC2ClientConfig } from "./EC2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EC2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ec2/runtimeConfig.native.ts b/clients/client-ec2/runtimeConfig.native.ts index 9c638def19c8..cdd4483a7c53 100644 --- a/clients/client-ec2/runtimeConfig.native.ts +++ b/clients/client-ec2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EC2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EC2ClientConfig } from "./EC2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EC2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ec2/runtimeConfig.shared.ts b/clients/client-ec2/runtimeConfig.shared.ts index 5bd79b8d34cf..8b482c343394 100644 --- a/clients/client-ec2/runtimeConfig.shared.ts +++ b/clients/client-ec2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EC2ClientConfig) => ({ apiVersion: "2016-11-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EC2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ec2/runtimeConfig.ts b/clients/client-ec2/runtimeConfig.ts index 4e01ff3bd76f..172655c3317e 100644 --- a/clients/client-ec2/runtimeConfig.ts +++ b/clients/client-ec2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EC2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EC2ClientConfig } from "./EC2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EC2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ecr-public/ECRPUBLICClient.ts b/clients/client-ecr-public/ECRPUBLICClient.ts index 0b5776141c14..f3d51f6d7e0f 100644 --- a/clients/client-ecr-public/ECRPUBLICClient.ts +++ b/clients/client-ecr-public/ECRPUBLICClient.ts @@ -60,7 +60,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UploadLayerPartCommandInput, UploadLayerPartCommandOutput } from "./commands/UploadLayerPartCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -322,10 +322,7 @@ export class ECRPUBLICClient extends __Client< readonly config: ECRPUBLICClientResolvedConfig; constructor(configuration: ECRPUBLICClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ecr-public/runtimeConfig.browser.ts b/clients/client-ecr-public/runtimeConfig.browser.ts index ca36841d7006..bb51fc55dd25 100644 --- a/clients/client-ecr-public/runtimeConfig.browser.ts +++ b/clients/client-ecr-public/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ECRPUBLICClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ECRPUBLICClientConfig } from "./ECRPUBLICClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ecr-public/runtimeConfig.native.ts b/clients/client-ecr-public/runtimeConfig.native.ts index 86a4cd7a1e78..8dc4c8e7b74d 100644 --- a/clients/client-ecr-public/runtimeConfig.native.ts +++ b/clients/client-ecr-public/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ECRPUBLICClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ECRPUBLICClientConfig } from "./ECRPUBLICClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ecr-public/runtimeConfig.shared.ts b/clients/client-ecr-public/runtimeConfig.shared.ts index 7b93255f9d11..d23efee0458a 100644 --- a/clients/client-ecr-public/runtimeConfig.shared.ts +++ b/clients/client-ecr-public/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => ({ apiVersion: "2020-10-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ECR PUBLIC", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ecr-public/runtimeConfig.ts b/clients/client-ecr-public/runtimeConfig.ts index c4aee5f867c1..d5e531eecb5f 100644 --- a/clients/client-ecr-public/runtimeConfig.ts +++ b/clients/client-ecr-public/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ECRPUBLICClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ECRPUBLICClientConfig } from "./ECRPUBLICClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ecr/ECRClient.ts b/clients/client-ecr/ECRClient.ts index 47a718486a9c..7e00b9409efe 100644 --- a/clients/client-ecr/ECRClient.ts +++ b/clients/client-ecr/ECRClient.ts @@ -86,7 +86,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UploadLayerPartCommandInput, UploadLayerPartCommandOutput } from "./commands/UploadLayerPartCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -370,10 +370,7 @@ export class ECRClient extends __Client< readonly config: ECRClientResolvedConfig; constructor(configuration: ECRClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ecr/runtimeConfig.browser.ts b/clients/client-ecr/runtimeConfig.browser.ts index 9351c1841193..62d609e57fdc 100644 --- a/clients/client-ecr/runtimeConfig.browser.ts +++ b/clients/client-ecr/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ECRClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ECRClientConfig } from "./ECRClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ECRClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ecr/runtimeConfig.native.ts b/clients/client-ecr/runtimeConfig.native.ts index c08f2880cd18..70d12c470e70 100644 --- a/clients/client-ecr/runtimeConfig.native.ts +++ b/clients/client-ecr/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ECRClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ECRClientConfig } from "./ECRClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ECRClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ecr/runtimeConfig.shared.ts b/clients/client-ecr/runtimeConfig.shared.ts index abb836a2f0c8..e7a53398f8dc 100644 --- a/clients/client-ecr/runtimeConfig.shared.ts +++ b/clients/client-ecr/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ECRClientConfig) => ({ apiVersion: "2015-09-21", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ECR", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ecr/runtimeConfig.ts b/clients/client-ecr/runtimeConfig.ts index 4be0b1b695ef..6a239462849a 100644 --- a/clients/client-ecr/runtimeConfig.ts +++ b/clients/client-ecr/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ECRClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ECRClientConfig } from "./ECRClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ECRClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ecs/ECSClient.ts b/clients/client-ecs/ECSClient.ts index 825c23b0a2d8..9000b80ea3d8 100644 --- a/clients/client-ecs/ECSClient.ts +++ b/clients/client-ecs/ECSClient.ts @@ -128,7 +128,7 @@ import { UpdateServicePrimaryTaskSetCommandOutput, } from "./commands/UpdateServicePrimaryTaskSetCommand"; import { UpdateTaskSetCommandInput, UpdateTaskSetCommandOutput } from "./commands/UpdateTaskSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -454,10 +454,7 @@ export class ECSClient extends __Client< readonly config: ECSClientResolvedConfig; constructor(configuration: ECSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ecs/runtimeConfig.browser.ts b/clients/client-ecs/runtimeConfig.browser.ts index 3bd1bb403a76..fcb41b8305e0 100644 --- a/clients/client-ecs/runtimeConfig.browser.ts +++ b/clients/client-ecs/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ECSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ECSClientConfig } from "./ECSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ECSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ecs/runtimeConfig.native.ts b/clients/client-ecs/runtimeConfig.native.ts index 91f195ff5492..f39aa5813283 100644 --- a/clients/client-ecs/runtimeConfig.native.ts +++ b/clients/client-ecs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ECSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ECSClientConfig } from "./ECSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ECSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ecs/runtimeConfig.shared.ts b/clients/client-ecs/runtimeConfig.shared.ts index 47013405c702..1903832b65f7 100644 --- a/clients/client-ecs/runtimeConfig.shared.ts +++ b/clients/client-ecs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ECSClientConfig) => ({ apiVersion: "2014-11-13", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ECS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ecs/runtimeConfig.ts b/clients/client-ecs/runtimeConfig.ts index ffc969e0496f..706ed44a5a4e 100644 --- a/clients/client-ecs/runtimeConfig.ts +++ b/clients/client-ecs/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ECSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ECSClientConfig } from "./ECSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ECSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-efs/EFSClient.ts b/clients/client-efs/EFSClient.ts index f84f6ceeb425..657580390418 100644 --- a/clients/client-efs/EFSClient.ts +++ b/clients/client-efs/EFSClient.ts @@ -67,7 +67,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateFileSystemCommandInput, UpdateFileSystemCommandOutput } from "./commands/UpdateFileSystemCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -335,10 +335,7 @@ export class EFSClient extends __Client< readonly config: EFSClientResolvedConfig; constructor(configuration: EFSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-efs/runtimeConfig.browser.ts b/clients/client-efs/runtimeConfig.browser.ts index 15fc6599996f..805ebc4f07ee 100644 --- a/clients/client-efs/runtimeConfig.browser.ts +++ b/clients/client-efs/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EFSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EFSClientConfig } from "./EFSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EFSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-efs/runtimeConfig.native.ts b/clients/client-efs/runtimeConfig.native.ts index 9ee547c11ec2..c28070a5e0f8 100644 --- a/clients/client-efs/runtimeConfig.native.ts +++ b/clients/client-efs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EFSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EFSClientConfig } from "./EFSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EFSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-efs/runtimeConfig.shared.ts b/clients/client-efs/runtimeConfig.shared.ts index 2b9348ba2715..b0b8409a1361 100644 --- a/clients/client-efs/runtimeConfig.shared.ts +++ b/clients/client-efs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EFSClientConfig) => ({ apiVersion: "2015-02-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EFS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-efs/runtimeConfig.ts b/clients/client-efs/runtimeConfig.ts index ec8da3f01959..ccbddc00e54a 100644 --- a/clients/client-efs/runtimeConfig.ts +++ b/clients/client-efs/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EFSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EFSClientConfig } from "./EFSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EFSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-eks/EKSClient.ts b/clients/client-eks/EKSClient.ts index 9c7e8f790dec..82cb89567c40 100644 --- a/clients/client-eks/EKSClient.ts +++ b/clients/client-eks/EKSClient.ts @@ -75,7 +75,7 @@ import { UpdateNodegroupVersionCommandInput, UpdateNodegroupVersionCommandOutput, } from "./commands/UpdateNodegroupVersionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -358,10 +358,7 @@ export class EKSClient extends __Client< readonly config: EKSClientResolvedConfig; constructor(configuration: EKSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-eks/runtimeConfig.browser.ts b/clients/client-eks/runtimeConfig.browser.ts index d3a8fa8c93e1..ea2803b7e022 100644 --- a/clients/client-eks/runtimeConfig.browser.ts +++ b/clients/client-eks/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EKSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EKSClientConfig } from "./EKSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EKSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-eks/runtimeConfig.native.ts b/clients/client-eks/runtimeConfig.native.ts index 9a2f25d86546..46322dfbfbe8 100644 --- a/clients/client-eks/runtimeConfig.native.ts +++ b/clients/client-eks/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EKSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EKSClientConfig } from "./EKSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EKSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-eks/runtimeConfig.shared.ts b/clients/client-eks/runtimeConfig.shared.ts index 1006e99f8447..ad95a430ba3d 100644 --- a/clients/client-eks/runtimeConfig.shared.ts +++ b/clients/client-eks/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EKSClientConfig) => ({ apiVersion: "2017-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EKS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-eks/runtimeConfig.ts b/clients/client-eks/runtimeConfig.ts index e97cc20f6c78..385535df4dbc 100644 --- a/clients/client-eks/runtimeConfig.ts +++ b/clients/client-eks/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EKSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EKSClientConfig } from "./EKSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EKSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-beanstalk/ElasticBeanstalkClient.ts b/clients/client-elastic-beanstalk/ElasticBeanstalkClient.ts index 7c7bb8e95ea4..b54e0727ebfe 100644 --- a/clients/client-elastic-beanstalk/ElasticBeanstalkClient.ts +++ b/clients/client-elastic-beanstalk/ElasticBeanstalkClient.ts @@ -162,7 +162,7 @@ import { ValidateConfigurationSettingsCommandInput, ValidateConfigurationSettingsCommandOutput, } from "./commands/ValidateConfigurationSettingsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -480,10 +480,7 @@ export class ElasticBeanstalkClient extends __Client< readonly config: ElasticBeanstalkClientResolvedConfig; constructor(configuration: ElasticBeanstalkClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elastic-beanstalk/runtimeConfig.browser.ts b/clients/client-elastic-beanstalk/runtimeConfig.browser.ts index a4dee6842240..6b6f5803100e 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.browser.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElasticBeanstalkClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticBeanstalkClientConfig } from "./ElasticBeanstalkClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-beanstalk/runtimeConfig.native.ts b/clients/client-elastic-beanstalk/runtimeConfig.native.ts index d3c092a212bd..5a1d8137327a 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.native.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElasticBeanstalkClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElasticBeanstalkClientConfig } from "./ElasticBeanstalkClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-elastic-beanstalk/runtimeConfig.shared.ts b/clients/client-elastic-beanstalk/runtimeConfig.shared.ts index dc6f4c0fa904..10ae99bbd83f 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.shared.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => ({ apiVersion: "2010-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Elastic Beanstalk", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elastic-beanstalk/runtimeConfig.ts b/clients/client-elastic-beanstalk/runtimeConfig.ts index 8942307870a2..dbf6c8f11564 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElasticBeanstalkClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticBeanstalkClientConfig } from "./ElasticBeanstalkClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-inference/ElasticInferenceClient.ts b/clients/client-elastic-inference/ElasticInferenceClient.ts index 796ac791bfdb..c87aac2f33a1 100644 --- a/clients/client-elastic-inference/ElasticInferenceClient.ts +++ b/clients/client-elastic-inference/ElasticInferenceClient.ts @@ -16,7 +16,7 @@ import { } from "./commands/ListTagsForResourceCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -240,10 +240,7 @@ export class ElasticInferenceClient extends __Client< readonly config: ElasticInferenceClientResolvedConfig; constructor(configuration: ElasticInferenceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elastic-inference/runtimeConfig.browser.ts b/clients/client-elastic-inference/runtimeConfig.browser.ts index def84bdef198..2e65a8bb7787 100644 --- a/clients/client-elastic-inference/runtimeConfig.browser.ts +++ b/clients/client-elastic-inference/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElasticInferenceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticInferenceClientConfig } from "./ElasticInferenceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-inference/runtimeConfig.native.ts b/clients/client-elastic-inference/runtimeConfig.native.ts index 6b97c510200f..9ab69006cdbf 100644 --- a/clients/client-elastic-inference/runtimeConfig.native.ts +++ b/clients/client-elastic-inference/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElasticInferenceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElasticInferenceClientConfig } from "./ElasticInferenceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-elastic-inference/runtimeConfig.shared.ts b/clients/client-elastic-inference/runtimeConfig.shared.ts index 1e7a6a1ff6ac..505452b4a8cc 100644 --- a/clients/client-elastic-inference/runtimeConfig.shared.ts +++ b/clients/client-elastic-inference/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Elastic Inference", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elastic-inference/runtimeConfig.ts b/clients/client-elastic-inference/runtimeConfig.ts index 2c98aac421d5..fd67f402027c 100644 --- a/clients/client-elastic-inference/runtimeConfig.ts +++ b/clients/client-elastic-inference/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElasticInferenceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticInferenceClientConfig } from "./ElasticInferenceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-load-balancing-v2/ElasticLoadBalancingV2Client.ts b/clients/client-elastic-load-balancing-v2/ElasticLoadBalancingV2Client.ts index 1f7d5cacb69e..98f61a5af01c 100644 --- a/clients/client-elastic-load-balancing-v2/ElasticLoadBalancingV2Client.ts +++ b/clients/client-elastic-load-balancing-v2/ElasticLoadBalancingV2Client.ts @@ -68,7 +68,7 @@ import { SetIpAddressTypeCommandInput, SetIpAddressTypeCommandOutput } from "./c import { SetRulePrioritiesCommandInput, SetRulePrioritiesCommandOutput } from "./commands/SetRulePrioritiesCommand"; import { SetSecurityGroupsCommandInput, SetSecurityGroupsCommandOutput } from "./commands/SetSecurityGroupsCommand"; import { SetSubnetsCommandInput, SetSubnetsCommandOutput } from "./commands/SetSubnetsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -384,10 +384,7 @@ export class ElasticLoadBalancingV2Client extends __Client< readonly config: ElasticLoadBalancingV2ClientResolvedConfig; constructor(configuration: ElasticLoadBalancingV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts index 93fab2c3ea17..b60a396d8743 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElasticLoadBalancingV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticLoadBalancingV2ClientConfig } from "./ElasticLoadBalancingV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 140bf1080827..f0061b1cdec3 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElasticLoadBalancingV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElasticLoadBalancingV2ClientConfig } from "./ElasticLoadBalancingV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 2033f47ae204..e7376ed8f29e 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.shared.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => ({ apiVersion: "2015-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Elastic Load Balancing v2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.ts index aee9fb3a326a..6821fa685271 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElasticLoadBalancingV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticLoadBalancingV2ClientConfig } from "./ElasticLoadBalancingV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-load-balancing/ElasticLoadBalancingClient.ts b/clients/client-elastic-load-balancing/ElasticLoadBalancingClient.ts index d97da0d9b70b..c49e7a0f94ee 100644 --- a/clients/client-elastic-load-balancing/ElasticLoadBalancingClient.ts +++ b/clients/client-elastic-load-balancing/ElasticLoadBalancingClient.ts @@ -99,7 +99,7 @@ import { SetLoadBalancerPoliciesOfListenerCommandInput, SetLoadBalancerPoliciesOfListenerCommandOutput, } from "./commands/SetLoadBalancerPoliciesOfListenerCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -387,10 +387,7 @@ export class ElasticLoadBalancingClient extends __Client< readonly config: ElasticLoadBalancingClientResolvedConfig; constructor(configuration: ElasticLoadBalancingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elastic-load-balancing/runtimeConfig.browser.ts b/clients/client-elastic-load-balancing/runtimeConfig.browser.ts index 92635ab46135..a4c27af53c91 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.browser.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElasticLoadBalancingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticLoadBalancingClientConfig } from "./ElasticLoadBalancingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-load-balancing/runtimeConfig.native.ts b/clients/client-elastic-load-balancing/runtimeConfig.native.ts index cb47839b8118..98e06446363c 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.native.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElasticLoadBalancingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElasticLoadBalancingClientConfig } from "./ElasticLoadBalancingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-elastic-load-balancing/runtimeConfig.shared.ts b/clients/client-elastic-load-balancing/runtimeConfig.shared.ts index 6767433cba88..523379a18102 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.shared.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => ({ apiVersion: "2012-06-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Elastic Load Balancing", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elastic-load-balancing/runtimeConfig.ts b/clients/client-elastic-load-balancing/runtimeConfig.ts index cff827042fd2..8d2740e983a6 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElasticLoadBalancingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticLoadBalancingClientConfig } from "./ElasticLoadBalancingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-transcoder/ElasticTranscoderClient.ts b/clients/client-elastic-transcoder/ElasticTranscoderClient.ts index 837fe8da0495..627942ffb03a 100644 --- a/clients/client-elastic-transcoder/ElasticTranscoderClient.ts +++ b/clients/client-elastic-transcoder/ElasticTranscoderClient.ts @@ -21,7 +21,7 @@ import { UpdatePipelineStatusCommandInput, UpdatePipelineStatusCommandOutput, } from "./commands/UpdatePipelineStatusCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -266,10 +266,7 @@ export class ElasticTranscoderClient extends __Client< readonly config: ElasticTranscoderClientResolvedConfig; constructor(configuration: ElasticTranscoderClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elastic-transcoder/runtimeConfig.browser.ts b/clients/client-elastic-transcoder/runtimeConfig.browser.ts index 8317a5a18d45..3b2e5fefbb5e 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.browser.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElasticTranscoderClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticTranscoderClientConfig } from "./ElasticTranscoderClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elastic-transcoder/runtimeConfig.native.ts b/clients/client-elastic-transcoder/runtimeConfig.native.ts index e54ca90ec9f0..034011c2a5d3 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.native.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElasticTranscoderClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElasticTranscoderClientConfig } from "./ElasticTranscoderClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-elastic-transcoder/runtimeConfig.shared.ts b/clients/client-elastic-transcoder/runtimeConfig.shared.ts index c6c6f37b8aa2..e2b3407dd310 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.shared.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => ({ apiVersion: "2012-09-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Elastic Transcoder", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elastic-transcoder/runtimeConfig.ts b/clients/client-elastic-transcoder/runtimeConfig.ts index 727675a8f72a..fd54a4c03d76 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElasticTranscoderClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticTranscoderClientConfig } from "./ElasticTranscoderClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elasticache/ElastiCacheClient.ts b/clients/client-elasticache/ElastiCacheClient.ts index 33a6523715b6..7398610c8e62 100644 --- a/clients/client-elasticache/ElastiCacheClient.ts +++ b/clients/client-elasticache/ElastiCacheClient.ts @@ -195,7 +195,7 @@ import { } from "./commands/RevokeCacheSecurityGroupIngressCommand"; import { StartMigrationCommandInput, StartMigrationCommandOutput } from "./commands/StartMigrationCommand"; import { TestFailoverCommandInput, TestFailoverCommandOutput } from "./commands/TestFailoverCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -544,10 +544,7 @@ export class ElastiCacheClient extends __Client< readonly config: ElastiCacheClientResolvedConfig; constructor(configuration: ElastiCacheClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elasticache/runtimeConfig.browser.ts b/clients/client-elasticache/runtimeConfig.browser.ts index 066856fabc1d..57957c140e63 100644 --- a/clients/client-elasticache/runtimeConfig.browser.ts +++ b/clients/client-elasticache/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElastiCacheClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElastiCacheClientConfig } from "./ElastiCacheClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elasticache/runtimeConfig.native.ts b/clients/client-elasticache/runtimeConfig.native.ts index 230192b8e5dd..056c3bd7a1ca 100644 --- a/clients/client-elasticache/runtimeConfig.native.ts +++ b/clients/client-elasticache/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElastiCacheClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElastiCacheClientConfig } from "./ElastiCacheClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-elasticache/runtimeConfig.shared.ts b/clients/client-elasticache/runtimeConfig.shared.ts index 0761a94a376a..fc5beeb4817b 100644 --- a/clients/client-elasticache/runtimeConfig.shared.ts +++ b/clients/client-elasticache/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElastiCacheClientConfig) => ({ apiVersion: "2015-02-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ElastiCache", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elasticache/runtimeConfig.ts b/clients/client-elasticache/runtimeConfig.ts index 61e614876d8a..8caa837b38d2 100644 --- a/clients/client-elasticache/runtimeConfig.ts +++ b/clients/client-elasticache/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElastiCacheClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElastiCacheClientConfig } from "./ElastiCacheClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elasticsearch-service/ElasticsearchServiceClient.ts b/clients/client-elasticsearch-service/ElasticsearchServiceClient.ts index 532c8d992f3b..33fce9670db4 100644 --- a/clients/client-elasticsearch-service/ElasticsearchServiceClient.ts +++ b/clients/client-elasticsearch-service/ElasticsearchServiceClient.ts @@ -122,7 +122,7 @@ import { UpgradeElasticsearchDomainCommandInput, UpgradeElasticsearchDomainCommandOutput, } from "./commands/UpgradeElasticsearchDomainCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -418,10 +418,7 @@ export class ElasticsearchServiceClient extends __Client< readonly config: ElasticsearchServiceClientResolvedConfig; constructor(configuration: ElasticsearchServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-elasticsearch-service/runtimeConfig.browser.ts b/clients/client-elasticsearch-service/runtimeConfig.browser.ts index 7fa4a3eea3ac..ec0e50b0e13a 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.browser.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ElasticsearchServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticsearchServiceClientConfig } from "./ElasticsearchServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-elasticsearch-service/runtimeConfig.native.ts b/clients/client-elasticsearch-service/runtimeConfig.native.ts index 82e73453c442..8e40095a93c8 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.native.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ElasticsearchServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ElasticsearchServiceClientConfig } from "./ElasticsearchServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-elasticsearch-service/runtimeConfig.shared.ts b/clients/client-elasticsearch-service/runtimeConfig.shared.ts index c224b2177221..3ecd54216d98 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.shared.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => ({ apiVersion: "2015-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Elasticsearch Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-elasticsearch-service/runtimeConfig.ts b/clients/client-elasticsearch-service/runtimeConfig.ts index 9d0771fccc54..20a594ac6892 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ElasticsearchServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ElasticsearchServiceClientConfig } from "./ElasticsearchServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-emr-containers/EMRContainersClient.ts b/clients/client-emr-containers/EMRContainersClient.ts index 13228d4b6fb7..c2668c3833de 100644 --- a/clients/client-emr-containers/EMRContainersClient.ts +++ b/clients/client-emr-containers/EMRContainersClient.ts @@ -40,7 +40,7 @@ import { import { StartJobRunCommandInput, StartJobRunCommandOutput } from "./commands/StartJobRunCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -301,10 +301,7 @@ export class EMRContainersClient extends __Client< readonly config: EMRContainersClientResolvedConfig; constructor(configuration: EMRContainersClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-emr-containers/runtimeConfig.browser.ts b/clients/client-emr-containers/runtimeConfig.browser.ts index fd7e33b3bf67..2d994da08c0b 100644 --- a/clients/client-emr-containers/runtimeConfig.browser.ts +++ b/clients/client-emr-containers/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EMRContainersClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EMRContainersClientConfig } from "./EMRContainersClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EMRContainersClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-emr-containers/runtimeConfig.native.ts b/clients/client-emr-containers/runtimeConfig.native.ts index f52635e3f828..0c1068696647 100644 --- a/clients/client-emr-containers/runtimeConfig.native.ts +++ b/clients/client-emr-containers/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EMRContainersClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EMRContainersClientConfig } from "./EMRContainersClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EMRContainersClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-emr-containers/runtimeConfig.shared.ts b/clients/client-emr-containers/runtimeConfig.shared.ts index f09d04e16714..96666485bb45 100644 --- a/clients/client-emr-containers/runtimeConfig.shared.ts +++ b/clients/client-emr-containers/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EMRContainersClientConfig) => ({ apiVersion: "2020-10-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EMR containers", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-emr-containers/runtimeConfig.ts b/clients/client-emr-containers/runtimeConfig.ts index 180122b3f96f..8e7d6e5d26e4 100644 --- a/clients/client-emr-containers/runtimeConfig.ts +++ b/clients/client-emr-containers/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EMRContainersClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EMRContainersClientConfig } from "./EMRContainersClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EMRContainersClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-emr/EMRClient.ts b/clients/client-emr/EMRClient.ts index d8ea218c43fe..5e5e8e0eea65 100644 --- a/clients/client-emr/EMRClient.ts +++ b/clients/client-emr/EMRClient.ts @@ -120,7 +120,7 @@ import { UpdateStudioSessionMappingCommandInput, UpdateStudioSessionMappingCommandOutput, } from "./commands/UpdateStudioSessionMappingCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -427,10 +427,7 @@ export class EMRClient extends __Client< readonly config: EMRClientResolvedConfig; constructor(configuration: EMRClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-emr/runtimeConfig.browser.ts b/clients/client-emr/runtimeConfig.browser.ts index c142e141c221..2efa4794061c 100644 --- a/clients/client-emr/runtimeConfig.browser.ts +++ b/clients/client-emr/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EMRClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EMRClientConfig } from "./EMRClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EMRClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-emr/runtimeConfig.native.ts b/clients/client-emr/runtimeConfig.native.ts index 8581cbcca90f..163987ae525a 100644 --- a/clients/client-emr/runtimeConfig.native.ts +++ b/clients/client-emr/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EMRClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EMRClientConfig } from "./EMRClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EMRClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-emr/runtimeConfig.shared.ts b/clients/client-emr/runtimeConfig.shared.ts index 592e6876ad66..0d9c66b6b0b9 100644 --- a/clients/client-emr/runtimeConfig.shared.ts +++ b/clients/client-emr/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EMRClientConfig) => ({ apiVersion: "2009-03-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EMR", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-emr/runtimeConfig.ts b/clients/client-emr/runtimeConfig.ts index c2df6865cbac..82bd0ca8466a 100644 --- a/clients/client-emr/runtimeConfig.ts +++ b/clients/client-emr/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EMRClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EMRClientConfig } from "./EMRClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EMRClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-eventbridge/EventBridgeClient.ts b/clients/client-eventbridge/EventBridgeClient.ts index a3da47ccf8f5..daa4ecb6981c 100644 --- a/clients/client-eventbridge/EventBridgeClient.ts +++ b/clients/client-eventbridge/EventBridgeClient.ts @@ -97,7 +97,7 @@ import { } from "./commands/UpdateApiDestinationCommand"; import { UpdateArchiveCommandInput, UpdateArchiveCommandOutput } from "./commands/UpdateArchiveCommand"; import { UpdateConnectionCommandInput, UpdateConnectionCommandOutput } from "./commands/UpdateConnectionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -429,10 +429,7 @@ export class EventBridgeClient extends __Client< readonly config: EventBridgeClientResolvedConfig; constructor(configuration: EventBridgeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-eventbridge/runtimeConfig.browser.ts b/clients/client-eventbridge/runtimeConfig.browser.ts index c107d993a76d..852e3cbf0293 100644 --- a/clients/client-eventbridge/runtimeConfig.browser.ts +++ b/clients/client-eventbridge/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EventBridgeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EventBridgeClientConfig } from "./EventBridgeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EventBridgeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-eventbridge/runtimeConfig.native.ts b/clients/client-eventbridge/runtimeConfig.native.ts index 6f4311c2529d..d19ba27cdb34 100644 --- a/clients/client-eventbridge/runtimeConfig.native.ts +++ b/clients/client-eventbridge/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EventBridgeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EventBridgeClientConfig } from "./EventBridgeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EventBridgeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-eventbridge/runtimeConfig.shared.ts b/clients/client-eventbridge/runtimeConfig.shared.ts index c3011b606dc8..7073ca9a32a1 100644 --- a/clients/client-eventbridge/runtimeConfig.shared.ts +++ b/clients/client-eventbridge/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EventBridgeClientConfig) => ({ apiVersion: "2015-10-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EventBridge", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-eventbridge/runtimeConfig.ts b/clients/client-eventbridge/runtimeConfig.ts index d36ecd7e35a5..0dade41b8987 100644 --- a/clients/client-eventbridge/runtimeConfig.ts +++ b/clients/client-eventbridge/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EventBridgeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EventBridgeClientConfig } from "./EventBridgeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EventBridgeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-finspace-data/FinspaceDataClient.ts b/clients/client-finspace-data/FinspaceDataClient.ts index de0219a1ae27..8a928de53997 100644 --- a/clients/client-finspace-data/FinspaceDataClient.ts +++ b/clients/client-finspace-data/FinspaceDataClient.ts @@ -4,7 +4,7 @@ import { GetProgrammaticAccessCredentialsCommandOutput, } from "./commands/GetProgrammaticAccessCredentialsCommand"; import { GetWorkingLocationCommandInput, GetWorkingLocationCommandOutput } from "./commands/GetWorkingLocationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -220,10 +220,7 @@ export class FinspaceDataClient extends __Client< readonly config: FinspaceDataClientResolvedConfig; constructor(configuration: FinspaceDataClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-finspace-data/runtimeConfig.browser.ts b/clients/client-finspace-data/runtimeConfig.browser.ts index 52891bf3ae1f..bc5f468181da 100644 --- a/clients/client-finspace-data/runtimeConfig.browser.ts +++ b/clients/client-finspace-data/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FinspaceDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FinspaceDataClientConfig } from "./FinspaceDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-finspace-data/runtimeConfig.native.ts b/clients/client-finspace-data/runtimeConfig.native.ts index cb79dee00b00..e3ddd8e060ee 100644 --- a/clients/client-finspace-data/runtimeConfig.native.ts +++ b/clients/client-finspace-data/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FinspaceDataClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FinspaceDataClientConfig } from "./FinspaceDataClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-finspace-data/runtimeConfig.shared.ts b/clients/client-finspace-data/runtimeConfig.shared.ts index 08e7c061b592..38de2432e649 100644 --- a/clients/client-finspace-data/runtimeConfig.shared.ts +++ b/clients/client-finspace-data/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FinspaceDataClientConfig) => ({ apiVersion: "2020-07-13", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "finspace data", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-finspace-data/runtimeConfig.ts b/clients/client-finspace-data/runtimeConfig.ts index 76ec9d5f861c..0e5d525f4394 100644 --- a/clients/client-finspace-data/runtimeConfig.ts +++ b/clients/client-finspace-data/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FinspaceDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FinspaceDataClientConfig } from "./FinspaceDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-finspace/FinspaceClient.ts b/clients/client-finspace/FinspaceClient.ts index 43c1606cdb43..b8530cd5bd5b 100644 --- a/clients/client-finspace/FinspaceClient.ts +++ b/clients/client-finspace/FinspaceClient.ts @@ -9,7 +9,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateEnvironmentCommandInput, UpdateEnvironmentCommandOutput } from "./commands/UpdateEnvironmentCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -236,10 +236,7 @@ export class FinspaceClient extends __Client< readonly config: FinspaceClientResolvedConfig; constructor(configuration: FinspaceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-finspace/runtimeConfig.browser.ts b/clients/client-finspace/runtimeConfig.browser.ts index ff4b378c3976..b9428233d2be 100644 --- a/clients/client-finspace/runtimeConfig.browser.ts +++ b/clients/client-finspace/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FinspaceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FinspaceClientConfig } from "./FinspaceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FinspaceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-finspace/runtimeConfig.native.ts b/clients/client-finspace/runtimeConfig.native.ts index bd3c3a4b0fed..2c18dee7e37d 100644 --- a/clients/client-finspace/runtimeConfig.native.ts +++ b/clients/client-finspace/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FinspaceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FinspaceClientConfig } from "./FinspaceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FinspaceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-finspace/runtimeConfig.shared.ts b/clients/client-finspace/runtimeConfig.shared.ts index d6632ea48470..a8cf08d1c462 100644 --- a/clients/client-finspace/runtimeConfig.shared.ts +++ b/clients/client-finspace/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FinspaceClientConfig) => ({ apiVersion: "2021-03-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "finspace", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-finspace/runtimeConfig.ts b/clients/client-finspace/runtimeConfig.ts index f70c994285d8..db78c2011f3c 100644 --- a/clients/client-finspace/runtimeConfig.ts +++ b/clients/client-finspace/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FinspaceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FinspaceClientConfig } from "./FinspaceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FinspaceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-firehose/FirehoseClient.ts b/clients/client-firehose/FirehoseClient.ts index a370863c91db..137800e4e858 100644 --- a/clients/client-firehose/FirehoseClient.ts +++ b/clients/client-firehose/FirehoseClient.ts @@ -34,7 +34,7 @@ import { UntagDeliveryStreamCommandOutput, } from "./commands/UntagDeliveryStreamCommand"; import { UpdateDestinationCommandInput, UpdateDestinationCommandOutput } from "./commands/UpdateDestinationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -271,10 +271,7 @@ export class FirehoseClient extends __Client< readonly config: FirehoseClientResolvedConfig; constructor(configuration: FirehoseClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-firehose/runtimeConfig.browser.ts b/clients/client-firehose/runtimeConfig.browser.ts index c5fd81724c78..70799f5bfaa2 100644 --- a/clients/client-firehose/runtimeConfig.browser.ts +++ b/clients/client-firehose/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FirehoseClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FirehoseClientConfig } from "./FirehoseClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FirehoseClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-firehose/runtimeConfig.native.ts b/clients/client-firehose/runtimeConfig.native.ts index 1d0be16a72b8..41ae1e006c6e 100644 --- a/clients/client-firehose/runtimeConfig.native.ts +++ b/clients/client-firehose/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FirehoseClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FirehoseClientConfig } from "./FirehoseClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FirehoseClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-firehose/runtimeConfig.shared.ts b/clients/client-firehose/runtimeConfig.shared.ts index 22577e7431a1..a22dbf3c9b6d 100644 --- a/clients/client-firehose/runtimeConfig.shared.ts +++ b/clients/client-firehose/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FirehoseClientConfig) => ({ apiVersion: "2015-08-04", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Firehose", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-firehose/runtimeConfig.ts b/clients/client-firehose/runtimeConfig.ts index df70e7e58b78..855f775db611 100644 --- a/clients/client-firehose/runtimeConfig.ts +++ b/clients/client-firehose/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FirehoseClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FirehoseClientConfig } from "./FirehoseClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FirehoseClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-fis/FisClient.ts b/clients/client-fis/FisClient.ts index 3ab787989092..11a0c0189906 100644 --- a/clients/client-fis/FisClient.ts +++ b/clients/client-fis/FisClient.ts @@ -30,7 +30,7 @@ import { UpdateExperimentTemplateCommandInput, UpdateExperimentTemplateCommandOutput, } from "./commands/UpdateExperimentTemplateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -269,10 +269,7 @@ export class FisClient extends __Client< readonly config: FisClientResolvedConfig; constructor(configuration: FisClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-fis/runtimeConfig.browser.ts b/clients/client-fis/runtimeConfig.browser.ts index 6bc295394ff1..efcb64964b2a 100644 --- a/clients/client-fis/runtimeConfig.browser.ts +++ b/clients/client-fis/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FisClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FisClientConfig } from "./FisClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FisClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-fis/runtimeConfig.native.ts b/clients/client-fis/runtimeConfig.native.ts index 923e5bea38d7..620186b13efa 100644 --- a/clients/client-fis/runtimeConfig.native.ts +++ b/clients/client-fis/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FisClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FisClientConfig } from "./FisClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FisClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-fis/runtimeConfig.shared.ts b/clients/client-fis/runtimeConfig.shared.ts index 0b5003e9ef1e..6e10f41cba4a 100644 --- a/clients/client-fis/runtimeConfig.shared.ts +++ b/clients/client-fis/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FisClientConfig) => ({ apiVersion: "2020-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "fis", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-fis/runtimeConfig.ts b/clients/client-fis/runtimeConfig.ts index 8af6d0d20248..21ff5f9159f0 100644 --- a/clients/client-fis/runtimeConfig.ts +++ b/clients/client-fis/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FisClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FisClientConfig } from "./FisClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FisClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-fms/FMSClient.ts b/clients/client-fms/FMSClient.ts index 42dba106bba7..2cc46f96e4b8 100644 --- a/clients/client-fms/FMSClient.ts +++ b/clients/client-fms/FMSClient.ts @@ -57,7 +57,7 @@ import { PutPolicyCommandInput, PutPolicyCommandOutput } from "./commands/PutPol import { PutProtocolsListCommandInput, PutProtocolsListCommandOutput } from "./commands/PutProtocolsListCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -325,10 +325,7 @@ export class FMSClient extends __Client< readonly config: FMSClientResolvedConfig; constructor(configuration: FMSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-fms/runtimeConfig.browser.ts b/clients/client-fms/runtimeConfig.browser.ts index d606bdf6d89b..3a04d3ae250e 100644 --- a/clients/client-fms/runtimeConfig.browser.ts +++ b/clients/client-fms/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FMSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FMSClientConfig } from "./FMSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FMSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-fms/runtimeConfig.native.ts b/clients/client-fms/runtimeConfig.native.ts index 926bb74ffa93..b5cb15635c2b 100644 --- a/clients/client-fms/runtimeConfig.native.ts +++ b/clients/client-fms/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FMSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FMSClientConfig } from "./FMSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FMSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-fms/runtimeConfig.shared.ts b/clients/client-fms/runtimeConfig.shared.ts index 2f823752aa96..c53e422bae45 100644 --- a/clients/client-fms/runtimeConfig.shared.ts +++ b/clients/client-fms/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FMSClientConfig) => ({ apiVersion: "2018-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "FMS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-fms/runtimeConfig.ts b/clients/client-fms/runtimeConfig.ts index 9d0461b4cad8..a4d9143000c7 100644 --- a/clients/client-fms/runtimeConfig.ts +++ b/clients/client-fms/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FMSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FMSClientConfig } from "./FMSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FMSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-forecast/ForecastClient.ts b/clients/client-forecast/ForecastClient.ts index 5eee3d595be4..5a9c34ca44f6 100644 --- a/clients/client-forecast/ForecastClient.ts +++ b/clients/client-forecast/ForecastClient.ts @@ -75,7 +75,7 @@ import { StopResourceCommandInput, StopResourceCommandOutput } from "./commands/ import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateDatasetGroupCommandInput, UpdateDatasetGroupCommandOutput } from "./commands/UpdateDatasetGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -355,10 +355,7 @@ export class ForecastClient extends __Client< readonly config: ForecastClientResolvedConfig; constructor(configuration: ForecastClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-forecast/runtimeConfig.browser.ts b/clients/client-forecast/runtimeConfig.browser.ts index d933192b78cf..009e7cb082bd 100644 --- a/clients/client-forecast/runtimeConfig.browser.ts +++ b/clients/client-forecast/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ForecastClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ForecastClientConfig } from "./ForecastClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ForecastClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-forecast/runtimeConfig.native.ts b/clients/client-forecast/runtimeConfig.native.ts index 4c815dc5996a..6e03b1a3603a 100644 --- a/clients/client-forecast/runtimeConfig.native.ts +++ b/clients/client-forecast/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ForecastClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ForecastClientConfig } from "./ForecastClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ForecastClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-forecast/runtimeConfig.shared.ts b/clients/client-forecast/runtimeConfig.shared.ts index dca83477eba3..6acedd3e5493 100644 --- a/clients/client-forecast/runtimeConfig.shared.ts +++ b/clients/client-forecast/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ForecastClientConfig) => ({ apiVersion: "2018-06-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "forecast", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-forecast/runtimeConfig.ts b/clients/client-forecast/runtimeConfig.ts index b276bc2c0531..d6081bc8e3db 100644 --- a/clients/client-forecast/runtimeConfig.ts +++ b/clients/client-forecast/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ForecastClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ForecastClientConfig } from "./ForecastClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ForecastClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-forecastquery/ForecastqueryClient.ts b/clients/client-forecastquery/ForecastqueryClient.ts index 25e613b70c89..3eaa05643541 100644 --- a/clients/client-forecastquery/ForecastqueryClient.ts +++ b/clients/client-forecastquery/ForecastqueryClient.ts @@ -1,5 +1,5 @@ import { QueryForecastCommandInput, QueryForecastCommandOutput } from "./commands/QueryForecastCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -209,10 +209,7 @@ export class ForecastqueryClient extends __Client< readonly config: ForecastqueryClientResolvedConfig; constructor(configuration: ForecastqueryClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-forecastquery/runtimeConfig.browser.ts b/clients/client-forecastquery/runtimeConfig.browser.ts index 8372ca265d8c..6fd6ac0154d9 100644 --- a/clients/client-forecastquery/runtimeConfig.browser.ts +++ b/clients/client-forecastquery/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ForecastqueryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ForecastqueryClientConfig } from "./ForecastqueryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-forecastquery/runtimeConfig.native.ts b/clients/client-forecastquery/runtimeConfig.native.ts index d1fea02bbf9b..d47804eb07fb 100644 --- a/clients/client-forecastquery/runtimeConfig.native.ts +++ b/clients/client-forecastquery/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ForecastqueryClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ForecastqueryClientConfig } from "./ForecastqueryClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-forecastquery/runtimeConfig.shared.ts b/clients/client-forecastquery/runtimeConfig.shared.ts index aaa9839f3b15..e39e2ac449ff 100644 --- a/clients/client-forecastquery/runtimeConfig.shared.ts +++ b/clients/client-forecastquery/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ForecastqueryClientConfig) => ({ apiVersion: "2018-06-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "forecastquery", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-forecastquery/runtimeConfig.ts b/clients/client-forecastquery/runtimeConfig.ts index 59ec63bc5252..2e5c2b93f264 100644 --- a/clients/client-forecastquery/runtimeConfig.ts +++ b/clients/client-forecastquery/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ForecastqueryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ForecastqueryClientConfig } from "./ForecastqueryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-frauddetector/FraudDetectorClient.ts b/clients/client-frauddetector/FraudDetectorClient.ts index f7edb93c6cf8..49093ff6d6ff 100644 --- a/clients/client-frauddetector/FraudDetectorClient.ts +++ b/clients/client-frauddetector/FraudDetectorClient.ts @@ -103,7 +103,7 @@ import { import { UpdateRuleMetadataCommandInput, UpdateRuleMetadataCommandOutput } from "./commands/UpdateRuleMetadataCommand"; import { UpdateRuleVersionCommandInput, UpdateRuleVersionCommandOutput } from "./commands/UpdateRuleVersionCommand"; import { UpdateVariableCommandInput, UpdateVariableCommandOutput } from "./commands/UpdateVariableCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -429,10 +429,7 @@ export class FraudDetectorClient extends __Client< readonly config: FraudDetectorClientResolvedConfig; constructor(configuration: FraudDetectorClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-frauddetector/runtimeConfig.browser.ts b/clients/client-frauddetector/runtimeConfig.browser.ts index 5c5bc2f86568..9def664cada4 100644 --- a/clients/client-frauddetector/runtimeConfig.browser.ts +++ b/clients/client-frauddetector/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FraudDetectorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FraudDetectorClientConfig } from "./FraudDetectorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-frauddetector/runtimeConfig.native.ts b/clients/client-frauddetector/runtimeConfig.native.ts index 2a43eb2635b3..6dbd4c007822 100644 --- a/clients/client-frauddetector/runtimeConfig.native.ts +++ b/clients/client-frauddetector/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FraudDetectorClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FraudDetectorClientConfig } from "./FraudDetectorClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-frauddetector/runtimeConfig.shared.ts b/clients/client-frauddetector/runtimeConfig.shared.ts index a0fdf469c306..d7ea62465518 100644 --- a/clients/client-frauddetector/runtimeConfig.shared.ts +++ b/clients/client-frauddetector/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FraudDetectorClientConfig) => ({ apiVersion: "2019-11-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "FraudDetector", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-frauddetector/runtimeConfig.ts b/clients/client-frauddetector/runtimeConfig.ts index c27454bd648a..3f08bd42cd48 100644 --- a/clients/client-frauddetector/runtimeConfig.ts +++ b/clients/client-frauddetector/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FraudDetectorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FraudDetectorClientConfig } from "./FraudDetectorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-fsx/FSxClient.ts b/clients/client-fsx/FSxClient.ts index 136ec2873538..41b93833e973 100644 --- a/clients/client-fsx/FSxClient.ts +++ b/clients/client-fsx/FSxClient.ts @@ -43,7 +43,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateFileSystemCommandInput, UpdateFileSystemCommandOutput } from "./commands/UpdateFileSystemCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -290,10 +290,7 @@ export class FSxClient extends __Client< readonly config: FSxClientResolvedConfig; constructor(configuration: FSxClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-fsx/runtimeConfig.browser.ts b/clients/client-fsx/runtimeConfig.browser.ts index dc57404fbe4b..ae30d27da904 100644 --- a/clients/client-fsx/runtimeConfig.browser.ts +++ b/clients/client-fsx/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./FSxClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FSxClientConfig } from "./FSxClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FSxClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-fsx/runtimeConfig.native.ts b/clients/client-fsx/runtimeConfig.native.ts index 341958b6651f..c13e02b7c25f 100644 --- a/clients/client-fsx/runtimeConfig.native.ts +++ b/clients/client-fsx/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./FSxClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { FSxClientConfig } from "./FSxClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: FSxClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-fsx/runtimeConfig.shared.ts b/clients/client-fsx/runtimeConfig.shared.ts index b6a86561d7d3..3d884982c9fc 100644 --- a/clients/client-fsx/runtimeConfig.shared.ts +++ b/clients/client-fsx/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: FSxClientConfig) => ({ apiVersion: "2018-03-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "FSx", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-fsx/runtimeConfig.ts b/clients/client-fsx/runtimeConfig.ts index 29c78c29a184..909f62e8cd22 100644 --- a/clients/client-fsx/runtimeConfig.ts +++ b/clients/client-fsx/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./FSxClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { FSxClientConfig } from "./FSxClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: FSxClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-gamelift/GameLiftClient.ts b/clients/client-gamelift/GameLiftClient.ts index 724be605dfee..96624b876118 100644 --- a/clients/client-gamelift/GameLiftClient.ts +++ b/clients/client-gamelift/GameLiftClient.ts @@ -264,7 +264,7 @@ import { ValidateMatchmakingRuleSetCommandInput, ValidateMatchmakingRuleSetCommandOutput, } from "./commands/ValidateMatchmakingRuleSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -721,10 +721,7 @@ export class GameLiftClient extends __Client< readonly config: GameLiftClientResolvedConfig; constructor(configuration: GameLiftClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-gamelift/runtimeConfig.browser.ts b/clients/client-gamelift/runtimeConfig.browser.ts index 81972543cda5..a3632d704482 100644 --- a/clients/client-gamelift/runtimeConfig.browser.ts +++ b/clients/client-gamelift/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GameLiftClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GameLiftClientConfig } from "./GameLiftClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GameLiftClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-gamelift/runtimeConfig.native.ts b/clients/client-gamelift/runtimeConfig.native.ts index 07213d5cb4bb..0b6dcfcd8a7e 100644 --- a/clients/client-gamelift/runtimeConfig.native.ts +++ b/clients/client-gamelift/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GameLiftClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GameLiftClientConfig } from "./GameLiftClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GameLiftClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-gamelift/runtimeConfig.shared.ts b/clients/client-gamelift/runtimeConfig.shared.ts index c4561104679f..b584306c08a6 100644 --- a/clients/client-gamelift/runtimeConfig.shared.ts +++ b/clients/client-gamelift/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GameLiftClientConfig) => ({ apiVersion: "2015-10-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "GameLift", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-gamelift/runtimeConfig.ts b/clients/client-gamelift/runtimeConfig.ts index 1775eb451c28..b8ec6cc0c796 100644 --- a/clients/client-gamelift/runtimeConfig.ts +++ b/clients/client-gamelift/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GameLiftClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GameLiftClientConfig } from "./GameLiftClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GameLiftClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-glacier/GlacierClient.ts b/clients/client-glacier/GlacierClient.ts index 6d431c106b25..4baded5fbcd3 100644 --- a/clients/client-glacier/GlacierClient.ts +++ b/clients/client-glacier/GlacierClient.ts @@ -79,7 +79,7 @@ import { UploadMultipartPartCommandInput, UploadMultipartPartCommandOutput, } from "./commands/UploadMultipartPartCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -403,10 +403,7 @@ export class GlacierClient extends __Client< readonly config: GlacierClientResolvedConfig; constructor(configuration: GlacierClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-glacier/runtimeConfig.browser.ts b/clients/client-glacier/runtimeConfig.browser.ts index 963db690fca3..d2b5d52cd974 100644 --- a/clients/client-glacier/runtimeConfig.browser.ts +++ b/clients/client-glacier/runtimeConfig.browser.ts @@ -5,34 +5,41 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GlacierClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GlacierClientConfig } from "./GlacierClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyChecksumGenerator, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GlacierClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/clients/client-glacier/runtimeConfig.native.ts b/clients/client-glacier/runtimeConfig.native.ts index eb177b65d605..76c84a150c3f 100644 --- a/clients/client-glacier/runtimeConfig.native.ts +++ b/clients/client-glacier/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GlacierClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GlacierClientConfig } from "./GlacierClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GlacierClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-glacier/runtimeConfig.shared.ts b/clients/client-glacier/runtimeConfig.shared.ts index f1d783406304..4e29f2cc5c14 100644 --- a/clients/client-glacier/runtimeConfig.shared.ts +++ b/clients/client-glacier/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GlacierClientConfig) => ({ apiVersion: "2012-06-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Glacier", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-glacier/runtimeConfig.ts b/clients/client-glacier/runtimeConfig.ts index 4f9bb4968a40..a9912d37d1d1 100644 --- a/clients/client-glacier/runtimeConfig.ts +++ b/clients/client-glacier/runtimeConfig.ts @@ -8,34 +8,41 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GlacierClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GlacierClientConfig } from "./GlacierClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyChecksumGenerator, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GlacierClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/clients/client-global-accelerator/GlobalAcceleratorClient.ts b/clients/client-global-accelerator/GlobalAcceleratorClient.ts index b367e3b877df..ae82ba25206a 100644 --- a/clients/client-global-accelerator/GlobalAcceleratorClient.ts +++ b/clients/client-global-accelerator/GlobalAcceleratorClient.ts @@ -138,7 +138,7 @@ import { } from "./commands/UpdateEndpointGroupCommand"; import { UpdateListenerCommandInput, UpdateListenerCommandOutput } from "./commands/UpdateListenerCommand"; import { WithdrawByoipCidrCommandInput, WithdrawByoipCidrCommandOutput } from "./commands/WithdrawByoipCidrCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -589,10 +589,7 @@ export class GlobalAcceleratorClient extends __Client< readonly config: GlobalAcceleratorClientResolvedConfig; constructor(configuration: GlobalAcceleratorClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-global-accelerator/runtimeConfig.browser.ts b/clients/client-global-accelerator/runtimeConfig.browser.ts index 6d4ea4bc6192..b74af69fcfbd 100644 --- a/clients/client-global-accelerator/runtimeConfig.browser.ts +++ b/clients/client-global-accelerator/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GlobalAcceleratorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GlobalAcceleratorClientConfig } from "./GlobalAcceleratorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-global-accelerator/runtimeConfig.native.ts b/clients/client-global-accelerator/runtimeConfig.native.ts index 64c950ccaca9..abb684ecd9c9 100644 --- a/clients/client-global-accelerator/runtimeConfig.native.ts +++ b/clients/client-global-accelerator/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GlobalAcceleratorClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GlobalAcceleratorClientConfig } from "./GlobalAcceleratorClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-global-accelerator/runtimeConfig.shared.ts b/clients/client-global-accelerator/runtimeConfig.shared.ts index cfd534b4bedb..2c08f2e49f0d 100644 --- a/clients/client-global-accelerator/runtimeConfig.shared.ts +++ b/clients/client-global-accelerator/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => ({ apiVersion: "2018-08-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Global Accelerator", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-global-accelerator/runtimeConfig.ts b/clients/client-global-accelerator/runtimeConfig.ts index c6cd378b98e6..bb8a5d2ee025 100644 --- a/clients/client-global-accelerator/runtimeConfig.ts +++ b/clients/client-global-accelerator/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GlobalAcceleratorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GlobalAcceleratorClientConfig } from "./GlobalAcceleratorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-glue/GlueClient.ts b/clients/client-glue/GlueClient.ts index a97302d892c0..d3561fa0b109 100644 --- a/clients/client-glue/GlueClient.ts +++ b/clients/client-glue/GlueClient.ts @@ -296,7 +296,7 @@ import { UpdateUserDefinedFunctionCommandOutput, } from "./commands/UpdateUserDefinedFunctionCommand"; import { UpdateWorkflowCommandInput, UpdateWorkflowCommandOutput } from "./commands/UpdateWorkflowCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -821,10 +821,7 @@ export class GlueClient extends __Client< readonly config: GlueClientResolvedConfig; constructor(configuration: GlueClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-glue/runtimeConfig.browser.ts b/clients/client-glue/runtimeConfig.browser.ts index 6e4c0b61f65f..8c52b251146b 100644 --- a/clients/client-glue/runtimeConfig.browser.ts +++ b/clients/client-glue/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GlueClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GlueClientConfig } from "./GlueClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GlueClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-glue/runtimeConfig.native.ts b/clients/client-glue/runtimeConfig.native.ts index 5d79dc298f35..044e25fe8792 100644 --- a/clients/client-glue/runtimeConfig.native.ts +++ b/clients/client-glue/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GlueClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GlueClientConfig } from "./GlueClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GlueClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-glue/runtimeConfig.shared.ts b/clients/client-glue/runtimeConfig.shared.ts index 791a1f632bd5..59509e87e333 100644 --- a/clients/client-glue/runtimeConfig.shared.ts +++ b/clients/client-glue/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GlueClientConfig) => ({ apiVersion: "2017-03-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Glue", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-glue/runtimeConfig.ts b/clients/client-glue/runtimeConfig.ts index f6bc1ad2b30a..560a47c3f23b 100644 --- a/clients/client-glue/runtimeConfig.ts +++ b/clients/client-glue/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GlueClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GlueClientConfig } from "./GlueClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GlueClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-greengrass/GreengrassClient.ts b/clients/client-greengrass/GreengrassClient.ts index df0eaffede66..558b786bd09d 100644 --- a/clients/client-greengrass/GreengrassClient.ts +++ b/clients/client-greengrass/GreengrassClient.ts @@ -318,7 +318,7 @@ import { UpdateThingRuntimeConfigurationCommandInput, UpdateThingRuntimeConfigurationCommandOutput, } from "./commands/UpdateThingRuntimeConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -712,10 +712,7 @@ export class GreengrassClient extends __Client< readonly config: GreengrassClientResolvedConfig; constructor(configuration: GreengrassClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-greengrass/runtimeConfig.browser.ts b/clients/client-greengrass/runtimeConfig.browser.ts index efb6565d8cb2..5040f33ba598 100644 --- a/clients/client-greengrass/runtimeConfig.browser.ts +++ b/clients/client-greengrass/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GreengrassClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GreengrassClientConfig } from "./GreengrassClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GreengrassClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-greengrass/runtimeConfig.native.ts b/clients/client-greengrass/runtimeConfig.native.ts index 4c31c3cee966..80ba04fa6b2e 100644 --- a/clients/client-greengrass/runtimeConfig.native.ts +++ b/clients/client-greengrass/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GreengrassClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GreengrassClientConfig } from "./GreengrassClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GreengrassClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-greengrass/runtimeConfig.shared.ts b/clients/client-greengrass/runtimeConfig.shared.ts index 764e7bb793ec..72f52f13268c 100644 --- a/clients/client-greengrass/runtimeConfig.shared.ts +++ b/clients/client-greengrass/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GreengrassClientConfig) => ({ apiVersion: "2017-06-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Greengrass", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-greengrass/runtimeConfig.ts b/clients/client-greengrass/runtimeConfig.ts index 82a84419ac23..574e923cedfa 100644 --- a/clients/client-greengrass/runtimeConfig.ts +++ b/clients/client-greengrass/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GreengrassClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GreengrassClientConfig } from "./GreengrassClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GreengrassClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-greengrassv2/GreengrassV2Client.ts b/clients/client-greengrassv2/GreengrassV2Client.ts index 5de6453f67d9..0059cf5b94aa 100644 --- a/clients/client-greengrassv2/GreengrassV2Client.ts +++ b/clients/client-greengrassv2/GreengrassV2Client.ts @@ -51,7 +51,7 @@ import { } from "./commands/ResolveComponentCandidatesCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -317,10 +317,7 @@ export class GreengrassV2Client extends __Client< readonly config: GreengrassV2ClientResolvedConfig; constructor(configuration: GreengrassV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-greengrassv2/runtimeConfig.browser.ts b/clients/client-greengrassv2/runtimeConfig.browser.ts index 21e9c6a5755a..5553f4b46116 100644 --- a/clients/client-greengrassv2/runtimeConfig.browser.ts +++ b/clients/client-greengrassv2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GreengrassV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GreengrassV2ClientConfig } from "./GreengrassV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-greengrassv2/runtimeConfig.native.ts b/clients/client-greengrassv2/runtimeConfig.native.ts index 7e221ab06f86..5b695722c15b 100644 --- a/clients/client-greengrassv2/runtimeConfig.native.ts +++ b/clients/client-greengrassv2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GreengrassV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GreengrassV2ClientConfig } from "./GreengrassV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-greengrassv2/runtimeConfig.shared.ts b/clients/client-greengrassv2/runtimeConfig.shared.ts index 585b44084fd1..6a994478aa74 100644 --- a/clients/client-greengrassv2/runtimeConfig.shared.ts +++ b/clients/client-greengrassv2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => ({ apiVersion: "2020-11-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "GreengrassV2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-greengrassv2/runtimeConfig.ts b/clients/client-greengrassv2/runtimeConfig.ts index 6913c22e736a..5e639cfa966c 100644 --- a/clients/client-greengrassv2/runtimeConfig.ts +++ b/clients/client-greengrassv2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GreengrassV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GreengrassV2ClientConfig } from "./GreengrassV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-groundstation/GroundStationClient.ts b/clients/client-groundstation/GroundStationClient.ts index 92eac2dce468..d4c541c1b686 100644 --- a/clients/client-groundstation/GroundStationClient.ts +++ b/clients/client-groundstation/GroundStationClient.ts @@ -50,7 +50,7 @@ import { UpdateMissionProfileCommandInput, UpdateMissionProfileCommandOutput, } from "./commands/UpdateMissionProfileCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -313,10 +313,7 @@ export class GroundStationClient extends __Client< readonly config: GroundStationClientResolvedConfig; constructor(configuration: GroundStationClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-groundstation/runtimeConfig.browser.ts b/clients/client-groundstation/runtimeConfig.browser.ts index 4205218dd2ab..bfef6e555445 100644 --- a/clients/client-groundstation/runtimeConfig.browser.ts +++ b/clients/client-groundstation/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GroundStationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GroundStationClientConfig } from "./GroundStationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GroundStationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-groundstation/runtimeConfig.native.ts b/clients/client-groundstation/runtimeConfig.native.ts index e43db9859a12..701b0cc35f6b 100644 --- a/clients/client-groundstation/runtimeConfig.native.ts +++ b/clients/client-groundstation/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GroundStationClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GroundStationClientConfig } from "./GroundStationClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GroundStationClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-groundstation/runtimeConfig.shared.ts b/clients/client-groundstation/runtimeConfig.shared.ts index b87b24d801e0..da6f0dbf4ea0 100644 --- a/clients/client-groundstation/runtimeConfig.shared.ts +++ b/clients/client-groundstation/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GroundStationClientConfig) => ({ apiVersion: "2019-05-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "GroundStation", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-groundstation/runtimeConfig.ts b/clients/client-groundstation/runtimeConfig.ts index 44047cb528c3..f07684723254 100644 --- a/clients/client-groundstation/runtimeConfig.ts +++ b/clients/client-groundstation/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GroundStationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GroundStationClientConfig } from "./GroundStationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GroundStationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-guardduty/GuardDutyClient.ts b/clients/client-guardduty/GuardDutyClient.ts index 043bd9b4501e..0fcb29841b6e 100644 --- a/clients/client-guardduty/GuardDutyClient.ts +++ b/clients/client-guardduty/GuardDutyClient.ts @@ -128,7 +128,7 @@ import { UpdateThreatIntelSetCommandInput, UpdateThreatIntelSetCommandOutput, } from "./commands/UpdateThreatIntelSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -470,10 +470,7 @@ export class GuardDutyClient extends __Client< readonly config: GuardDutyClientResolvedConfig; constructor(configuration: GuardDutyClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-guardduty/runtimeConfig.browser.ts b/clients/client-guardduty/runtimeConfig.browser.ts index 23f23f17e18e..566ffb121b61 100644 --- a/clients/client-guardduty/runtimeConfig.browser.ts +++ b/clients/client-guardduty/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./GuardDutyClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GuardDutyClientConfig } from "./GuardDutyClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GuardDutyClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-guardduty/runtimeConfig.native.ts b/clients/client-guardduty/runtimeConfig.native.ts index 9f640854ad28..e85a04b93b0c 100644 --- a/clients/client-guardduty/runtimeConfig.native.ts +++ b/clients/client-guardduty/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./GuardDutyClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { GuardDutyClientConfig } from "./GuardDutyClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: GuardDutyClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-guardduty/runtimeConfig.shared.ts b/clients/client-guardduty/runtimeConfig.shared.ts index 3115234dc118..fe8df7bbc439 100644 --- a/clients/client-guardduty/runtimeConfig.shared.ts +++ b/clients/client-guardduty/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: GuardDutyClientConfig) => ({ apiVersion: "2017-11-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "GuardDuty", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-guardduty/runtimeConfig.ts b/clients/client-guardduty/runtimeConfig.ts index f344a6cec977..94dd11d78f4c 100644 --- a/clients/client-guardduty/runtimeConfig.ts +++ b/clients/client-guardduty/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./GuardDutyClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { GuardDutyClientConfig } from "./GuardDutyClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: GuardDutyClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-health/HealthClient.ts b/clients/client-health/HealthClient.ts index 1aef70883727..dc189d25c441 100644 --- a/clients/client-health/HealthClient.ts +++ b/clients/client-health/HealthClient.ts @@ -44,7 +44,7 @@ import { EnableHealthServiceAccessForOrganizationCommandInput, EnableHealthServiceAccessForOrganizationCommandOutput, } from "./commands/EnableHealthServiceAccessForOrganizationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -329,10 +329,7 @@ export class HealthClient extends __Client< readonly config: HealthClientResolvedConfig; constructor(configuration: HealthClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-health/runtimeConfig.browser.ts b/clients/client-health/runtimeConfig.browser.ts index 25bbcc0246fd..5a17c23f2166 100644 --- a/clients/client-health/runtimeConfig.browser.ts +++ b/clients/client-health/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./HealthClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { HealthClientConfig } from "./HealthClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: HealthClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-health/runtimeConfig.native.ts b/clients/client-health/runtimeConfig.native.ts index f885913dc660..ffa52344e51e 100644 --- a/clients/client-health/runtimeConfig.native.ts +++ b/clients/client-health/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./HealthClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { HealthClientConfig } from "./HealthClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: HealthClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-health/runtimeConfig.shared.ts b/clients/client-health/runtimeConfig.shared.ts index 9d0902421b6f..24aa9abad813 100644 --- a/clients/client-health/runtimeConfig.shared.ts +++ b/clients/client-health/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: HealthClientConfig) => ({ apiVersion: "2016-08-04", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Health", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-health/runtimeConfig.ts b/clients/client-health/runtimeConfig.ts index f6f1cd6751ac..5f65ebd62365 100644 --- a/clients/client-health/runtimeConfig.ts +++ b/clients/client-health/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./HealthClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { HealthClientConfig } from "./HealthClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: HealthClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-healthlake/HealthLakeClient.ts b/clients/client-healthlake/HealthLakeClient.ts index 2478ef92e01b..61354d4046fd 100644 --- a/clients/client-healthlake/HealthLakeClient.ts +++ b/clients/client-healthlake/HealthLakeClient.ts @@ -29,7 +29,7 @@ import { StartFHIRExportJobCommandInput, StartFHIRExportJobCommandOutput } from import { StartFHIRImportJobCommandInput, StartFHIRImportJobCommandOutput } from "./commands/StartFHIRImportJobCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -266,10 +266,7 @@ export class HealthLakeClient extends __Client< readonly config: HealthLakeClientResolvedConfig; constructor(configuration: HealthLakeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-healthlake/runtimeConfig.browser.ts b/clients/client-healthlake/runtimeConfig.browser.ts index f8786589c900..e6bf685d3d0b 100644 --- a/clients/client-healthlake/runtimeConfig.browser.ts +++ b/clients/client-healthlake/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./HealthLakeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { HealthLakeClientConfig } from "./HealthLakeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: HealthLakeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-healthlake/runtimeConfig.native.ts b/clients/client-healthlake/runtimeConfig.native.ts index 238e4fe0670e..a0e0a26a9280 100644 --- a/clients/client-healthlake/runtimeConfig.native.ts +++ b/clients/client-healthlake/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./HealthLakeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { HealthLakeClientConfig } from "./HealthLakeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: HealthLakeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-healthlake/runtimeConfig.shared.ts b/clients/client-healthlake/runtimeConfig.shared.ts index ebeb423d7821..24a3490679b5 100644 --- a/clients/client-healthlake/runtimeConfig.shared.ts +++ b/clients/client-healthlake/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: HealthLakeClientConfig) => ({ apiVersion: "2017-07-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "HealthLake", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-healthlake/runtimeConfig.ts b/clients/client-healthlake/runtimeConfig.ts index 0743c96888fb..acfa42ee40ce 100644 --- a/clients/client-healthlake/runtimeConfig.ts +++ b/clients/client-healthlake/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./HealthLakeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { HealthLakeClientConfig } from "./HealthLakeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: HealthLakeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-honeycode/HoneycodeClient.ts b/clients/client-honeycode/HoneycodeClient.ts index 5d7b2fb9445f..b0be37e26700 100644 --- a/clients/client-honeycode/HoneycodeClient.ts +++ b/clients/client-honeycode/HoneycodeClient.ts @@ -31,7 +31,7 @@ import { StartTableDataImportJobCommandInput, StartTableDataImportJobCommandOutput, } from "./commands/StartTableDataImportJobCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -269,10 +269,7 @@ export class HoneycodeClient extends __Client< readonly config: HoneycodeClientResolvedConfig; constructor(configuration: HoneycodeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-honeycode/runtimeConfig.browser.ts b/clients/client-honeycode/runtimeConfig.browser.ts index 4320f9c6c6eb..5811497c9d56 100644 --- a/clients/client-honeycode/runtimeConfig.browser.ts +++ b/clients/client-honeycode/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./HoneycodeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { HoneycodeClientConfig } from "./HoneycodeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: HoneycodeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-honeycode/runtimeConfig.native.ts b/clients/client-honeycode/runtimeConfig.native.ts index db98524fb477..f4ca3196745b 100644 --- a/clients/client-honeycode/runtimeConfig.native.ts +++ b/clients/client-honeycode/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./HoneycodeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { HoneycodeClientConfig } from "./HoneycodeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: HoneycodeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-honeycode/runtimeConfig.shared.ts b/clients/client-honeycode/runtimeConfig.shared.ts index bcf52ce37bcc..c77c33288785 100644 --- a/clients/client-honeycode/runtimeConfig.shared.ts +++ b/clients/client-honeycode/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: HoneycodeClientConfig) => ({ apiVersion: "2020-03-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Honeycode", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-honeycode/runtimeConfig.ts b/clients/client-honeycode/runtimeConfig.ts index 5f59e70ee745..66c4c8dcb38e 100644 --- a/clients/client-honeycode/runtimeConfig.ts +++ b/clients/client-honeycode/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./HoneycodeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { HoneycodeClientConfig } from "./HoneycodeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: HoneycodeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iam/IAMClient.ts b/clients/client-iam/IAMClient.ts index 7a6159525eae..50fe6be42134 100644 --- a/clients/client-iam/IAMClient.ts +++ b/clients/client-iam/IAMClient.ts @@ -381,7 +381,7 @@ import { UploadSigningCertificateCommandInput, UploadSigningCertificateCommandOutput, } from "./commands/UploadSigningCertificateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -911,10 +911,7 @@ export class IAMClient extends __Client< readonly config: IAMClientResolvedConfig; constructor(configuration: IAMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iam/runtimeConfig.browser.ts b/clients/client-iam/runtimeConfig.browser.ts index be4b81758002..ed2a642a66cf 100644 --- a/clients/client-iam/runtimeConfig.browser.ts +++ b/clients/client-iam/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IAMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IAMClientConfig } from "./IAMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IAMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iam/runtimeConfig.native.ts b/clients/client-iam/runtimeConfig.native.ts index fa0bb70a2745..e2dc8d83cdab 100644 --- a/clients/client-iam/runtimeConfig.native.ts +++ b/clients/client-iam/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IAMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IAMClientConfig } from "./IAMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IAMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iam/runtimeConfig.shared.ts b/clients/client-iam/runtimeConfig.shared.ts index 71f47458a42f..812be93483f4 100644 --- a/clients/client-iam/runtimeConfig.shared.ts +++ b/clients/client-iam/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IAMClientConfig) => ({ apiVersion: "2010-05-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IAM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iam/runtimeConfig.ts b/clients/client-iam/runtimeConfig.ts index 2ee42bb83d56..f73e319dd8c0 100644 --- a/clients/client-iam/runtimeConfig.ts +++ b/clients/client-iam/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IAMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IAMClientConfig } from "./IAMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IAMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-identitystore/IdentitystoreClient.ts b/clients/client-identitystore/IdentitystoreClient.ts index 12eb433f45cc..1e591a8f0283 100644 --- a/clients/client-identitystore/IdentitystoreClient.ts +++ b/clients/client-identitystore/IdentitystoreClient.ts @@ -2,7 +2,7 @@ import { DescribeGroupCommandInput, DescribeGroupCommandOutput } from "./command import { DescribeUserCommandInput, DescribeUserCommandOutput } from "./commands/DescribeUserCommand"; import { ListGroupsCommandInput, ListGroupsCommandOutput } from "./commands/ListGroupsCommand"; import { ListUsersCommandInput, ListUsersCommandOutput } from "./commands/ListUsersCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -217,10 +217,7 @@ export class IdentitystoreClient extends __Client< readonly config: IdentitystoreClientResolvedConfig; constructor(configuration: IdentitystoreClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-identitystore/runtimeConfig.browser.ts b/clients/client-identitystore/runtimeConfig.browser.ts index 1f96d396757b..9913cda5a827 100644 --- a/clients/client-identitystore/runtimeConfig.browser.ts +++ b/clients/client-identitystore/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IdentitystoreClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IdentitystoreClientConfig } from "./IdentitystoreClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-identitystore/runtimeConfig.native.ts b/clients/client-identitystore/runtimeConfig.native.ts index 75f42610b186..17de8197cecf 100644 --- a/clients/client-identitystore/runtimeConfig.native.ts +++ b/clients/client-identitystore/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IdentitystoreClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IdentitystoreClientConfig } from "./IdentitystoreClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-identitystore/runtimeConfig.shared.ts b/clients/client-identitystore/runtimeConfig.shared.ts index 677413ef79e7..256e03525574 100644 --- a/clients/client-identitystore/runtimeConfig.shared.ts +++ b/clients/client-identitystore/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IdentitystoreClientConfig) => ({ apiVersion: "2020-06-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "identitystore", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-identitystore/runtimeConfig.ts b/clients/client-identitystore/runtimeConfig.ts index 7ece04e0ccf8..07fbfc92ac6a 100644 --- a/clients/client-identitystore/runtimeConfig.ts +++ b/clients/client-identitystore/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IdentitystoreClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IdentitystoreClientConfig } from "./IdentitystoreClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-imagebuilder/ImagebuilderClient.ts b/clients/client-imagebuilder/ImagebuilderClient.ts index ad83e0fc1bd3..c7656b002d47 100644 --- a/clients/client-imagebuilder/ImagebuilderClient.ts +++ b/clients/client-imagebuilder/ImagebuilderClient.ts @@ -125,7 +125,7 @@ import { UpdateInfrastructureConfigurationCommandInput, UpdateInfrastructureConfigurationCommandOutput, } from "./commands/UpdateInfrastructureConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -436,10 +436,7 @@ export class ImagebuilderClient extends __Client< readonly config: ImagebuilderClientResolvedConfig; constructor(configuration: ImagebuilderClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-imagebuilder/runtimeConfig.browser.ts b/clients/client-imagebuilder/runtimeConfig.browser.ts index b1993ccf04fd..9eb2537da89c 100644 --- a/clients/client-imagebuilder/runtimeConfig.browser.ts +++ b/clients/client-imagebuilder/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ImagebuilderClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ImagebuilderClientConfig } from "./ImagebuilderClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-imagebuilder/runtimeConfig.native.ts b/clients/client-imagebuilder/runtimeConfig.native.ts index 4e7c9c8346bb..e064e6fc18fc 100644 --- a/clients/client-imagebuilder/runtimeConfig.native.ts +++ b/clients/client-imagebuilder/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ImagebuilderClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ImagebuilderClientConfig } from "./ImagebuilderClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-imagebuilder/runtimeConfig.shared.ts b/clients/client-imagebuilder/runtimeConfig.shared.ts index bdaedaa5555b..5a5793d781d8 100644 --- a/clients/client-imagebuilder/runtimeConfig.shared.ts +++ b/clients/client-imagebuilder/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ImagebuilderClientConfig) => ({ apiVersion: "2019-12-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "imagebuilder", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-imagebuilder/runtimeConfig.ts b/clients/client-imagebuilder/runtimeConfig.ts index cdda4d2d24f4..3cb76938bbe9 100644 --- a/clients/client-imagebuilder/runtimeConfig.ts +++ b/clients/client-imagebuilder/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ImagebuilderClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ImagebuilderClientConfig } from "./ImagebuilderClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-inspector/InspectorClient.ts b/clients/client-inspector/InspectorClient.ts index 64c02a15f823..05f20decf983 100644 --- a/clients/client-inspector/InspectorClient.ts +++ b/clients/client-inspector/InspectorClient.ts @@ -113,7 +113,7 @@ import { UpdateAssessmentTargetCommandInput, UpdateAssessmentTargetCommandOutput, } from "./commands/UpdateAssessmentTargetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -400,10 +400,7 @@ export class InspectorClient extends __Client< readonly config: InspectorClientResolvedConfig; constructor(configuration: InspectorClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-inspector/runtimeConfig.browser.ts b/clients/client-inspector/runtimeConfig.browser.ts index 06f0c4adc832..ca9da1a757f7 100644 --- a/clients/client-inspector/runtimeConfig.browser.ts +++ b/clients/client-inspector/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./InspectorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { InspectorClientConfig } from "./InspectorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: InspectorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-inspector/runtimeConfig.native.ts b/clients/client-inspector/runtimeConfig.native.ts index 0f574c84b827..07a3f85dd817 100644 --- a/clients/client-inspector/runtimeConfig.native.ts +++ b/clients/client-inspector/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./InspectorClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { InspectorClientConfig } from "./InspectorClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: InspectorClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-inspector/runtimeConfig.shared.ts b/clients/client-inspector/runtimeConfig.shared.ts index c190603cd03c..54cf5566169d 100644 --- a/clients/client-inspector/runtimeConfig.shared.ts +++ b/clients/client-inspector/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: InspectorClientConfig) => ({ apiVersion: "2016-02-16", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Inspector", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-inspector/runtimeConfig.ts b/clients/client-inspector/runtimeConfig.ts index 813137db23fd..91934c4a3b20 100644 --- a/clients/client-inspector/runtimeConfig.ts +++ b/clients/client-inspector/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./InspectorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { InspectorClientConfig } from "./InspectorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: InspectorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-1click-devices-service/IoT1ClickDevicesServiceClient.ts b/clients/client-iot-1click-devices-service/IoT1ClickDevicesServiceClient.ts index 6a6f45ed8583..a14af085b58f 100644 --- a/clients/client-iot-1click-devices-service/IoT1ClickDevicesServiceClient.ts +++ b/clients/client-iot-1click-devices-service/IoT1ClickDevicesServiceClient.ts @@ -23,7 +23,7 @@ import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/Ta import { UnclaimDeviceCommandInput, UnclaimDeviceCommandOutput } from "./commands/UnclaimDeviceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateDeviceStateCommandInput, UpdateDeviceStateCommandOutput } from "./commands/UpdateDeviceStateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -261,10 +261,7 @@ export class IoT1ClickDevicesServiceClient extends __Client< readonly config: IoT1ClickDevicesServiceClientResolvedConfig; constructor(configuration: IoT1ClickDevicesServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts b/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts index 8ef4c72cdbc9..fe654a06ee08 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoT1ClickDevicesServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoT1ClickDevicesServiceClientConfig } from "./IoT1ClickDevicesServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 8e970f538001..b8480e11b568 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.native.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoT1ClickDevicesServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoT1ClickDevicesServiceClientConfig } from "./IoT1ClickDevicesServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 0aec62bf3300..a4c9bd469bf9 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.shared.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => ({ apiVersion: "2018-05-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT 1Click Devices Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.ts b/clients/client-iot-1click-devices-service/runtimeConfig.ts index b6bc8d7fff1a..f7ad305379d6 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoT1ClickDevicesServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoT1ClickDevicesServiceClientConfig } from "./IoT1ClickDevicesServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-1click-projects/IoT1ClickProjectsClient.ts b/clients/client-iot-1click-projects/IoT1ClickProjectsClient.ts index 9d9546c510de..2185a2858775 100644 --- a/clients/client-iot-1click-projects/IoT1ClickProjectsClient.ts +++ b/clients/client-iot-1click-projects/IoT1ClickProjectsClient.ts @@ -26,7 +26,7 @@ import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/Ta import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdatePlacementCommandInput, UpdatePlacementCommandOutput } from "./commands/UpdatePlacementCommand"; import { UpdateProjectCommandInput, UpdateProjectCommandOutput } from "./commands/UpdateProjectCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -268,10 +268,7 @@ export class IoT1ClickProjectsClient extends __Client< readonly config: IoT1ClickProjectsClientResolvedConfig; constructor(configuration: IoT1ClickProjectsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-1click-projects/runtimeConfig.browser.ts b/clients/client-iot-1click-projects/runtimeConfig.browser.ts index fce292ccfb85..44bb5812982f 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.browser.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoT1ClickProjectsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoT1ClickProjectsClientConfig } from "./IoT1ClickProjectsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-1click-projects/runtimeConfig.native.ts b/clients/client-iot-1click-projects/runtimeConfig.native.ts index 07ce1da32ca3..aaabc89746e6 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.native.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoT1ClickProjectsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoT1ClickProjectsClientConfig } from "./IoT1ClickProjectsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iot-1click-projects/runtimeConfig.shared.ts b/clients/client-iot-1click-projects/runtimeConfig.shared.ts index 106d4272c5c6..7e3153e6f585 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.shared.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => ({ apiVersion: "2018-05-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT 1Click Projects", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-1click-projects/runtimeConfig.ts b/clients/client-iot-1click-projects/runtimeConfig.ts index c9e42237ad19..48b7b9a0bee6 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoT1ClickProjectsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoT1ClickProjectsClientConfig } from "./IoT1ClickProjectsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-data-plane/IoTDataPlaneClient.ts b/clients/client-iot-data-plane/IoTDataPlaneClient.ts index 7d5d77e49f8d..3723b1f1aee0 100644 --- a/clients/client-iot-data-plane/IoTDataPlaneClient.ts +++ b/clients/client-iot-data-plane/IoTDataPlaneClient.ts @@ -6,7 +6,7 @@ import { } from "./commands/ListNamedShadowsForThingCommand"; import { PublishCommandInput, PublishCommandOutput } from "./commands/PublishCommand"; import { UpdateThingShadowCommandInput, UpdateThingShadowCommandOutput } from "./commands/UpdateThingShadowCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -242,10 +242,7 @@ export class IoTDataPlaneClient extends __Client< readonly config: IoTDataPlaneClientResolvedConfig; constructor(configuration: IoTDataPlaneClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-data-plane/runtimeConfig.browser.ts b/clients/client-iot-data-plane/runtimeConfig.browser.ts index 99c3a1328ad8..ac987cc62acd 100644 --- a/clients/client-iot-data-plane/runtimeConfig.browser.ts +++ b/clients/client-iot-data-plane/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTDataPlaneClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTDataPlaneClientConfig } from "./IoTDataPlaneClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-data-plane/runtimeConfig.native.ts b/clients/client-iot-data-plane/runtimeConfig.native.ts index 3a72bc834063..11f7741ba6cb 100644 --- a/clients/client-iot-data-plane/runtimeConfig.native.ts +++ b/clients/client-iot-data-plane/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTDataPlaneClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTDataPlaneClientConfig } from "./IoTDataPlaneClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iot-data-plane/runtimeConfig.shared.ts b/clients/client-iot-data-plane/runtimeConfig.shared.ts index d4d649112fb1..efe9ef3131e8 100644 --- a/clients/client-iot-data-plane/runtimeConfig.shared.ts +++ b/clients/client-iot-data-plane/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => ({ apiVersion: "2015-05-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT Data Plane", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-data-plane/runtimeConfig.ts b/clients/client-iot-data-plane/runtimeConfig.ts index 2f5aaae42f3c..af620240a35e 100644 --- a/clients/client-iot-data-plane/runtimeConfig.ts +++ b/clients/client-iot-data-plane/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTDataPlaneClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTDataPlaneClientConfig } from "./IoTDataPlaneClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-events-data/IoTEventsDataClient.ts b/clients/client-iot-events-data/IoTEventsDataClient.ts index 64aaf2c0b777..d5e52de2f9ce 100644 --- a/clients/client-iot-events-data/IoTEventsDataClient.ts +++ b/clients/client-iot-events-data/IoTEventsDataClient.ts @@ -15,7 +15,7 @@ import { DescribeAlarmCommandInput, DescribeAlarmCommandOutput } from "./command import { DescribeDetectorCommandInput, DescribeDetectorCommandOutput } from "./commands/DescribeDetectorCommand"; import { ListAlarmsCommandInput, ListAlarmsCommandOutput } from "./commands/ListAlarmsCommand"; import { ListDetectorsCommandInput, ListDetectorsCommandOutput } from "./commands/ListDetectorsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -251,10 +251,7 @@ export class IoTEventsDataClient extends __Client< readonly config: IoTEventsDataClientResolvedConfig; constructor(configuration: IoTEventsDataClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-events-data/runtimeConfig.browser.ts b/clients/client-iot-events-data/runtimeConfig.browser.ts index 34dadf9d8e59..29bf7304fa86 100644 --- a/clients/client-iot-events-data/runtimeConfig.browser.ts +++ b/clients/client-iot-events-data/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTEventsDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTEventsDataClientConfig } from "./IoTEventsDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-events-data/runtimeConfig.native.ts b/clients/client-iot-events-data/runtimeConfig.native.ts index eea5d5572a71..4f810c0b95e0 100644 --- a/clients/client-iot-events-data/runtimeConfig.native.ts +++ b/clients/client-iot-events-data/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTEventsDataClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTEventsDataClientConfig } from "./IoTEventsDataClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iot-events-data/runtimeConfig.shared.ts b/clients/client-iot-events-data/runtimeConfig.shared.ts index 0980ab6b1eb4..981d48f0d609 100644 --- a/clients/client-iot-events-data/runtimeConfig.shared.ts +++ b/clients/client-iot-events-data/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => ({ apiVersion: "2018-10-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT Events Data", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-events-data/runtimeConfig.ts b/clients/client-iot-events-data/runtimeConfig.ts index c90789d50b9c..fd514c21cc4c 100644 --- a/clients/client-iot-events-data/runtimeConfig.ts +++ b/clients/client-iot-events-data/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTEventsDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTEventsDataClientConfig } from "./IoTEventsDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-events/IoTEventsClient.ts b/clients/client-iot-events/IoTEventsClient.ts index 6273aff3a25f..9bc1794f0ce8 100644 --- a/clients/client-iot-events/IoTEventsClient.ts +++ b/clients/client-iot-events/IoTEventsClient.ts @@ -57,7 +57,7 @@ import { UpdateDetectorModelCommandOutput, } from "./commands/UpdateDetectorModelCommand"; import { UpdateInputCommandInput, UpdateInputCommandOutput } from "./commands/UpdateInputCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -321,10 +321,7 @@ export class IoTEventsClient extends __Client< readonly config: IoTEventsClientResolvedConfig; constructor(configuration: IoTEventsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-events/runtimeConfig.browser.ts b/clients/client-iot-events/runtimeConfig.browser.ts index 81259707165f..3e600ffde421 100644 --- a/clients/client-iot-events/runtimeConfig.browser.ts +++ b/clients/client-iot-events/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTEventsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTEventsClientConfig } from "./IoTEventsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTEventsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-events/runtimeConfig.native.ts b/clients/client-iot-events/runtimeConfig.native.ts index 4890d48961d3..724f828020ed 100644 --- a/clients/client-iot-events/runtimeConfig.native.ts +++ b/clients/client-iot-events/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTEventsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTEventsClientConfig } from "./IoTEventsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTEventsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iot-events/runtimeConfig.shared.ts b/clients/client-iot-events/runtimeConfig.shared.ts index 3134862075ee..d9658124a9c9 100644 --- a/clients/client-iot-events/runtimeConfig.shared.ts +++ b/clients/client-iot-events/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTEventsClientConfig) => ({ apiVersion: "2018-07-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT Events", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-events/runtimeConfig.ts b/clients/client-iot-events/runtimeConfig.ts index 098c204f70c6..7c12fc54f526 100644 --- a/clients/client-iot-events/runtimeConfig.ts +++ b/clients/client-iot-events/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTEventsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTEventsClientConfig } from "./IoTEventsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTEventsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-jobs-data-plane/IoTJobsDataPlaneClient.ts b/clients/client-iot-jobs-data-plane/IoTJobsDataPlaneClient.ts index 77bce9b9bba4..1da1adfb1c87 100644 --- a/clients/client-iot-jobs-data-plane/IoTJobsDataPlaneClient.ts +++ b/clients/client-iot-jobs-data-plane/IoTJobsDataPlaneClient.ts @@ -11,7 +11,7 @@ import { StartNextPendingJobExecutionCommandOutput, } from "./commands/StartNextPendingJobExecutionCommand"; import { UpdateJobExecutionCommandInput, UpdateJobExecutionCommandOutput } from "./commands/UpdateJobExecutionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -239,10 +239,7 @@ export class IoTJobsDataPlaneClient extends __Client< readonly config: IoTJobsDataPlaneClientResolvedConfig; constructor(configuration: IoTJobsDataPlaneClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts index 478e7b273f0f..f03f7d382f80 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTJobsDataPlaneClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTJobsDataPlaneClientConfig } from "./IoTJobsDataPlaneClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 0988305cbe47..3dce822679a7 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTJobsDataPlaneClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTJobsDataPlaneClientConfig } from "./IoTJobsDataPlaneClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 ad8282653df1..56f6f0096f4a 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.shared.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => ({ apiVersion: "2017-09-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT Jobs Data Plane", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.ts index 4c86a4c8d30b..25157fa8b1cd 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTJobsDataPlaneClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTJobsDataPlaneClientConfig } from "./IoTJobsDataPlaneClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-wireless/IoTWirelessClient.ts b/clients/client-iot-wireless/IoTWirelessClient.ts index 8cbb44adcebb..776a5b9e1e1d 100644 --- a/clients/client-iot-wireless/IoTWirelessClient.ts +++ b/clients/client-iot-wireless/IoTWirelessClient.ts @@ -181,7 +181,7 @@ import { UpdateWirelessGatewayCommandInput, UpdateWirelessGatewayCommandOutput, } from "./commands/UpdateWirelessGatewayCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -505,10 +505,7 @@ export class IoTWirelessClient extends __Client< readonly config: IoTWirelessClientResolvedConfig; constructor(configuration: IoTWirelessClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot-wireless/runtimeConfig.browser.ts b/clients/client-iot-wireless/runtimeConfig.browser.ts index 6d09838cddf0..30ee8603cdc2 100644 --- a/clients/client-iot-wireless/runtimeConfig.browser.ts +++ b/clients/client-iot-wireless/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTWirelessClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTWirelessClientConfig } from "./IoTWirelessClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot-wireless/runtimeConfig.native.ts b/clients/client-iot-wireless/runtimeConfig.native.ts index cb57785f9fa7..80dcc236e741 100644 --- a/clients/client-iot-wireless/runtimeConfig.native.ts +++ b/clients/client-iot-wireless/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTWirelessClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTWirelessClientConfig } from "./IoTWirelessClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iot-wireless/runtimeConfig.shared.ts b/clients/client-iot-wireless/runtimeConfig.shared.ts index 8353e6925e91..d6d80ec8cf6a 100644 --- a/clients/client-iot-wireless/runtimeConfig.shared.ts +++ b/clients/client-iot-wireless/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTWirelessClientConfig) => ({ apiVersion: "2020-11-22", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT Wireless", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot-wireless/runtimeConfig.ts b/clients/client-iot-wireless/runtimeConfig.ts index d616f7e483aa..7cae259bd619 100644 --- a/clients/client-iot-wireless/runtimeConfig.ts +++ b/clients/client-iot-wireless/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTWirelessClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTWirelessClientConfig } from "./IoTWirelessClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot/IoTClient.ts b/clients/client-iot/IoTClient.ts index b99f068d3a0f..169398182cdb 100644 --- a/clients/client-iot/IoTClient.ts +++ b/clients/client-iot/IoTClient.ts @@ -618,7 +618,7 @@ import { ValidateSecurityProfileBehaviorsCommandInput, ValidateSecurityProfileBehaviorsCommandOutput, } from "./commands/ValidateSecurityProfileBehaviorsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -1303,10 +1303,7 @@ export class IoTClient extends __Client< readonly config: IoTClientResolvedConfig; constructor(configuration: IoTClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iot/runtimeConfig.browser.ts b/clients/client-iot/runtimeConfig.browser.ts index d204adede5ee..45ab72b06ad2 100644 --- a/clients/client-iot/runtimeConfig.browser.ts +++ b/clients/client-iot/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTClientConfig } from "./IoTClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iot/runtimeConfig.native.ts b/clients/client-iot/runtimeConfig.native.ts index 8c2a84c66984..3108081e4319 100644 --- a/clients/client-iot/runtimeConfig.native.ts +++ b/clients/client-iot/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTClientConfig } from "./IoTClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iot/runtimeConfig.shared.ts b/clients/client-iot/runtimeConfig.shared.ts index f52edc8e582d..fb9f0c76b690 100644 --- a/clients/client-iot/runtimeConfig.shared.ts +++ b/clients/client-iot/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTClientConfig) => ({ apiVersion: "2015-05-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoT", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iot/runtimeConfig.ts b/clients/client-iot/runtimeConfig.ts index 511a425f9cd7..9cacee7af830 100644 --- a/clients/client-iot/runtimeConfig.ts +++ b/clients/client-iot/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTClientConfig } from "./IoTClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotanalytics/IoTAnalyticsClient.ts b/clients/client-iotanalytics/IoTAnalyticsClient.ts index fd52e31a2cca..97c0e52267b6 100644 --- a/clients/client-iotanalytics/IoTAnalyticsClient.ts +++ b/clients/client-iotanalytics/IoTAnalyticsClient.ts @@ -56,7 +56,7 @@ import { UpdateChannelCommandInput, UpdateChannelCommandOutput } from "./command import { UpdateDatasetCommandInput, UpdateDatasetCommandOutput } from "./commands/UpdateDatasetCommand"; import { UpdateDatastoreCommandInput, UpdateDatastoreCommandOutput } from "./commands/UpdateDatastoreCommand"; import { UpdatePipelineCommandInput, UpdatePipelineCommandOutput } from "./commands/UpdatePipelineCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -352,10 +352,7 @@ export class IoTAnalyticsClient extends __Client< readonly config: IoTAnalyticsClientResolvedConfig; constructor(configuration: IoTAnalyticsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iotanalytics/runtimeConfig.browser.ts b/clients/client-iotanalytics/runtimeConfig.browser.ts index d57214f8d1ea..8aa54e7d5be1 100644 --- a/clients/client-iotanalytics/runtimeConfig.browser.ts +++ b/clients/client-iotanalytics/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTAnalyticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTAnalyticsClientConfig } from "./IoTAnalyticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotanalytics/runtimeConfig.native.ts b/clients/client-iotanalytics/runtimeConfig.native.ts index 43eae9b60894..430163b19172 100644 --- a/clients/client-iotanalytics/runtimeConfig.native.ts +++ b/clients/client-iotanalytics/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTAnalyticsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTAnalyticsClientConfig } from "./IoTAnalyticsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iotanalytics/runtimeConfig.shared.ts b/clients/client-iotanalytics/runtimeConfig.shared.ts index 6664dbd7f083..f306a536ed47 100644 --- a/clients/client-iotanalytics/runtimeConfig.shared.ts +++ b/clients/client-iotanalytics/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoTAnalytics", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iotanalytics/runtimeConfig.ts b/clients/client-iotanalytics/runtimeConfig.ts index 2126bc053d6f..cd2780120e91 100644 --- a/clients/client-iotanalytics/runtimeConfig.ts +++ b/clients/client-iotanalytics/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTAnalyticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTAnalyticsClientConfig } from "./IoTAnalyticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotdeviceadvisor/IotDeviceAdvisorClient.ts b/clients/client-iotdeviceadvisor/IotDeviceAdvisorClient.ts index 9ac54665c1aa..79b589a17c80 100644 --- a/clients/client-iotdeviceadvisor/IotDeviceAdvisorClient.ts +++ b/clients/client-iotdeviceadvisor/IotDeviceAdvisorClient.ts @@ -26,7 +26,7 @@ import { UpdateSuiteDefinitionCommandInput, UpdateSuiteDefinitionCommandOutput, } from "./commands/UpdateSuiteDefinitionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -262,10 +262,7 @@ export class IotDeviceAdvisorClient extends __Client< readonly config: IotDeviceAdvisorClientResolvedConfig; constructor(configuration: IotDeviceAdvisorClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts b/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts index 036f299f316e..dd7b438a560f 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IotDeviceAdvisorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IotDeviceAdvisorClientConfig } from "./IotDeviceAdvisorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.native.ts b/clients/client-iotdeviceadvisor/runtimeConfig.native.ts index f09a357db83d..df1b8cad55fa 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.native.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IotDeviceAdvisorClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IotDeviceAdvisorClientConfig } from "./IotDeviceAdvisorClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts b/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts index 677884775d77..ec0c03f4e9c7 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => ({ apiVersion: "2020-09-18", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IotDeviceAdvisor", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.ts b/clients/client-iotdeviceadvisor/runtimeConfig.ts index 8fefee59aadf..48ba3bda00e6 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IotDeviceAdvisorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IotDeviceAdvisorClientConfig } from "./IotDeviceAdvisorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotfleethub/IoTFleetHubClient.ts b/clients/client-iotfleethub/IoTFleetHubClient.ts index 105c484f5db6..3c69c2016f4a 100644 --- a/clients/client-iotfleethub/IoTFleetHubClient.ts +++ b/clients/client-iotfleethub/IoTFleetHubClient.ts @@ -12,7 +12,7 @@ import { import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateApplicationCommandInput, UpdateApplicationCommandOutput } from "./commands/UpdateApplicationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -241,10 +241,7 @@ export class IoTFleetHubClient extends __Client< readonly config: IoTFleetHubClientResolvedConfig; constructor(configuration: IoTFleetHubClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iotfleethub/runtimeConfig.browser.ts b/clients/client-iotfleethub/runtimeConfig.browser.ts index 7d93c9a33642..49ab16a748b6 100644 --- a/clients/client-iotfleethub/runtimeConfig.browser.ts +++ b/clients/client-iotfleethub/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTFleetHubClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTFleetHubClientConfig } from "./IoTFleetHubClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotfleethub/runtimeConfig.native.ts b/clients/client-iotfleethub/runtimeConfig.native.ts index b4d54f390194..ccde355e602f 100644 --- a/clients/client-iotfleethub/runtimeConfig.native.ts +++ b/clients/client-iotfleethub/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTFleetHubClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTFleetHubClientConfig } from "./IoTFleetHubClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iotfleethub/runtimeConfig.shared.ts b/clients/client-iotfleethub/runtimeConfig.shared.ts index 8f7ccb1ce0e9..66d62d984daa 100644 --- a/clients/client-iotfleethub/runtimeConfig.shared.ts +++ b/clients/client-iotfleethub/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => ({ apiVersion: "2020-11-03", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoTFleetHub", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iotfleethub/runtimeConfig.ts b/clients/client-iotfleethub/runtimeConfig.ts index 933c129d72b9..58c6a747d8d5 100644 --- a/clients/client-iotfleethub/runtimeConfig.ts +++ b/clients/client-iotfleethub/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTFleetHubClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTFleetHubClientConfig } from "./IoTFleetHubClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotsecuretunneling/IoTSecureTunnelingClient.ts b/clients/client-iotsecuretunneling/IoTSecureTunnelingClient.ts index 7291895b5ba0..09e1c8e8e801 100644 --- a/clients/client-iotsecuretunneling/IoTSecureTunnelingClient.ts +++ b/clients/client-iotsecuretunneling/IoTSecureTunnelingClient.ts @@ -8,7 +8,7 @@ import { ListTunnelsCommandInput, ListTunnelsCommandOutput } from "./commands/Li import { OpenTunnelCommandInput, OpenTunnelCommandOutput } from "./commands/OpenTunnelCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -236,10 +236,7 @@ export class IoTSecureTunnelingClient extends __Client< readonly config: IoTSecureTunnelingClientResolvedConfig; constructor(configuration: IoTSecureTunnelingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iotsecuretunneling/runtimeConfig.browser.ts b/clients/client-iotsecuretunneling/runtimeConfig.browser.ts index 754148ae60e4..8c319862fbd2 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.browser.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTSecureTunnelingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTSecureTunnelingClientConfig } from "./IoTSecureTunnelingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotsecuretunneling/runtimeConfig.native.ts b/clients/client-iotsecuretunneling/runtimeConfig.native.ts index ff20b505833e..4407b576f65b 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.native.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTSecureTunnelingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTSecureTunnelingClientConfig } from "./IoTSecureTunnelingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iotsecuretunneling/runtimeConfig.shared.ts b/clients/client-iotsecuretunneling/runtimeConfig.shared.ts index 509b7db828f3..e9250c21d029 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.shared.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => ({ apiVersion: "2018-10-05", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoTSecureTunneling", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iotsecuretunneling/runtimeConfig.ts b/clients/client-iotsecuretunneling/runtimeConfig.ts index 4c2c553694d2..812572e280fa 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTSecureTunnelingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTSecureTunnelingClientConfig } from "./IoTSecureTunnelingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotsitewise/IoTSiteWiseClient.ts b/clients/client-iotsitewise/IoTSiteWiseClient.ts index 0f66e236e6de..d663fa826536 100644 --- a/clients/client-iotsitewise/IoTSiteWiseClient.ts +++ b/clients/client-iotsitewise/IoTSiteWiseClient.ts @@ -118,7 +118,7 @@ import { import { UpdateGatewayCommandInput, UpdateGatewayCommandOutput } from "./commands/UpdateGatewayCommand"; import { UpdatePortalCommandInput, UpdatePortalCommandOutput } from "./commands/UpdatePortalCommand"; import { UpdateProjectCommandInput, UpdateProjectCommandOutput } from "./commands/UpdateProjectCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -449,10 +449,7 @@ export class IoTSiteWiseClient extends __Client< readonly config: IoTSiteWiseClientResolvedConfig; constructor(configuration: IoTSiteWiseClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iotsitewise/runtimeConfig.browser.ts b/clients/client-iotsitewise/runtimeConfig.browser.ts index 1895814676f9..aa28b30be66a 100644 --- a/clients/client-iotsitewise/runtimeConfig.browser.ts +++ b/clients/client-iotsitewise/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTSiteWiseClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTSiteWiseClientConfig } from "./IoTSiteWiseClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotsitewise/runtimeConfig.native.ts b/clients/client-iotsitewise/runtimeConfig.native.ts index 83e41d3ccf23..35a4bd461eb2 100644 --- a/clients/client-iotsitewise/runtimeConfig.native.ts +++ b/clients/client-iotsitewise/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTSiteWiseClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTSiteWiseClientConfig } from "./IoTSiteWiseClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iotsitewise/runtimeConfig.shared.ts b/clients/client-iotsitewise/runtimeConfig.shared.ts index 6a8ceaf5fb75..20c1db8a2bca 100644 --- a/clients/client-iotsitewise/runtimeConfig.shared.ts +++ b/clients/client-iotsitewise/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => ({ apiVersion: "2019-12-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoTSiteWise", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iotsitewise/runtimeConfig.ts b/clients/client-iotsitewise/runtimeConfig.ts index 195ca66f090d..344c435215e7 100644 --- a/clients/client-iotsitewise/runtimeConfig.ts +++ b/clients/client-iotsitewise/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTSiteWiseClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTSiteWiseClientConfig } from "./IoTSiteWiseClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotthingsgraph/IoTThingsGraphClient.ts b/clients/client-iotthingsgraph/IoTThingsGraphClient.ts index 58902920f3e3..94c708c379ba 100644 --- a/clients/client-iotthingsgraph/IoTThingsGraphClient.ts +++ b/clients/client-iotthingsgraph/IoTThingsGraphClient.ts @@ -96,7 +96,7 @@ import { UploadEntityDefinitionsCommandInput, UploadEntityDefinitionsCommandOutput, } from "./commands/UploadEntityDefinitionsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -380,10 +380,7 @@ export class IoTThingsGraphClient extends __Client< readonly config: IoTThingsGraphClientResolvedConfig; constructor(configuration: IoTThingsGraphClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-iotthingsgraph/runtimeConfig.browser.ts b/clients/client-iotthingsgraph/runtimeConfig.browser.ts index 4a9668f6b506..6acedc3ac462 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.browser.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IoTThingsGraphClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTThingsGraphClientConfig } from "./IoTThingsGraphClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-iotthingsgraph/runtimeConfig.native.ts b/clients/client-iotthingsgraph/runtimeConfig.native.ts index bdc762a4c6fc..43e2e572f227 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.native.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IoTThingsGraphClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IoTThingsGraphClientConfig } from "./IoTThingsGraphClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-iotthingsgraph/runtimeConfig.shared.ts b/clients/client-iotthingsgraph/runtimeConfig.shared.ts index 0ff116ff72e1..ed26144685b0 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.shared.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => ({ apiVersion: "2018-09-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "IoTThingsGraph", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-iotthingsgraph/runtimeConfig.ts b/clients/client-iotthingsgraph/runtimeConfig.ts index 4cd9d5cd9d04..e4a6cd1ccbd0 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IoTThingsGraphClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IoTThingsGraphClientConfig } from "./IoTThingsGraphClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ivs/IvsClient.ts b/clients/client-ivs/IvsClient.ts index 76e228b38226..148bb9950a99 100644 --- a/clients/client-ivs/IvsClient.ts +++ b/clients/client-ivs/IvsClient.ts @@ -48,7 +48,7 @@ import { StopStreamCommandInput, StopStreamCommandOutput } from "./commands/Stop import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateChannelCommandInput, UpdateChannelCommandOutput } from "./commands/UpdateChannelCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -669,10 +669,7 @@ export class IvsClient extends __Client< readonly config: IvsClientResolvedConfig; constructor(configuration: IvsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ivs/runtimeConfig.browser.ts b/clients/client-ivs/runtimeConfig.browser.ts index cd8122d706ef..e90f14b5a041 100644 --- a/clients/client-ivs/runtimeConfig.browser.ts +++ b/clients/client-ivs/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./IvsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IvsClientConfig } from "./IvsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IvsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ivs/runtimeConfig.native.ts b/clients/client-ivs/runtimeConfig.native.ts index 73b0c7a6700e..c6091b8b4d82 100644 --- a/clients/client-ivs/runtimeConfig.native.ts +++ b/clients/client-ivs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./IvsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { IvsClientConfig } from "./IvsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: IvsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ivs/runtimeConfig.shared.ts b/clients/client-ivs/runtimeConfig.shared.ts index 3f31538acfed..a1a6204c053d 100644 --- a/clients/client-ivs/runtimeConfig.shared.ts +++ b/clients/client-ivs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: IvsClientConfig) => ({ apiVersion: "2020-07-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ivs", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ivs/runtimeConfig.ts b/clients/client-ivs/runtimeConfig.ts index 810aecbef967..066198b1b59d 100644 --- a/clients/client-ivs/runtimeConfig.ts +++ b/clients/client-ivs/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./IvsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { IvsClientConfig } from "./IvsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: IvsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kafka/KafkaClient.ts b/clients/client-kafka/KafkaClient.ts index 8dcb34f5b9e8..efe170799c66 100644 --- a/clients/client-kafka/KafkaClient.ts +++ b/clients/client-kafka/KafkaClient.ts @@ -76,7 +76,7 @@ import { UpdateConfigurationCommandOutput, } from "./commands/UpdateConfigurationCommand"; import { UpdateMonitoringCommandInput, UpdateMonitoringCommandOutput } from "./commands/UpdateMonitoringCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -346,10 +346,7 @@ export class KafkaClient extends __Client< readonly config: KafkaClientResolvedConfig; constructor(configuration: KafkaClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kafka/runtimeConfig.browser.ts b/clients/client-kafka/runtimeConfig.browser.ts index f4cc86ab34d3..6338137043f7 100644 --- a/clients/client-kafka/runtimeConfig.browser.ts +++ b/clients/client-kafka/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KafkaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KafkaClientConfig } from "./KafkaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KafkaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kafka/runtimeConfig.native.ts b/clients/client-kafka/runtimeConfig.native.ts index a0c270e4236f..23bfd3dc3db0 100644 --- a/clients/client-kafka/runtimeConfig.native.ts +++ b/clients/client-kafka/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KafkaClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KafkaClientConfig } from "./KafkaClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KafkaClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kafka/runtimeConfig.shared.ts b/clients/client-kafka/runtimeConfig.shared.ts index fcc86fce55ec..d0b81dc6154b 100644 --- a/clients/client-kafka/runtimeConfig.shared.ts +++ b/clients/client-kafka/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KafkaClientConfig) => ({ apiVersion: "2018-11-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kafka", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kafka/runtimeConfig.ts b/clients/client-kafka/runtimeConfig.ts index 56188b123be4..fb610f178cf4 100644 --- a/clients/client-kafka/runtimeConfig.ts +++ b/clients/client-kafka/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KafkaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KafkaClientConfig } from "./KafkaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KafkaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kendra/KendraClient.ts b/clients/client-kendra/KendraClient.ts index 4ecd5ebab87d..ab1c2da1ada3 100644 --- a/clients/client-kendra/KendraClient.ts +++ b/clients/client-kendra/KendraClient.ts @@ -98,7 +98,7 @@ import { UpdateQuerySuggestionsConfigCommandOutput, } from "./commands/UpdateQuerySuggestionsConfigCommand"; import { UpdateThesaurusCommandInput, UpdateThesaurusCommandOutput } from "./commands/UpdateThesaurusCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -394,10 +394,7 @@ export class KendraClient extends __Client< readonly config: KendraClientResolvedConfig; constructor(configuration: KendraClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kendra/runtimeConfig.browser.ts b/clients/client-kendra/runtimeConfig.browser.ts index 14f47db40ee0..c265f4d442af 100644 --- a/clients/client-kendra/runtimeConfig.browser.ts +++ b/clients/client-kendra/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KendraClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KendraClientConfig } from "./KendraClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KendraClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kendra/runtimeConfig.native.ts b/clients/client-kendra/runtimeConfig.native.ts index 18ca437ca50b..1d66d0b54f82 100644 --- a/clients/client-kendra/runtimeConfig.native.ts +++ b/clients/client-kendra/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KendraClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KendraClientConfig } from "./KendraClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KendraClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kendra/runtimeConfig.shared.ts b/clients/client-kendra/runtimeConfig.shared.ts index 90d3816a49d7..30b48a5a8fe9 100644 --- a/clients/client-kendra/runtimeConfig.shared.ts +++ b/clients/client-kendra/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KendraClientConfig) => ({ apiVersion: "2019-02-03", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "kendra", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kendra/runtimeConfig.ts b/clients/client-kendra/runtimeConfig.ts index b03cba7797e1..288f7d6c4e17 100644 --- a/clients/client-kendra/runtimeConfig.ts +++ b/clients/client-kendra/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KendraClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KendraClientConfig } from "./KendraClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KendraClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-analytics-v2/KinesisAnalyticsV2Client.ts b/clients/client-kinesis-analytics-v2/KinesisAnalyticsV2Client.ts index 1cc64c49ebef..084a44308572 100644 --- a/clients/client-kinesis-analytics-v2/KinesisAnalyticsV2Client.ts +++ b/clients/client-kinesis-analytics-v2/KinesisAnalyticsV2Client.ts @@ -98,7 +98,7 @@ import { UpdateApplicationMaintenanceConfigurationCommandInput, UpdateApplicationMaintenanceConfigurationCommandOutput, } from "./commands/UpdateApplicationMaintenanceConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -372,10 +372,7 @@ export class KinesisAnalyticsV2Client extends __Client< readonly config: KinesisAnalyticsV2ClientResolvedConfig; constructor(configuration: KinesisAnalyticsV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts index 9fc07674cc03..7408676eb982 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisAnalyticsV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisAnalyticsV2ClientConfig } from "./KinesisAnalyticsV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts index 8d05c44e20cf..365340444e16 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisAnalyticsV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisAnalyticsV2ClientConfig } from "./KinesisAnalyticsV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts index 65c074f0e9b5..5b8fc9388b78 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => ({ apiVersion: "2018-05-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis Analytics V2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.ts index 0fc91fcf94c0..8be9ef410907 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisAnalyticsV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisAnalyticsV2ClientConfig } from "./KinesisAnalyticsV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-analytics/KinesisAnalyticsClient.ts b/clients/client-kinesis-analytics/KinesisAnalyticsClient.ts index d46c113bd5d6..4d4590b894dd 100644 --- a/clients/client-kinesis-analytics/KinesisAnalyticsClient.ts +++ b/clients/client-kinesis-analytics/KinesisAnalyticsClient.ts @@ -54,7 +54,7 @@ import { StopApplicationCommandInput, StopApplicationCommandOutput } from "./com import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateApplicationCommandInput, UpdateApplicationCommandOutput } from "./commands/UpdateApplicationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -313,10 +313,7 @@ export class KinesisAnalyticsClient extends __Client< readonly config: KinesisAnalyticsClientResolvedConfig; constructor(configuration: KinesisAnalyticsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis-analytics/runtimeConfig.browser.ts b/clients/client-kinesis-analytics/runtimeConfig.browser.ts index 72d84ba75e7a..d86916d51832 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.browser.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisAnalyticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisAnalyticsClientConfig } from "./KinesisAnalyticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-analytics/runtimeConfig.native.ts b/clients/client-kinesis-analytics/runtimeConfig.native.ts index 6f28f53aa6c5..98b9c709bb2f 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.native.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisAnalyticsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisAnalyticsClientConfig } from "./KinesisAnalyticsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kinesis-analytics/runtimeConfig.shared.ts b/clients/client-kinesis-analytics/runtimeConfig.shared.ts index 3b336c22da69..b978fa19a4d7 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.shared.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => ({ apiVersion: "2015-08-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis Analytics", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis-analytics/runtimeConfig.ts b/clients/client-kinesis-analytics/runtimeConfig.ts index 9ed5d78d3064..b66adb3dce70 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisAnalyticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisAnalyticsClientConfig } from "./KinesisAnalyticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video-archived-media/KinesisVideoArchivedMediaClient.ts b/clients/client-kinesis-video-archived-media/KinesisVideoArchivedMediaClient.ts index 27eb7cc0e3c1..749d5b284895 100644 --- a/clients/client-kinesis-video-archived-media/KinesisVideoArchivedMediaClient.ts +++ b/clients/client-kinesis-video-archived-media/KinesisVideoArchivedMediaClient.ts @@ -12,7 +12,7 @@ import { GetMediaForFragmentListCommandOutput, } from "./commands/GetMediaForFragmentListCommand"; import { ListFragmentsCommandInput, ListFragmentsCommandOutput } from "./commands/ListFragmentsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -233,10 +233,7 @@ export class KinesisVideoArchivedMediaClient extends __Client< readonly config: KinesisVideoArchivedMediaClientResolvedConfig; constructor(configuration: KinesisVideoArchivedMediaClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts index 240f9f2b4cc6..b2d65f3b777c 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisVideoArchivedMediaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 7200ae167c41..25f5a9d592fa 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisVideoArchivedMediaClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 f1eb004ec059..4e227fa248a6 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) => ({ apiVersion: "2017-09-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis Video Archived Media", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.ts index 44319a362840..2762e82352cd 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisVideoArchivedMediaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video-media/KinesisVideoMediaClient.ts b/clients/client-kinesis-video-media/KinesisVideoMediaClient.ts index 0ffe311a73ce..0aeaf38bac01 100644 --- a/clients/client-kinesis-video-media/KinesisVideoMediaClient.ts +++ b/clients/client-kinesis-video-media/KinesisVideoMediaClient.ts @@ -1,5 +1,5 @@ import { GetMediaCommandInput, GetMediaCommandOutput } from "./commands/GetMediaCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -209,10 +209,7 @@ export class KinesisVideoMediaClient extends __Client< readonly config: KinesisVideoMediaClientResolvedConfig; constructor(configuration: KinesisVideoMediaClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis-video-media/runtimeConfig.browser.ts b/clients/client-kinesis-video-media/runtimeConfig.browser.ts index 7bb1fa1852ab..f6923681db31 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisVideoMediaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video-media/runtimeConfig.native.ts b/clients/client-kinesis-video-media/runtimeConfig.native.ts index 97d29177a3fd..3341bd0ee9ed 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisVideoMediaClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kinesis-video-media/runtimeConfig.shared.ts b/clients/client-kinesis-video-media/runtimeConfig.shared.ts index a3cd541e6db5..112299c36e22 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => ({ apiVersion: "2017-09-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis Video Media", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis-video-media/runtimeConfig.ts b/clients/client-kinesis-video-media/runtimeConfig.ts index 109a7b972d1c..86d5c4134577 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisVideoMediaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video-signaling/KinesisVideoSignalingClient.ts b/clients/client-kinesis-video-signaling/KinesisVideoSignalingClient.ts index 93a33bb3b6c9..ef50b45addb9 100644 --- a/clients/client-kinesis-video-signaling/KinesisVideoSignalingClient.ts +++ b/clients/client-kinesis-video-signaling/KinesisVideoSignalingClient.ts @@ -3,7 +3,7 @@ import { SendAlexaOfferToMasterCommandInput, SendAlexaOfferToMasterCommandOutput, } from "./commands/SendAlexaOfferToMasterCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -221,10 +221,7 @@ export class KinesisVideoSignalingClient extends __Client< readonly config: KinesisVideoSignalingClientResolvedConfig; constructor(configuration: KinesisVideoSignalingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts b/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts index 69e3f395dbe8..4f54b9eedc98 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisVideoSignalingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoSignalingClientConfig } from "./KinesisVideoSignalingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.native.ts b/clients/client-kinesis-video-signaling/runtimeConfig.native.ts index b951cbabf0fd..69fc8cd75484 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisVideoSignalingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisVideoSignalingClientConfig } from "./KinesisVideoSignalingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts b/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts index bd634dd75302..619af9f9bb7b 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => ({ apiVersion: "2019-12-04", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis Video Signaling", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.ts b/clients/client-kinesis-video-signaling/runtimeConfig.ts index 09959f85c88d..6f78bc3f5f8f 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisVideoSignalingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoSignalingClientConfig } from "./KinesisVideoSignalingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video/KinesisVideoClient.ts b/clients/client-kinesis-video/KinesisVideoClient.ts index d123bebbc35f..7daef6f1076e 100644 --- a/clients/client-kinesis-video/KinesisVideoClient.ts +++ b/clients/client-kinesis-video/KinesisVideoClient.ts @@ -41,7 +41,7 @@ import { UpdateSignalingChannelCommandOutput, } from "./commands/UpdateSignalingChannelCommand"; import { UpdateStreamCommandInput, UpdateStreamCommandOutput } from "./commands/UpdateStreamCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -289,10 +289,7 @@ export class KinesisVideoClient extends __Client< readonly config: KinesisVideoClientResolvedConfig; constructor(configuration: KinesisVideoClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis-video/runtimeConfig.browser.ts b/clients/client-kinesis-video/runtimeConfig.browser.ts index 88f05e0bd7f5..2d82bad375ae 100644 --- a/clients/client-kinesis-video/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisVideoClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoClientConfig } from "./KinesisVideoClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis-video/runtimeConfig.native.ts b/clients/client-kinesis-video/runtimeConfig.native.ts index 38bcc64c3df3..a669e2d9ab9f 100644 --- a/clients/client-kinesis-video/runtimeConfig.native.ts +++ b/clients/client-kinesis-video/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisVideoClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisVideoClientConfig } from "./KinesisVideoClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kinesis-video/runtimeConfig.shared.ts b/clients/client-kinesis-video/runtimeConfig.shared.ts index 6e3a5bc49597..06b4664be87b 100644 --- a/clients/client-kinesis-video/runtimeConfig.shared.ts +++ b/clients/client-kinesis-video/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisVideoClientConfig) => ({ apiVersion: "2017-09-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis Video", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis-video/runtimeConfig.ts b/clients/client-kinesis-video/runtimeConfig.ts index e4eb8b6f84b5..3c0200b97cc9 100644 --- a/clients/client-kinesis-video/runtimeConfig.ts +++ b/clients/client-kinesis-video/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisVideoClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisVideoClientConfig } from "./KinesisVideoClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kinesis/KinesisClient.ts b/clients/client-kinesis/KinesisClient.ts index 50485fdba2b2..c743301d8a35 100644 --- a/clients/client-kinesis/KinesisClient.ts +++ b/clients/client-kinesis/KinesisClient.ts @@ -62,7 +62,7 @@ import { } from "./commands/StopStreamEncryptionCommand"; import { SubscribeToShardCommandInput, SubscribeToShardCommandOutput } from "./commands/SubscribeToShardCommand"; import { UpdateShardCountCommandInput, UpdateShardCountCommandOutput } from "./commands/UpdateShardCountCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -343,10 +343,7 @@ export class KinesisClient extends __Client< readonly config: KinesisClientResolvedConfig; constructor(configuration: KinesisClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kinesis/runtimeConfig.browser.ts b/clients/client-kinesis/runtimeConfig.browser.ts index bac16f631e58..2700b3fd05ba 100644 --- a/clients/client-kinesis/runtimeConfig.browser.ts +++ b/clients/client-kinesis/runtimeConfig.browser.ts @@ -5,34 +5,41 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KinesisClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisClientConfig } from "./KinesisClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamSerdeProvider, - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-kinesis/runtimeConfig.native.ts b/clients/client-kinesis/runtimeConfig.native.ts index 5567c509f70f..276f093ebcbd 100644 --- a/clients/client-kinesis/runtimeConfig.native.ts +++ b/clients/client-kinesis/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KinesisClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KinesisClientConfig } from "./KinesisClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KinesisClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kinesis/runtimeConfig.shared.ts b/clients/client-kinesis/runtimeConfig.shared.ts index 0fd263095326..b53b7b1a1615 100644 --- a/clients/client-kinesis/runtimeConfig.shared.ts +++ b/clients/client-kinesis/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KinesisClientConfig) => ({ apiVersion: "2013-12-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Kinesis", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kinesis/runtimeConfig.ts b/clients/client-kinesis/runtimeConfig.ts index 41c389fcf6db..3087e7b8802b 100644 --- a/clients/client-kinesis/runtimeConfig.ts +++ b/clients/client-kinesis/runtimeConfig.ts @@ -8,34 +8,41 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KinesisClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KinesisClientConfig } from "./KinesisClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamSerdeProvider, - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KinesisClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-kms/KMSClient.ts b/clients/client-kms/KMSClient.ts index 7188776d57a7..267f3a54ca30 100644 --- a/clients/client-kms/KMSClient.ts +++ b/clients/client-kms/KMSClient.ts @@ -94,7 +94,7 @@ import { UpdatePrimaryRegionCommandOutput, } from "./commands/UpdatePrimaryRegionCommand"; import { VerifyCommandInput, VerifyCommandOutput } from "./commands/VerifyCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -488,10 +488,7 @@ export class KMSClient extends __Client< readonly config: KMSClientResolvedConfig; constructor(configuration: KMSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-kms/runtimeConfig.browser.ts b/clients/client-kms/runtimeConfig.browser.ts index 230130cd37f2..abbddc234695 100644 --- a/clients/client-kms/runtimeConfig.browser.ts +++ b/clients/client-kms/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./KMSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KMSClientConfig } from "./KMSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KMSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-kms/runtimeConfig.native.ts b/clients/client-kms/runtimeConfig.native.ts index 0dfcfe205157..e426e6f27890 100644 --- a/clients/client-kms/runtimeConfig.native.ts +++ b/clients/client-kms/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./KMSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { KMSClientConfig } from "./KMSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: KMSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-kms/runtimeConfig.shared.ts b/clients/client-kms/runtimeConfig.shared.ts index e84ede33c9ea..5274f00a8609 100644 --- a/clients/client-kms/runtimeConfig.shared.ts +++ b/clients/client-kms/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: KMSClientConfig) => ({ apiVersion: "2014-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "KMS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-kms/runtimeConfig.ts b/clients/client-kms/runtimeConfig.ts index ce5ac1429d29..fa8bb2dc76b7 100644 --- a/clients/client-kms/runtimeConfig.ts +++ b/clients/client-kms/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./KMSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { KMSClientConfig } from "./KMSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: KMSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lakeformation/LakeFormationClient.ts b/clients/client-lakeformation/LakeFormationClient.ts index 4f61535f209a..d114b1beae3b 100644 --- a/clients/client-lakeformation/LakeFormationClient.ts +++ b/clients/client-lakeformation/LakeFormationClient.ts @@ -48,7 +48,7 @@ import { } from "./commands/SearchTablesByLFTagsCommand"; import { UpdateLFTagCommandInput, UpdateLFTagCommandOutput } from "./commands/UpdateLFTagCommand"; import { UpdateResourceCommandInput, UpdateResourceCommandOutput } from "./commands/UpdateResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -305,10 +305,7 @@ export class LakeFormationClient extends __Client< readonly config: LakeFormationClientResolvedConfig; constructor(configuration: LakeFormationClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lakeformation/runtimeConfig.browser.ts b/clients/client-lakeformation/runtimeConfig.browser.ts index dbf629dbec4b..418ea4aca129 100644 --- a/clients/client-lakeformation/runtimeConfig.browser.ts +++ b/clients/client-lakeformation/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LakeFormationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LakeFormationClientConfig } from "./LakeFormationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LakeFormationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lakeformation/runtimeConfig.native.ts b/clients/client-lakeformation/runtimeConfig.native.ts index 3e85fc4a31ba..7397564ce63c 100644 --- a/clients/client-lakeformation/runtimeConfig.native.ts +++ b/clients/client-lakeformation/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LakeFormationClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LakeFormationClientConfig } from "./LakeFormationClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LakeFormationClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lakeformation/runtimeConfig.shared.ts b/clients/client-lakeformation/runtimeConfig.shared.ts index 186e0225540f..cceb1836053b 100644 --- a/clients/client-lakeformation/runtimeConfig.shared.ts +++ b/clients/client-lakeformation/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LakeFormationClientConfig) => ({ apiVersion: "2017-03-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "LakeFormation", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lakeformation/runtimeConfig.ts b/clients/client-lakeformation/runtimeConfig.ts index 7e159cc5f3ca..3b44eb8934f4 100644 --- a/clients/client-lakeformation/runtimeConfig.ts +++ b/clients/client-lakeformation/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LakeFormationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LakeFormationClientConfig } from "./LakeFormationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LakeFormationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lambda/LambdaClient.ts b/clients/client-lambda/LambdaClient.ts index b03ca8c641e9..e66bf5f6eee6 100644 --- a/clients/client-lambda/LambdaClient.ts +++ b/clients/client-lambda/LambdaClient.ts @@ -158,7 +158,7 @@ import { UpdateFunctionEventInvokeConfigCommandInput, UpdateFunctionEventInvokeConfigCommandOutput, } from "./commands/UpdateFunctionEventInvokeConfigCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -490,10 +490,7 @@ export class LambdaClient extends __Client< readonly config: LambdaClientResolvedConfig; constructor(configuration: LambdaClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lambda/runtimeConfig.browser.ts b/clients/client-lambda/runtimeConfig.browser.ts index 714fa0dbbb97..1b6fc13cb50f 100644 --- a/clients/client-lambda/runtimeConfig.browser.ts +++ b/clients/client-lambda/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LambdaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LambdaClientConfig } from "./LambdaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LambdaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lambda/runtimeConfig.native.ts b/clients/client-lambda/runtimeConfig.native.ts index 9b81ddfb5a74..4368e814724c 100644 --- a/clients/client-lambda/runtimeConfig.native.ts +++ b/clients/client-lambda/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LambdaClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LambdaClientConfig } from "./LambdaClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LambdaClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lambda/runtimeConfig.shared.ts b/clients/client-lambda/runtimeConfig.shared.ts index b5eb623f00b7..8f46c4192aa0 100644 --- a/clients/client-lambda/runtimeConfig.shared.ts +++ b/clients/client-lambda/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LambdaClientConfig) => ({ apiVersion: "2015-03-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Lambda", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lambda/runtimeConfig.ts b/clients/client-lambda/runtimeConfig.ts index 5f0ca290dcb3..5b9a549a9765 100644 --- a/clients/client-lambda/runtimeConfig.ts +++ b/clients/client-lambda/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LambdaClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LambdaClientConfig } from "./LambdaClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LambdaClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lex-model-building-service/LexModelBuildingServiceClient.ts b/clients/client-lex-model-building-service/LexModelBuildingServiceClient.ts index e5e4f4063e77..0e9a9af8c3ce 100644 --- a/clients/client-lex-model-building-service/LexModelBuildingServiceClient.ts +++ b/clients/client-lex-model-building-service/LexModelBuildingServiceClient.ts @@ -70,7 +70,7 @@ import { StartImportCommandInput, StartImportCommandOutput } from "./commands/St import { StartMigrationCommandInput, StartMigrationCommandOutput } from "./commands/StartMigrationCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -367,10 +367,7 @@ export class LexModelBuildingServiceClient extends __Client< readonly config: LexModelBuildingServiceClientResolvedConfig; constructor(configuration: LexModelBuildingServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lex-model-building-service/runtimeConfig.browser.ts b/clients/client-lex-model-building-service/runtimeConfig.browser.ts index adb1c99ef4ed..3e3a44465621 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.browser.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LexModelBuildingServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexModelBuildingServiceClientConfig } from "./LexModelBuildingServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 48179f9ace7b..10e6cf5ff294 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.native.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LexModelBuildingServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LexModelBuildingServiceClientConfig } from "./LexModelBuildingServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 1b7e3955744c..a12436040ee1 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.shared.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => ({ apiVersion: "2017-04-19", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Lex Model Building Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lex-model-building-service/runtimeConfig.ts b/clients/client-lex-model-building-service/runtimeConfig.ts index f76265d9592e..1f5c2b0f6a33 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LexModelBuildingServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexModelBuildingServiceClientConfig } from "./LexModelBuildingServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lex-models-v2/LexModelsV2Client.ts b/clients/client-lex-models-v2/LexModelsV2Client.ts index e33e6261a63b..a41b54a9ea63 100644 --- a/clients/client-lex-models-v2/LexModelsV2Client.ts +++ b/clients/client-lex-models-v2/LexModelsV2Client.ts @@ -78,7 +78,7 @@ import { } from "./commands/UpdateResourcePolicyCommand"; import { UpdateSlotCommandInput, UpdateSlotCommandOutput } from "./commands/UpdateSlotCommand"; import { UpdateSlotTypeCommandInput, UpdateSlotTypeCommandOutput } from "./commands/UpdateSlotTypeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -400,10 +400,7 @@ export class LexModelsV2Client extends __Client< readonly config: LexModelsV2ClientResolvedConfig; constructor(configuration: LexModelsV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lex-models-v2/runtimeConfig.browser.ts b/clients/client-lex-models-v2/runtimeConfig.browser.ts index 1bbf9beb8585..040ca250a947 100644 --- a/clients/client-lex-models-v2/runtimeConfig.browser.ts +++ b/clients/client-lex-models-v2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LexModelsV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexModelsV2ClientConfig } from "./LexModelsV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lex-models-v2/runtimeConfig.native.ts b/clients/client-lex-models-v2/runtimeConfig.native.ts index eb628367ab0f..e5d45a76662d 100644 --- a/clients/client-lex-models-v2/runtimeConfig.native.ts +++ b/clients/client-lex-models-v2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LexModelsV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LexModelsV2ClientConfig } from "./LexModelsV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lex-models-v2/runtimeConfig.shared.ts b/clients/client-lex-models-v2/runtimeConfig.shared.ts index 0f0e47890046..d9bb45695592 100644 --- a/clients/client-lex-models-v2/runtimeConfig.shared.ts +++ b/clients/client-lex-models-v2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => ({ apiVersion: "2020-08-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Lex Models V2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lex-models-v2/runtimeConfig.ts b/clients/client-lex-models-v2/runtimeConfig.ts index 208b80159c5e..ef8b50e62704 100644 --- a/clients/client-lex-models-v2/runtimeConfig.ts +++ b/clients/client-lex-models-v2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LexModelsV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexModelsV2ClientConfig } from "./LexModelsV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lex-runtime-service/LexRuntimeServiceClient.ts b/clients/client-lex-runtime-service/LexRuntimeServiceClient.ts index 4f67c4f0196a..491fed020d75 100644 --- a/clients/client-lex-runtime-service/LexRuntimeServiceClient.ts +++ b/clients/client-lex-runtime-service/LexRuntimeServiceClient.ts @@ -3,7 +3,7 @@ import { GetSessionCommandInput, GetSessionCommandOutput } from "./commands/GetS import { PostContentCommandInput, PostContentCommandOutput } from "./commands/PostContentCommand"; import { PostTextCommandInput, PostTextCommandOutput } from "./commands/PostTextCommand"; import { PutSessionCommandInput, PutSessionCommandOutput } from "./commands/PutSessionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -234,10 +234,7 @@ export class LexRuntimeServiceClient extends __Client< readonly config: LexRuntimeServiceClientResolvedConfig; constructor(configuration: LexRuntimeServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lex-runtime-service/runtimeConfig.browser.ts b/clients/client-lex-runtime-service/runtimeConfig.browser.ts index 3eeeb370dfd4..f44745868a7a 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LexRuntimeServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lex-runtime-service/runtimeConfig.native.ts b/clients/client-lex-runtime-service/runtimeConfig.native.ts index 47a39dfd51d7..3c19d736f890 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.native.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LexRuntimeServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lex-runtime-service/runtimeConfig.shared.ts b/clients/client-lex-runtime-service/runtimeConfig.shared.ts index bd722efdcc3d..fe280a6f9615 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.shared.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Lex Runtime Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lex-runtime-service/runtimeConfig.ts b/clients/client-lex-runtime-service/runtimeConfig.ts index d0279c49aa19..39754a4cf842 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LexRuntimeServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lex-runtime-v2/LexRuntimeV2Client.ts b/clients/client-lex-runtime-v2/LexRuntimeV2Client.ts index ff3671c5e9e7..2af2b66ab752 100644 --- a/clients/client-lex-runtime-v2/LexRuntimeV2Client.ts +++ b/clients/client-lex-runtime-v2/LexRuntimeV2Client.ts @@ -4,7 +4,7 @@ import { PutSessionCommandInput, PutSessionCommandOutput } from "./commands/PutS import { RecognizeTextCommandInput, RecognizeTextCommandOutput } from "./commands/RecognizeTextCommand"; import { RecognizeUtteranceCommandInput, RecognizeUtteranceCommandOutput } from "./commands/RecognizeUtteranceCommand"; import { StartConversationCommandInput, StartConversationCommandOutput } from "./commands/StartConversationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -253,10 +253,7 @@ export class LexRuntimeV2Client extends __Client< readonly config: LexRuntimeV2ClientResolvedConfig; constructor(configuration: LexRuntimeV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lex-runtime-v2/runtimeConfig.browser.ts b/clients/client-lex-runtime-v2/runtimeConfig.browser.ts index 3e42011ace83..76b49e3feab6 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.browser.ts @@ -5,37 +5,44 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LexRuntimeV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamPayloadHandlerProvider: () => ({ - handle: invalidFunction("event stream request is not supported in browser."), - }), - eventStreamSerdeProvider, - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-lex-runtime-v2/runtimeConfig.native.ts b/clients/client-lex-runtime-v2/runtimeConfig.native.ts index 21acc3d5869f..3b172e775593 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.native.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.native.ts @@ -1,16 +1,20 @@ import { Sha256 } from "@aws-crypto/sha256-js"; import { invalidFunction } from "@aws-sdk/invalid-dependency"; -import { ClientDefaults } from "./LexRuntimeV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - eventStreamPayloadHandlerProvider: () => ({ - handle: invalidFunction("event stream request is not supported in ReactNative."), - }), - sha256: Sha256, +export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + eventStreamPayloadHandlerProvider: coalesce(config.eventStreamPayloadHandlerProvider, () => ({ + handle: invalidFunction("event stream request is not supported in ReactNative."), + })), + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lex-runtime-v2/runtimeConfig.shared.ts b/clients/client-lex-runtime-v2/runtimeConfig.shared.ts index a4659c2c8f3e..5352fdc5acf6 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.shared.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => ({ apiVersion: "2020-08-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Lex Runtime V2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lex-runtime-v2/runtimeConfig.ts b/clients/client-lex-runtime-v2/runtimeConfig.ts index e2292120f385..f3ae75d4fa2e 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.ts @@ -9,35 +9,45 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LexRuntimeV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamPayloadHandlerProvider, - eventStreamSerdeProvider, - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttp2Handler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-license-manager/LicenseManagerClient.ts b/clients/client-license-manager/LicenseManagerClient.ts index dfd9b1ee2750..9624bc11b9f2 100644 --- a/clients/client-license-manager/LicenseManagerClient.ts +++ b/clients/client-license-manager/LicenseManagerClient.ts @@ -115,7 +115,7 @@ import { UpdateServiceSettingsCommandInput, UpdateServiceSettingsCommandOutput, } from "./commands/UpdateServiceSettingsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -417,10 +417,7 @@ export class LicenseManagerClient extends __Client< readonly config: LicenseManagerClientResolvedConfig; constructor(configuration: LicenseManagerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-license-manager/runtimeConfig.browser.ts b/clients/client-license-manager/runtimeConfig.browser.ts index 2d37df8932ea..3fbf35e9bc9e 100644 --- a/clients/client-license-manager/runtimeConfig.browser.ts +++ b/clients/client-license-manager/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LicenseManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LicenseManagerClientConfig } from "./LicenseManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-license-manager/runtimeConfig.native.ts b/clients/client-license-manager/runtimeConfig.native.ts index 170c47b73b9d..6d71cdb1608b 100644 --- a/clients/client-license-manager/runtimeConfig.native.ts +++ b/clients/client-license-manager/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LicenseManagerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LicenseManagerClientConfig } from "./LicenseManagerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-license-manager/runtimeConfig.shared.ts b/clients/client-license-manager/runtimeConfig.shared.ts index 5e116a37df73..0b8d1cc98cf9 100644 --- a/clients/client-license-manager/runtimeConfig.shared.ts +++ b/clients/client-license-manager/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LicenseManagerClientConfig) => ({ apiVersion: "2018-08-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "License Manager", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-license-manager/runtimeConfig.ts b/clients/client-license-manager/runtimeConfig.ts index bf9acae1ec55..21c061cb189d 100644 --- a/clients/client-license-manager/runtimeConfig.ts +++ b/clients/client-license-manager/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LicenseManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LicenseManagerClientConfig } from "./LicenseManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lightsail/LightsailClient.ts b/clients/client-lightsail/LightsailClient.ts index a4c6c17481e5..6a6e84c7c9df 100644 --- a/clients/client-lightsail/LightsailClient.ts +++ b/clients/client-lightsail/LightsailClient.ts @@ -376,7 +376,7 @@ import { UpdateRelationalDatabaseParametersCommandInput, UpdateRelationalDatabaseParametersCommandOutput, } from "./commands/UpdateRelationalDatabaseParametersCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -906,10 +906,7 @@ export class LightsailClient extends __Client< readonly config: LightsailClientResolvedConfig; constructor(configuration: LightsailClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lightsail/runtimeConfig.browser.ts b/clients/client-lightsail/runtimeConfig.browser.ts index c267e16a6e41..0ec8c11082e1 100644 --- a/clients/client-lightsail/runtimeConfig.browser.ts +++ b/clients/client-lightsail/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LightsailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LightsailClientConfig } from "./LightsailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LightsailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lightsail/runtimeConfig.native.ts b/clients/client-lightsail/runtimeConfig.native.ts index 219a2c0e2263..ca0c181cd9de 100644 --- a/clients/client-lightsail/runtimeConfig.native.ts +++ b/clients/client-lightsail/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LightsailClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LightsailClientConfig } from "./LightsailClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LightsailClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lightsail/runtimeConfig.shared.ts b/clients/client-lightsail/runtimeConfig.shared.ts index 2c47929bec5f..4e974352baf7 100644 --- a/clients/client-lightsail/runtimeConfig.shared.ts +++ b/clients/client-lightsail/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LightsailClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Lightsail", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lightsail/runtimeConfig.ts b/clients/client-lightsail/runtimeConfig.ts index 6e4f3b56c489..e1b6bf5d16e1 100644 --- a/clients/client-lightsail/runtimeConfig.ts +++ b/clients/client-lightsail/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LightsailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LightsailClientConfig } from "./LightsailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LightsailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-location/LocationClient.ts b/clients/client-location/LocationClient.ts index 9cf3debf389b..b3158eda9f44 100644 --- a/clients/client-location/LocationClient.ts +++ b/clients/client-location/LocationClient.ts @@ -109,7 +109,7 @@ import { } from "./commands/SearchPlaceIndexForTextCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -409,10 +409,7 @@ export class LocationClient extends __Client< readonly config: LocationClientResolvedConfig; constructor(configuration: LocationClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-location/runtimeConfig.browser.ts b/clients/client-location/runtimeConfig.browser.ts index dddd368016a4..ef8555b91d42 100644 --- a/clients/client-location/runtimeConfig.browser.ts +++ b/clients/client-location/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LocationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LocationClientConfig } from "./LocationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LocationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-location/runtimeConfig.native.ts b/clients/client-location/runtimeConfig.native.ts index 59dd64cafe76..105e0ca05d7b 100644 --- a/clients/client-location/runtimeConfig.native.ts +++ b/clients/client-location/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LocationClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LocationClientConfig } from "./LocationClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LocationClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-location/runtimeConfig.shared.ts b/clients/client-location/runtimeConfig.shared.ts index 1331dcb812bc..8d9816594226 100644 --- a/clients/client-location/runtimeConfig.shared.ts +++ b/clients/client-location/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LocationClientConfig) => ({ apiVersion: "2020-11-19", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Location", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-location/runtimeConfig.ts b/clients/client-location/runtimeConfig.ts index 7b111b0db8d8..c3bcafd0c81b 100644 --- a/clients/client-location/runtimeConfig.ts +++ b/clients/client-location/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LocationClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LocationClientConfig } from "./LocationClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LocationClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lookoutequipment/LookoutEquipmentClient.ts b/clients/client-lookoutequipment/LookoutEquipmentClient.ts index d2c4efa97717..aa319182ba92 100644 --- a/clients/client-lookoutequipment/LookoutEquipmentClient.ts +++ b/clients/client-lookoutequipment/LookoutEquipmentClient.ts @@ -56,7 +56,7 @@ import { UpdateInferenceSchedulerCommandInput, UpdateInferenceSchedulerCommandOutput, } from "./commands/UpdateInferenceSchedulerCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -311,10 +311,7 @@ export class LookoutEquipmentClient extends __Client< readonly config: LookoutEquipmentClientResolvedConfig; constructor(configuration: LookoutEquipmentClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lookoutequipment/runtimeConfig.browser.ts b/clients/client-lookoutequipment/runtimeConfig.browser.ts index 50fc764ff6e2..bd25dbbbab89 100644 --- a/clients/client-lookoutequipment/runtimeConfig.browser.ts +++ b/clients/client-lookoutequipment/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LookoutEquipmentClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LookoutEquipmentClientConfig } from "./LookoutEquipmentClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lookoutequipment/runtimeConfig.native.ts b/clients/client-lookoutequipment/runtimeConfig.native.ts index 91bde55e2bd0..98ebe3cde284 100644 --- a/clients/client-lookoutequipment/runtimeConfig.native.ts +++ b/clients/client-lookoutequipment/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LookoutEquipmentClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LookoutEquipmentClientConfig } from "./LookoutEquipmentClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lookoutequipment/runtimeConfig.shared.ts b/clients/client-lookoutequipment/runtimeConfig.shared.ts index 431e3f44c50a..df973247d649 100644 --- a/clients/client-lookoutequipment/runtimeConfig.shared.ts +++ b/clients/client-lookoutequipment/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => ({ apiVersion: "2020-12-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "LookoutEquipment", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lookoutequipment/runtimeConfig.ts b/clients/client-lookoutequipment/runtimeConfig.ts index bc076ecf671e..f2b562a73c5a 100644 --- a/clients/client-lookoutequipment/runtimeConfig.ts +++ b/clients/client-lookoutequipment/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LookoutEquipmentClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LookoutEquipmentClientConfig } from "./LookoutEquipmentClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lookoutmetrics/LookoutMetricsClient.ts b/clients/client-lookoutmetrics/LookoutMetricsClient.ts index 14a592bab2fb..1a4a73e67d05 100644 --- a/clients/client-lookoutmetrics/LookoutMetricsClient.ts +++ b/clients/client-lookoutmetrics/LookoutMetricsClient.ts @@ -56,7 +56,7 @@ import { UpdateAnomalyDetectorCommandOutput, } from "./commands/UpdateAnomalyDetectorCommand"; import { UpdateMetricSetCommandInput, UpdateMetricSetCommandOutput } from "./commands/UpdateMetricSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -318,10 +318,7 @@ export class LookoutMetricsClient extends __Client< readonly config: LookoutMetricsClientResolvedConfig; constructor(configuration: LookoutMetricsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lookoutmetrics/runtimeConfig.browser.ts b/clients/client-lookoutmetrics/runtimeConfig.browser.ts index 6e58ef020b70..e5afd986b30e 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.browser.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LookoutMetricsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LookoutMetricsClientConfig } from "./LookoutMetricsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lookoutmetrics/runtimeConfig.native.ts b/clients/client-lookoutmetrics/runtimeConfig.native.ts index cb0d80a16900..3e390f95bf0c 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.native.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LookoutMetricsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LookoutMetricsClientConfig } from "./LookoutMetricsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lookoutmetrics/runtimeConfig.shared.ts b/clients/client-lookoutmetrics/runtimeConfig.shared.ts index 72373fa69ca3..98a8ee63bb9f 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.shared.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "LookoutMetrics", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lookoutmetrics/runtimeConfig.ts b/clients/client-lookoutmetrics/runtimeConfig.ts index b3fa3b25b6ed..4f3751477755 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LookoutMetricsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LookoutMetricsClientConfig } from "./LookoutMetricsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lookoutvision/LookoutVisionClient.ts b/clients/client-lookoutvision/LookoutVisionClient.ts index 9cf6dd05e0c9..e11ffdee75af 100644 --- a/clients/client-lookoutvision/LookoutVisionClient.ts +++ b/clients/client-lookoutvision/LookoutVisionClient.ts @@ -23,7 +23,7 @@ import { UpdateDatasetEntriesCommandInput, UpdateDatasetEntriesCommandOutput, } from "./commands/UpdateDatasetEntriesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -277,10 +277,7 @@ export class LookoutVisionClient extends __Client< readonly config: LookoutVisionClientResolvedConfig; constructor(configuration: LookoutVisionClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-lookoutvision/runtimeConfig.browser.ts b/clients/client-lookoutvision/runtimeConfig.browser.ts index fa3e3c210bff..008c8091a976 100644 --- a/clients/client-lookoutvision/runtimeConfig.browser.ts +++ b/clients/client-lookoutvision/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./LookoutVisionClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LookoutVisionClientConfig } from "./LookoutVisionClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-lookoutvision/runtimeConfig.native.ts b/clients/client-lookoutvision/runtimeConfig.native.ts index 24c0b654162c..f1f298346b0d 100644 --- a/clients/client-lookoutvision/runtimeConfig.native.ts +++ b/clients/client-lookoutvision/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./LookoutVisionClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { LookoutVisionClientConfig } from "./LookoutVisionClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-lookoutvision/runtimeConfig.shared.ts b/clients/client-lookoutvision/runtimeConfig.shared.ts index dd3d2158fe7e..c683032c00f8 100644 --- a/clients/client-lookoutvision/runtimeConfig.shared.ts +++ b/clients/client-lookoutvision/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: LookoutVisionClientConfig) => ({ apiVersion: "2020-11-20", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "LookoutVision", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-lookoutvision/runtimeConfig.ts b/clients/client-lookoutvision/runtimeConfig.ts index bcb4cbc64f66..6793ca40a4c2 100644 --- a/clients/client-lookoutvision/runtimeConfig.ts +++ b/clients/client-lookoutvision/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./LookoutVisionClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { LookoutVisionClientConfig } from "./LookoutVisionClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-machine-learning/MachineLearningClient.ts b/clients/client-machine-learning/MachineLearningClient.ts index d999252c0197..91951b75f130 100644 --- a/clients/client-machine-learning/MachineLearningClient.ts +++ b/clients/client-machine-learning/MachineLearningClient.ts @@ -59,7 +59,7 @@ import { import { UpdateDataSourceCommandInput, UpdateDataSourceCommandOutput } from "./commands/UpdateDataSourceCommand"; import { UpdateEvaluationCommandInput, UpdateEvaluationCommandOutput } from "./commands/UpdateEvaluationCommand"; import { UpdateMLModelCommandInput, UpdateMLModelCommandOutput } from "./commands/UpdateMLModelCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -326,10 +326,7 @@ export class MachineLearningClient extends __Client< readonly config: MachineLearningClientResolvedConfig; constructor(configuration: MachineLearningClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-machine-learning/runtimeConfig.browser.ts b/clients/client-machine-learning/runtimeConfig.browser.ts index c449a20238bc..aaf82a9a5cfd 100644 --- a/clients/client-machine-learning/runtimeConfig.browser.ts +++ b/clients/client-machine-learning/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MachineLearningClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MachineLearningClientConfig } from "./MachineLearningClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MachineLearningClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-machine-learning/runtimeConfig.native.ts b/clients/client-machine-learning/runtimeConfig.native.ts index 740fd477d915..9b2e162015dc 100644 --- a/clients/client-machine-learning/runtimeConfig.native.ts +++ b/clients/client-machine-learning/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MachineLearningClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MachineLearningClientConfig } from "./MachineLearningClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MachineLearningClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-machine-learning/runtimeConfig.shared.ts b/clients/client-machine-learning/runtimeConfig.shared.ts index 2e9cf58b899a..2b32916e6c22 100644 --- a/clients/client-machine-learning/runtimeConfig.shared.ts +++ b/clients/client-machine-learning/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MachineLearningClientConfig) => ({ apiVersion: "2014-12-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Machine Learning", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-machine-learning/runtimeConfig.ts b/clients/client-machine-learning/runtimeConfig.ts index 6b2d8793aa67..3b56ca294a62 100644 --- a/clients/client-machine-learning/runtimeConfig.ts +++ b/clients/client-machine-learning/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MachineLearningClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MachineLearningClientConfig } from "./MachineLearningClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MachineLearningClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-macie/MacieClient.ts b/clients/client-macie/MacieClient.ts index df2e5360e5a0..b22ff250e4f9 100644 --- a/clients/client-macie/MacieClient.ts +++ b/clients/client-macie/MacieClient.ts @@ -17,7 +17,7 @@ import { import { ListMemberAccountsCommandInput, ListMemberAccountsCommandOutput } from "./commands/ListMemberAccountsCommand"; import { ListS3ResourcesCommandInput, ListS3ResourcesCommandOutput } from "./commands/ListS3ResourcesCommand"; import { UpdateS3ResourcesCommandInput, UpdateS3ResourcesCommandOutput } from "./commands/UpdateS3ResourcesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -247,10 +247,7 @@ export class MacieClient extends __Client< readonly config: MacieClientResolvedConfig; constructor(configuration: MacieClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-macie/runtimeConfig.browser.ts b/clients/client-macie/runtimeConfig.browser.ts index eb2997e5c4f5..ef5c6be00d28 100644 --- a/clients/client-macie/runtimeConfig.browser.ts +++ b/clients/client-macie/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MacieClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MacieClientConfig } from "./MacieClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MacieClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-macie/runtimeConfig.native.ts b/clients/client-macie/runtimeConfig.native.ts index ebe86b2f7644..084dac955977 100644 --- a/clients/client-macie/runtimeConfig.native.ts +++ b/clients/client-macie/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MacieClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MacieClientConfig } from "./MacieClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MacieClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-macie/runtimeConfig.shared.ts b/clients/client-macie/runtimeConfig.shared.ts index 5b577b77e595..c22bfe26ba8b 100644 --- a/clients/client-macie/runtimeConfig.shared.ts +++ b/clients/client-macie/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MacieClientConfig) => ({ apiVersion: "2017-12-19", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Macie", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-macie/runtimeConfig.ts b/clients/client-macie/runtimeConfig.ts index b5726e6adec1..8cd81972763c 100644 --- a/clients/client-macie/runtimeConfig.ts +++ b/clients/client-macie/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MacieClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MacieClientConfig } from "./MacieClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MacieClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-macie2/Macie2Client.ts b/clients/client-macie2/Macie2Client.ts index 03c90964a7db..23f9f036de9f 100644 --- a/clients/client-macie2/Macie2Client.ts +++ b/clients/client-macie2/Macie2Client.ts @@ -150,7 +150,7 @@ import { UpdateOrganizationConfigurationCommandInput, UpdateOrganizationConfigurationCommandOutput, } from "./commands/UpdateOrganizationConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -472,10 +472,7 @@ export class Macie2Client extends __Client< readonly config: Macie2ClientResolvedConfig; constructor(configuration: Macie2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-macie2/runtimeConfig.browser.ts b/clients/client-macie2/runtimeConfig.browser.ts index 63705475496b..cb057712c8fd 100644 --- a/clients/client-macie2/runtimeConfig.browser.ts +++ b/clients/client-macie2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./Macie2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Macie2ClientConfig } from "./Macie2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Macie2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-macie2/runtimeConfig.native.ts b/clients/client-macie2/runtimeConfig.native.ts index 5a743cc09da3..3a751b4b222d 100644 --- a/clients/client-macie2/runtimeConfig.native.ts +++ b/clients/client-macie2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./Macie2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { Macie2ClientConfig } from "./Macie2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: Macie2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-macie2/runtimeConfig.shared.ts b/clients/client-macie2/runtimeConfig.shared.ts index 5872b92bbddc..669ea733c60a 100644 --- a/clients/client-macie2/runtimeConfig.shared.ts +++ b/clients/client-macie2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: Macie2ClientConfig) => ({ apiVersion: "2020-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Macie2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-macie2/runtimeConfig.ts b/clients/client-macie2/runtimeConfig.ts index a9bad63ad35b..d5934c07b281 100644 --- a/clients/client-macie2/runtimeConfig.ts +++ b/clients/client-macie2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./Macie2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Macie2ClientConfig } from "./Macie2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Macie2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-managedblockchain/ManagedBlockchainClient.ts b/clients/client-managedblockchain/ManagedBlockchainClient.ts index 64e0368d8936..112bd50ab712 100644 --- a/clients/client-managedblockchain/ManagedBlockchainClient.ts +++ b/clients/client-managedblockchain/ManagedBlockchainClient.ts @@ -24,7 +24,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateMemberCommandInput, UpdateMemberCommandOutput } from "./commands/UpdateMemberCommand"; import { UpdateNodeCommandInput, UpdateNodeCommandOutput } from "./commands/UpdateNodeCommand"; import { VoteOnProposalCommandInput, VoteOnProposalCommandOutput } from "./commands/VoteOnProposalCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -283,10 +283,7 @@ export class ManagedBlockchainClient extends __Client< readonly config: ManagedBlockchainClientResolvedConfig; constructor(configuration: ManagedBlockchainClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-managedblockchain/runtimeConfig.browser.ts b/clients/client-managedblockchain/runtimeConfig.browser.ts index 17007163b391..6ef6d68b02ec 100644 --- a/clients/client-managedblockchain/runtimeConfig.browser.ts +++ b/clients/client-managedblockchain/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ManagedBlockchainClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ManagedBlockchainClientConfig } from "./ManagedBlockchainClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-managedblockchain/runtimeConfig.native.ts b/clients/client-managedblockchain/runtimeConfig.native.ts index bf01aa9c5275..25cbecb27bbf 100644 --- a/clients/client-managedblockchain/runtimeConfig.native.ts +++ b/clients/client-managedblockchain/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ManagedBlockchainClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ManagedBlockchainClientConfig } from "./ManagedBlockchainClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-managedblockchain/runtimeConfig.shared.ts b/clients/client-managedblockchain/runtimeConfig.shared.ts index dc908d2f68ce..3e2c9cb58765 100644 --- a/clients/client-managedblockchain/runtimeConfig.shared.ts +++ b/clients/client-managedblockchain/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => ({ apiVersion: "2018-09-24", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ManagedBlockchain", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-managedblockchain/runtimeConfig.ts b/clients/client-managedblockchain/runtimeConfig.ts index 9acbc1284ab9..9599151ef9d2 100644 --- a/clients/client-managedblockchain/runtimeConfig.ts +++ b/clients/client-managedblockchain/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ManagedBlockchainClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ManagedBlockchainClientConfig } from "./ManagedBlockchainClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-catalog/MarketplaceCatalogClient.ts b/clients/client-marketplace-catalog/MarketplaceCatalogClient.ts index 86788c3a1568..815861c0e9fe 100644 --- a/clients/client-marketplace-catalog/MarketplaceCatalogClient.ts +++ b/clients/client-marketplace-catalog/MarketplaceCatalogClient.ts @@ -4,7 +4,7 @@ import { DescribeEntityCommandInput, DescribeEntityCommandOutput } from "./comma import { ListChangeSetsCommandInput, ListChangeSetsCommandOutput } from "./commands/ListChangeSetsCommand"; import { ListEntitiesCommandInput, ListEntitiesCommandOutput } from "./commands/ListEntitiesCommand"; import { StartChangeSetCommandInput, StartChangeSetCommandOutput } from "./commands/StartChangeSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -232,10 +232,7 @@ export class MarketplaceCatalogClient extends __Client< readonly config: MarketplaceCatalogClientResolvedConfig; constructor(configuration: MarketplaceCatalogClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-marketplace-catalog/runtimeConfig.browser.ts b/clients/client-marketplace-catalog/runtimeConfig.browser.ts index 10c5db77e685..a9617495216a 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.browser.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MarketplaceCatalogClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceCatalogClientConfig } from "./MarketplaceCatalogClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-catalog/runtimeConfig.native.ts b/clients/client-marketplace-catalog/runtimeConfig.native.ts index 71011af852c4..4c3289e2ab14 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.native.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MarketplaceCatalogClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MarketplaceCatalogClientConfig } from "./MarketplaceCatalogClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-marketplace-catalog/runtimeConfig.shared.ts b/clients/client-marketplace-catalog/runtimeConfig.shared.ts index d8db0c6ab4c0..4d4ead6fe67d 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.shared.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => ({ apiVersion: "2018-09-17", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Marketplace Catalog", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-marketplace-catalog/runtimeConfig.ts b/clients/client-marketplace-catalog/runtimeConfig.ts index 22e4c96bf62a..4563ea96c1be 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MarketplaceCatalogClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceCatalogClientConfig } from "./MarketplaceCatalogClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-commerce-analytics/MarketplaceCommerceAnalyticsClient.ts b/clients/client-marketplace-commerce-analytics/MarketplaceCommerceAnalyticsClient.ts index be410d380f02..22006d5a80f9 100644 --- a/clients/client-marketplace-commerce-analytics/MarketplaceCommerceAnalyticsClient.ts +++ b/clients/client-marketplace-commerce-analytics/MarketplaceCommerceAnalyticsClient.ts @@ -3,7 +3,7 @@ import { StartSupportDataExportCommandInput, StartSupportDataExportCommandOutput, } from "./commands/StartSupportDataExportCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -214,10 +214,7 @@ export class MarketplaceCommerceAnalyticsClient extends __Client< readonly config: MarketplaceCommerceAnalyticsClientResolvedConfig; constructor(configuration: MarketplaceCommerceAnalyticsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts index dd24030e1fd6..8ea84f28f861 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MarketplaceCommerceAnalyticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceCommerceAnalyticsClientConfig } from "./MarketplaceCommerceAnalyticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts index 8e4ffaa2cd97..c7c3ca189128 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MarketplaceCommerceAnalyticsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MarketplaceCommerceAnalyticsClientConfig } from "./MarketplaceCommerceAnalyticsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts index 14908724025a..6dac3f383e79 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfig) => ({ apiVersion: "2015-07-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Marketplace Commerce Analytics", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.ts index c392e298a61f..5fc431332652 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MarketplaceCommerceAnalyticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceCommerceAnalyticsClientConfig } from "./MarketplaceCommerceAnalyticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-entitlement-service/MarketplaceEntitlementServiceClient.ts b/clients/client-marketplace-entitlement-service/MarketplaceEntitlementServiceClient.ts index 9730a4755bb5..abdcd563a5f3 100644 --- a/clients/client-marketplace-entitlement-service/MarketplaceEntitlementServiceClient.ts +++ b/clients/client-marketplace-entitlement-service/MarketplaceEntitlementServiceClient.ts @@ -1,5 +1,5 @@ import { GetEntitlementsCommandInput, GetEntitlementsCommandOutput } from "./commands/GetEntitlementsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -226,10 +226,7 @@ export class MarketplaceEntitlementServiceClient extends __Client< readonly config: MarketplaceEntitlementServiceClientResolvedConfig; constructor(configuration: MarketplaceEntitlementServiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts index b355bffe5f0b..2ccedecaa547 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MarketplaceEntitlementServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceEntitlementServiceClientConfig } from "./MarketplaceEntitlementServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts index a4e7eed64424..44c82053812b 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MarketplaceEntitlementServiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MarketplaceEntitlementServiceClientConfig } from "./MarketplaceEntitlementServiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts index b2d72441a1a7..728f474f18ec 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConfig) => ({ apiVersion: "2017-01-11", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Marketplace Entitlement Service", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.ts index 89c3e8fec579..d523b69a87e9 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MarketplaceEntitlementServiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceEntitlementServiceClientConfig } from "./MarketplaceEntitlementServiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-metering/MarketplaceMeteringClient.ts b/clients/client-marketplace-metering/MarketplaceMeteringClient.ts index 10a62d7c5fda..8d821f31c288 100644 --- a/clients/client-marketplace-metering/MarketplaceMeteringClient.ts +++ b/clients/client-marketplace-metering/MarketplaceMeteringClient.ts @@ -2,7 +2,7 @@ import { BatchMeterUsageCommandInput, BatchMeterUsageCommandOutput } from "./com import { MeterUsageCommandInput, MeterUsageCommandOutput } from "./commands/MeterUsageCommand"; import { RegisterUsageCommandInput, RegisterUsageCommandOutput } from "./commands/RegisterUsageCommand"; import { ResolveCustomerCommandInput, ResolveCustomerCommandOutput } from "./commands/ResolveCustomerCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -276,10 +276,7 @@ export class MarketplaceMeteringClient extends __Client< readonly config: MarketplaceMeteringClientResolvedConfig; constructor(configuration: MarketplaceMeteringClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-marketplace-metering/runtimeConfig.browser.ts b/clients/client-marketplace-metering/runtimeConfig.browser.ts index 70c1e1ce2d16..a3495633c3c2 100644 --- a/clients/client-marketplace-metering/runtimeConfig.browser.ts +++ b/clients/client-marketplace-metering/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MarketplaceMeteringClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceMeteringClientConfig } from "./MarketplaceMeteringClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-marketplace-metering/runtimeConfig.native.ts b/clients/client-marketplace-metering/runtimeConfig.native.ts index 44b50c7a21de..792d30700b48 100644 --- a/clients/client-marketplace-metering/runtimeConfig.native.ts +++ b/clients/client-marketplace-metering/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MarketplaceMeteringClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MarketplaceMeteringClientConfig } from "./MarketplaceMeteringClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-marketplace-metering/runtimeConfig.shared.ts b/clients/client-marketplace-metering/runtimeConfig.shared.ts index 20d06e231452..7001f097788a 100644 --- a/clients/client-marketplace-metering/runtimeConfig.shared.ts +++ b/clients/client-marketplace-metering/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => ({ apiVersion: "2016-01-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Marketplace Metering", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-marketplace-metering/runtimeConfig.ts b/clients/client-marketplace-metering/runtimeConfig.ts index 1a6f821713c0..326a7e962712 100644 --- a/clients/client-marketplace-metering/runtimeConfig.ts +++ b/clients/client-marketplace-metering/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MarketplaceMeteringClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MarketplaceMeteringClientConfig } from "./MarketplaceMeteringClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediaconnect/MediaConnectClient.ts b/clients/client-mediaconnect/MediaConnectClient.ts index ea24f20f0097..bbc5ce9294a5 100644 --- a/clients/client-mediaconnect/MediaConnectClient.ts +++ b/clients/client-mediaconnect/MediaConnectClient.ts @@ -58,7 +58,7 @@ import { } from "./commands/UpdateFlowMediaStreamCommand"; import { UpdateFlowOutputCommandInput, UpdateFlowOutputCommandOutput } from "./commands/UpdateFlowOutputCommand"; import { UpdateFlowSourceCommandInput, UpdateFlowSourceCommandOutput } from "./commands/UpdateFlowSourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -328,10 +328,7 @@ export class MediaConnectClient extends __Client< readonly config: MediaConnectClientResolvedConfig; constructor(configuration: MediaConnectClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediaconnect/runtimeConfig.browser.ts b/clients/client-mediaconnect/runtimeConfig.browser.ts index ca438c2884da..5fe79d1e8c56 100644 --- a/clients/client-mediaconnect/runtimeConfig.browser.ts +++ b/clients/client-mediaconnect/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaConnectClientConfig } from "./MediaConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediaconnect/runtimeConfig.native.ts b/clients/client-mediaconnect/runtimeConfig.native.ts index a842c347f902..da5e58626666 100644 --- a/clients/client-mediaconnect/runtimeConfig.native.ts +++ b/clients/client-mediaconnect/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaConnectClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaConnectClientConfig } from "./MediaConnectClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaConnectClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediaconnect/runtimeConfig.shared.ts b/clients/client-mediaconnect/runtimeConfig.shared.ts index 1eb706d414fe..6bb9382910e1 100644 --- a/clients/client-mediaconnect/runtimeConfig.shared.ts +++ b/clients/client-mediaconnect/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaConnectClientConfig) => ({ apiVersion: "2018-11-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaConnect", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediaconnect/runtimeConfig.ts b/clients/client-mediaconnect/runtimeConfig.ts index 2adbbec9eb06..7dad56947cc2 100644 --- a/clients/client-mediaconnect/runtimeConfig.ts +++ b/clients/client-mediaconnect/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaConnectClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaConnectClientConfig } from "./MediaConnectClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaConnectClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediaconvert/MediaConvertClient.ts b/clients/client-mediaconvert/MediaConvertClient.ts index 36b4b96927b2..0701bf8cbeac 100644 --- a/clients/client-mediaconvert/MediaConvertClient.ts +++ b/clients/client-mediaconvert/MediaConvertClient.ts @@ -32,7 +32,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateJobTemplateCommandInput, UpdateJobTemplateCommandOutput } from "./commands/UpdateJobTemplateCommand"; import { UpdatePresetCommandInput, UpdatePresetCommandOutput } from "./commands/UpdatePresetCommand"; import { UpdateQueueCommandInput, UpdateQueueCommandOutput } from "./commands/UpdateQueueCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -292,10 +292,7 @@ export class MediaConvertClient extends __Client< readonly config: MediaConvertClientResolvedConfig; constructor(configuration: MediaConvertClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediaconvert/runtimeConfig.browser.ts b/clients/client-mediaconvert/runtimeConfig.browser.ts index 6252a41079af..efe9f90db4f3 100644 --- a/clients/client-mediaconvert/runtimeConfig.browser.ts +++ b/clients/client-mediaconvert/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaConvertClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaConvertClientConfig } from "./MediaConvertClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaConvertClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediaconvert/runtimeConfig.native.ts b/clients/client-mediaconvert/runtimeConfig.native.ts index a43e5545e37c..e3dbbfa23474 100644 --- a/clients/client-mediaconvert/runtimeConfig.native.ts +++ b/clients/client-mediaconvert/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaConvertClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaConvertClientConfig } from "./MediaConvertClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaConvertClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediaconvert/runtimeConfig.shared.ts b/clients/client-mediaconvert/runtimeConfig.shared.ts index f21a70321a52..4b3c9c238e16 100644 --- a/clients/client-mediaconvert/runtimeConfig.shared.ts +++ b/clients/client-mediaconvert/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaConvertClientConfig) => ({ apiVersion: "2017-08-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaConvert", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediaconvert/runtimeConfig.ts b/clients/client-mediaconvert/runtimeConfig.ts index 66b3587b8ba8..dc53526af52d 100644 --- a/clients/client-mediaconvert/runtimeConfig.ts +++ b/clients/client-mediaconvert/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaConvertClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaConvertClientConfig } from "./MediaConvertClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaConvertClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-medialive/MediaLiveClient.ts b/clients/client-medialive/MediaLiveClient.ts index 5567a70866ed..c64abcb75b98 100644 --- a/clients/client-medialive/MediaLiveClient.ts +++ b/clients/client-medialive/MediaLiveClient.ts @@ -114,7 +114,7 @@ import { UpdateMultiplexProgramCommandOutput, } from "./commands/UpdateMultiplexProgramCommand"; import { UpdateReservationCommandInput, UpdateReservationCommandOutput } from "./commands/UpdateReservationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -436,10 +436,7 @@ export class MediaLiveClient extends __Client< readonly config: MediaLiveClientResolvedConfig; constructor(configuration: MediaLiveClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-medialive/runtimeConfig.browser.ts b/clients/client-medialive/runtimeConfig.browser.ts index cbe80e7e3415..84380f92e173 100644 --- a/clients/client-medialive/runtimeConfig.browser.ts +++ b/clients/client-medialive/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaLiveClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaLiveClientConfig } from "./MediaLiveClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaLiveClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-medialive/runtimeConfig.native.ts b/clients/client-medialive/runtimeConfig.native.ts index 8fb78383d4b0..8f5e5d84a8af 100644 --- a/clients/client-medialive/runtimeConfig.native.ts +++ b/clients/client-medialive/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaLiveClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaLiveClientConfig } from "./MediaLiveClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaLiveClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-medialive/runtimeConfig.shared.ts b/clients/client-medialive/runtimeConfig.shared.ts index fe37478106c6..c461ea8dec50 100644 --- a/clients/client-medialive/runtimeConfig.shared.ts +++ b/clients/client-medialive/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaLiveClientConfig) => ({ apiVersion: "2017-10-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaLive", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-medialive/runtimeConfig.ts b/clients/client-medialive/runtimeConfig.ts index 1c4227a37ca7..00cd0b6005c9 100644 --- a/clients/client-medialive/runtimeConfig.ts +++ b/clients/client-medialive/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaLiveClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaLiveClientConfig } from "./MediaLiveClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaLiveClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediapackage-vod/MediaPackageVodClient.ts b/clients/client-mediapackage-vod/MediaPackageVodClient.ts index 705c4b50d8ac..ae8c8687a009 100644 --- a/clients/client-mediapackage-vod/MediaPackageVodClient.ts +++ b/clients/client-mediapackage-vod/MediaPackageVodClient.ts @@ -45,7 +45,7 @@ import { UpdatePackagingGroupCommandInput, UpdatePackagingGroupCommandOutput, } from "./commands/UpdatePackagingGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -289,10 +289,7 @@ export class MediaPackageVodClient extends __Client< readonly config: MediaPackageVodClientResolvedConfig; constructor(configuration: MediaPackageVodClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediapackage-vod/runtimeConfig.browser.ts b/clients/client-mediapackage-vod/runtimeConfig.browser.ts index 9fb8c743a31f..5f00924e2a74 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.browser.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaPackageVodClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaPackageVodClientConfig } from "./MediaPackageVodClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediapackage-vod/runtimeConfig.native.ts b/clients/client-mediapackage-vod/runtimeConfig.native.ts index ea05c7d3e96f..d838283f8620 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.native.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaPackageVodClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaPackageVodClientConfig } from "./MediaPackageVodClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediapackage-vod/runtimeConfig.shared.ts b/clients/client-mediapackage-vod/runtimeConfig.shared.ts index 21ec29fcdf59..1b3211ed0ff1 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.shared.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => ({ apiVersion: "2018-11-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaPackage Vod", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediapackage-vod/runtimeConfig.ts b/clients/client-mediapackage-vod/runtimeConfig.ts index 1809e089c40e..3ab63f8ce191 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaPackageVodClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaPackageVodClientConfig } from "./MediaPackageVodClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediapackage/MediaPackageClient.ts b/clients/client-mediapackage/MediaPackageClient.ts index 4bb9badb8f6b..e18ffc136ec1 100644 --- a/clients/client-mediapackage/MediaPackageClient.ts +++ b/clients/client-mediapackage/MediaPackageClient.ts @@ -41,7 +41,7 @@ import { UpdateOriginEndpointCommandInput, UpdateOriginEndpointCommandOutput, } from "./commands/UpdateOriginEndpointCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -289,10 +289,7 @@ export class MediaPackageClient extends __Client< readonly config: MediaPackageClientResolvedConfig; constructor(configuration: MediaPackageClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediapackage/runtimeConfig.browser.ts b/clients/client-mediapackage/runtimeConfig.browser.ts index bee8e94a1c2f..ac40489f0e23 100644 --- a/clients/client-mediapackage/runtimeConfig.browser.ts +++ b/clients/client-mediapackage/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaPackageClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaPackageClientConfig } from "./MediaPackageClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaPackageClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediapackage/runtimeConfig.native.ts b/clients/client-mediapackage/runtimeConfig.native.ts index 16f498ee7185..0825a2ab1c98 100644 --- a/clients/client-mediapackage/runtimeConfig.native.ts +++ b/clients/client-mediapackage/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaPackageClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaPackageClientConfig } from "./MediaPackageClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaPackageClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediapackage/runtimeConfig.shared.ts b/clients/client-mediapackage/runtimeConfig.shared.ts index 8204142818b7..56d7908e2e5e 100644 --- a/clients/client-mediapackage/runtimeConfig.shared.ts +++ b/clients/client-mediapackage/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaPackageClientConfig) => ({ apiVersion: "2017-10-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaPackage", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediapackage/runtimeConfig.ts b/clients/client-mediapackage/runtimeConfig.ts index b9856dc5b3c1..6d8bcf9d9d9d 100644 --- a/clients/client-mediapackage/runtimeConfig.ts +++ b/clients/client-mediapackage/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaPackageClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaPackageClientConfig } from "./MediaPackageClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaPackageClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediastore-data/MediaStoreDataClient.ts b/clients/client-mediastore-data/MediaStoreDataClient.ts index 8536d9d9ea76..d52e50b29eb2 100644 --- a/clients/client-mediastore-data/MediaStoreDataClient.ts +++ b/clients/client-mediastore-data/MediaStoreDataClient.ts @@ -3,7 +3,7 @@ import { DescribeObjectCommandInput, DescribeObjectCommandOutput } from "./comma import { GetObjectCommandInput, GetObjectCommandOutput } from "./commands/GetObjectCommand"; import { ListItemsCommandInput, ListItemsCommandOutput } from "./commands/ListItemsCommand"; import { PutObjectCommandInput, PutObjectCommandOutput } from "./commands/PutObjectCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -225,10 +225,7 @@ export class MediaStoreDataClient extends __Client< readonly config: MediaStoreDataClientResolvedConfig; constructor(configuration: MediaStoreDataClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediastore-data/runtimeConfig.browser.ts b/clients/client-mediastore-data/runtimeConfig.browser.ts index a62e587a75d3..ed32721bb852 100644 --- a/clients/client-mediastore-data/runtimeConfig.browser.ts +++ b/clients/client-mediastore-data/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaStoreDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediastore-data/runtimeConfig.native.ts b/clients/client-mediastore-data/runtimeConfig.native.ts index d0a62a39d4fb..7025fda54b31 100644 --- a/clients/client-mediastore-data/runtimeConfig.native.ts +++ b/clients/client-mediastore-data/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaStoreDataClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediastore-data/runtimeConfig.shared.ts b/clients/client-mediastore-data/runtimeConfig.shared.ts index c3dd7797b3de..9d285c35af90 100644 --- a/clients/client-mediastore-data/runtimeConfig.shared.ts +++ b/clients/client-mediastore-data/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => ({ apiVersion: "2017-09-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaStore Data", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediastore-data/runtimeConfig.ts b/clients/client-mediastore-data/runtimeConfig.ts index c8a6dce8ad88..1ab1c8a49c89 100644 --- a/clients/client-mediastore-data/runtimeConfig.ts +++ b/clients/client-mediastore-data/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaStoreDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediastore/MediaStoreClient.ts b/clients/client-mediastore/MediaStoreClient.ts index 9428a50bff6f..0d9800db9f7e 100644 --- a/clients/client-mediastore/MediaStoreClient.ts +++ b/clients/client-mediastore/MediaStoreClient.ts @@ -28,7 +28,7 @@ import { StartAccessLoggingCommandInput, StartAccessLoggingCommandOutput } from import { StopAccessLoggingCommandInput, StopAccessLoggingCommandOutput } from "./commands/StopAccessLoggingCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -281,10 +281,7 @@ export class MediaStoreClient extends __Client< readonly config: MediaStoreClientResolvedConfig; constructor(configuration: MediaStoreClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediastore/runtimeConfig.browser.ts b/clients/client-mediastore/runtimeConfig.browser.ts index b384e785c1b4..7c7d4a8853d6 100644 --- a/clients/client-mediastore/runtimeConfig.browser.ts +++ b/clients/client-mediastore/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaStoreClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaStoreClientConfig } from "./MediaStoreClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaStoreClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediastore/runtimeConfig.native.ts b/clients/client-mediastore/runtimeConfig.native.ts index d258ec44449f..a63434794260 100644 --- a/clients/client-mediastore/runtimeConfig.native.ts +++ b/clients/client-mediastore/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaStoreClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaStoreClientConfig } from "./MediaStoreClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaStoreClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediastore/runtimeConfig.shared.ts b/clients/client-mediastore/runtimeConfig.shared.ts index 0e5e9666075e..c703dbd8f466 100644 --- a/clients/client-mediastore/runtimeConfig.shared.ts +++ b/clients/client-mediastore/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaStoreClientConfig) => ({ apiVersion: "2017-09-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaStore", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediastore/runtimeConfig.ts b/clients/client-mediastore/runtimeConfig.ts index e14c737d6658..785ca0e3ec60 100644 --- a/clients/client-mediastore/runtimeConfig.ts +++ b/clients/client-mediastore/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaStoreClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaStoreClientConfig } from "./MediaStoreClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaStoreClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediatailor/MediaTailorClient.ts b/clients/client-mediatailor/MediaTailorClient.ts index 7a0239b5ad87..4eff3a9091b3 100644 --- a/clients/client-mediatailor/MediaTailorClient.ts +++ b/clients/client-mediatailor/MediaTailorClient.ts @@ -63,7 +63,7 @@ import { UpdateSourceLocationCommandOutput, } from "./commands/UpdateSourceLocationCommand"; import { UpdateVodSourceCommandInput, UpdateVodSourceCommandOutput } from "./commands/UpdateVodSourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -337,10 +337,7 @@ export class MediaTailorClient extends __Client< readonly config: MediaTailorClientResolvedConfig; constructor(configuration: MediaTailorClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mediatailor/runtimeConfig.browser.ts b/clients/client-mediatailor/runtimeConfig.browser.ts index 9bb19ece4670..f7920aa825c6 100644 --- a/clients/client-mediatailor/runtimeConfig.browser.ts +++ b/clients/client-mediatailor/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MediaTailorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaTailorClientConfig } from "./MediaTailorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaTailorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mediatailor/runtimeConfig.native.ts b/clients/client-mediatailor/runtimeConfig.native.ts index aec936c16cf9..9e43b514ab16 100644 --- a/clients/client-mediatailor/runtimeConfig.native.ts +++ b/clients/client-mediatailor/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MediaTailorClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MediaTailorClientConfig } from "./MediaTailorClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MediaTailorClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mediatailor/runtimeConfig.shared.ts b/clients/client-mediatailor/runtimeConfig.shared.ts index 4f9e972d8aab..29e80ed508cc 100644 --- a/clients/client-mediatailor/runtimeConfig.shared.ts +++ b/clients/client-mediatailor/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MediaTailorClientConfig) => ({ apiVersion: "2018-04-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MediaTailor", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mediatailor/runtimeConfig.ts b/clients/client-mediatailor/runtimeConfig.ts index 5db8cc348746..ce36af66e5ae 100644 --- a/clients/client-mediatailor/runtimeConfig.ts +++ b/clients/client-mediatailor/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MediaTailorClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MediaTailorClientConfig } from "./MediaTailorClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MediaTailorClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mgn/MgnClient.ts b/clients/client-mgn/MgnClient.ts index 43e7fead248e..eee146c12b99 100644 --- a/clients/client-mgn/MgnClient.ts +++ b/clients/client-mgn/MgnClient.ts @@ -68,7 +68,7 @@ import { UpdateReplicationConfigurationTemplateCommandInput, UpdateReplicationConfigurationTemplateCommandOutput, } from "./commands/UpdateReplicationConfigurationTemplateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -328,10 +328,7 @@ export class MgnClient extends __Client< readonly config: MgnClientResolvedConfig; constructor(configuration: MgnClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mgn/runtimeConfig.browser.ts b/clients/client-mgn/runtimeConfig.browser.ts index 579724e6345c..bc171a2746de 100644 --- a/clients/client-mgn/runtimeConfig.browser.ts +++ b/clients/client-mgn/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MgnClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MgnClientConfig } from "./MgnClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MgnClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mgn/runtimeConfig.native.ts b/clients/client-mgn/runtimeConfig.native.ts index 87f02494cb71..485f148418d7 100644 --- a/clients/client-mgn/runtimeConfig.native.ts +++ b/clients/client-mgn/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MgnClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MgnClientConfig } from "./MgnClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MgnClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mgn/runtimeConfig.shared.ts b/clients/client-mgn/runtimeConfig.shared.ts index 967fac80c107..64e8c940eacd 100644 --- a/clients/client-mgn/runtimeConfig.shared.ts +++ b/clients/client-mgn/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MgnClientConfig) => ({ apiVersion: "2020-02-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "mgn", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mgn/runtimeConfig.ts b/clients/client-mgn/runtimeConfig.ts index d7e351bf3d1f..87c1d41fc0ce 100644 --- a/clients/client-mgn/runtimeConfig.ts +++ b/clients/client-mgn/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MgnClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MgnClientConfig } from "./MgnClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MgnClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-migration-hub/MigrationHubClient.ts b/clients/client-migration-hub/MigrationHubClient.ts index 24d449e2c60a..e2a60eb78d28 100644 --- a/clients/client-migration-hub/MigrationHubClient.ts +++ b/clients/client-migration-hub/MigrationHubClient.ts @@ -63,7 +63,7 @@ import { PutResourceAttributesCommandInput, PutResourceAttributesCommandOutput, } from "./commands/PutResourceAttributesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -312,10 +312,7 @@ export class MigrationHubClient extends __Client< readonly config: MigrationHubClientResolvedConfig; constructor(configuration: MigrationHubClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-migration-hub/runtimeConfig.browser.ts b/clients/client-migration-hub/runtimeConfig.browser.ts index 1644fd664be4..16a9d505d7a7 100644 --- a/clients/client-migration-hub/runtimeConfig.browser.ts +++ b/clients/client-migration-hub/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MigrationHubClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MigrationHubClientConfig } from "./MigrationHubClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MigrationHubClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-migration-hub/runtimeConfig.native.ts b/clients/client-migration-hub/runtimeConfig.native.ts index a2caaaebdc70..69cff771ce68 100644 --- a/clients/client-migration-hub/runtimeConfig.native.ts +++ b/clients/client-migration-hub/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MigrationHubClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MigrationHubClientConfig } from "./MigrationHubClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MigrationHubClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-migration-hub/runtimeConfig.shared.ts b/clients/client-migration-hub/runtimeConfig.shared.ts index 7d2900672fb2..603cc97185fb 100644 --- a/clients/client-migration-hub/runtimeConfig.shared.ts +++ b/clients/client-migration-hub/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MigrationHubClientConfig) => ({ apiVersion: "2017-05-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Migration Hub", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-migration-hub/runtimeConfig.ts b/clients/client-migration-hub/runtimeConfig.ts index 8ec58eab81dc..ccf1c50a576d 100644 --- a/clients/client-migration-hub/runtimeConfig.ts +++ b/clients/client-migration-hub/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MigrationHubClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MigrationHubClientConfig } from "./MigrationHubClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MigrationHubClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-migrationhub-config/MigrationHubConfigClient.ts b/clients/client-migrationhub-config/MigrationHubConfigClient.ts index c143d0d40e55..ea7351ae702c 100644 --- a/clients/client-migrationhub-config/MigrationHubConfigClient.ts +++ b/clients/client-migrationhub-config/MigrationHubConfigClient.ts @@ -7,7 +7,7 @@ import { DescribeHomeRegionControlsCommandOutput, } from "./commands/DescribeHomeRegionControlsCommand"; import { GetHomeRegionCommandInput, GetHomeRegionCommandOutput } from "./commands/GetHomeRegionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -248,10 +248,7 @@ export class MigrationHubConfigClient extends __Client< readonly config: MigrationHubConfigClientResolvedConfig; constructor(configuration: MigrationHubConfigClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-migrationhub-config/runtimeConfig.browser.ts b/clients/client-migrationhub-config/runtimeConfig.browser.ts index 3aa18aedd389..153aa8c45af0 100644 --- a/clients/client-migrationhub-config/runtimeConfig.browser.ts +++ b/clients/client-migrationhub-config/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MigrationHubConfigClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MigrationHubConfigClientConfig } from "./MigrationHubConfigClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-migrationhub-config/runtimeConfig.native.ts b/clients/client-migrationhub-config/runtimeConfig.native.ts index b8d98cf11bef..3d6f6a4a45d5 100644 --- a/clients/client-migrationhub-config/runtimeConfig.native.ts +++ b/clients/client-migrationhub-config/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MigrationHubConfigClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MigrationHubConfigClientConfig } from "./MigrationHubConfigClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-migrationhub-config/runtimeConfig.shared.ts b/clients/client-migrationhub-config/runtimeConfig.shared.ts index ac0403d961f5..5a839ed0f96f 100644 --- a/clients/client-migrationhub-config/runtimeConfig.shared.ts +++ b/clients/client-migrationhub-config/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => ({ apiVersion: "2019-06-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MigrationHub Config", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-migrationhub-config/runtimeConfig.ts b/clients/client-migrationhub-config/runtimeConfig.ts index 93f0c76c43bd..e3311b66ab3e 100644 --- a/clients/client-migrationhub-config/runtimeConfig.ts +++ b/clients/client-migrationhub-config/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MigrationHubConfigClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MigrationHubConfigClientConfig } from "./MigrationHubConfigClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mobile/MobileClient.ts b/clients/client-mobile/MobileClient.ts index 079b7679c104..29b29ad356f4 100644 --- a/clients/client-mobile/MobileClient.ts +++ b/clients/client-mobile/MobileClient.ts @@ -7,7 +7,7 @@ import { ExportProjectCommandInput, ExportProjectCommandOutput } from "./command import { ListBundlesCommandInput, ListBundlesCommandOutput } from "./commands/ListBundlesCommand"; import { ListProjectsCommandInput, ListProjectsCommandOutput } from "./commands/ListProjectsCommand"; import { UpdateProjectCommandInput, UpdateProjectCommandOutput } from "./commands/UpdateProjectCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -239,10 +239,7 @@ export class MobileClient extends __Client< readonly config: MobileClientResolvedConfig; constructor(configuration: MobileClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mobile/runtimeConfig.browser.ts b/clients/client-mobile/runtimeConfig.browser.ts index 6c1f412223c8..865321e6e99c 100644 --- a/clients/client-mobile/runtimeConfig.browser.ts +++ b/clients/client-mobile/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MobileClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MobileClientConfig } from "./MobileClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MobileClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mobile/runtimeConfig.native.ts b/clients/client-mobile/runtimeConfig.native.ts index 814ee58b700f..471b293ad0a1 100644 --- a/clients/client-mobile/runtimeConfig.native.ts +++ b/clients/client-mobile/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MobileClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MobileClientConfig } from "./MobileClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MobileClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mobile/runtimeConfig.shared.ts b/clients/client-mobile/runtimeConfig.shared.ts index 5cb5a4b86f6b..b10f89b16265 100644 --- a/clients/client-mobile/runtimeConfig.shared.ts +++ b/clients/client-mobile/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MobileClientConfig) => ({ apiVersion: "2017-07-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Mobile", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mobile/runtimeConfig.ts b/clients/client-mobile/runtimeConfig.ts index fcac107d11d3..2b6e88a5da01 100644 --- a/clients/client-mobile/runtimeConfig.ts +++ b/clients/client-mobile/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MobileClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MobileClientConfig } from "./MobileClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MobileClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mq/MqClient.ts b/clients/client-mq/MqClient.ts index 8b5b30021975..59ce81ce1d8e 100644 --- a/clients/client-mq/MqClient.ts +++ b/clients/client-mq/MqClient.ts @@ -41,7 +41,7 @@ import { UpdateConfigurationCommandOutput, } from "./commands/UpdateConfigurationCommand"; import { UpdateUserCommandInput, UpdateUserCommandOutput } from "./commands/UpdateUserCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -295,10 +295,7 @@ export class MqClient extends __Client< readonly config: MqClientResolvedConfig; constructor(configuration: MqClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mq/runtimeConfig.browser.ts b/clients/client-mq/runtimeConfig.browser.ts index e3402a9df3f1..e4fc13fa6f3f 100644 --- a/clients/client-mq/runtimeConfig.browser.ts +++ b/clients/client-mq/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MqClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MqClientConfig } from "./MqClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MqClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mq/runtimeConfig.native.ts b/clients/client-mq/runtimeConfig.native.ts index 24060311f20e..f67d42e6c059 100644 --- a/clients/client-mq/runtimeConfig.native.ts +++ b/clients/client-mq/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MqClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MqClientConfig } from "./MqClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MqClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mq/runtimeConfig.shared.ts b/clients/client-mq/runtimeConfig.shared.ts index de251006887e..e05c5fb038c4 100644 --- a/clients/client-mq/runtimeConfig.shared.ts +++ b/clients/client-mq/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MqClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "mq", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mq/runtimeConfig.ts b/clients/client-mq/runtimeConfig.ts index 446803e65cfe..a538f8f42bc7 100644 --- a/clients/client-mq/runtimeConfig.ts +++ b/clients/client-mq/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MqClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MqClientConfig } from "./MqClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MqClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mturk/MTurkClient.ts b/clients/client-mturk/MTurkClient.ts index 3904476572f2..99f273fc1388 100644 --- a/clients/client-mturk/MTurkClient.ts +++ b/clients/client-mturk/MTurkClient.ts @@ -100,7 +100,7 @@ import { UpdateQualificationTypeCommandInput, UpdateQualificationTypeCommandOutput, } from "./commands/UpdateQualificationTypeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -388,10 +388,7 @@ export class MTurkClient extends __Client< readonly config: MTurkClientResolvedConfig; constructor(configuration: MTurkClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mturk/runtimeConfig.browser.ts b/clients/client-mturk/runtimeConfig.browser.ts index 3b5f4660c9ac..41c0a0c96528 100644 --- a/clients/client-mturk/runtimeConfig.browser.ts +++ b/clients/client-mturk/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MTurkClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MTurkClientConfig } from "./MTurkClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MTurkClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mturk/runtimeConfig.native.ts b/clients/client-mturk/runtimeConfig.native.ts index 12f1741f865e..d3517fa03fc1 100644 --- a/clients/client-mturk/runtimeConfig.native.ts +++ b/clients/client-mturk/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MTurkClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MTurkClientConfig } from "./MTurkClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MTurkClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mturk/runtimeConfig.shared.ts b/clients/client-mturk/runtimeConfig.shared.ts index c59369fe59cc..f5f8398866df 100644 --- a/clients/client-mturk/runtimeConfig.shared.ts +++ b/clients/client-mturk/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MTurkClientConfig) => ({ apiVersion: "2017-01-17", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MTurk", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mturk/runtimeConfig.ts b/clients/client-mturk/runtimeConfig.ts index fcfda41912ba..aba42ad80470 100644 --- a/clients/client-mturk/runtimeConfig.ts +++ b/clients/client-mturk/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MTurkClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MTurkClientConfig } from "./MTurkClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MTurkClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mwaa/MWAAClient.ts b/clients/client-mwaa/MWAAClient.ts index 00a091ee1d52..e28ed7b20827 100644 --- a/clients/client-mwaa/MWAAClient.ts +++ b/clients/client-mwaa/MWAAClient.ts @@ -15,7 +15,7 @@ import { PublishMetricsCommandInput, PublishMetricsCommandOutput } from "./comma import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateEnvironmentCommandInput, UpdateEnvironmentCommandOutput } from "./commands/UpdateEnvironmentCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -248,10 +248,7 @@ export class MWAAClient extends __Client< readonly config: MWAAClientResolvedConfig; constructor(configuration: MWAAClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-mwaa/runtimeConfig.browser.ts b/clients/client-mwaa/runtimeConfig.browser.ts index ce651903197b..9055ca8cd910 100644 --- a/clients/client-mwaa/runtimeConfig.browser.ts +++ b/clients/client-mwaa/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./MWAAClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MWAAClientConfig } from "./MWAAClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MWAAClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-mwaa/runtimeConfig.native.ts b/clients/client-mwaa/runtimeConfig.native.ts index 8e8245d25f0e..ec15971d92fe 100644 --- a/clients/client-mwaa/runtimeConfig.native.ts +++ b/clients/client-mwaa/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./MWAAClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { MWAAClientConfig } from "./MWAAClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: MWAAClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-mwaa/runtimeConfig.shared.ts b/clients/client-mwaa/runtimeConfig.shared.ts index 70dbf0048121..b869a3b7c957 100644 --- a/clients/client-mwaa/runtimeConfig.shared.ts +++ b/clients/client-mwaa/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: MWAAClientConfig) => ({ apiVersion: "2020-07-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "MWAA", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-mwaa/runtimeConfig.ts b/clients/client-mwaa/runtimeConfig.ts index 675f840d5e61..806a74c47848 100644 --- a/clients/client-mwaa/runtimeConfig.ts +++ b/clients/client-mwaa/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./MWAAClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { MWAAClientConfig } from "./MWAAClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: MWAAClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-neptune/NeptuneClient.ts b/clients/client-neptune/NeptuneClient.ts index d4950fd034a3..5a55e6cb915c 100644 --- a/clients/client-neptune/NeptuneClient.ts +++ b/clients/client-neptune/NeptuneClient.ts @@ -208,7 +208,7 @@ import { } from "./commands/RestoreDBClusterToPointInTimeCommand"; import { StartDBClusterCommandInput, StartDBClusterCommandOutput } from "./commands/StartDBClusterCommand"; import { StopDBClusterCommandInput, StopDBClusterCommandOutput } from "./commands/StopDBClusterCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -561,10 +561,7 @@ export class NeptuneClient extends __Client< readonly config: NeptuneClientResolvedConfig; constructor(configuration: NeptuneClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-neptune/runtimeConfig.browser.ts b/clients/client-neptune/runtimeConfig.browser.ts index fc757f66e1bc..dde7a4e057b3 100644 --- a/clients/client-neptune/runtimeConfig.browser.ts +++ b/clients/client-neptune/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./NeptuneClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NeptuneClientConfig } from "./NeptuneClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NeptuneClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-neptune/runtimeConfig.native.ts b/clients/client-neptune/runtimeConfig.native.ts index de7a28b86854..628624017a9d 100644 --- a/clients/client-neptune/runtimeConfig.native.ts +++ b/clients/client-neptune/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./NeptuneClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { NeptuneClientConfig } from "./NeptuneClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: NeptuneClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-neptune/runtimeConfig.shared.ts b/clients/client-neptune/runtimeConfig.shared.ts index f637fe5cfd84..97a8fe60841a 100644 --- a/clients/client-neptune/runtimeConfig.shared.ts +++ b/clients/client-neptune/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: NeptuneClientConfig) => ({ apiVersion: "2014-10-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Neptune", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-neptune/runtimeConfig.ts b/clients/client-neptune/runtimeConfig.ts index 77c76f9d3bc8..a9257ead0917 100644 --- a/clients/client-neptune/runtimeConfig.ts +++ b/clients/client-neptune/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./NeptuneClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NeptuneClientConfig } from "./NeptuneClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NeptuneClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-network-firewall/NetworkFirewallClient.ts b/clients/client-network-firewall/NetworkFirewallClient.ts index 53c74d995854..5af469cd7481 100644 --- a/clients/client-network-firewall/NetworkFirewallClient.ts +++ b/clients/client-network-firewall/NetworkFirewallClient.ts @@ -75,7 +75,7 @@ import { UpdateSubnetChangeProtectionCommandInput, UpdateSubnetChangeProtectionCommandOutput, } from "./commands/UpdateSubnetChangeProtectionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -419,10 +419,7 @@ export class NetworkFirewallClient extends __Client< readonly config: NetworkFirewallClientResolvedConfig; constructor(configuration: NetworkFirewallClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-network-firewall/runtimeConfig.browser.ts b/clients/client-network-firewall/runtimeConfig.browser.ts index c40da967c0a1..e5336c66a5cc 100644 --- a/clients/client-network-firewall/runtimeConfig.browser.ts +++ b/clients/client-network-firewall/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./NetworkFirewallClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NetworkFirewallClientConfig } from "./NetworkFirewallClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-network-firewall/runtimeConfig.native.ts b/clients/client-network-firewall/runtimeConfig.native.ts index 2b25d9786790..7607f909a6df 100644 --- a/clients/client-network-firewall/runtimeConfig.native.ts +++ b/clients/client-network-firewall/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./NetworkFirewallClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { NetworkFirewallClientConfig } from "./NetworkFirewallClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-network-firewall/runtimeConfig.shared.ts b/clients/client-network-firewall/runtimeConfig.shared.ts index 192535a96cf3..22ae53fecafb 100644 --- a/clients/client-network-firewall/runtimeConfig.shared.ts +++ b/clients/client-network-firewall/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => ({ apiVersion: "2020-11-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Network Firewall", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-network-firewall/runtimeConfig.ts b/clients/client-network-firewall/runtimeConfig.ts index 9e3661547cb9..601b85ac7038 100644 --- a/clients/client-network-firewall/runtimeConfig.ts +++ b/clients/client-network-firewall/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./NetworkFirewallClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NetworkFirewallClientConfig } from "./NetworkFirewallClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-networkmanager/NetworkManagerClient.ts b/clients/client-networkmanager/NetworkManagerClient.ts index 5e1473be7ef8..e70a513af8b7 100644 --- a/clients/client-networkmanager/NetworkManagerClient.ts +++ b/clients/client-networkmanager/NetworkManagerClient.ts @@ -78,7 +78,7 @@ import { } from "./commands/UpdateGlobalNetworkCommand"; import { UpdateLinkCommandInput, UpdateLinkCommandOutput } from "./commands/UpdateLinkCommand"; import { UpdateSiteCommandInput, UpdateSiteCommandOutput } from "./commands/UpdateSiteCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -360,10 +360,7 @@ export class NetworkManagerClient extends __Client< readonly config: NetworkManagerClientResolvedConfig; constructor(configuration: NetworkManagerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-networkmanager/runtimeConfig.browser.ts b/clients/client-networkmanager/runtimeConfig.browser.ts index f4f9a937e609..4c665a6c8888 100644 --- a/clients/client-networkmanager/runtimeConfig.browser.ts +++ b/clients/client-networkmanager/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./NetworkManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NetworkManagerClientConfig } from "./NetworkManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-networkmanager/runtimeConfig.native.ts b/clients/client-networkmanager/runtimeConfig.native.ts index 42a28676f93f..f7b537855324 100644 --- a/clients/client-networkmanager/runtimeConfig.native.ts +++ b/clients/client-networkmanager/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./NetworkManagerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { NetworkManagerClientConfig } from "./NetworkManagerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-networkmanager/runtimeConfig.shared.ts b/clients/client-networkmanager/runtimeConfig.shared.ts index 448df95ccc0b..71c30bad757f 100644 --- a/clients/client-networkmanager/runtimeConfig.shared.ts +++ b/clients/client-networkmanager/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: NetworkManagerClientConfig) => ({ apiVersion: "2019-07-05", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "NetworkManager", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-networkmanager/runtimeConfig.ts b/clients/client-networkmanager/runtimeConfig.ts index 2f9bbe8aa8a9..27206d3731dd 100644 --- a/clients/client-networkmanager/runtimeConfig.ts +++ b/clients/client-networkmanager/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./NetworkManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NetworkManagerClientConfig } from "./NetworkManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-nimble/NimbleClient.ts b/clients/client-nimble/NimbleClient.ts index 51c979dd9a73..6f6ac818f003 100644 --- a/clients/client-nimble/NimbleClient.ts +++ b/clients/client-nimble/NimbleClient.ts @@ -124,7 +124,7 @@ import { UpdateStudioComponentCommandInput, UpdateStudioComponentCommandOutput, } from "./commands/UpdateStudioComponentCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -421,10 +421,7 @@ export class NimbleClient extends __Client< readonly config: NimbleClientResolvedConfig; constructor(configuration: NimbleClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-nimble/runtimeConfig.browser.ts b/clients/client-nimble/runtimeConfig.browser.ts index 09ea095150b2..20a9b404e978 100644 --- a/clients/client-nimble/runtimeConfig.browser.ts +++ b/clients/client-nimble/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./NimbleClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NimbleClientConfig } from "./NimbleClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NimbleClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-nimble/runtimeConfig.native.ts b/clients/client-nimble/runtimeConfig.native.ts index 2118ea8fca5d..da8de8eb267a 100644 --- a/clients/client-nimble/runtimeConfig.native.ts +++ b/clients/client-nimble/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./NimbleClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { NimbleClientConfig } from "./NimbleClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: NimbleClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-nimble/runtimeConfig.shared.ts b/clients/client-nimble/runtimeConfig.shared.ts index c518be876228..7c5e202fc453 100644 --- a/clients/client-nimble/runtimeConfig.shared.ts +++ b/clients/client-nimble/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: NimbleClientConfig) => ({ apiVersion: "2020-08-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "nimble", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-nimble/runtimeConfig.ts b/clients/client-nimble/runtimeConfig.ts index e41a880565f3..d9d9cc004182 100644 --- a/clients/client-nimble/runtimeConfig.ts +++ b/clients/client-nimble/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./NimbleClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { NimbleClientConfig } from "./NimbleClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: NimbleClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-opsworks/OpsWorksClient.ts b/clients/client-opsworks/OpsWorksClient.ts index 33e1903133de..65af1fd49244 100644 --- a/clients/client-opsworks/OpsWorksClient.ts +++ b/clients/client-opsworks/OpsWorksClient.ts @@ -150,7 +150,7 @@ import { import { UpdateStackCommandInput, UpdateStackCommandOutput } from "./commands/UpdateStackCommand"; import { UpdateUserProfileCommandInput, UpdateUserProfileCommandOutput } from "./commands/UpdateUserProfileCommand"; import { UpdateVolumeCommandInput, UpdateVolumeCommandOutput } from "./commands/UpdateVolumeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -622,10 +622,7 @@ export class OpsWorksClient extends __Client< readonly config: OpsWorksClientResolvedConfig; constructor(configuration: OpsWorksClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-opsworks/runtimeConfig.browser.ts b/clients/client-opsworks/runtimeConfig.browser.ts index 7b6df1d23b1b..8d2c10edb360 100644 --- a/clients/client-opsworks/runtimeConfig.browser.ts +++ b/clients/client-opsworks/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./OpsWorksClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OpsWorksClientConfig } from "./OpsWorksClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OpsWorksClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-opsworks/runtimeConfig.native.ts b/clients/client-opsworks/runtimeConfig.native.ts index 9c5531232e99..f8f2c12423fb 100644 --- a/clients/client-opsworks/runtimeConfig.native.ts +++ b/clients/client-opsworks/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./OpsWorksClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { OpsWorksClientConfig } from "./OpsWorksClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: OpsWorksClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-opsworks/runtimeConfig.shared.ts b/clients/client-opsworks/runtimeConfig.shared.ts index c740e4848da2..20781da0ea8c 100644 --- a/clients/client-opsworks/runtimeConfig.shared.ts +++ b/clients/client-opsworks/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: OpsWorksClientConfig) => ({ apiVersion: "2013-02-18", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "OpsWorks", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-opsworks/runtimeConfig.ts b/clients/client-opsworks/runtimeConfig.ts index 12c00b5dc1e6..1706e94ccedd 100644 --- a/clients/client-opsworks/runtimeConfig.ts +++ b/clients/client-opsworks/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./OpsWorksClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OpsWorksClientConfig } from "./OpsWorksClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OpsWorksClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-opsworkscm/OpsWorksCMClient.ts b/clients/client-opsworkscm/OpsWorksCMClient.ts index 486c5df6b80f..14588f783ccd 100644 --- a/clients/client-opsworkscm/OpsWorksCMClient.ts +++ b/clients/client-opsworkscm/OpsWorksCMClient.ts @@ -32,7 +32,7 @@ import { UpdateServerEngineAttributesCommandInput, UpdateServerEngineAttributesCommandOutput, } from "./commands/UpdateServerEngineAttributesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -367,10 +367,7 @@ export class OpsWorksCMClient extends __Client< readonly config: OpsWorksCMClientResolvedConfig; constructor(configuration: OpsWorksCMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-opsworkscm/runtimeConfig.browser.ts b/clients/client-opsworkscm/runtimeConfig.browser.ts index 9bc8635caec9..67c77040358a 100644 --- a/clients/client-opsworkscm/runtimeConfig.browser.ts +++ b/clients/client-opsworkscm/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./OpsWorksCMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OpsWorksCMClientConfig } from "./OpsWorksCMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-opsworkscm/runtimeConfig.native.ts b/clients/client-opsworkscm/runtimeConfig.native.ts index 7db72777f198..0e56e7650f4a 100644 --- a/clients/client-opsworkscm/runtimeConfig.native.ts +++ b/clients/client-opsworkscm/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./OpsWorksCMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { OpsWorksCMClientConfig } from "./OpsWorksCMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-opsworkscm/runtimeConfig.shared.ts b/clients/client-opsworkscm/runtimeConfig.shared.ts index 2c3cee5f6b14..a132b93eb621 100644 --- a/clients/client-opsworkscm/runtimeConfig.shared.ts +++ b/clients/client-opsworkscm/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => ({ apiVersion: "2016-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "OpsWorksCM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-opsworkscm/runtimeConfig.ts b/clients/client-opsworkscm/runtimeConfig.ts index cc3e32f748f6..20fa04b02446 100644 --- a/clients/client-opsworkscm/runtimeConfig.ts +++ b/clients/client-opsworkscm/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./OpsWorksCMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OpsWorksCMClientConfig } from "./OpsWorksCMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-organizations/OrganizationsClient.ts b/clients/client-organizations/OrganizationsClient.ts index a87d87bdcce8..642dc6a83fb9 100644 --- a/clients/client-organizations/OrganizationsClient.ts +++ b/clients/client-organizations/OrganizationsClient.ts @@ -124,7 +124,7 @@ import { UpdateOrganizationalUnitCommandOutput, } from "./commands/UpdateOrganizationalUnitCommand"; import { UpdatePolicyCommandInput, UpdatePolicyCommandOutput } from "./commands/UpdatePolicyCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -506,10 +506,7 @@ export class OrganizationsClient extends __Client< readonly config: OrganizationsClientResolvedConfig; constructor(configuration: OrganizationsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-organizations/runtimeConfig.browser.ts b/clients/client-organizations/runtimeConfig.browser.ts index 20ff2b746bc4..49df9cac86aa 100644 --- a/clients/client-organizations/runtimeConfig.browser.ts +++ b/clients/client-organizations/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./OrganizationsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OrganizationsClientConfig } from "./OrganizationsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OrganizationsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-organizations/runtimeConfig.native.ts b/clients/client-organizations/runtimeConfig.native.ts index 109af58a1033..9f17d2db5bb7 100644 --- a/clients/client-organizations/runtimeConfig.native.ts +++ b/clients/client-organizations/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./OrganizationsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { OrganizationsClientConfig } from "./OrganizationsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: OrganizationsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-organizations/runtimeConfig.shared.ts b/clients/client-organizations/runtimeConfig.shared.ts index f725decd1dce..3c7259ec78f6 100644 --- a/clients/client-organizations/runtimeConfig.shared.ts +++ b/clients/client-organizations/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: OrganizationsClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Organizations", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-organizations/runtimeConfig.ts b/clients/client-organizations/runtimeConfig.ts index fcba437dc0c7..747a282932c6 100644 --- a/clients/client-organizations/runtimeConfig.ts +++ b/clients/client-organizations/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./OrganizationsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OrganizationsClientConfig } from "./OrganizationsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OrganizationsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-outposts/OutpostsClient.ts b/clients/client-outposts/OutpostsClient.ts index c2aeb27f1b5e..02427b4f0eb2 100644 --- a/clients/client-outposts/OutpostsClient.ts +++ b/clients/client-outposts/OutpostsClient.ts @@ -14,7 +14,7 @@ import { } from "./commands/ListTagsForResourceCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -248,10 +248,7 @@ export class OutpostsClient extends __Client< readonly config: OutpostsClientResolvedConfig; constructor(configuration: OutpostsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-outposts/runtimeConfig.browser.ts b/clients/client-outposts/runtimeConfig.browser.ts index e86adaf45ed5..0d922925cdb4 100644 --- a/clients/client-outposts/runtimeConfig.browser.ts +++ b/clients/client-outposts/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./OutpostsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OutpostsClientConfig } from "./OutpostsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OutpostsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-outposts/runtimeConfig.native.ts b/clients/client-outposts/runtimeConfig.native.ts index be932d8ecbdd..4c0667c4243e 100644 --- a/clients/client-outposts/runtimeConfig.native.ts +++ b/clients/client-outposts/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./OutpostsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { OutpostsClientConfig } from "./OutpostsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: OutpostsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-outposts/runtimeConfig.shared.ts b/clients/client-outposts/runtimeConfig.shared.ts index 3ed0690de81e..4f2e4256725a 100644 --- a/clients/client-outposts/runtimeConfig.shared.ts +++ b/clients/client-outposts/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: OutpostsClientConfig) => ({ apiVersion: "2019-12-03", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Outposts", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-outposts/runtimeConfig.ts b/clients/client-outposts/runtimeConfig.ts index bb1770ea10f8..07467e00a47b 100644 --- a/clients/client-outposts/runtimeConfig.ts +++ b/clients/client-outposts/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./OutpostsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { OutpostsClientConfig } from "./OutpostsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: OutpostsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-personalize-events/PersonalizeEventsClient.ts b/clients/client-personalize-events/PersonalizeEventsClient.ts index 7b3bf3de1cfe..af3a51ac739a 100644 --- a/clients/client-personalize-events/PersonalizeEventsClient.ts +++ b/clients/client-personalize-events/PersonalizeEventsClient.ts @@ -1,7 +1,7 @@ import { PutEventsCommandInput, PutEventsCommandOutput } from "./commands/PutEventsCommand"; import { PutItemsCommandInput, PutItemsCommandOutput } from "./commands/PutItemsCommand"; import { PutUsersCommandInput, PutUsersCommandOutput } from "./commands/PutUsersCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -213,10 +213,7 @@ export class PersonalizeEventsClient extends __Client< readonly config: PersonalizeEventsClientResolvedConfig; constructor(configuration: PersonalizeEventsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-personalize-events/runtimeConfig.browser.ts b/clients/client-personalize-events/runtimeConfig.browser.ts index 0e57410eb6cd..1177cb74d56c 100644 --- a/clients/client-personalize-events/runtimeConfig.browser.ts +++ b/clients/client-personalize-events/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PersonalizeEventsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-personalize-events/runtimeConfig.native.ts b/clients/client-personalize-events/runtimeConfig.native.ts index aa68a8e1ff13..aa08b29d5104 100644 --- a/clients/client-personalize-events/runtimeConfig.native.ts +++ b/clients/client-personalize-events/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PersonalizeEventsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-personalize-events/runtimeConfig.shared.ts b/clients/client-personalize-events/runtimeConfig.shared.ts index 6a5ee1d5e1b0..779410622d2a 100644 --- a/clients/client-personalize-events/runtimeConfig.shared.ts +++ b/clients/client-personalize-events/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => ({ apiVersion: "2018-03-22", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Personalize Events", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-personalize-events/runtimeConfig.ts b/clients/client-personalize-events/runtimeConfig.ts index 76946d80fd8f..3658495c1e83 100644 --- a/clients/client-personalize-events/runtimeConfig.ts +++ b/clients/client-personalize-events/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PersonalizeEventsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PersonalizeEventsClientConfig } from "./PersonalizeEventsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-personalize-runtime/PersonalizeRuntimeClient.ts b/clients/client-personalize-runtime/PersonalizeRuntimeClient.ts index 77e9bd40dc22..9e1f64a425f1 100644 --- a/clients/client-personalize-runtime/PersonalizeRuntimeClient.ts +++ b/clients/client-personalize-runtime/PersonalizeRuntimeClient.ts @@ -3,7 +3,7 @@ import { GetPersonalizedRankingCommandOutput, } from "./commands/GetPersonalizedRankingCommand"; import { GetRecommendationsCommandInput, GetRecommendationsCommandOutput } from "./commands/GetRecommendationsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -213,10 +213,7 @@ export class PersonalizeRuntimeClient extends __Client< readonly config: PersonalizeRuntimeClientResolvedConfig; constructor(configuration: PersonalizeRuntimeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-personalize-runtime/runtimeConfig.browser.ts b/clients/client-personalize-runtime/runtimeConfig.browser.ts index 8141d9cd6044..61e5cf3ce6a7 100644 --- a/clients/client-personalize-runtime/runtimeConfig.browser.ts +++ b/clients/client-personalize-runtime/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PersonalizeRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-personalize-runtime/runtimeConfig.native.ts b/clients/client-personalize-runtime/runtimeConfig.native.ts index 7f5c672641e2..87fa4a6f0b34 100644 --- a/clients/client-personalize-runtime/runtimeConfig.native.ts +++ b/clients/client-personalize-runtime/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PersonalizeRuntimeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-personalize-runtime/runtimeConfig.shared.ts b/clients/client-personalize-runtime/runtimeConfig.shared.ts index 63abb2f86f7c..f35cd83510d7 100644 --- a/clients/client-personalize-runtime/runtimeConfig.shared.ts +++ b/clients/client-personalize-runtime/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => ({ apiVersion: "2018-05-22", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Personalize Runtime", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-personalize-runtime/runtimeConfig.ts b/clients/client-personalize-runtime/runtimeConfig.ts index 04860342fbf2..c249f5ab53d3 100644 --- a/clients/client-personalize-runtime/runtimeConfig.ts +++ b/clients/client-personalize-runtime/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PersonalizeRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-personalize/PersonalizeClient.ts b/clients/client-personalize/PersonalizeClient.ts index 45565651ce9d..d975211b69df 100644 --- a/clients/client-personalize/PersonalizeClient.ts +++ b/clients/client-personalize/PersonalizeClient.ts @@ -93,7 +93,7 @@ import { StopSolutionVersionCreationCommandOutput, } from "./commands/StopSolutionVersionCreationCommand"; import { UpdateCampaignCommandInput, UpdateCampaignCommandOutput } from "./commands/UpdateCampaignCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -398,10 +398,7 @@ export class PersonalizeClient extends __Client< readonly config: PersonalizeClientResolvedConfig; constructor(configuration: PersonalizeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-personalize/runtimeConfig.browser.ts b/clients/client-personalize/runtimeConfig.browser.ts index 47320ea08209..a440e5069db1 100644 --- a/clients/client-personalize/runtimeConfig.browser.ts +++ b/clients/client-personalize/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PersonalizeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PersonalizeClientConfig } from "./PersonalizeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PersonalizeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-personalize/runtimeConfig.native.ts b/clients/client-personalize/runtimeConfig.native.ts index 5bc03d0998b5..a727655a2f51 100644 --- a/clients/client-personalize/runtimeConfig.native.ts +++ b/clients/client-personalize/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PersonalizeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PersonalizeClientConfig } from "./PersonalizeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PersonalizeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-personalize/runtimeConfig.shared.ts b/clients/client-personalize/runtimeConfig.shared.ts index 32ffd761726c..3d2a62b64e04 100644 --- a/clients/client-personalize/runtimeConfig.shared.ts +++ b/clients/client-personalize/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PersonalizeClientConfig) => ({ apiVersion: "2018-05-22", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Personalize", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-personalize/runtimeConfig.ts b/clients/client-personalize/runtimeConfig.ts index bb828983114e..f026a0a3e4b0 100644 --- a/clients/client-personalize/runtimeConfig.ts +++ b/clients/client-personalize/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PersonalizeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PersonalizeClientConfig } from "./PersonalizeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PersonalizeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pi/PIClient.ts b/clients/client-pi/PIClient.ts index 6520a88952c2..ac2e49a561f8 100644 --- a/clients/client-pi/PIClient.ts +++ b/clients/client-pi/PIClient.ts @@ -7,7 +7,7 @@ import { GetDimensionKeyDetailsCommandOutput, } from "./commands/GetDimensionKeyDetailsCommand"; import { GetResourceMetricsCommandInput, GetResourceMetricsCommandOutput } from "./commands/GetResourceMetricsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -244,10 +244,7 @@ export class PIClient extends __Client< readonly config: PIClientResolvedConfig; constructor(configuration: PIClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-pi/runtimeConfig.browser.ts b/clients/client-pi/runtimeConfig.browser.ts index 90bd4d7b1b3b..58e8cf8ad8f4 100644 --- a/clients/client-pi/runtimeConfig.browser.ts +++ b/clients/client-pi/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PIClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PIClientConfig } from "./PIClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PIClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pi/runtimeConfig.native.ts b/clients/client-pi/runtimeConfig.native.ts index 11a8066cef75..4015f2544017 100644 --- a/clients/client-pi/runtimeConfig.native.ts +++ b/clients/client-pi/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PIClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PIClientConfig } from "./PIClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PIClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-pi/runtimeConfig.shared.ts b/clients/client-pi/runtimeConfig.shared.ts index 9fb214f4a757..d1c0828d25a0 100644 --- a/clients/client-pi/runtimeConfig.shared.ts +++ b/clients/client-pi/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PIClientConfig) => ({ apiVersion: "2018-02-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "PI", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-pi/runtimeConfig.ts b/clients/client-pi/runtimeConfig.ts index e0169f2944a0..f638ef945510 100644 --- a/clients/client-pi/runtimeConfig.ts +++ b/clients/client-pi/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PIClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PIClientConfig } from "./PIClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PIClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pinpoint-email/PinpointEmailClient.ts b/clients/client-pinpoint-email/PinpointEmailClient.ts index f4a000e62598..3ceb999ec50b 100644 --- a/clients/client-pinpoint-email/PinpointEmailClient.ts +++ b/clients/client-pinpoint-email/PinpointEmailClient.ts @@ -145,7 +145,7 @@ import { UpdateConfigurationSetEventDestinationCommandInput, UpdateConfigurationSetEventDestinationCommandOutput, } from "./commands/UpdateConfigurationSetEventDestinationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -467,10 +467,7 @@ export class PinpointEmailClient extends __Client< readonly config: PinpointEmailClientResolvedConfig; constructor(configuration: PinpointEmailClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-pinpoint-email/runtimeConfig.browser.ts b/clients/client-pinpoint-email/runtimeConfig.browser.ts index 647563ad0721..044f652b2c44 100644 --- a/clients/client-pinpoint-email/runtimeConfig.browser.ts +++ b/clients/client-pinpoint-email/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PinpointEmailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PinpointEmailClientConfig } from "./PinpointEmailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pinpoint-email/runtimeConfig.native.ts b/clients/client-pinpoint-email/runtimeConfig.native.ts index cdb13c1bcf66..b4fce4cb0e12 100644 --- a/clients/client-pinpoint-email/runtimeConfig.native.ts +++ b/clients/client-pinpoint-email/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PinpointEmailClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PinpointEmailClientConfig } from "./PinpointEmailClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-pinpoint-email/runtimeConfig.shared.ts b/clients/client-pinpoint-email/runtimeConfig.shared.ts index de8852d9f20c..999604c9bef4 100644 --- a/clients/client-pinpoint-email/runtimeConfig.shared.ts +++ b/clients/client-pinpoint-email/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PinpointEmailClientConfig) => ({ apiVersion: "2018-07-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Pinpoint Email", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-pinpoint-email/runtimeConfig.ts b/clients/client-pinpoint-email/runtimeConfig.ts index 2b72c5069f0a..767db04f3ab6 100644 --- a/clients/client-pinpoint-email/runtimeConfig.ts +++ b/clients/client-pinpoint-email/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PinpointEmailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PinpointEmailClientConfig } from "./PinpointEmailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pinpoint-sms-voice/PinpointSMSVoiceClient.ts b/clients/client-pinpoint-sms-voice/PinpointSMSVoiceClient.ts index 90bab6cad9da..e5c6ab196571 100644 --- a/clients/client-pinpoint-sms-voice/PinpointSMSVoiceClient.ts +++ b/clients/client-pinpoint-sms-voice/PinpointSMSVoiceClient.ts @@ -27,7 +27,7 @@ import { UpdateConfigurationSetEventDestinationCommandInput, UpdateConfigurationSetEventDestinationCommandOutput, } from "./commands/UpdateConfigurationSetEventDestinationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -253,10 +253,7 @@ export class PinpointSMSVoiceClient extends __Client< readonly config: PinpointSMSVoiceClientResolvedConfig; constructor(configuration: PinpointSMSVoiceClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts index 2476f7fe9100..b94b6be0fb4d 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PinpointSMSVoiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PinpointSMSVoiceClientConfig } from "./PinpointSMSVoiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts index 3d56c1332de2..8765ff11cd6b 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PinpointSMSVoiceClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PinpointSMSVoiceClientConfig } from "./PinpointSMSVoiceClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts index 63c7ba5d404f..d977240ead36 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => ({ apiVersion: "2018-09-05", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Pinpoint SMS Voice", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.ts index 3bc739fcaeab..9b463beb8401 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PinpointSMSVoiceClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PinpointSMSVoiceClientConfig } from "./PinpointSMSVoiceClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pinpoint/PinpointClient.ts b/clients/client-pinpoint/PinpointClient.ts index 4e2727f77af7..2fc8727af8fa 100644 --- a/clients/client-pinpoint/PinpointClient.ts +++ b/clients/client-pinpoint/PinpointClient.ts @@ -218,7 +218,7 @@ import { UpdateVoiceTemplateCommandInput, UpdateVoiceTemplateCommandOutput, } from "./commands/UpdateVoiceTemplateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -652,10 +652,7 @@ export class PinpointClient extends __Client< readonly config: PinpointClientResolvedConfig; constructor(configuration: PinpointClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-pinpoint/runtimeConfig.browser.ts b/clients/client-pinpoint/runtimeConfig.browser.ts index bf1457ca0883..065ccf920a7e 100644 --- a/clients/client-pinpoint/runtimeConfig.browser.ts +++ b/clients/client-pinpoint/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PinpointClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PinpointClientConfig } from "./PinpointClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PinpointClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pinpoint/runtimeConfig.native.ts b/clients/client-pinpoint/runtimeConfig.native.ts index d6d6b4d04d13..a0ff77228c81 100644 --- a/clients/client-pinpoint/runtimeConfig.native.ts +++ b/clients/client-pinpoint/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PinpointClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PinpointClientConfig } from "./PinpointClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PinpointClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-pinpoint/runtimeConfig.shared.ts b/clients/client-pinpoint/runtimeConfig.shared.ts index 37fa0bdfa688..c79df02063ca 100644 --- a/clients/client-pinpoint/runtimeConfig.shared.ts +++ b/clients/client-pinpoint/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PinpointClientConfig) => ({ apiVersion: "2016-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Pinpoint", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-pinpoint/runtimeConfig.ts b/clients/client-pinpoint/runtimeConfig.ts index d41d9c046509..9eba058728c0 100644 --- a/clients/client-pinpoint/runtimeConfig.ts +++ b/clients/client-pinpoint/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PinpointClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PinpointClientConfig } from "./PinpointClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PinpointClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-polly/PollyClient.ts b/clients/client-polly/PollyClient.ts index bf1021020b9c..de1ffca49685 100644 --- a/clients/client-polly/PollyClient.ts +++ b/clients/client-polly/PollyClient.ts @@ -16,7 +16,7 @@ import { StartSpeechSynthesisTaskCommandOutput, } from "./commands/StartSpeechSynthesisTaskCommand"; import { SynthesizeSpeechCommandInput, SynthesizeSpeechCommandOutput } from "./commands/SynthesizeSpeechCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -249,10 +249,7 @@ export class PollyClient extends __Client< readonly config: PollyClientResolvedConfig; constructor(configuration: PollyClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-polly/runtimeConfig.browser.ts b/clients/client-polly/runtimeConfig.browser.ts index f87d3d85da8f..4f9870929b46 100644 --- a/clients/client-polly/runtimeConfig.browser.ts +++ b/clients/client-polly/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PollyClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PollyClientConfig } from "./PollyClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PollyClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-polly/runtimeConfig.native.ts b/clients/client-polly/runtimeConfig.native.ts index e52b214696d9..8b2c6c14e77f 100644 --- a/clients/client-polly/runtimeConfig.native.ts +++ b/clients/client-polly/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PollyClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PollyClientConfig } from "./PollyClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PollyClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-polly/runtimeConfig.shared.ts b/clients/client-polly/runtimeConfig.shared.ts index e0d76344686d..9ad20ca4a96e 100644 --- a/clients/client-polly/runtimeConfig.shared.ts +++ b/clients/client-polly/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PollyClientConfig) => ({ apiVersion: "2016-06-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Polly", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-polly/runtimeConfig.ts b/clients/client-polly/runtimeConfig.ts index a8ce17ee39f8..a7f9e0f378f3 100644 --- a/clients/client-polly/runtimeConfig.ts +++ b/clients/client-polly/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PollyClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PollyClientConfig } from "./PollyClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PollyClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pricing/PricingClient.ts b/clients/client-pricing/PricingClient.ts index 42c44ba6e54e..874df9c70565 100644 --- a/clients/client-pricing/PricingClient.ts +++ b/clients/client-pricing/PricingClient.ts @@ -1,7 +1,7 @@ import { DescribeServicesCommandInput, DescribeServicesCommandOutput } from "./commands/DescribeServicesCommand"; import { GetAttributeValuesCommandInput, GetAttributeValuesCommandOutput } from "./commands/GetAttributeValuesCommand"; import { GetProductsCommandInput, GetProductsCommandOutput } from "./commands/GetProductsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -237,10 +237,7 @@ export class PricingClient extends __Client< readonly config: PricingClientResolvedConfig; constructor(configuration: PricingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-pricing/runtimeConfig.browser.ts b/clients/client-pricing/runtimeConfig.browser.ts index c776ea152996..23a123eefc17 100644 --- a/clients/client-pricing/runtimeConfig.browser.ts +++ b/clients/client-pricing/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./PricingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PricingClientConfig } from "./PricingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PricingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-pricing/runtimeConfig.native.ts b/clients/client-pricing/runtimeConfig.native.ts index 6c701816537d..7d2ae936ec5e 100644 --- a/clients/client-pricing/runtimeConfig.native.ts +++ b/clients/client-pricing/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./PricingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { PricingClientConfig } from "./PricingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: PricingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-pricing/runtimeConfig.shared.ts b/clients/client-pricing/runtimeConfig.shared.ts index df1013512902..e0f5f13d2fd1 100644 --- a/clients/client-pricing/runtimeConfig.shared.ts +++ b/clients/client-pricing/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: PricingClientConfig) => ({ apiVersion: "2017-10-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Pricing", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-pricing/runtimeConfig.ts b/clients/client-pricing/runtimeConfig.ts index f4a10469fca3..809a741c840b 100644 --- a/clients/client-pricing/runtimeConfig.ts +++ b/clients/client-pricing/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./PricingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { PricingClientConfig } from "./PricingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: PricingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-proton/ProtonClient.ts b/clients/client-proton/ProtonClient.ts index 2dece9651356..6002619005c2 100644 --- a/clients/client-proton/ProtonClient.ts +++ b/clients/client-proton/ProtonClient.ts @@ -149,7 +149,7 @@ import { UpdateServiceTemplateVersionCommandInput, UpdateServiceTemplateVersionCommandOutput, } from "./commands/UpdateServiceTemplateVersionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -554,10 +554,7 @@ export class ProtonClient extends __Client< readonly config: ProtonClientResolvedConfig; constructor(configuration: ProtonClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-proton/runtimeConfig.browser.ts b/clients/client-proton/runtimeConfig.browser.ts index b486e90696b9..37363e5753d9 100644 --- a/clients/client-proton/runtimeConfig.browser.ts +++ b/clients/client-proton/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ProtonClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ProtonClientConfig } from "./ProtonClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ProtonClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-proton/runtimeConfig.native.ts b/clients/client-proton/runtimeConfig.native.ts index 3389a1caaa41..d4c88e4e15d6 100644 --- a/clients/client-proton/runtimeConfig.native.ts +++ b/clients/client-proton/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ProtonClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ProtonClientConfig } from "./ProtonClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ProtonClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-proton/runtimeConfig.shared.ts b/clients/client-proton/runtimeConfig.shared.ts index e84e76f16160..e8adb689433e 100644 --- a/clients/client-proton/runtimeConfig.shared.ts +++ b/clients/client-proton/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ProtonClientConfig) => ({ apiVersion: "2020-07-20", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Proton", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-proton/runtimeConfig.ts b/clients/client-proton/runtimeConfig.ts index 0f6582398340..64b1c5f789a9 100644 --- a/clients/client-proton/runtimeConfig.ts +++ b/clients/client-proton/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ProtonClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ProtonClientConfig } from "./ProtonClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ProtonClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-qldb-session/QLDBSessionClient.ts b/clients/client-qldb-session/QLDBSessionClient.ts index 8e118fd86d6d..fbd6134f0edc 100644 --- a/clients/client-qldb-session/QLDBSessionClient.ts +++ b/clients/client-qldb-session/QLDBSessionClient.ts @@ -1,5 +1,5 @@ import { SendCommandCommandInput, SendCommandCommandOutput } from "./commands/SendCommandCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -229,10 +229,7 @@ export class QLDBSessionClient extends __Client< readonly config: QLDBSessionClientResolvedConfig; constructor(configuration: QLDBSessionClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-qldb-session/runtimeConfig.browser.ts b/clients/client-qldb-session/runtimeConfig.browser.ts index 841fb43bf55c..67f7f77fb639 100644 --- a/clients/client-qldb-session/runtimeConfig.browser.ts +++ b/clients/client-qldb-session/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./QLDBSessionClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QLDBSessionClientConfig } from "./QLDBSessionClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-qldb-session/runtimeConfig.native.ts b/clients/client-qldb-session/runtimeConfig.native.ts index f9ad547e3586..55bd445cc116 100644 --- a/clients/client-qldb-session/runtimeConfig.native.ts +++ b/clients/client-qldb-session/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./QLDBSessionClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { QLDBSessionClientConfig } from "./QLDBSessionClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-qldb-session/runtimeConfig.shared.ts b/clients/client-qldb-session/runtimeConfig.shared.ts index 6bc14536a485..98f169fb8f64 100644 --- a/clients/client-qldb-session/runtimeConfig.shared.ts +++ b/clients/client-qldb-session/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: QLDBSessionClientConfig) => ({ apiVersion: "2019-07-11", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "QLDB Session", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-qldb-session/runtimeConfig.ts b/clients/client-qldb-session/runtimeConfig.ts index 0ecab1b7ec22..894b7573b477 100644 --- a/clients/client-qldb-session/runtimeConfig.ts +++ b/clients/client-qldb-session/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./QLDBSessionClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QLDBSessionClientConfig } from "./QLDBSessionClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-qldb/QLDBClient.ts b/clients/client-qldb/QLDBClient.ts index 7d3e15fe36b0..933c9ca582fe 100644 --- a/clients/client-qldb/QLDBClient.ts +++ b/clients/client-qldb/QLDBClient.ts @@ -45,7 +45,7 @@ import { UpdateLedgerPermissionsModeCommandInput, UpdateLedgerPermissionsModeCommandOutput, } from "./commands/UpdateLedgerPermissionsModeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -295,10 +295,7 @@ export class QLDBClient extends __Client< readonly config: QLDBClientResolvedConfig; constructor(configuration: QLDBClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-qldb/runtimeConfig.browser.ts b/clients/client-qldb/runtimeConfig.browser.ts index 497024b3b96c..6b21628b8fc3 100644 --- a/clients/client-qldb/runtimeConfig.browser.ts +++ b/clients/client-qldb/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./QLDBClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QLDBClientConfig } from "./QLDBClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QLDBClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-qldb/runtimeConfig.native.ts b/clients/client-qldb/runtimeConfig.native.ts index 6f2635ab1903..c5aa5cd97bb8 100644 --- a/clients/client-qldb/runtimeConfig.native.ts +++ b/clients/client-qldb/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./QLDBClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { QLDBClientConfig } from "./QLDBClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: QLDBClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-qldb/runtimeConfig.shared.ts b/clients/client-qldb/runtimeConfig.shared.ts index 2ff37bf3087a..927d2bedc039 100644 --- a/clients/client-qldb/runtimeConfig.shared.ts +++ b/clients/client-qldb/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: QLDBClientConfig) => ({ apiVersion: "2019-01-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "QLDB", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-qldb/runtimeConfig.ts b/clients/client-qldb/runtimeConfig.ts index 01e70fae5142..1dcf0b86b271 100644 --- a/clients/client-qldb/runtimeConfig.ts +++ b/clients/client-qldb/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./QLDBClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QLDBClientConfig } from "./QLDBClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QLDBClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-quicksight/QuickSightClient.ts b/clients/client-quicksight/QuickSightClient.ts index 5734aa26b86f..ed9bba70dbe3 100644 --- a/clients/client-quicksight/QuickSightClient.ts +++ b/clients/client-quicksight/QuickSightClient.ts @@ -238,7 +238,7 @@ import { UpdateThemePermissionsCommandOutput, } from "./commands/UpdateThemePermissionsCommand"; import { UpdateUserCommandInput, UpdateUserCommandOutput } from "./commands/UpdateUserCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -674,10 +674,7 @@ export class QuickSightClient extends __Client< readonly config: QuickSightClientResolvedConfig; constructor(configuration: QuickSightClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-quicksight/runtimeConfig.browser.ts b/clients/client-quicksight/runtimeConfig.browser.ts index 3a34d337e143..e377a4a75d1e 100644 --- a/clients/client-quicksight/runtimeConfig.browser.ts +++ b/clients/client-quicksight/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./QuickSightClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QuickSightClientConfig } from "./QuickSightClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QuickSightClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-quicksight/runtimeConfig.native.ts b/clients/client-quicksight/runtimeConfig.native.ts index fbbae6cb3eee..32c13d7598c0 100644 --- a/clients/client-quicksight/runtimeConfig.native.ts +++ b/clients/client-quicksight/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./QuickSightClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { QuickSightClientConfig } from "./QuickSightClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: QuickSightClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-quicksight/runtimeConfig.shared.ts b/clients/client-quicksight/runtimeConfig.shared.ts index ddcb54d0b773..82fa0be9b2ab 100644 --- a/clients/client-quicksight/runtimeConfig.shared.ts +++ b/clients/client-quicksight/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: QuickSightClientConfig) => ({ apiVersion: "2018-04-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "QuickSight", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-quicksight/runtimeConfig.ts b/clients/client-quicksight/runtimeConfig.ts index 6631fc718a86..9f4507e7aa59 100644 --- a/clients/client-quicksight/runtimeConfig.ts +++ b/clients/client-quicksight/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./QuickSightClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QuickSightClientConfig } from "./QuickSightClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QuickSightClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ram/RAMClient.ts b/clients/client-ram/RAMClient.ts index 04506ecd4bf4..19d45972744f 100644 --- a/clients/client-ram/RAMClient.ts +++ b/clients/client-ram/RAMClient.ts @@ -70,7 +70,7 @@ import { UpdateResourceShareCommandInput, UpdateResourceShareCommandOutput, } from "./commands/UpdateResourceShareCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -333,10 +333,7 @@ export class RAMClient extends __Client< readonly config: RAMClientResolvedConfig; constructor(configuration: RAMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ram/runtimeConfig.browser.ts b/clients/client-ram/runtimeConfig.browser.ts index af3b44ff6adf..4fe6da9bf39f 100644 --- a/clients/client-ram/runtimeConfig.browser.ts +++ b/clients/client-ram/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RAMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RAMClientConfig } from "./RAMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RAMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ram/runtimeConfig.native.ts b/clients/client-ram/runtimeConfig.native.ts index eecfd6582e80..a8a57b775c4b 100644 --- a/clients/client-ram/runtimeConfig.native.ts +++ b/clients/client-ram/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RAMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RAMClientConfig } from "./RAMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RAMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ram/runtimeConfig.shared.ts b/clients/client-ram/runtimeConfig.shared.ts index fa901e5e4091..e990b456242e 100644 --- a/clients/client-ram/runtimeConfig.shared.ts +++ b/clients/client-ram/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RAMClientConfig) => ({ apiVersion: "2018-01-04", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "RAM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ram/runtimeConfig.ts b/clients/client-ram/runtimeConfig.ts index a62a03f6c5b9..343db7124c77 100644 --- a/clients/client-ram/runtimeConfig.ts +++ b/clients/client-ram/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RAMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RAMClientConfig } from "./RAMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RAMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-rds-data/RDSDataClient.ts b/clients/client-rds-data/RDSDataClient.ts index a4cf53fb26cf..1debec72c71c 100644 --- a/clients/client-rds-data/RDSDataClient.ts +++ b/clients/client-rds-data/RDSDataClient.ts @@ -10,7 +10,7 @@ import { RollbackTransactionCommandInput, RollbackTransactionCommandOutput, } from "./commands/RollbackTransactionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -237,10 +237,7 @@ export class RDSDataClient extends __Client< readonly config: RDSDataClientResolvedConfig; constructor(configuration: RDSDataClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-rds-data/runtimeConfig.browser.ts b/clients/client-rds-data/runtimeConfig.browser.ts index 9d2326f8289f..ca2776424a65 100644 --- a/clients/client-rds-data/runtimeConfig.browser.ts +++ b/clients/client-rds-data/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RDSDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RDSDataClientConfig } from "./RDSDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RDSDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-rds-data/runtimeConfig.native.ts b/clients/client-rds-data/runtimeConfig.native.ts index fb2b95786424..c80a2658d80e 100644 --- a/clients/client-rds-data/runtimeConfig.native.ts +++ b/clients/client-rds-data/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RDSDataClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RDSDataClientConfig } from "./RDSDataClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RDSDataClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-rds-data/runtimeConfig.shared.ts b/clients/client-rds-data/runtimeConfig.shared.ts index 3ff2a8d7f423..e1d555a38cac 100644 --- a/clients/client-rds-data/runtimeConfig.shared.ts +++ b/clients/client-rds-data/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RDSDataClientConfig) => ({ apiVersion: "2018-08-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "RDS Data", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-rds-data/runtimeConfig.ts b/clients/client-rds-data/runtimeConfig.ts index 51de16f2962d..bc666e2d58c0 100644 --- a/clients/client-rds-data/runtimeConfig.ts +++ b/clients/client-rds-data/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RDSDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RDSDataClientConfig } from "./RDSDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RDSDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-rds/RDSClient.ts b/clients/client-rds/RDSClient.ts index fc403c032375..16f316f388a8 100644 --- a/clients/client-rds/RDSClient.ts +++ b/clients/client-rds/RDSClient.ts @@ -441,7 +441,7 @@ import { StopDBInstanceAutomatedBackupsReplicationCommandOutput, } from "./commands/StopDBInstanceAutomatedBackupsReplicationCommand"; import { StopDBInstanceCommandInput, StopDBInstanceCommandOutput } from "./commands/StopDBInstanceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -981,10 +981,7 @@ export class RDSClient extends __Client< readonly config: RDSClientResolvedConfig; constructor(configuration: RDSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-rds/runtimeConfig.browser.ts b/clients/client-rds/runtimeConfig.browser.ts index fc1c6f15f3bc..b4dba2df9990 100644 --- a/clients/client-rds/runtimeConfig.browser.ts +++ b/clients/client-rds/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RDSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RDSClientConfig } from "./RDSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RDSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-rds/runtimeConfig.native.ts b/clients/client-rds/runtimeConfig.native.ts index 67e0658db553..98df5a5eb18a 100644 --- a/clients/client-rds/runtimeConfig.native.ts +++ b/clients/client-rds/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RDSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RDSClientConfig } from "./RDSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RDSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-rds/runtimeConfig.shared.ts b/clients/client-rds/runtimeConfig.shared.ts index ebe09a0fbab3..be3380eace31 100644 --- a/clients/client-rds/runtimeConfig.shared.ts +++ b/clients/client-rds/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RDSClientConfig) => ({ apiVersion: "2014-10-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "RDS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-rds/runtimeConfig.ts b/clients/client-rds/runtimeConfig.ts index 93043fa94afa..45876c0b79d8 100644 --- a/clients/client-rds/runtimeConfig.ts +++ b/clients/client-rds/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RDSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RDSClientConfig } from "./RDSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RDSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-redshift-data/RedshiftDataClient.ts b/clients/client-redshift-data/RedshiftDataClient.ts index f0de825a253c..3605714112f6 100644 --- a/clients/client-redshift-data/RedshiftDataClient.ts +++ b/clients/client-redshift-data/RedshiftDataClient.ts @@ -7,7 +7,7 @@ import { ListDatabasesCommandInput, ListDatabasesCommandOutput } from "./command import { ListSchemasCommandInput, ListSchemasCommandOutput } from "./commands/ListSchemasCommand"; import { ListStatementsCommandInput, ListStatementsCommandOutput } from "./commands/ListStatementsCommand"; import { ListTablesCommandInput, ListTablesCommandOutput } from "./commands/ListTablesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -239,10 +239,7 @@ export class RedshiftDataClient extends __Client< readonly config: RedshiftDataClientResolvedConfig; constructor(configuration: RedshiftDataClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-redshift-data/runtimeConfig.browser.ts b/clients/client-redshift-data/runtimeConfig.browser.ts index 91dcbb9f72cc..c0c0706d18a2 100644 --- a/clients/client-redshift-data/runtimeConfig.browser.ts +++ b/clients/client-redshift-data/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RedshiftDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RedshiftDataClientConfig } from "./RedshiftDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-redshift-data/runtimeConfig.native.ts b/clients/client-redshift-data/runtimeConfig.native.ts index 2c9262c2d6f7..0cf75193ab47 100644 --- a/clients/client-redshift-data/runtimeConfig.native.ts +++ b/clients/client-redshift-data/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RedshiftDataClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RedshiftDataClientConfig } from "./RedshiftDataClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-redshift-data/runtimeConfig.shared.ts b/clients/client-redshift-data/runtimeConfig.shared.ts index 98335d33cf7b..f93ca644acdc 100644 --- a/clients/client-redshift-data/runtimeConfig.shared.ts +++ b/clients/client-redshift-data/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RedshiftDataClientConfig) => ({ apiVersion: "2019-12-20", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Redshift Data", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-redshift-data/runtimeConfig.ts b/clients/client-redshift-data/runtimeConfig.ts index 7bcd91f909a5..ef6d2dbd9976 100644 --- a/clients/client-redshift-data/runtimeConfig.ts +++ b/clients/client-redshift-data/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RedshiftDataClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RedshiftDataClientConfig } from "./RedshiftDataClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-redshift/RedshiftClient.ts b/clients/client-redshift/RedshiftClient.ts index 324718833a4b..0e28d51c96fc 100644 --- a/clients/client-redshift/RedshiftClient.ts +++ b/clients/client-redshift/RedshiftClient.ts @@ -358,7 +358,7 @@ import { UpdatePartnerStatusCommandInput, UpdatePartnerStatusCommandOutput, } from "./commands/UpdatePartnerStatusCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -805,10 +805,7 @@ export class RedshiftClient extends __Client< readonly config: RedshiftClientResolvedConfig; constructor(configuration: RedshiftClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-redshift/runtimeConfig.browser.ts b/clients/client-redshift/runtimeConfig.browser.ts index e9ff0952a94e..e0564e5a8238 100644 --- a/clients/client-redshift/runtimeConfig.browser.ts +++ b/clients/client-redshift/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RedshiftClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RedshiftClientConfig } from "./RedshiftClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RedshiftClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-redshift/runtimeConfig.native.ts b/clients/client-redshift/runtimeConfig.native.ts index 1cc8faa14b02..d5aec847b22d 100644 --- a/clients/client-redshift/runtimeConfig.native.ts +++ b/clients/client-redshift/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RedshiftClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RedshiftClientConfig } from "./RedshiftClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RedshiftClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-redshift/runtimeConfig.shared.ts b/clients/client-redshift/runtimeConfig.shared.ts index a6684b231004..c081a64650bd 100644 --- a/clients/client-redshift/runtimeConfig.shared.ts +++ b/clients/client-redshift/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RedshiftClientConfig) => ({ apiVersion: "2012-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Redshift", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-redshift/runtimeConfig.ts b/clients/client-redshift/runtimeConfig.ts index 4c9e8ee38f12..335a35f02382 100644 --- a/clients/client-redshift/runtimeConfig.ts +++ b/clients/client-redshift/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RedshiftClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RedshiftClientConfig } from "./RedshiftClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RedshiftClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-rekognition/RekognitionClient.ts b/clients/client-rekognition/RekognitionClient.ts index ac5b9ba4250a..ac97222bfe19 100644 --- a/clients/client-rekognition/RekognitionClient.ts +++ b/clients/client-rekognition/RekognitionClient.ts @@ -115,7 +115,7 @@ import { } from "./commands/StopStreamProcessorCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -427,10 +427,7 @@ export class RekognitionClient extends __Client< readonly config: RekognitionClientResolvedConfig; constructor(configuration: RekognitionClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-rekognition/runtimeConfig.browser.ts b/clients/client-rekognition/runtimeConfig.browser.ts index 5051a092c127..67dd6e59172e 100644 --- a/clients/client-rekognition/runtimeConfig.browser.ts +++ b/clients/client-rekognition/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RekognitionClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RekognitionClientConfig } from "./RekognitionClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RekognitionClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-rekognition/runtimeConfig.native.ts b/clients/client-rekognition/runtimeConfig.native.ts index a3a1bc7ce534..00b1a3ceb69c 100644 --- a/clients/client-rekognition/runtimeConfig.native.ts +++ b/clients/client-rekognition/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RekognitionClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RekognitionClientConfig } from "./RekognitionClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RekognitionClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-rekognition/runtimeConfig.shared.ts b/clients/client-rekognition/runtimeConfig.shared.ts index 900a789ddb7f..bc069be4e9fc 100644 --- a/clients/client-rekognition/runtimeConfig.shared.ts +++ b/clients/client-rekognition/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RekognitionClientConfig) => ({ apiVersion: "2016-06-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Rekognition", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-rekognition/runtimeConfig.ts b/clients/client-rekognition/runtimeConfig.ts index a563446da9a8..b8a13cb64327 100644 --- a/clients/client-rekognition/runtimeConfig.ts +++ b/clients/client-rekognition/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RekognitionClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RekognitionClientConfig } from "./RekognitionClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RekognitionClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-resource-groups-tagging-api/ResourceGroupsTaggingAPIClient.ts b/clients/client-resource-groups-tagging-api/ResourceGroupsTaggingAPIClient.ts index 439e63f5b9ba..75af45d67468 100644 --- a/clients/client-resource-groups-tagging-api/ResourceGroupsTaggingAPIClient.ts +++ b/clients/client-resource-groups-tagging-api/ResourceGroupsTaggingAPIClient.ts @@ -15,7 +15,7 @@ import { } from "./commands/StartReportCreationCommand"; import { TagResourcesCommandInput, TagResourcesCommandOutput } from "./commands/TagResourcesCommand"; import { UntagResourcesCommandInput, UntagResourcesCommandOutput } from "./commands/UntagResourcesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -242,10 +242,7 @@ export class ResourceGroupsTaggingAPIClient extends __Client< readonly config: ResourceGroupsTaggingAPIClientResolvedConfig; constructor(configuration: ResourceGroupsTaggingAPIClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts index c5e343e7c5fe..2cf0c6ef5825 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ResourceGroupsTaggingAPIClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ResourceGroupsTaggingAPIClientConfig } from "./ResourceGroupsTaggingAPIClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(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 d6a4b51afc0f..72971da9999e 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ResourceGroupsTaggingAPIClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ResourceGroupsTaggingAPIClientConfig } from "./ResourceGroupsTaggingAPIClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(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 c6e15322eae7..6faf5ebddc06 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.shared.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) => ({ apiVersion: "2017-01-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Resource Groups Tagging API", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.ts index c7ea236d9516..abdcd189ba88 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ResourceGroupsTaggingAPIClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ResourceGroupsTaggingAPIClientConfig } from "./ResourceGroupsTaggingAPIClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-resource-groups/ResourceGroupsClient.ts b/clients/client-resource-groups/ResourceGroupsClient.ts index da1866107549..b38f97c6475e 100644 --- a/clients/client-resource-groups/ResourceGroupsClient.ts +++ b/clients/client-resource-groups/ResourceGroupsClient.ts @@ -20,7 +20,7 @@ import { UngroupResourcesCommandInput, UngroupResourcesCommandOutput } from "./c import { UntagCommandInput, UntagCommandOutput } from "./commands/UntagCommand"; import { UpdateGroupCommandInput, UpdateGroupCommandOutput } from "./commands/UpdateGroupCommand"; import { UpdateGroupQueryCommandInput, UpdateGroupQueryCommandOutput } from "./commands/UpdateGroupQueryCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -297,10 +297,7 @@ export class ResourceGroupsClient extends __Client< readonly config: ResourceGroupsClientResolvedConfig; constructor(configuration: ResourceGroupsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-resource-groups/runtimeConfig.browser.ts b/clients/client-resource-groups/runtimeConfig.browser.ts index fc44b1f6df83..ce9b088e5c68 100644 --- a/clients/client-resource-groups/runtimeConfig.browser.ts +++ b/clients/client-resource-groups/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ResourceGroupsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ResourceGroupsClientConfig } from "./ResourceGroupsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-resource-groups/runtimeConfig.native.ts b/clients/client-resource-groups/runtimeConfig.native.ts index f1bedafb052c..d3ebdd2048ad 100644 --- a/clients/client-resource-groups/runtimeConfig.native.ts +++ b/clients/client-resource-groups/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ResourceGroupsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ResourceGroupsClientConfig } from "./ResourceGroupsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-resource-groups/runtimeConfig.shared.ts b/clients/client-resource-groups/runtimeConfig.shared.ts index 065e0dd5ddc9..dc8652e37e10 100644 --- a/clients/client-resource-groups/runtimeConfig.shared.ts +++ b/clients/client-resource-groups/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => ({ apiVersion: "2017-11-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Resource Groups", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-resource-groups/runtimeConfig.ts b/clients/client-resource-groups/runtimeConfig.ts index ea1fe72722dc..c21da395d270 100644 --- a/clients/client-resource-groups/runtimeConfig.ts +++ b/clients/client-resource-groups/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ResourceGroupsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ResourceGroupsClientConfig } from "./ResourceGroupsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-robomaker/RoboMakerClient.ts b/clients/client-robomaker/RoboMakerClient.ts index 8d58b5928043..21df61f8cfe8 100644 --- a/clients/client-robomaker/RoboMakerClient.ts +++ b/clients/client-robomaker/RoboMakerClient.ts @@ -169,7 +169,7 @@ import { UpdateWorldTemplateCommandInput, UpdateWorldTemplateCommandOutput, } from "./commands/UpdateWorldTemplateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -493,10 +493,7 @@ export class RoboMakerClient extends __Client< readonly config: RoboMakerClientResolvedConfig; constructor(configuration: RoboMakerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-robomaker/runtimeConfig.browser.ts b/clients/client-robomaker/runtimeConfig.browser.ts index 0a13cebc10db..767652fb3038 100644 --- a/clients/client-robomaker/runtimeConfig.browser.ts +++ b/clients/client-robomaker/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RoboMakerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RoboMakerClientConfig } from "./RoboMakerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RoboMakerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-robomaker/runtimeConfig.native.ts b/clients/client-robomaker/runtimeConfig.native.ts index 4336ee14c639..420ef059da3f 100644 --- a/clients/client-robomaker/runtimeConfig.native.ts +++ b/clients/client-robomaker/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RoboMakerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RoboMakerClientConfig } from "./RoboMakerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RoboMakerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-robomaker/runtimeConfig.shared.ts b/clients/client-robomaker/runtimeConfig.shared.ts index d1feef1c5614..21258d2b06c0 100644 --- a/clients/client-robomaker/runtimeConfig.shared.ts +++ b/clients/client-robomaker/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RoboMakerClientConfig) => ({ apiVersion: "2018-06-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "RoboMaker", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-robomaker/runtimeConfig.ts b/clients/client-robomaker/runtimeConfig.ts index 19393f440b63..64f5ef11b546 100644 --- a/clients/client-robomaker/runtimeConfig.ts +++ b/clients/client-robomaker/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RoboMakerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RoboMakerClientConfig } from "./RoboMakerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RoboMakerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-route-53-domains/Route53DomainsClient.ts b/clients/client-route-53-domains/Route53DomainsClient.ts index cd9dfabc06a0..e355b7544f1d 100644 --- a/clients/client-route-53-domains/Route53DomainsClient.ts +++ b/clients/client-route-53-domains/Route53DomainsClient.ts @@ -83,7 +83,7 @@ import { UpdateTagsForDomainCommandOutput, } from "./commands/UpdateTagsForDomainCommand"; import { ViewBillingCommandInput, ViewBillingCommandOutput } from "./commands/ViewBillingCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -349,10 +349,7 @@ export class Route53DomainsClient extends __Client< readonly config: Route53DomainsClientResolvedConfig; constructor(configuration: Route53DomainsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-route-53-domains/runtimeConfig.browser.ts b/clients/client-route-53-domains/runtimeConfig.browser.ts index 9c0d12e3b6ca..25a08e2ba207 100644 --- a/clients/client-route-53-domains/runtimeConfig.browser.ts +++ b/clients/client-route-53-domains/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./Route53DomainsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Route53DomainsClientConfig } from "./Route53DomainsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-route-53-domains/runtimeConfig.native.ts b/clients/client-route-53-domains/runtimeConfig.native.ts index 904907076e03..1e6f1fbe9851 100644 --- a/clients/client-route-53-domains/runtimeConfig.native.ts +++ b/clients/client-route-53-domains/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./Route53DomainsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { Route53DomainsClientConfig } from "./Route53DomainsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-route-53-domains/runtimeConfig.shared.ts b/clients/client-route-53-domains/runtimeConfig.shared.ts index 820f242fb8ba..bd7104fee816 100644 --- a/clients/client-route-53-domains/runtimeConfig.shared.ts +++ b/clients/client-route-53-domains/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: Route53DomainsClientConfig) => ({ apiVersion: "2014-05-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Route 53 Domains", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-route-53-domains/runtimeConfig.ts b/clients/client-route-53-domains/runtimeConfig.ts index 0878faf85dab..302f646f9d10 100644 --- a/clients/client-route-53-domains/runtimeConfig.ts +++ b/clients/client-route-53-domains/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./Route53DomainsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Route53DomainsClientConfig } from "./Route53DomainsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-route-53/Route53Client.ts b/clients/client-route-53/Route53Client.ts index bfde974b5871..cf3f3be040ac 100644 --- a/clients/client-route-53/Route53Client.ts +++ b/clients/client-route-53/Route53Client.ts @@ -197,7 +197,7 @@ import { UpdateTrafficPolicyInstanceCommandInput, UpdateTrafficPolicyInstanceCommandOutput, } from "./commands/UpdateTrafficPolicyInstanceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -535,10 +535,7 @@ export class Route53Client extends __Client< readonly config: Route53ClientResolvedConfig; constructor(configuration: Route53ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-route-53/runtimeConfig.browser.ts b/clients/client-route-53/runtimeConfig.browser.ts index b7a3b0bfa98e..efac281faf8f 100644 --- a/clients/client-route-53/runtimeConfig.browser.ts +++ b/clients/client-route-53/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./Route53Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Route53ClientConfig } from "./Route53Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Route53ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-route-53/runtimeConfig.native.ts b/clients/client-route-53/runtimeConfig.native.ts index 29fe37020adf..64f58f4e9d11 100644 --- a/clients/client-route-53/runtimeConfig.native.ts +++ b/clients/client-route-53/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./Route53Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { Route53ClientConfig } from "./Route53Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: Route53ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-route-53/runtimeConfig.shared.ts b/clients/client-route-53/runtimeConfig.shared.ts index 87be3e97e761..f943de048d1c 100644 --- a/clients/client-route-53/runtimeConfig.shared.ts +++ b/clients/client-route-53/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: Route53ClientConfig) => ({ apiVersion: "2013-04-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Route 53", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-route-53/runtimeConfig.ts b/clients/client-route-53/runtimeConfig.ts index 34e209394ecb..5b8e1c442b1d 100644 --- a/clients/client-route-53/runtimeConfig.ts +++ b/clients/client-route-53/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./Route53Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Route53ClientConfig } from "./Route53Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Route53ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-route53resolver/Route53ResolverClient.ts b/clients/client-route53resolver/Route53ResolverClient.ts index 179bc547f38a..01ba00a16eeb 100644 --- a/clients/client-route53resolver/Route53ResolverClient.ts +++ b/clients/client-route53resolver/Route53ResolverClient.ts @@ -202,7 +202,7 @@ import { UpdateResolverEndpointCommandOutput, } from "./commands/UpdateResolverEndpointCommand"; import { UpdateResolverRuleCommandInput, UpdateResolverRuleCommandOutput } from "./commands/UpdateResolverRuleCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -564,10 +564,7 @@ export class Route53ResolverClient extends __Client< readonly config: Route53ResolverClientResolvedConfig; constructor(configuration: Route53ResolverClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-route53resolver/runtimeConfig.browser.ts b/clients/client-route53resolver/runtimeConfig.browser.ts index 2f5e12e09910..e29da76721d1 100644 --- a/clients/client-route53resolver/runtimeConfig.browser.ts +++ b/clients/client-route53resolver/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./Route53ResolverClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Route53ResolverClientConfig } from "./Route53ResolverClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-route53resolver/runtimeConfig.native.ts b/clients/client-route53resolver/runtimeConfig.native.ts index bfcb4a831fac..d6985490e34f 100644 --- a/clients/client-route53resolver/runtimeConfig.native.ts +++ b/clients/client-route53resolver/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./Route53ResolverClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { Route53ResolverClientConfig } from "./Route53ResolverClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-route53resolver/runtimeConfig.shared.ts b/clients/client-route53resolver/runtimeConfig.shared.ts index 2a1f9b2fc333..e3517c2243a4 100644 --- a/clients/client-route53resolver/runtimeConfig.shared.ts +++ b/clients/client-route53resolver/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: Route53ResolverClientConfig) => ({ apiVersion: "2018-04-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Route53Resolver", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-route53resolver/runtimeConfig.ts b/clients/client-route53resolver/runtimeConfig.ts index 89e709771505..ccde1fd096ca 100644 --- a/clients/client-route53resolver/runtimeConfig.ts +++ b/clients/client-route53resolver/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./Route53ResolverClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { Route53ResolverClientConfig } from "./Route53ResolverClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-s3-control/S3ControlClient.ts b/clients/client-s3-control/S3ControlClient.ts index 3e1beffac42b..a632ba710305 100644 --- a/clients/client-s3-control/S3ControlClient.ts +++ b/clients/client-s3-control/S3ControlClient.ts @@ -134,7 +134,7 @@ import { } from "./commands/PutStorageLensConfigurationTaggingCommand"; import { UpdateJobPriorityCommandInput, UpdateJobPriorityCommandOutput } from "./commands/UpdateJobPriorityCommand"; import { UpdateJobStatusCommandInput, UpdateJobStatusCommandOutput } from "./commands/UpdateJobStatusCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -468,10 +468,7 @@ export class S3ControlClient extends __Client< readonly config: S3ControlClientResolvedConfig; constructor(configuration: S3ControlClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-s3-control/runtimeConfig.browser.ts b/clients/client-s3-control/runtimeConfig.browser.ts index e087b34e1f70..e2ebfee2f28d 100644 --- a/clients/client-s3-control/runtimeConfig.browser.ts +++ b/clients/client-s3-control/runtimeConfig.browser.ts @@ -6,35 +6,42 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./S3ControlClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { S3ControlClientConfig } from "./S3ControlClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - md5: Md5, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - streamHasher, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: S3ControlClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.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), + }; }; diff --git a/clients/client-s3-control/runtimeConfig.native.ts b/clients/client-s3-control/runtimeConfig.native.ts index 7d827c755a49..a7d1ac2fb9cd 100644 --- a/clients/client-s3-control/runtimeConfig.native.ts +++ b/clients/client-s3-control/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./S3ControlClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { S3ControlClientConfig } from "./S3ControlClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: S3ControlClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-s3-control/runtimeConfig.shared.ts b/clients/client-s3-control/runtimeConfig.shared.ts index 8c5a64d60848..31de9c02513c 100644 --- a/clients/client-s3-control/runtimeConfig.shared.ts +++ b/clients/client-s3-control/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: S3ControlClientConfig) => ({ apiVersion: "2018-08-20", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "S3 Control", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-s3-control/runtimeConfig.ts b/clients/client-s3-control/runtimeConfig.ts index d98b9a100a47..e4cc864de224 100644 --- a/clients/client-s3-control/runtimeConfig.ts +++ b/clients/client-s3-control/runtimeConfig.ts @@ -8,36 +8,43 @@ 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"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./S3ControlClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { S3ControlClientConfig } from "./S3ControlClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - md5: Hash.bind(null, "md5"), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - streamHasher, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: S3ControlClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.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), + }; }; diff --git a/clients/client-s3/S3Client.ts b/clients/client-s3/S3Client.ts index e9ffc5d86e23..c3951dee2752 100644 --- a/clients/client-s3/S3Client.ts +++ b/clients/client-s3/S3Client.ts @@ -243,7 +243,7 @@ import { WriteGetObjectResponseCommandInput, WriteGetObjectResponseCommandOutput, } from "./commands/WriteGetObjectResponseCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -684,10 +684,7 @@ export class S3Client extends __Client< readonly config: S3ClientResolvedConfig; constructor(configuration: S3ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-s3/runtimeConfig.browser.ts b/clients/client-s3/runtimeConfig.browser.ts index 11456b9b8f93..e2d776265092 100644 --- a/clients/client-s3/runtimeConfig.browser.ts +++ b/clients/client-s3/runtimeConfig.browser.ts @@ -7,36 +7,43 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./S3Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { S3ClientConfig } from "./S3Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamSerdeProvider, - maxAttempts: DEFAULT_MAX_ATTEMPTS, - md5: Md5, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - streamHasher, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: S3ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-s3/runtimeConfig.native.ts b/clients/client-s3/runtimeConfig.native.ts index ebb0239b47e5..8efb9ec87db3 100644 --- a/clients/client-s3/runtimeConfig.native.ts +++ b/clients/client-s3/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./S3Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { S3ClientConfig } from "./S3Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: S3ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-s3/runtimeConfig.shared.ts b/clients/client-s3/runtimeConfig.shared.ts index 7e2a09ffe840..092315d57639 100644 --- a/clients/client-s3/runtimeConfig.shared.ts +++ b/clients/client-s3/runtimeConfig.shared.ts @@ -1,17 +1,19 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: S3ClientConfig) => ({ apiVersion: "2006-03-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "S3", - signingEscapePath: false, - urlParser: parseUrl, - useArnRegion: false, -}; + 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), +}); diff --git a/clients/client-s3/runtimeConfig.ts b/clients/client-s3/runtimeConfig.ts index 9af9826f6a49..efbf888ece9c 100644 --- a/clients/client-s3/runtimeConfig.ts +++ b/clients/client-s3/runtimeConfig.ts @@ -10,38 +10,45 @@ 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"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./S3Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { S3ClientConfig } from "./S3Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamSerdeProvider, - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - md5: Hash.bind(null, "md5"), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - streamHasher, - useArnRegion: loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS), - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: S3ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-s3outposts/S3OutpostsClient.ts b/clients/client-s3outposts/S3OutpostsClient.ts index e732af59542b..216f3b797d0f 100644 --- a/clients/client-s3outposts/S3OutpostsClient.ts +++ b/clients/client-s3outposts/S3OutpostsClient.ts @@ -1,7 +1,7 @@ import { CreateEndpointCommandInput, CreateEndpointCommandOutput } from "./commands/CreateEndpointCommand"; import { DeleteEndpointCommandInput, DeleteEndpointCommandOutput } from "./commands/DeleteEndpointCommand"; import { ListEndpointsCommandInput, ListEndpointsCommandOutput } from "./commands/ListEndpointsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -211,10 +211,7 @@ export class S3OutpostsClient extends __Client< readonly config: S3OutpostsClientResolvedConfig; constructor(configuration: S3OutpostsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-s3outposts/runtimeConfig.browser.ts b/clients/client-s3outposts/runtimeConfig.browser.ts index afab6fb00e75..6b85b3db64a0 100644 --- a/clients/client-s3outposts/runtimeConfig.browser.ts +++ b/clients/client-s3outposts/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./S3OutpostsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { S3OutpostsClientConfig } from "./S3OutpostsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-s3outposts/runtimeConfig.native.ts b/clients/client-s3outposts/runtimeConfig.native.ts index 90497e24b1f1..d182168dbc5b 100644 --- a/clients/client-s3outposts/runtimeConfig.native.ts +++ b/clients/client-s3outposts/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./S3OutpostsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { S3OutpostsClientConfig } from "./S3OutpostsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-s3outposts/runtimeConfig.shared.ts b/clients/client-s3outposts/runtimeConfig.shared.ts index d9c795291721..d4984129669d 100644 --- a/clients/client-s3outposts/runtimeConfig.shared.ts +++ b/clients/client-s3outposts/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: S3OutpostsClientConfig) => ({ apiVersion: "2017-07-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "S3Outposts", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-s3outposts/runtimeConfig.ts b/clients/client-s3outposts/runtimeConfig.ts index 56149283bd7b..4f333a5049ed 100644 --- a/clients/client-s3outposts/runtimeConfig.ts +++ b/clients/client-s3outposts/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./S3OutpostsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { S3OutpostsClientConfig } from "./S3OutpostsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-a2i-runtime/SageMakerA2IRuntimeClient.ts b/clients/client-sagemaker-a2i-runtime/SageMakerA2IRuntimeClient.ts index e135fac78054..9106f8a64fd1 100644 --- a/clients/client-sagemaker-a2i-runtime/SageMakerA2IRuntimeClient.ts +++ b/clients/client-sagemaker-a2i-runtime/SageMakerA2IRuntimeClient.ts @@ -3,7 +3,7 @@ import { DescribeHumanLoopCommandInput, DescribeHumanLoopCommandOutput } from ". import { ListHumanLoopsCommandInput, ListHumanLoopsCommandOutput } from "./commands/ListHumanLoopsCommand"; import { StartHumanLoopCommandInput, StartHumanLoopCommandOutput } from "./commands/StartHumanLoopCommand"; import { StopHumanLoopCommandInput, StopHumanLoopCommandOutput } from "./commands/StopHumanLoopCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -248,10 +248,7 @@ export class SageMakerA2IRuntimeClient extends __Client< readonly config: SageMakerA2IRuntimeClientResolvedConfig; constructor(configuration: SageMakerA2IRuntimeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts index da940f30a05b..2018025cfc0c 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SageMakerA2IRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerA2IRuntimeClientConfig } from "./SageMakerA2IRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts index 5e177fd876b9..36fc446f16d8 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SageMakerA2IRuntimeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SageMakerA2IRuntimeClientConfig } from "./SageMakerA2IRuntimeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts index e40c60915db1..796d751ad1d1 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => ({ apiVersion: "2019-11-07", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SageMaker A2I Runtime", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts index ad1e99f8e9fa..7bb8c5fb3a94 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SageMakerA2IRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerA2IRuntimeClientConfig } from "./SageMakerA2IRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-edge/SagemakerEdgeClient.ts b/clients/client-sagemaker-edge/SagemakerEdgeClient.ts index 7fac7ee449b9..684750aaa836 100644 --- a/clients/client-sagemaker-edge/SagemakerEdgeClient.ts +++ b/clients/client-sagemaker-edge/SagemakerEdgeClient.ts @@ -3,7 +3,7 @@ import { GetDeviceRegistrationCommandOutput, } from "./commands/GetDeviceRegistrationCommand"; import { SendHeartbeatCommandInput, SendHeartbeatCommandOutput } from "./commands/SendHeartbeatCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -213,10 +213,7 @@ export class SagemakerEdgeClient extends __Client< readonly config: SagemakerEdgeClientResolvedConfig; constructor(configuration: SagemakerEdgeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sagemaker-edge/runtimeConfig.browser.ts b/clients/client-sagemaker-edge/runtimeConfig.browser.ts index 6a18d25ed633..0bca073628be 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SagemakerEdgeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-edge/runtimeConfig.native.ts b/clients/client-sagemaker-edge/runtimeConfig.native.ts index a073acc21575..f25034e47995 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.native.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SagemakerEdgeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sagemaker-edge/runtimeConfig.shared.ts b/clients/client-sagemaker-edge/runtimeConfig.shared.ts index 3e1755c52b82..8d3ce59c69b5 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => ({ apiVersion: "2020-09-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Sagemaker Edge", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sagemaker-edge/runtimeConfig.ts b/clients/client-sagemaker-edge/runtimeConfig.ts index 6c0d45c72e13..60f546bb05e1 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SagemakerEdgeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SagemakerEdgeClientConfig } from "./SagemakerEdgeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-featurestore-runtime/SageMakerFeatureStoreRuntimeClient.ts b/clients/client-sagemaker-featurestore-runtime/SageMakerFeatureStoreRuntimeClient.ts index 12090237c2f3..72f7b360d950 100644 --- a/clients/client-sagemaker-featurestore-runtime/SageMakerFeatureStoreRuntimeClient.ts +++ b/clients/client-sagemaker-featurestore-runtime/SageMakerFeatureStoreRuntimeClient.ts @@ -2,7 +2,7 @@ import { BatchGetRecordCommandInput, BatchGetRecordCommandOutput } from "./comma import { DeleteRecordCommandInput, DeleteRecordCommandOutput } from "./commands/DeleteRecordCommand"; import { GetRecordCommandInput, GetRecordCommandOutput } from "./commands/GetRecordCommand"; import { PutRecordCommandInput, PutRecordCommandOutput } from "./commands/PutRecordCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -247,10 +247,7 @@ export class SageMakerFeatureStoreRuntimeClient extends __Client< readonly config: SageMakerFeatureStoreRuntimeClientResolvedConfig; constructor(configuration: SageMakerFeatureStoreRuntimeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts index befe1304e5af..dc78beb9c19d 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SageMakerFeatureStoreRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerFeatureStoreRuntimeClientConfig } from "./SageMakerFeatureStoreRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts index 40526c262fb0..4b37f7bb7f88 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SageMakerFeatureStoreRuntimeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SageMakerFeatureStoreRuntimeClientConfig } from "./SageMakerFeatureStoreRuntimeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts index c0eb819f6060..508c7214ef53 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfig) => ({ apiVersion: "2020-07-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SageMaker FeatureStore Runtime", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts index 3a7d298e2099..f536787204c9 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SageMakerFeatureStoreRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerFeatureStoreRuntimeClientConfig } from "./SageMakerFeatureStoreRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-runtime/SageMakerRuntimeClient.ts b/clients/client-sagemaker-runtime/SageMakerRuntimeClient.ts index e2c29d451c84..b1b6dcd207f8 100644 --- a/clients/client-sagemaker-runtime/SageMakerRuntimeClient.ts +++ b/clients/client-sagemaker-runtime/SageMakerRuntimeClient.ts @@ -1,5 +1,5 @@ import { InvokeEndpointCommandInput, InvokeEndpointCommandOutput } from "./commands/InvokeEndpointCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -209,10 +209,7 @@ export class SageMakerRuntimeClient extends __Client< readonly config: SageMakerRuntimeClientResolvedConfig; constructor(configuration: SageMakerRuntimeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sagemaker-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-runtime/runtimeConfig.browser.ts index 9e4d94da098c..b8a2f96f9c87 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SageMakerRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-runtime/runtimeConfig.native.ts index 51a4f4f9c2b4..a97a0f1d4c7a 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SageMakerRuntimeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sagemaker-runtime/runtimeConfig.shared.ts b/clients/client-sagemaker-runtime/runtimeConfig.shared.ts index 997ccd3d0cdc..43c8684ed0e9 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.shared.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => ({ apiVersion: "2017-05-13", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SageMaker Runtime", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sagemaker-runtime/runtimeConfig.ts b/clients/client-sagemaker-runtime/runtimeConfig.ts index d262cc7b0642..1c26b0a1abc6 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SageMakerRuntimeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker/SageMakerClient.ts b/clients/client-sagemaker/SageMakerClient.ts index 7e59731923b9..f858c3e97947 100644 --- a/clients/client-sagemaker/SageMakerClient.ts +++ b/clients/client-sagemaker/SageMakerClient.ts @@ -572,7 +572,7 @@ import { import { UpdateUserProfileCommandInput, UpdateUserProfileCommandOutput } from "./commands/UpdateUserProfileCommand"; import { UpdateWorkforceCommandInput, UpdateWorkforceCommandOutput } from "./commands/UpdateWorkforceCommand"; import { UpdateWorkteamCommandInput, UpdateWorkteamCommandOutput } from "./commands/UpdateWorkteamCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -1267,10 +1267,7 @@ export class SageMakerClient extends __Client< readonly config: SageMakerClientResolvedConfig; constructor(configuration: SageMakerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sagemaker/runtimeConfig.browser.ts b/clients/client-sagemaker/runtimeConfig.browser.ts index 97543318eeb2..be22313138b4 100644 --- a/clients/client-sagemaker/runtimeConfig.browser.ts +++ b/clients/client-sagemaker/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SageMakerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerClientConfig } from "./SageMakerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sagemaker/runtimeConfig.native.ts b/clients/client-sagemaker/runtimeConfig.native.ts index b9f956a952f5..b556688a4e0d 100644 --- a/clients/client-sagemaker/runtimeConfig.native.ts +++ b/clients/client-sagemaker/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SageMakerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SageMakerClientConfig } from "./SageMakerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SageMakerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sagemaker/runtimeConfig.shared.ts b/clients/client-sagemaker/runtimeConfig.shared.ts index 155d6a2849e8..175584c27044 100644 --- a/clients/client-sagemaker/runtimeConfig.shared.ts +++ b/clients/client-sagemaker/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SageMakerClientConfig) => ({ apiVersion: "2017-07-24", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SageMaker", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sagemaker/runtimeConfig.ts b/clients/client-sagemaker/runtimeConfig.ts index 79addccb4529..0b8b485ce4cd 100644 --- a/clients/client-sagemaker/runtimeConfig.ts +++ b/clients/client-sagemaker/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SageMakerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SageMakerClientConfig } from "./SageMakerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SageMakerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-savingsplans/SavingsplansClient.ts b/clients/client-savingsplans/SavingsplansClient.ts index 1027eb616a92..0077ddafe619 100644 --- a/clients/client-savingsplans/SavingsplansClient.ts +++ b/clients/client-savingsplans/SavingsplansClient.ts @@ -25,7 +25,7 @@ import { } from "./commands/ListTagsForResourceCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -256,10 +256,7 @@ export class SavingsplansClient extends __Client< readonly config: SavingsplansClientResolvedConfig; constructor(configuration: SavingsplansClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-savingsplans/runtimeConfig.browser.ts b/clients/client-savingsplans/runtimeConfig.browser.ts index 454c97c06096..45f5967ffbb7 100644 --- a/clients/client-savingsplans/runtimeConfig.browser.ts +++ b/clients/client-savingsplans/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SavingsplansClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SavingsplansClientConfig } from "./SavingsplansClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SavingsplansClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-savingsplans/runtimeConfig.native.ts b/clients/client-savingsplans/runtimeConfig.native.ts index 7f5969165662..bf3759005ba9 100644 --- a/clients/client-savingsplans/runtimeConfig.native.ts +++ b/clients/client-savingsplans/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SavingsplansClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SavingsplansClientConfig } from "./SavingsplansClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SavingsplansClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-savingsplans/runtimeConfig.shared.ts b/clients/client-savingsplans/runtimeConfig.shared.ts index d1267e3c9b70..98f5cf4e93ed 100644 --- a/clients/client-savingsplans/runtimeConfig.shared.ts +++ b/clients/client-savingsplans/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SavingsplansClientConfig) => ({ apiVersion: "2019-06-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "savingsplans", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-savingsplans/runtimeConfig.ts b/clients/client-savingsplans/runtimeConfig.ts index 57ffd6ebed5e..52c572fef626 100644 --- a/clients/client-savingsplans/runtimeConfig.ts +++ b/clients/client-savingsplans/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SavingsplansClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SavingsplansClientConfig } from "./SavingsplansClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SavingsplansClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-schemas/SchemasClient.ts b/clients/client-schemas/SchemasClient.ts index 54c607155929..defb9aa2df72 100644 --- a/clients/client-schemas/SchemasClient.ts +++ b/clients/client-schemas/SchemasClient.ts @@ -47,7 +47,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateDiscovererCommandInput, UpdateDiscovererCommandOutput } from "./commands/UpdateDiscovererCommand"; import { UpdateRegistryCommandInput, UpdateRegistryCommandOutput } from "./commands/UpdateRegistryCommand"; import { UpdateSchemaCommandInput, UpdateSchemaCommandOutput } from "./commands/UpdateSchemaCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -319,10 +319,7 @@ export class SchemasClient extends __Client< readonly config: SchemasClientResolvedConfig; constructor(configuration: SchemasClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-schemas/runtimeConfig.browser.ts b/clients/client-schemas/runtimeConfig.browser.ts index a574f433d2f7..6364c5699d11 100644 --- a/clients/client-schemas/runtimeConfig.browser.ts +++ b/clients/client-schemas/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SchemasClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SchemasClientConfig } from "./SchemasClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SchemasClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-schemas/runtimeConfig.native.ts b/clients/client-schemas/runtimeConfig.native.ts index 7412626d064e..9ba5924e7b1a 100644 --- a/clients/client-schemas/runtimeConfig.native.ts +++ b/clients/client-schemas/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SchemasClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SchemasClientConfig } from "./SchemasClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SchemasClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-schemas/runtimeConfig.shared.ts b/clients/client-schemas/runtimeConfig.shared.ts index f0ce6be7b356..ee08e57f34bf 100644 --- a/clients/client-schemas/runtimeConfig.shared.ts +++ b/clients/client-schemas/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SchemasClientConfig) => ({ apiVersion: "2019-12-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "schemas", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-schemas/runtimeConfig.ts b/clients/client-schemas/runtimeConfig.ts index 775ba42c17ee..293220c6081e 100644 --- a/clients/client-schemas/runtimeConfig.ts +++ b/clients/client-schemas/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SchemasClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SchemasClientConfig } from "./SchemasClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SchemasClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-secrets-manager/SecretsManagerClient.ts b/clients/client-secrets-manager/SecretsManagerClient.ts index 039935d938aa..721f45bdd3dd 100644 --- a/clients/client-secrets-manager/SecretsManagerClient.ts +++ b/clients/client-secrets-manager/SecretsManagerClient.ts @@ -41,7 +41,7 @@ import { ValidateResourcePolicyCommandInput, ValidateResourcePolicyCommandOutput, } from "./commands/ValidateResourcePolicyCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -357,10 +357,7 @@ export class SecretsManagerClient extends __Client< readonly config: SecretsManagerClientResolvedConfig; constructor(configuration: SecretsManagerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-secrets-manager/runtimeConfig.browser.ts b/clients/client-secrets-manager/runtimeConfig.browser.ts index 0d613882d93c..3298a80df5ac 100644 --- a/clients/client-secrets-manager/runtimeConfig.browser.ts +++ b/clients/client-secrets-manager/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SecretsManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SecretsManagerClientConfig } from "./SecretsManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-secrets-manager/runtimeConfig.native.ts b/clients/client-secrets-manager/runtimeConfig.native.ts index 21eb6fa13d36..1ccaf3355f1f 100644 --- a/clients/client-secrets-manager/runtimeConfig.native.ts +++ b/clients/client-secrets-manager/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SecretsManagerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SecretsManagerClientConfig } from "./SecretsManagerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-secrets-manager/runtimeConfig.shared.ts b/clients/client-secrets-manager/runtimeConfig.shared.ts index 1b9a2be6bb44..54481603122b 100644 --- a/clients/client-secrets-manager/runtimeConfig.shared.ts +++ b/clients/client-secrets-manager/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SecretsManagerClientConfig) => ({ apiVersion: "2017-10-17", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Secrets Manager", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-secrets-manager/runtimeConfig.ts b/clients/client-secrets-manager/runtimeConfig.ts index 942635d9ab7a..3e32b0d41c9e 100644 --- a/clients/client-secrets-manager/runtimeConfig.ts +++ b/clients/client-secrets-manager/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SecretsManagerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SecretsManagerClientConfig } from "./SecretsManagerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-securityhub/SecurityHubClient.ts b/clients/client-securityhub/SecurityHubClient.ts index 412e2eb83fb2..fad4f77e628f 100644 --- a/clients/client-securityhub/SecurityHubClient.ts +++ b/clients/client-securityhub/SecurityHubClient.ts @@ -121,7 +121,7 @@ import { UpdateStandardsControlCommandInput, UpdateStandardsControlCommandOutput, } from "./commands/UpdateStandardsControlCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -487,10 +487,7 @@ export class SecurityHubClient extends __Client< readonly config: SecurityHubClientResolvedConfig; constructor(configuration: SecurityHubClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-securityhub/runtimeConfig.browser.ts b/clients/client-securityhub/runtimeConfig.browser.ts index 1f2cbe9cc493..11025a3644da 100644 --- a/clients/client-securityhub/runtimeConfig.browser.ts +++ b/clients/client-securityhub/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SecurityHubClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SecurityHubClientConfig } from "./SecurityHubClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SecurityHubClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-securityhub/runtimeConfig.native.ts b/clients/client-securityhub/runtimeConfig.native.ts index bcfb4c4062c2..7038eac096f3 100644 --- a/clients/client-securityhub/runtimeConfig.native.ts +++ b/clients/client-securityhub/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SecurityHubClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SecurityHubClientConfig } from "./SecurityHubClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SecurityHubClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-securityhub/runtimeConfig.shared.ts b/clients/client-securityhub/runtimeConfig.shared.ts index fdbffa7c17d2..0d54fd69fde5 100644 --- a/clients/client-securityhub/runtimeConfig.shared.ts +++ b/clients/client-securityhub/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SecurityHubClientConfig) => ({ apiVersion: "2018-10-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SecurityHub", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-securityhub/runtimeConfig.ts b/clients/client-securityhub/runtimeConfig.ts index 2f7ed6da5e67..1cd4fed73595 100644 --- a/clients/client-securityhub/runtimeConfig.ts +++ b/clients/client-securityhub/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SecurityHubClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SecurityHubClientConfig } from "./SecurityHubClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SecurityHubClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-serverlessapplicationrepository/ServerlessApplicationRepositoryClient.ts b/clients/client-serverlessapplicationrepository/ServerlessApplicationRepositoryClient.ts index c139fc77b370..1b806c73642f 100644 --- a/clients/client-serverlessapplicationrepository/ServerlessApplicationRepositoryClient.ts +++ b/clients/client-serverlessapplicationrepository/ServerlessApplicationRepositoryClient.ts @@ -36,7 +36,7 @@ import { } from "./commands/PutApplicationPolicyCommand"; import { UnshareApplicationCommandInput, UnshareApplicationCommandOutput } from "./commands/UnshareApplicationCommand"; import { UpdateApplicationCommandInput, UpdateApplicationCommandOutput } from "./commands/UpdateApplicationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -294,10 +294,7 @@ export class ServerlessApplicationRepositoryClient extends __Client< readonly config: ServerlessApplicationRepositoryClientResolvedConfig; constructor(configuration: ServerlessApplicationRepositoryClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts index 916755f2b4d7..63774eeb34b5 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ServerlessApplicationRepositoryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServerlessApplicationRepositoryClientConfig } from "./ServerlessApplicationRepositoryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts index 072c7ca09544..a35d12455b58 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ServerlessApplicationRepositoryClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ServerlessApplicationRepositoryClientConfig } from "./ServerlessApplicationRepositoryClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts index da6791b1fb10..01afcc816eac 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientConfig) => ({ apiVersion: "2017-09-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ServerlessApplicationRepository", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.ts index b192fea61052..f1914b2d98a2 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ServerlessApplicationRepositoryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServerlessApplicationRepositoryClientConfig } from "./ServerlessApplicationRepositoryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-service-catalog-appregistry/ServiceCatalogAppRegistryClient.ts b/clients/client-service-catalog-appregistry/ServiceCatalogAppRegistryClient.ts index 3543136b8078..12067d537714 100644 --- a/clients/client-service-catalog-appregistry/ServiceCatalogAppRegistryClient.ts +++ b/clients/client-service-catalog-appregistry/ServiceCatalogAppRegistryClient.ts @@ -48,7 +48,7 @@ import { UpdateAttributeGroupCommandInput, UpdateAttributeGroupCommandOutput, } from "./commands/UpdateAttributeGroupCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -305,10 +305,7 @@ export class ServiceCatalogAppRegistryClient extends __Client< readonly config: ServiceCatalogAppRegistryClientResolvedConfig; constructor(configuration: ServiceCatalogAppRegistryClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts b/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts index 38b60048db53..80e5dbe76215 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ServiceCatalogAppRegistryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceCatalogAppRegistryClientConfig } from "./ServiceCatalogAppRegistryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.native.ts b/clients/client-service-catalog-appregistry/runtimeConfig.native.ts index f844117ad17f..83be1797fa2a 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.native.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ServiceCatalogAppRegistryClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ServiceCatalogAppRegistryClientConfig } from "./ServiceCatalogAppRegistryClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts b/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts index 0d37aa8a2d6d..6ae09cc64c45 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) => ({ apiVersion: "2020-06-24", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Service Catalog AppRegistry", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.ts b/clients/client-service-catalog-appregistry/runtimeConfig.ts index 3c4258491036..9bc57d96e425 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ServiceCatalogAppRegistryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceCatalogAppRegistryClientConfig } from "./ServiceCatalogAppRegistryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-service-catalog/ServiceCatalogClient.ts b/clients/client-service-catalog/ServiceCatalogClient.ts index 668502a30e0d..e1a746cf3bf8 100644 --- a/clients/client-service-catalog/ServiceCatalogClient.ts +++ b/clients/client-service-catalog/ServiceCatalogClient.ts @@ -271,7 +271,7 @@ import { UpdateServiceActionCommandOutput, } from "./commands/UpdateServiceActionCommand"; import { UpdateTagOptionCommandInput, UpdateTagOptionCommandOutput } from "./commands/UpdateTagOptionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -661,10 +661,7 @@ export class ServiceCatalogClient extends __Client< readonly config: ServiceCatalogClientResolvedConfig; constructor(configuration: ServiceCatalogClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-service-catalog/runtimeConfig.browser.ts b/clients/client-service-catalog/runtimeConfig.browser.ts index 4269f5b02a66..6b0567f5bac4 100644 --- a/clients/client-service-catalog/runtimeConfig.browser.ts +++ b/clients/client-service-catalog/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ServiceCatalogClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceCatalogClientConfig } from "./ServiceCatalogClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-service-catalog/runtimeConfig.native.ts b/clients/client-service-catalog/runtimeConfig.native.ts index 657e3b597c11..c9f4d428bb4e 100644 --- a/clients/client-service-catalog/runtimeConfig.native.ts +++ b/clients/client-service-catalog/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ServiceCatalogClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ServiceCatalogClientConfig } from "./ServiceCatalogClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-service-catalog/runtimeConfig.shared.ts b/clients/client-service-catalog/runtimeConfig.shared.ts index 9be408d6c060..30221f33faec 100644 --- a/clients/client-service-catalog/runtimeConfig.shared.ts +++ b/clients/client-service-catalog/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => ({ apiVersion: "2015-12-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Service Catalog", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-service-catalog/runtimeConfig.ts b/clients/client-service-catalog/runtimeConfig.ts index b4a870cbc79f..de21008ccece 100644 --- a/clients/client-service-catalog/runtimeConfig.ts +++ b/clients/client-service-catalog/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ServiceCatalogClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceCatalogClientConfig } from "./ServiceCatalogClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-service-quotas/ServiceQuotasClient.ts b/clients/client-service-quotas/ServiceQuotasClient.ts index ec2d8b01664f..cabe768d80b4 100644 --- a/clients/client-service-quotas/ServiceQuotasClient.ts +++ b/clients/client-service-quotas/ServiceQuotasClient.ts @@ -59,7 +59,7 @@ import { } from "./commands/RequestServiceQuotaIncreaseCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -309,10 +309,7 @@ export class ServiceQuotasClient extends __Client< readonly config: ServiceQuotasClientResolvedConfig; constructor(configuration: ServiceQuotasClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-service-quotas/runtimeConfig.browser.ts b/clients/client-service-quotas/runtimeConfig.browser.ts index 6c5161791f36..2ca15836a718 100644 --- a/clients/client-service-quotas/runtimeConfig.browser.ts +++ b/clients/client-service-quotas/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ServiceQuotasClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceQuotasClientConfig } from "./ServiceQuotasClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-service-quotas/runtimeConfig.native.ts b/clients/client-service-quotas/runtimeConfig.native.ts index 5df0b7866f08..98e211579e0d 100644 --- a/clients/client-service-quotas/runtimeConfig.native.ts +++ b/clients/client-service-quotas/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ServiceQuotasClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ServiceQuotasClientConfig } from "./ServiceQuotasClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-service-quotas/runtimeConfig.shared.ts b/clients/client-service-quotas/runtimeConfig.shared.ts index 61479b937ae8..14e5b4fce867 100644 --- a/clients/client-service-quotas/runtimeConfig.shared.ts +++ b/clients/client-service-quotas/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => ({ apiVersion: "2019-06-24", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Service Quotas", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-service-quotas/runtimeConfig.ts b/clients/client-service-quotas/runtimeConfig.ts index 9efce42716ee..be7cf1d95416 100644 --- a/clients/client-service-quotas/runtimeConfig.ts +++ b/clients/client-service-quotas/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ServiceQuotasClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceQuotasClientConfig } from "./ServiceQuotasClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-servicediscovery/ServiceDiscoveryClient.ts b/clients/client-servicediscovery/ServiceDiscoveryClient.ts index e56c0a7efc0f..1f160782936a 100644 --- a/clients/client-servicediscovery/ServiceDiscoveryClient.ts +++ b/clients/client-servicediscovery/ServiceDiscoveryClient.ts @@ -51,7 +51,7 @@ import { UpdatePublicDnsNamespaceCommandOutput, } from "./commands/UpdatePublicDnsNamespaceCommand"; import { UpdateServiceCommandInput, UpdateServiceCommandOutput } from "./commands/UpdateServiceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -318,10 +318,7 @@ export class ServiceDiscoveryClient extends __Client< readonly config: ServiceDiscoveryClientResolvedConfig; constructor(configuration: ServiceDiscoveryClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-servicediscovery/runtimeConfig.browser.ts b/clients/client-servicediscovery/runtimeConfig.browser.ts index 5d943730e630..42c8cfcd7bbb 100644 --- a/clients/client-servicediscovery/runtimeConfig.browser.ts +++ b/clients/client-servicediscovery/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ServiceDiscoveryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceDiscoveryClientConfig } from "./ServiceDiscoveryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-servicediscovery/runtimeConfig.native.ts b/clients/client-servicediscovery/runtimeConfig.native.ts index 4567b2f65fe8..f2a99154fbc1 100644 --- a/clients/client-servicediscovery/runtimeConfig.native.ts +++ b/clients/client-servicediscovery/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ServiceDiscoveryClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ServiceDiscoveryClientConfig } from "./ServiceDiscoveryClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-servicediscovery/runtimeConfig.shared.ts b/clients/client-servicediscovery/runtimeConfig.shared.ts index 022e47be9679..7feed2fbf4ff 100644 --- a/clients/client-servicediscovery/runtimeConfig.shared.ts +++ b/clients/client-servicediscovery/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => ({ apiVersion: "2017-03-14", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "ServiceDiscovery", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-servicediscovery/runtimeConfig.ts b/clients/client-servicediscovery/runtimeConfig.ts index b50dc5923a77..06adc9c67b0a 100644 --- a/clients/client-servicediscovery/runtimeConfig.ts +++ b/clients/client-servicediscovery/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ServiceDiscoveryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ServiceDiscoveryClientConfig } from "./ServiceDiscoveryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ses/SESClient.ts b/clients/client-ses/SESClient.ts index 661a6d23e5c5..a4abde5c13f1 100644 --- a/clients/client-ses/SESClient.ts +++ b/clients/client-ses/SESClient.ts @@ -219,7 +219,7 @@ import { VerifyEmailIdentityCommandInput, VerifyEmailIdentityCommandOutput, } from "./commands/VerifyEmailIdentityCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -579,10 +579,7 @@ export class SESClient extends __Client< readonly config: SESClientResolvedConfig; constructor(configuration: SESClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ses/runtimeConfig.browser.ts b/clients/client-ses/runtimeConfig.browser.ts index 2ee1430ca9e1..97bff76a99bb 100644 --- a/clients/client-ses/runtimeConfig.browser.ts +++ b/clients/client-ses/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SESClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SESClientConfig } from "./SESClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SESClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ses/runtimeConfig.native.ts b/clients/client-ses/runtimeConfig.native.ts index c5255bbc70c2..649f29a9de63 100644 --- a/clients/client-ses/runtimeConfig.native.ts +++ b/clients/client-ses/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SESClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SESClientConfig } from "./SESClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SESClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ses/runtimeConfig.shared.ts b/clients/client-ses/runtimeConfig.shared.ts index 442c6b43a06a..c9265b764940 100644 --- a/clients/client-ses/runtimeConfig.shared.ts +++ b/clients/client-ses/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SESClientConfig) => ({ apiVersion: "2010-12-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SES", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ses/runtimeConfig.ts b/clients/client-ses/runtimeConfig.ts index 4c531c4ea660..b0be125b7d3a 100644 --- a/clients/client-ses/runtimeConfig.ts +++ b/clients/client-ses/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SESClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SESClientConfig } from "./SESClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SESClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sesv2/SESv2Client.ts b/clients/client-sesv2/SESv2Client.ts index 49edfeb23bd6..54975c46f8d5 100644 --- a/clients/client-sesv2/SESv2Client.ts +++ b/clients/client-sesv2/SESv2Client.ts @@ -250,7 +250,7 @@ import { UpdateEmailTemplateCommandInput, UpdateEmailTemplateCommandOutput, } from "./commands/UpdateEmailTemplateCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -641,10 +641,7 @@ export class SESv2Client extends __Client< readonly config: SESv2ClientResolvedConfig; constructor(configuration: SESv2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sesv2/runtimeConfig.browser.ts b/clients/client-sesv2/runtimeConfig.browser.ts index cf7e122e26a3..58febb05226e 100644 --- a/clients/client-sesv2/runtimeConfig.browser.ts +++ b/clients/client-sesv2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SESv2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SESv2ClientConfig } from "./SESv2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SESv2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sesv2/runtimeConfig.native.ts b/clients/client-sesv2/runtimeConfig.native.ts index 904b0fc2ce60..e6590b83cc0a 100644 --- a/clients/client-sesv2/runtimeConfig.native.ts +++ b/clients/client-sesv2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SESv2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SESv2ClientConfig } from "./SESv2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SESv2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sesv2/runtimeConfig.shared.ts b/clients/client-sesv2/runtimeConfig.shared.ts index 2c62b8fbd2ea..ecf866367fb0 100644 --- a/clients/client-sesv2/runtimeConfig.shared.ts +++ b/clients/client-sesv2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SESv2ClientConfig) => ({ apiVersion: "2019-09-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SESv2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sesv2/runtimeConfig.ts b/clients/client-sesv2/runtimeConfig.ts index 1ea3a71f157f..c2a9a141a162 100644 --- a/clients/client-sesv2/runtimeConfig.ts +++ b/clients/client-sesv2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SESv2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SESv2ClientConfig } from "./SESv2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SESv2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sfn/SFNClient.ts b/clients/client-sfn/SFNClient.ts index 2c7e6e881bf6..6ca049e9cac1 100644 --- a/clients/client-sfn/SFNClient.ts +++ b/clients/client-sfn/SFNClient.ts @@ -33,7 +33,7 @@ import { StopExecutionCommandInput, StopExecutionCommandOutput } from "./command import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateStateMachineCommandInput, UpdateStateMachineCommandOutput } from "./commands/UpdateStateMachineCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -304,10 +304,7 @@ export class SFNClient extends __Client< readonly config: SFNClientResolvedConfig; constructor(configuration: SFNClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sfn/runtimeConfig.browser.ts b/clients/client-sfn/runtimeConfig.browser.ts index b254aa8ef2d0..f803a4e18efa 100644 --- a/clients/client-sfn/runtimeConfig.browser.ts +++ b/clients/client-sfn/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SFNClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SFNClientConfig } from "./SFNClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SFNClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sfn/runtimeConfig.native.ts b/clients/client-sfn/runtimeConfig.native.ts index 5795204b51ca..896632286aef 100644 --- a/clients/client-sfn/runtimeConfig.native.ts +++ b/clients/client-sfn/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SFNClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SFNClientConfig } from "./SFNClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SFNClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sfn/runtimeConfig.shared.ts b/clients/client-sfn/runtimeConfig.shared.ts index 86e6407f13d8..400a7a3e233f 100644 --- a/clients/client-sfn/runtimeConfig.shared.ts +++ b/clients/client-sfn/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SFNClientConfig) => ({ apiVersion: "2016-11-23", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SFN", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sfn/runtimeConfig.ts b/clients/client-sfn/runtimeConfig.ts index 17fff14cc10a..32b353f28802 100644 --- a/clients/client-sfn/runtimeConfig.ts +++ b/clients/client-sfn/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SFNClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SFNClientConfig } from "./SFNClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SFNClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-shield/ShieldClient.ts b/clients/client-shield/ShieldClient.ts index 3e36f1feafad..22b4f54eb2bb 100644 --- a/clients/client-shield/ShieldClient.ts +++ b/clients/client-shield/ShieldClient.ts @@ -91,7 +91,7 @@ import { UpdateProtectionGroupCommandOutput, } from "./commands/UpdateProtectionGroupCommand"; import { UpdateSubscriptionCommandInput, UpdateSubscriptionCommandOutput } from "./commands/UpdateSubscriptionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -370,10 +370,7 @@ export class ShieldClient extends __Client< readonly config: ShieldClientResolvedConfig; constructor(configuration: ShieldClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-shield/runtimeConfig.browser.ts b/clients/client-shield/runtimeConfig.browser.ts index 25c3dc3b2e3c..16e2f0fd4be0 100644 --- a/clients/client-shield/runtimeConfig.browser.ts +++ b/clients/client-shield/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./ShieldClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ShieldClientConfig } from "./ShieldClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ShieldClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-shield/runtimeConfig.native.ts b/clients/client-shield/runtimeConfig.native.ts index d88dde8410f7..03eaa0befec4 100644 --- a/clients/client-shield/runtimeConfig.native.ts +++ b/clients/client-shield/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./ShieldClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { ShieldClientConfig } from "./ShieldClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: ShieldClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-shield/runtimeConfig.shared.ts b/clients/client-shield/runtimeConfig.shared.ts index 1feca7d0e269..75c5f9551b6e 100644 --- a/clients/client-shield/runtimeConfig.shared.ts +++ b/clients/client-shield/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: ShieldClientConfig) => ({ apiVersion: "2016-06-02", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Shield", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-shield/runtimeConfig.ts b/clients/client-shield/runtimeConfig.ts index f3fde84f55bc..dbcada6f525c 100644 --- a/clients/client-shield/runtimeConfig.ts +++ b/clients/client-shield/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./ShieldClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { ShieldClientConfig } from "./ShieldClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: ShieldClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-signer/SignerClient.ts b/clients/client-signer/SignerClient.ts index 5f5465989ccd..fbdb745113c6 100644 --- a/clients/client-signer/SignerClient.ts +++ b/clients/client-signer/SignerClient.ts @@ -39,7 +39,7 @@ import { import { StartSigningJobCommandInput, StartSigningJobCommandOutput } from "./commands/StartSigningJobCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -299,10 +299,7 @@ export class SignerClient extends __Client< readonly config: SignerClientResolvedConfig; constructor(configuration: SignerClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-signer/runtimeConfig.browser.ts b/clients/client-signer/runtimeConfig.browser.ts index b02f0d92afb0..c0b85031cbd3 100644 --- a/clients/client-signer/runtimeConfig.browser.ts +++ b/clients/client-signer/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SignerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SignerClientConfig } from "./SignerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SignerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-signer/runtimeConfig.native.ts b/clients/client-signer/runtimeConfig.native.ts index 603a4cda364b..e2a702e158b3 100644 --- a/clients/client-signer/runtimeConfig.native.ts +++ b/clients/client-signer/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SignerClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SignerClientConfig } from "./SignerClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SignerClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-signer/runtimeConfig.shared.ts b/clients/client-signer/runtimeConfig.shared.ts index 678ffa649151..7d77a2af1469 100644 --- a/clients/client-signer/runtimeConfig.shared.ts +++ b/clients/client-signer/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SignerClientConfig) => ({ apiVersion: "2017-08-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "signer", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-signer/runtimeConfig.ts b/clients/client-signer/runtimeConfig.ts index ffdea8438b8d..3c061b253313 100644 --- a/clients/client-signer/runtimeConfig.ts +++ b/clients/client-signer/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SignerClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SignerClientConfig } from "./SignerClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SignerClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sms/SMSClient.ts b/clients/client-sms/SMSClient.ts index 65276a7fe02d..c3bec7a63aee 100644 --- a/clients/client-sms/SMSClient.ts +++ b/clients/client-sms/SMSClient.ts @@ -93,7 +93,7 @@ import { UpdateReplicationJobCommandInput, UpdateReplicationJobCommandOutput, } from "./commands/UpdateReplicationJobCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -389,10 +389,7 @@ export class SMSClient extends __Client< readonly config: SMSClientResolvedConfig; constructor(configuration: SMSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sms/runtimeConfig.browser.ts b/clients/client-sms/runtimeConfig.browser.ts index a10df8831f0a..cd8475128f2c 100644 --- a/clients/client-sms/runtimeConfig.browser.ts +++ b/clients/client-sms/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SMSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SMSClientConfig } from "./SMSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SMSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sms/runtimeConfig.native.ts b/clients/client-sms/runtimeConfig.native.ts index 969f55fe2940..2e4c16b96633 100644 --- a/clients/client-sms/runtimeConfig.native.ts +++ b/clients/client-sms/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SMSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SMSClientConfig } from "./SMSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SMSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sms/runtimeConfig.shared.ts b/clients/client-sms/runtimeConfig.shared.ts index caea43a95dac..680872d9349c 100644 --- a/clients/client-sms/runtimeConfig.shared.ts +++ b/clients/client-sms/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SMSClientConfig) => ({ apiVersion: "2016-10-24", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SMS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sms/runtimeConfig.ts b/clients/client-sms/runtimeConfig.ts index e6875ceb09ae..7988e0eb1538 100644 --- a/clients/client-sms/runtimeConfig.ts +++ b/clients/client-sms/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SMSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SMSClientConfig } from "./SMSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SMSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-snowball/SnowballClient.ts b/clients/client-snowball/SnowballClient.ts index 1a9ea8690a04..2b70617bc088 100644 --- a/clients/client-snowball/SnowballClient.ts +++ b/clients/client-snowball/SnowballClient.ts @@ -44,7 +44,7 @@ import { UpdateLongTermPricingCommandInput, UpdateLongTermPricingCommandOutput, } from "./commands/UpdateLongTermPricingCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -310,10 +310,7 @@ export class SnowballClient extends __Client< readonly config: SnowballClientResolvedConfig; constructor(configuration: SnowballClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-snowball/runtimeConfig.browser.ts b/clients/client-snowball/runtimeConfig.browser.ts index 7cbb08598c7b..9bf283274efa 100644 --- a/clients/client-snowball/runtimeConfig.browser.ts +++ b/clients/client-snowball/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SnowballClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SnowballClientConfig } from "./SnowballClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SnowballClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-snowball/runtimeConfig.native.ts b/clients/client-snowball/runtimeConfig.native.ts index 4a5fd4a24f9c..80ffab53f4e2 100644 --- a/clients/client-snowball/runtimeConfig.native.ts +++ b/clients/client-snowball/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SnowballClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SnowballClientConfig } from "./SnowballClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SnowballClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-snowball/runtimeConfig.shared.ts b/clients/client-snowball/runtimeConfig.shared.ts index 2b9cc5106185..c1378d3abd0f 100644 --- a/clients/client-snowball/runtimeConfig.shared.ts +++ b/clients/client-snowball/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SnowballClientConfig) => ({ apiVersion: "2016-06-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Snowball", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-snowball/runtimeConfig.ts b/clients/client-snowball/runtimeConfig.ts index 1aea2129aa9b..91d340b352ae 100644 --- a/clients/client-snowball/runtimeConfig.ts +++ b/clients/client-snowball/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SnowballClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SnowballClientConfig } from "./SnowballClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SnowballClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sns/SNSClient.ts b/clients/client-sns/SNSClient.ts index 3f179c6eaa24..d62cefb87cac 100644 --- a/clients/client-sns/SNSClient.ts +++ b/clients/client-sns/SNSClient.ts @@ -103,7 +103,7 @@ import { VerifySMSSandboxPhoneNumberCommandInput, VerifySMSSandboxPhoneNumberCommandOutput, } from "./commands/VerifySMSSandboxPhoneNumberCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -403,10 +403,7 @@ export class SNSClient extends __Client< readonly config: SNSClientResolvedConfig; constructor(configuration: SNSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sns/runtimeConfig.browser.ts b/clients/client-sns/runtimeConfig.browser.ts index ab75cad75c4c..870fed24d271 100644 --- a/clients/client-sns/runtimeConfig.browser.ts +++ b/clients/client-sns/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SNSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SNSClientConfig } from "./SNSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SNSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sns/runtimeConfig.native.ts b/clients/client-sns/runtimeConfig.native.ts index c2e1fe86d7a3..d74d757d9b2c 100644 --- a/clients/client-sns/runtimeConfig.native.ts +++ b/clients/client-sns/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SNSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SNSClientConfig } from "./SNSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SNSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sns/runtimeConfig.shared.ts b/clients/client-sns/runtimeConfig.shared.ts index 218eaa024923..ce56e55d1f44 100644 --- a/clients/client-sns/runtimeConfig.shared.ts +++ b/clients/client-sns/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SNSClientConfig) => ({ apiVersion: "2010-03-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SNS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sns/runtimeConfig.ts b/clients/client-sns/runtimeConfig.ts index 5d8d94cce552..61b5d998b284 100644 --- a/clients/client-sns/runtimeConfig.ts +++ b/clients/client-sns/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SNSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SNSClientConfig } from "./SNSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SNSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sqs/SQSClient.ts b/clients/client-sqs/SQSClient.ts index 6a6c05f65d6d..46addcc57bc5 100644 --- a/clients/client-sqs/SQSClient.ts +++ b/clients/client-sqs/SQSClient.ts @@ -27,7 +27,7 @@ import { SendMessageCommandInput, SendMessageCommandOutput } from "./commands/Se import { SetQueueAttributesCommandInput, SetQueueAttributesCommandOutput } from "./commands/SetQueueAttributesCommand"; import { TagQueueCommandInput, TagQueueCommandOutput } from "./commands/TagQueueCommand"; import { UntagQueueCommandInput, UntagQueueCommandOutput } from "./commands/UntagQueueCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -352,10 +352,7 @@ export class SQSClient extends __Client< readonly config: SQSClientResolvedConfig; constructor(configuration: SQSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sqs/runtimeConfig.browser.ts b/clients/client-sqs/runtimeConfig.browser.ts index d6a4aa3ac794..0dd6079c42e5 100644 --- a/clients/client-sqs/runtimeConfig.browser.ts +++ b/clients/client-sqs/runtimeConfig.browser.ts @@ -5,34 +5,41 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SQSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SQSClientConfig } from "./SQSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - md5: Md5, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SQSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.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), + }; }; diff --git a/clients/client-sqs/runtimeConfig.native.ts b/clients/client-sqs/runtimeConfig.native.ts index 9aba4a4cb12e..dccf3d4b5e68 100644 --- a/clients/client-sqs/runtimeConfig.native.ts +++ b/clients/client-sqs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SQSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SQSClientConfig } from "./SQSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SQSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sqs/runtimeConfig.shared.ts b/clients/client-sqs/runtimeConfig.shared.ts index 6358558e47f3..25f316d6c42b 100644 --- a/clients/client-sqs/runtimeConfig.shared.ts +++ b/clients/client-sqs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SQSClientConfig) => ({ apiVersion: "2012-11-05", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SQS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sqs/runtimeConfig.ts b/clients/client-sqs/runtimeConfig.ts index 70b432217940..20f52f6e1287 100644 --- a/clients/client-sqs/runtimeConfig.ts +++ b/clients/client-sqs/runtimeConfig.ts @@ -7,35 +7,42 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@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"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SQSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SQSClientConfig } from "./SQSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - md5: Hash.bind(null, "md5"), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SQSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.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), + }; }; diff --git a/clients/client-ssm-contacts/SSMContactsClient.ts b/clients/client-ssm-contacts/SSMContactsClient.ts index e66bafe48eb9..af42f6ef6911 100644 --- a/clients/client-ssm-contacts/SSMContactsClient.ts +++ b/clients/client-ssm-contacts/SSMContactsClient.ts @@ -49,7 +49,7 @@ import { UpdateContactChannelCommandOutput, } from "./commands/UpdateContactChannelCommand"; import { UpdateContactCommandInput, UpdateContactCommandOutput } from "./commands/UpdateContactCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -313,10 +313,7 @@ export class SSMContactsClient extends __Client< readonly config: SSMContactsClientResolvedConfig; constructor(configuration: SSMContactsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ssm-contacts/runtimeConfig.browser.ts b/clients/client-ssm-contacts/runtimeConfig.browser.ts index 8d8d5f57b117..c2f97e8dd279 100644 --- a/clients/client-ssm-contacts/runtimeConfig.browser.ts +++ b/clients/client-ssm-contacts/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SSMContactsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSMContactsClientConfig } from "./SSMContactsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSMContactsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ssm-contacts/runtimeConfig.native.ts b/clients/client-ssm-contacts/runtimeConfig.native.ts index bde7ce498e27..45f8d5f7c991 100644 --- a/clients/client-ssm-contacts/runtimeConfig.native.ts +++ b/clients/client-ssm-contacts/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SSMContactsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SSMContactsClientConfig } from "./SSMContactsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SSMContactsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ssm-contacts/runtimeConfig.shared.ts b/clients/client-ssm-contacts/runtimeConfig.shared.ts index 5b0803c02ed9..8ec31254e6a0 100644 --- a/clients/client-ssm-contacts/runtimeConfig.shared.ts +++ b/clients/client-ssm-contacts/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SSMContactsClientConfig) => ({ apiVersion: "2021-05-03", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SSM Contacts", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ssm-contacts/runtimeConfig.ts b/clients/client-ssm-contacts/runtimeConfig.ts index 50c7794ddf7e..fab0909af83d 100644 --- a/clients/client-ssm-contacts/runtimeConfig.ts +++ b/clients/client-ssm-contacts/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SSMContactsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSMContactsClientConfig } from "./SSMContactsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSMContactsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ssm-incidents/SSMIncidentsClient.ts b/clients/client-ssm-incidents/SSMIncidentsClient.ts index 49fa5e7ee93c..3cd28e3dc528 100644 --- a/clients/client-ssm-incidents/SSMIncidentsClient.ts +++ b/clients/client-ssm-incidents/SSMIncidentsClient.ts @@ -69,7 +69,7 @@ import { UpdateTimelineEventCommandInput, UpdateTimelineEventCommandOutput, } from "./commands/UpdateTimelineEventCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -344,10 +344,7 @@ export class SSMIncidentsClient extends __Client< readonly config: SSMIncidentsClientResolvedConfig; constructor(configuration: SSMIncidentsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ssm-incidents/runtimeConfig.browser.ts b/clients/client-ssm-incidents/runtimeConfig.browser.ts index a5f466226890..d389b5a7a946 100644 --- a/clients/client-ssm-incidents/runtimeConfig.browser.ts +++ b/clients/client-ssm-incidents/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SSMIncidentsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSMIncidentsClientConfig } from "./SSMIncidentsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ssm-incidents/runtimeConfig.native.ts b/clients/client-ssm-incidents/runtimeConfig.native.ts index ef10f499e4d6..2bfe05135725 100644 --- a/clients/client-ssm-incidents/runtimeConfig.native.ts +++ b/clients/client-ssm-incidents/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SSMIncidentsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SSMIncidentsClientConfig } from "./SSMIncidentsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ssm-incidents/runtimeConfig.shared.ts b/clients/client-ssm-incidents/runtimeConfig.shared.ts index d12cdaf7a782..a9cdfed808ad 100644 --- a/clients/client-ssm-incidents/runtimeConfig.shared.ts +++ b/clients/client-ssm-incidents/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => ({ apiVersion: "2018-05-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SSM Incidents", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ssm-incidents/runtimeConfig.ts b/clients/client-ssm-incidents/runtimeConfig.ts index 2a8f641f8ce8..9dbba54c2898 100644 --- a/clients/client-ssm-incidents/runtimeConfig.ts +++ b/clients/client-ssm-incidents/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SSMIncidentsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSMIncidentsClientConfig } from "./SSMIncidentsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ssm/SSMClient.ts b/clients/client-ssm/SSMClient.ts index 2d2cc168b49a..d2baa52ca228 100644 --- a/clients/client-ssm/SSMClient.ts +++ b/clients/client-ssm/SSMClient.ts @@ -403,7 +403,7 @@ import { UpdateServiceSettingCommandInput, UpdateServiceSettingCommandOutput, } from "./commands/UpdateServiceSettingCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -914,10 +914,7 @@ export class SSMClient extends __Client< readonly config: SSMClientResolvedConfig; constructor(configuration: SSMClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-ssm/runtimeConfig.browser.ts b/clients/client-ssm/runtimeConfig.browser.ts index d2d355ee1f52..779f98e61ba1 100644 --- a/clients/client-ssm/runtimeConfig.browser.ts +++ b/clients/client-ssm/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SSMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSMClientConfig } from "./SSMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-ssm/runtimeConfig.native.ts b/clients/client-ssm/runtimeConfig.native.ts index 8e8669fecf83..ec07027d7456 100644 --- a/clients/client-ssm/runtimeConfig.native.ts +++ b/clients/client-ssm/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SSMClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SSMClientConfig } from "./SSMClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SSMClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-ssm/runtimeConfig.shared.ts b/clients/client-ssm/runtimeConfig.shared.ts index e68ef2d4588d..592091516544 100644 --- a/clients/client-ssm/runtimeConfig.shared.ts +++ b/clients/client-ssm/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SSMClientConfig) => ({ apiVersion: "2014-11-06", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SSM", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-ssm/runtimeConfig.ts b/clients/client-ssm/runtimeConfig.ts index 3c9cc80a707d..6ab81a671fc8 100644 --- a/clients/client-ssm/runtimeConfig.ts +++ b/clients/client-ssm/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SSMClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSMClientConfig } from "./SSMClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSMClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sso-admin/SSOAdminClient.ts b/clients/client-sso-admin/SSOAdminClient.ts index bfc06c769b78..3217c48027ce 100644 --- a/clients/client-sso-admin/SSOAdminClient.ts +++ b/clients/client-sso-admin/SSOAdminClient.ts @@ -110,7 +110,7 @@ import { UpdatePermissionSetCommandInput, UpdatePermissionSetCommandOutput, } from "./commands/UpdatePermissionSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -379,10 +379,7 @@ export class SSOAdminClient extends __Client< readonly config: SSOAdminClientResolvedConfig; constructor(configuration: SSOAdminClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sso-admin/runtimeConfig.browser.ts b/clients/client-sso-admin/runtimeConfig.browser.ts index 15595e8b2226..9b739eaec324 100644 --- a/clients/client-sso-admin/runtimeConfig.browser.ts +++ b/clients/client-sso-admin/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SSOAdminClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSOAdminClientConfig } from "./SSOAdminClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSOAdminClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sso-admin/runtimeConfig.native.ts b/clients/client-sso-admin/runtimeConfig.native.ts index 33053a643614..3c90e1f3b228 100644 --- a/clients/client-sso-admin/runtimeConfig.native.ts +++ b/clients/client-sso-admin/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SSOAdminClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SSOAdminClientConfig } from "./SSOAdminClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SSOAdminClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sso-admin/runtimeConfig.shared.ts b/clients/client-sso-admin/runtimeConfig.shared.ts index d98ef24df79a..97d8106dd019 100644 --- a/clients/client-sso-admin/runtimeConfig.shared.ts +++ b/clients/client-sso-admin/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SSOAdminClientConfig) => ({ apiVersion: "2020-07-20", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SSO Admin", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sso-admin/runtimeConfig.ts b/clients/client-sso-admin/runtimeConfig.ts index 4a9a957ee3e2..294acfc53c83 100644 --- a/clients/client-sso-admin/runtimeConfig.ts +++ b/clients/client-sso-admin/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SSOAdminClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSOAdminClientConfig } from "./SSOAdminClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSOAdminClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sso-oidc/SSOOIDCClient.ts b/clients/client-sso-oidc/SSOOIDCClient.ts index ece40e44d6be..cbc2582c5b2b 100644 --- a/clients/client-sso-oidc/SSOOIDCClient.ts +++ b/clients/client-sso-oidc/SSOOIDCClient.ts @@ -4,7 +4,7 @@ import { StartDeviceAuthorizationCommandInput, StartDeviceAuthorizationCommandOutput, } from "./commands/StartDeviceAuthorizationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -222,10 +222,7 @@ export class SSOOIDCClient extends __Client< readonly config: SSOOIDCClientResolvedConfig; constructor(configuration: SSOOIDCClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sso-oidc/runtimeConfig.browser.ts b/clients/client-sso-oidc/runtimeConfig.browser.ts index 50d1401b597e..8664ef899474 100644 --- a/clients/client-sso-oidc/runtimeConfig.browser.ts +++ b/clients/client-sso-oidc/runtimeConfig.browser.ts @@ -4,32 +4,36 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SSOOIDCClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSOOIDCClientConfig } from "./SSOOIDCClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/clients/client-sso-oidc/runtimeConfig.native.ts b/clients/client-sso-oidc/runtimeConfig.native.ts index ec7313ebd814..9a6943b356a8 100644 --- a/clients/client-sso-oidc/runtimeConfig.native.ts +++ b/clients/client-sso-oidc/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SSOOIDCClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SSOOIDCClientConfig } from "./SSOOIDCClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sso-oidc/runtimeConfig.shared.ts b/clients/client-sso-oidc/runtimeConfig.shared.ts index 53c7e6d9ec44..745e137718d1 100644 --- a/clients/client-sso-oidc/runtimeConfig.shared.ts +++ b/clients/client-sso-oidc/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SSOOIDCClientConfig) => ({ apiVersion: "2019-06-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SSO OIDC", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sso-oidc/runtimeConfig.ts b/clients/client-sso-oidc/runtimeConfig.ts index 71a0ddca23c9..eeacc7681963 100644 --- a/clients/client-sso-oidc/runtimeConfig.ts +++ b/clients/client-sso-oidc/runtimeConfig.ts @@ -5,32 +5,36 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SSOOIDCClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSOOIDCClientConfig } from "./SSOOIDCClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/clients/client-sso/SSOClient.ts b/clients/client-sso/SSOClient.ts index 80ea8fa913f4..b12a34dd4d7a 100644 --- a/clients/client-sso/SSOClient.ts +++ b/clients/client-sso/SSOClient.ts @@ -2,7 +2,7 @@ import { GetRoleCredentialsCommandInput, GetRoleCredentialsCommandOutput } from import { ListAccountRolesCommandInput, ListAccountRolesCommandOutput } from "./commands/ListAccountRolesCommand"; import { ListAccountsCommandInput, ListAccountsCommandOutput } from "./commands/ListAccountsCommand"; import { LogoutCommandInput, LogoutCommandOutput } from "./commands/LogoutCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -220,10 +220,7 @@ export class SSOClient extends __Client< readonly config: SSOClientResolvedConfig; constructor(configuration: SSOClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sso/runtimeConfig.browser.ts b/clients/client-sso/runtimeConfig.browser.ts index f31da568d485..1dcb396ea01c 100644 --- a/clients/client-sso/runtimeConfig.browser.ts +++ b/clients/client-sso/runtimeConfig.browser.ts @@ -4,32 +4,36 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SSOClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSOClientConfig } from "./SSOClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSOClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/clients/client-sso/runtimeConfig.native.ts b/clients/client-sso/runtimeConfig.native.ts index ac771c373546..f4d246d93175 100644 --- a/clients/client-sso/runtimeConfig.native.ts +++ b/clients/client-sso/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SSOClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SSOClientConfig } from "./SSOClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SSOClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sso/runtimeConfig.shared.ts b/clients/client-sso/runtimeConfig.shared.ts index c24c6080fa13..c1441744dea2 100644 --- a/clients/client-sso/runtimeConfig.shared.ts +++ b/clients/client-sso/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SSOClientConfig) => ({ apiVersion: "2019-06-10", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SSO", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sso/runtimeConfig.ts b/clients/client-sso/runtimeConfig.ts index 341d5f745bd3..21c2d15e9f24 100644 --- a/clients/client-sso/runtimeConfig.ts +++ b/clients/client-sso/runtimeConfig.ts @@ -5,32 +5,36 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SSOClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SSOClientConfig } from "./SSOClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SSOClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/clients/client-storage-gateway/StorageGatewayClient.ts b/clients/client-storage-gateway/StorageGatewayClient.ts index 2e9adcc0d993..17f94f23a37c 100644 --- a/clients/client-storage-gateway/StorageGatewayClient.ts +++ b/clients/client-storage-gateway/StorageGatewayClient.ts @@ -237,7 +237,7 @@ import { UpdateVTLDeviceTypeCommandInput, UpdateVTLDeviceTypeCommandOutput, } from "./commands/UpdateVTLDeviceTypeCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -696,10 +696,7 @@ export class StorageGatewayClient extends __Client< readonly config: StorageGatewayClientResolvedConfig; constructor(configuration: StorageGatewayClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-storage-gateway/runtimeConfig.browser.ts b/clients/client-storage-gateway/runtimeConfig.browser.ts index 0ebcf8380e13..5565fe93308b 100644 --- a/clients/client-storage-gateway/runtimeConfig.browser.ts +++ b/clients/client-storage-gateway/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./StorageGatewayClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { StorageGatewayClientConfig } from "./StorageGatewayClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-storage-gateway/runtimeConfig.native.ts b/clients/client-storage-gateway/runtimeConfig.native.ts index 333849f8b99e..62c924c70c08 100644 --- a/clients/client-storage-gateway/runtimeConfig.native.ts +++ b/clients/client-storage-gateway/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./StorageGatewayClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { StorageGatewayClientConfig } from "./StorageGatewayClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-storage-gateway/runtimeConfig.shared.ts b/clients/client-storage-gateway/runtimeConfig.shared.ts index f4ff10870399..05c945ea146c 100644 --- a/clients/client-storage-gateway/runtimeConfig.shared.ts +++ b/clients/client-storage-gateway/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: StorageGatewayClientConfig) => ({ apiVersion: "2013-06-30", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Storage Gateway", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-storage-gateway/runtimeConfig.ts b/clients/client-storage-gateway/runtimeConfig.ts index d9bc9522d4a5..81f6f5d3b83a 100644 --- a/clients/client-storage-gateway/runtimeConfig.ts +++ b/clients/client-storage-gateway/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./StorageGatewayClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { StorageGatewayClientConfig } from "./StorageGatewayClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sts/STSClient.ts b/clients/client-sts/STSClient.ts index 55a3bf372a55..6fa2e8d63ec0 100644 --- a/clients/client-sts/STSClient.ts +++ b/clients/client-sts/STSClient.ts @@ -12,7 +12,7 @@ import { GetAccessKeyInfoCommandInput, GetAccessKeyInfoCommandOutput } from "./c import { GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput } from "./commands/GetCallerIdentityCommand"; import { GetFederationTokenCommandInput, GetFederationTokenCommandOutput } from "./commands/GetFederationTokenCommand"; import { GetSessionTokenCommandInput, GetSessionTokenCommandOutput } from "./commands/GetSessionTokenCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -237,10 +237,7 @@ export class STSClient extends __Client< readonly config: STSClientResolvedConfig; constructor(configuration: STSClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-sts/runtimeConfig.browser.ts b/clients/client-sts/runtimeConfig.browser.ts index addf7343a194..51160dde4fb1 100644 --- a/clients/client-sts/runtimeConfig.browser.ts +++ b/clients/client-sts/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./STSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { STSClientConfig } from "./STSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: STSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-sts/runtimeConfig.native.ts b/clients/client-sts/runtimeConfig.native.ts index c6ea55a45da5..7047a77a820f 100644 --- a/clients/client-sts/runtimeConfig.native.ts +++ b/clients/client-sts/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./STSClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { STSClientConfig } from "./STSClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: STSClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-sts/runtimeConfig.shared.ts b/clients/client-sts/runtimeConfig.shared.ts index cb7e89e11f3e..777ec6fdfa73 100644 --- a/clients/client-sts/runtimeConfig.shared.ts +++ b/clients/client-sts/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: STSClientConfig) => ({ apiVersion: "2011-06-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "STS", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-sts/runtimeConfig.ts b/clients/client-sts/runtimeConfig.ts index 1ac3ec5363d6..98af351b6ebb 100644 --- a/clients/client-sts/runtimeConfig.ts +++ b/clients/client-sts/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./STSClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { STSClientConfig } from "./STSClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: STSClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-support/SupportClient.ts b/clients/client-support/SupportClient.ts index 45ea6e005112..6c710be5df11 100644 --- a/clients/client-support/SupportClient.ts +++ b/clients/client-support/SupportClient.ts @@ -39,7 +39,7 @@ import { RefreshTrustedAdvisorCheckCommandOutput, } from "./commands/RefreshTrustedAdvisorCheckCommand"; import { ResolveCaseCommandInput, ResolveCaseCommandOutput } from "./commands/ResolveCaseCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -350,10 +350,7 @@ export class SupportClient extends __Client< readonly config: SupportClientResolvedConfig; constructor(configuration: SupportClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-support/runtimeConfig.browser.ts b/clients/client-support/runtimeConfig.browser.ts index 5d1dc0f0aae5..fc04f407df25 100644 --- a/clients/client-support/runtimeConfig.browser.ts +++ b/clients/client-support/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SupportClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SupportClientConfig } from "./SupportClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SupportClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-support/runtimeConfig.native.ts b/clients/client-support/runtimeConfig.native.ts index a24f3d917b66..500fc82525e8 100644 --- a/clients/client-support/runtimeConfig.native.ts +++ b/clients/client-support/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SupportClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SupportClientConfig } from "./SupportClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SupportClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-support/runtimeConfig.shared.ts b/clients/client-support/runtimeConfig.shared.ts index 2a7996708ec7..f16e15482f3e 100644 --- a/clients/client-support/runtimeConfig.shared.ts +++ b/clients/client-support/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SupportClientConfig) => ({ apiVersion: "2013-04-15", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Support", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-support/runtimeConfig.ts b/clients/client-support/runtimeConfig.ts index f210aeb92c8f..68b392eb17a6 100644 --- a/clients/client-support/runtimeConfig.ts +++ b/clients/client-support/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SupportClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SupportClientConfig } from "./SupportClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SupportClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-swf/SWFClient.ts b/clients/client-swf/SWFClient.ts index 80ec2ea8bd80..c9f5c22446e7 100644 --- a/clients/client-swf/SWFClient.ts +++ b/clients/client-swf/SWFClient.ts @@ -119,7 +119,7 @@ import { UndeprecateWorkflowTypeCommandOutput, } from "./commands/UndeprecateWorkflowTypeCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -418,10 +418,7 @@ export class SWFClient extends __Client< readonly config: SWFClientResolvedConfig; constructor(configuration: SWFClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-swf/runtimeConfig.browser.ts b/clients/client-swf/runtimeConfig.browser.ts index 2d574b765c19..4eb4d3599319 100644 --- a/clients/client-swf/runtimeConfig.browser.ts +++ b/clients/client-swf/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SWFClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SWFClientConfig } from "./SWFClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SWFClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-swf/runtimeConfig.native.ts b/clients/client-swf/runtimeConfig.native.ts index 4a33eb8279bc..8201f02ac15b 100644 --- a/clients/client-swf/runtimeConfig.native.ts +++ b/clients/client-swf/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SWFClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SWFClientConfig } from "./SWFClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SWFClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-swf/runtimeConfig.shared.ts b/clients/client-swf/runtimeConfig.shared.ts index 5c4ec0776c76..5c883695cf1c 100644 --- a/clients/client-swf/runtimeConfig.shared.ts +++ b/clients/client-swf/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SWFClientConfig) => ({ apiVersion: "2012-01-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "SWF", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-swf/runtimeConfig.ts b/clients/client-swf/runtimeConfig.ts index 93b3b6e190ae..06f63b2bb6d8 100644 --- a/clients/client-swf/runtimeConfig.ts +++ b/clients/client-swf/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SWFClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SWFClientConfig } from "./SWFClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SWFClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-synthetics/SyntheticsClient.ts b/clients/client-synthetics/SyntheticsClient.ts index fb58d8378d20..b72150fd8a2c 100644 --- a/clients/client-synthetics/SyntheticsClient.ts +++ b/clients/client-synthetics/SyntheticsClient.ts @@ -20,7 +20,7 @@ import { StopCanaryCommandInput, StopCanaryCommandOutput } from "./commands/Stop import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateCanaryCommandInput, UpdateCanaryCommandOutput } from "./commands/UpdateCanaryCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -271,10 +271,7 @@ export class SyntheticsClient extends __Client< readonly config: SyntheticsClientResolvedConfig; constructor(configuration: SyntheticsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-synthetics/runtimeConfig.browser.ts b/clients/client-synthetics/runtimeConfig.browser.ts index 52811232665a..31cd8600f4cb 100644 --- a/clients/client-synthetics/runtimeConfig.browser.ts +++ b/clients/client-synthetics/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./SyntheticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SyntheticsClientConfig } from "./SyntheticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SyntheticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-synthetics/runtimeConfig.native.ts b/clients/client-synthetics/runtimeConfig.native.ts index 71e888ac557e..cc722ef73066 100644 --- a/clients/client-synthetics/runtimeConfig.native.ts +++ b/clients/client-synthetics/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./SyntheticsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { SyntheticsClientConfig } from "./SyntheticsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: SyntheticsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-synthetics/runtimeConfig.shared.ts b/clients/client-synthetics/runtimeConfig.shared.ts index 487e1b5b2c31..ab83cb758257 100644 --- a/clients/client-synthetics/runtimeConfig.shared.ts +++ b/clients/client-synthetics/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: SyntheticsClientConfig) => ({ apiVersion: "2017-10-11", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "synthetics", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-synthetics/runtimeConfig.ts b/clients/client-synthetics/runtimeConfig.ts index a933b04e4109..a7879849e904 100644 --- a/clients/client-synthetics/runtimeConfig.ts +++ b/clients/client-synthetics/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./SyntheticsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { SyntheticsClientConfig } from "./SyntheticsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: SyntheticsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-textract/TextractClient.ts b/clients/client-textract/TextractClient.ts index dab1fae9590f..e614fb7b95d0 100644 --- a/clients/client-textract/TextractClient.ts +++ b/clients/client-textract/TextractClient.ts @@ -16,7 +16,7 @@ import { StartDocumentTextDetectionCommandInput, StartDocumentTextDetectionCommandOutput, } from "./commands/StartDocumentTextDetectionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -240,10 +240,7 @@ export class TextractClient extends __Client< readonly config: TextractClientResolvedConfig; constructor(configuration: TextractClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-textract/runtimeConfig.browser.ts b/clients/client-textract/runtimeConfig.browser.ts index 9a1faa97b415..bb1305a14bda 100644 --- a/clients/client-textract/runtimeConfig.browser.ts +++ b/clients/client-textract/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TextractClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TextractClientConfig } from "./TextractClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TextractClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-textract/runtimeConfig.native.ts b/clients/client-textract/runtimeConfig.native.ts index 3f598bafcb17..d76dfdc9941d 100644 --- a/clients/client-textract/runtimeConfig.native.ts +++ b/clients/client-textract/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./TextractClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TextractClientConfig } from "./TextractClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: TextractClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-textract/runtimeConfig.shared.ts b/clients/client-textract/runtimeConfig.shared.ts index f49487ba7baf..240dd093378e 100644 --- a/clients/client-textract/runtimeConfig.shared.ts +++ b/clients/client-textract/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TextractClientConfig) => ({ apiVersion: "2018-06-27", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Textract", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-textract/runtimeConfig.ts b/clients/client-textract/runtimeConfig.ts index 0a14a46c9849..5ab08585e150 100644 --- a/clients/client-textract/runtimeConfig.ts +++ b/clients/client-textract/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TextractClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TextractClientConfig } from "./TextractClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TextractClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-timestream-query/TimestreamQueryClient.ts b/clients/client-timestream-query/TimestreamQueryClient.ts index 899924fe8925..a0b3e865b311 100644 --- a/clients/client-timestream-query/TimestreamQueryClient.ts +++ b/clients/client-timestream-query/TimestreamQueryClient.ts @@ -5,7 +5,7 @@ import { DescribeEndpointsCommandOutput, } from "./commands/DescribeEndpointsCommand"; import { QueryCommandInput, QueryCommandOutput } from "./commands/QueryCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -231,10 +231,7 @@ export class TimestreamQueryClient extends __Client< readonly config: TimestreamQueryClientResolvedConfig; constructor(configuration: TimestreamQueryClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-timestream-query/runtimeConfig.browser.ts b/clients/client-timestream-query/runtimeConfig.browser.ts index a9a4eb9b363c..5e38480f0819 100644 --- a/clients/client-timestream-query/runtimeConfig.browser.ts +++ b/clients/client-timestream-query/runtimeConfig.browser.ts @@ -4,34 +4,43 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TimestreamQueryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TimestreamQueryClientConfig } from "./TimestreamQueryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - endpointDiscoveryEnabledProvider: () => Promise.resolve(undefined), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-timestream-query/runtimeConfig.native.ts b/clients/client-timestream-query/runtimeConfig.native.ts index 7a220f362e23..3b0920787d3b 100644 --- a/clients/client-timestream-query/runtimeConfig.native.ts +++ b/clients/client-timestream-query/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./TimestreamQueryClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TimestreamQueryClientConfig } from "./TimestreamQueryClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-timestream-query/runtimeConfig.shared.ts b/clients/client-timestream-query/runtimeConfig.shared.ts index 60b5c56ddff7..eb199ba32ad9 100644 --- a/clients/client-timestream-query/runtimeConfig.shared.ts +++ b/clients/client-timestream-query/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => ({ apiVersion: "2018-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Timestream Query", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-timestream-query/runtimeConfig.ts b/clients/client-timestream-query/runtimeConfig.ts index 0533c592ff51..7d7d178e3a7b 100644 --- a/clients/client-timestream-query/runtimeConfig.ts +++ b/clients/client-timestream-query/runtimeConfig.ts @@ -8,34 +8,44 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TimestreamQueryClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TimestreamQueryClientConfig } from "./TimestreamQueryClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - endpointDiscoveryEnabledProvider: loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-timestream-write/TimestreamWriteClient.ts b/clients/client-timestream-write/TimestreamWriteClient.ts index cdcf4fe5546c..2214c4c97b1f 100644 --- a/clients/client-timestream-write/TimestreamWriteClient.ts +++ b/clients/client-timestream-write/TimestreamWriteClient.ts @@ -20,7 +20,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateDatabaseCommandInput, UpdateDatabaseCommandOutput } from "./commands/UpdateDatabaseCommand"; import { UpdateTableCommandInput, UpdateTableCommandOutput } from "./commands/UpdateTableCommand"; import { WriteRecordsCommandInput, WriteRecordsCommandOutput } from "./commands/WriteRecordsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -274,10 +274,7 @@ export class TimestreamWriteClient extends __Client< readonly config: TimestreamWriteClientResolvedConfig; constructor(configuration: TimestreamWriteClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-timestream-write/runtimeConfig.browser.ts b/clients/client-timestream-write/runtimeConfig.browser.ts index cf0eba687ca2..0643e5a866da 100644 --- a/clients/client-timestream-write/runtimeConfig.browser.ts +++ b/clients/client-timestream-write/runtimeConfig.browser.ts @@ -4,34 +4,43 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TimestreamWriteClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TimestreamWriteClientConfig } from "./TimestreamWriteClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - endpointDiscoveryEnabledProvider: () => Promise.resolve(undefined), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-timestream-write/runtimeConfig.native.ts b/clients/client-timestream-write/runtimeConfig.native.ts index f192d83dcf87..20800593eea3 100644 --- a/clients/client-timestream-write/runtimeConfig.native.ts +++ b/clients/client-timestream-write/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./TimestreamWriteClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TimestreamWriteClientConfig } from "./TimestreamWriteClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-timestream-write/runtimeConfig.shared.ts b/clients/client-timestream-write/runtimeConfig.shared.ts index b6246f8087fc..0a9677839d3e 100644 --- a/clients/client-timestream-write/runtimeConfig.shared.ts +++ b/clients/client-timestream-write/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => ({ apiVersion: "2018-11-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Timestream Write", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-timestream-write/runtimeConfig.ts b/clients/client-timestream-write/runtimeConfig.ts index ca380c8e9b6a..c935344cb349 100644 --- a/clients/client-timestream-write/runtimeConfig.ts +++ b/clients/client-timestream-write/runtimeConfig.ts @@ -8,34 +8,44 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TimestreamWriteClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TimestreamWriteClientConfig } from "./TimestreamWriteClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - endpointDiscoveryEnabledProvider: loadNodeConfig(NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-transcribe-streaming/TranscribeStreamingClient.ts b/clients/client-transcribe-streaming/TranscribeStreamingClient.ts index da8212907caf..c0cd6fafec64 100644 --- a/clients/client-transcribe-streaming/TranscribeStreamingClient.ts +++ b/clients/client-transcribe-streaming/TranscribeStreamingClient.ts @@ -6,7 +6,7 @@ import { StartStreamTranscriptionCommandInput, StartStreamTranscriptionCommandOutput, } from "./commands/StartStreamTranscriptionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -251,10 +251,7 @@ export class TranscribeStreamingClient extends __Client< readonly config: TranscribeStreamingClientResolvedConfig; constructor(configuration: TranscribeStreamingClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-transcribe-streaming/runtimeConfig.browser.ts b/clients/client-transcribe-streaming/runtimeConfig.browser.ts index 52936dc43c2e..81e2c09d1e33 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.browser.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.browser.ts @@ -6,35 +6,45 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TranscribeStreamingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TranscribeStreamingClientConfig } from "./TranscribeStreamingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamPayloadHandlerProvider: () => eventStreamPayloadHandler, - eventStreamSerdeProvider, - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new WebSocketHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, 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), + }; }; diff --git a/clients/client-transcribe-streaming/runtimeConfig.native.ts b/clients/client-transcribe-streaming/runtimeConfig.native.ts index c8d372a7f560..f23d625d6f8b 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.native.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.native.ts @@ -1,15 +1,22 @@ import { Sha256 } from "@aws-crypto/sha256-js"; import { WebSocketHandler, eventStreamPayloadHandler } from "@aws-sdk/middleware-sdk-transcribe-streaming"; -import { ClientDefaults } from "./TranscribeStreamingClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TranscribeStreamingClientConfig } from "./TranscribeStreamingClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - eventStreamPayloadHandlerProvider: () => eventStreamPayloadHandler, - requestHandler: new WebSocketHandler(), - sha256: Sha256, +export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + eventStreamPayloadHandlerProvider: coalesce( + config.eventStreamPayloadHandlerProvider, + () => eventStreamPayloadHandler + ), + requestHandler: coalesce(config.requestHandler, new WebSocketHandler()), + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-transcribe-streaming/runtimeConfig.shared.ts b/clients/client-transcribe-streaming/runtimeConfig.shared.ts index cbbfedfca61b..8c7110d1f876 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.shared.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => ({ apiVersion: "2017-10-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Transcribe Streaming", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-transcribe-streaming/runtimeConfig.ts b/clients/client-transcribe-streaming/runtimeConfig.ts index 2d121f816a69..393cf487309d 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.ts @@ -9,35 +9,45 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TranscribeStreamingClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TranscribeStreamingClientConfig } from "./TranscribeStreamingClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - eventStreamPayloadHandlerProvider, - eventStreamSerdeProvider, - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttp2Handler({ disableConcurrentStreams: true }), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.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), + }; }; diff --git a/clients/client-transcribe/TranscribeClient.ts b/clients/client-transcribe/TranscribeClient.ts index ddd7f2b84de6..ee49b1e6459f 100644 --- a/clients/client-transcribe/TranscribeClient.ts +++ b/clients/client-transcribe/TranscribeClient.ts @@ -88,7 +88,7 @@ import { UpdateVocabularyFilterCommandInput, UpdateVocabularyFilterCommandOutput, } from "./commands/UpdateVocabularyFilterCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -352,10 +352,7 @@ export class TranscribeClient extends __Client< readonly config: TranscribeClientResolvedConfig; constructor(configuration: TranscribeClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-transcribe/runtimeConfig.browser.ts b/clients/client-transcribe/runtimeConfig.browser.ts index 5e884ec1a682..d3f706bb4924 100644 --- a/clients/client-transcribe/runtimeConfig.browser.ts +++ b/clients/client-transcribe/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TranscribeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TranscribeClientConfig } from "./TranscribeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TranscribeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-transcribe/runtimeConfig.native.ts b/clients/client-transcribe/runtimeConfig.native.ts index 3a5cce493808..d4fde6829f2b 100644 --- a/clients/client-transcribe/runtimeConfig.native.ts +++ b/clients/client-transcribe/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./TranscribeClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TranscribeClientConfig } from "./TranscribeClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: TranscribeClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-transcribe/runtimeConfig.shared.ts b/clients/client-transcribe/runtimeConfig.shared.ts index 1b6d28ac0752..5526af727829 100644 --- a/clients/client-transcribe/runtimeConfig.shared.ts +++ b/clients/client-transcribe/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TranscribeClientConfig) => ({ apiVersion: "2017-10-26", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Transcribe", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-transcribe/runtimeConfig.ts b/clients/client-transcribe/runtimeConfig.ts index 353c18632d8e..655db52b9eab 100644 --- a/clients/client-transcribe/runtimeConfig.ts +++ b/clients/client-transcribe/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TranscribeClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TranscribeClientConfig } from "./TranscribeClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TranscribeClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-transfer/TransferClient.ts b/clients/client-transfer/TransferClient.ts index f18c6a1853ef..c5df92865550 100644 --- a/clients/client-transfer/TransferClient.ts +++ b/clients/client-transfer/TransferClient.ts @@ -35,7 +35,7 @@ import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./command import { UpdateAccessCommandInput, UpdateAccessCommandOutput } from "./commands/UpdateAccessCommand"; import { UpdateServerCommandInput, UpdateServerCommandOutput } from "./commands/UpdateServerCommand"; import { UpdateUserCommandInput, UpdateUserCommandOutput } from "./commands/UpdateUserCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -303,10 +303,7 @@ export class TransferClient extends __Client< readonly config: TransferClientResolvedConfig; constructor(configuration: TransferClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-transfer/runtimeConfig.browser.ts b/clients/client-transfer/runtimeConfig.browser.ts index 2530781f4bd3..21871088e47a 100644 --- a/clients/client-transfer/runtimeConfig.browser.ts +++ b/clients/client-transfer/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TransferClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TransferClientConfig } from "./TransferClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TransferClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-transfer/runtimeConfig.native.ts b/clients/client-transfer/runtimeConfig.native.ts index cedd63512069..5262e3c42aa7 100644 --- a/clients/client-transfer/runtimeConfig.native.ts +++ b/clients/client-transfer/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./TransferClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TransferClientConfig } from "./TransferClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: TransferClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-transfer/runtimeConfig.shared.ts b/clients/client-transfer/runtimeConfig.shared.ts index aed65606afba..d736fdbddfe0 100644 --- a/clients/client-transfer/runtimeConfig.shared.ts +++ b/clients/client-transfer/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TransferClientConfig) => ({ apiVersion: "2018-11-05", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Transfer", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-transfer/runtimeConfig.ts b/clients/client-transfer/runtimeConfig.ts index b2497a687d63..9478e7b53fa2 100644 --- a/clients/client-transfer/runtimeConfig.ts +++ b/clients/client-transfer/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TransferClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TransferClientConfig } from "./TransferClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TransferClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-translate/TranslateClient.ts b/clients/client-translate/TranslateClient.ts index 49fe15a2083a..1336f6e814e3 100644 --- a/clients/client-translate/TranslateClient.ts +++ b/clients/client-translate/TranslateClient.ts @@ -24,7 +24,7 @@ import { } from "./commands/StopTextTranslationJobCommand"; import { TranslateTextCommandInput, TranslateTextCommandOutput } from "./commands/TranslateTextCommand"; import { UpdateParallelDataCommandInput, UpdateParallelDataCommandOutput } from "./commands/UpdateParallelDataCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -263,10 +263,7 @@ export class TranslateClient extends __Client< readonly config: TranslateClientResolvedConfig; constructor(configuration: TranslateClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-translate/runtimeConfig.browser.ts b/clients/client-translate/runtimeConfig.browser.ts index 611cdeb388ab..831f83e11288 100644 --- a/clients/client-translate/runtimeConfig.browser.ts +++ b/clients/client-translate/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./TranslateClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TranslateClientConfig } from "./TranslateClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TranslateClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-translate/runtimeConfig.native.ts b/clients/client-translate/runtimeConfig.native.ts index 811be083a10d..3000fdd06a9f 100644 --- a/clients/client-translate/runtimeConfig.native.ts +++ b/clients/client-translate/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./TranslateClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { TranslateClientConfig } from "./TranslateClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: TranslateClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-translate/runtimeConfig.shared.ts b/clients/client-translate/runtimeConfig.shared.ts index f0456b167716..665409ef182b 100644 --- a/clients/client-translate/runtimeConfig.shared.ts +++ b/clients/client-translate/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: TranslateClientConfig) => ({ apiVersion: "2017-07-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Translate", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-translate/runtimeConfig.ts b/clients/client-translate/runtimeConfig.ts index 625db47cf960..d8a93a892334 100644 --- a/clients/client-translate/runtimeConfig.ts +++ b/clients/client-translate/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./TranslateClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { TranslateClientConfig } from "./TranslateClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: TranslateClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-waf-regional/WAFRegionalClient.ts b/clients/client-waf-regional/WAFRegionalClient.ts index 9f8a42995788..a95eda9d1978 100644 --- a/clients/client-waf-regional/WAFRegionalClient.ts +++ b/clients/client-waf-regional/WAFRegionalClient.ts @@ -184,7 +184,7 @@ import { } from "./commands/UpdateSqlInjectionMatchSetCommand"; import { UpdateWebACLCommandInput, UpdateWebACLCommandOutput } from "./commands/UpdateWebACLCommand"; import { UpdateXssMatchSetCommandInput, UpdateXssMatchSetCommandOutput } from "./commands/UpdateXssMatchSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -566,10 +566,7 @@ export class WAFRegionalClient extends __Client< readonly config: WAFRegionalClientResolvedConfig; constructor(configuration: WAFRegionalClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-waf-regional/runtimeConfig.browser.ts b/clients/client-waf-regional/runtimeConfig.browser.ts index 4619a15762e1..20ff9e8f7c46 100644 --- a/clients/client-waf-regional/runtimeConfig.browser.ts +++ b/clients/client-waf-regional/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WAFRegionalClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WAFRegionalClientConfig } from "./WAFRegionalClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-waf-regional/runtimeConfig.native.ts b/clients/client-waf-regional/runtimeConfig.native.ts index 6adaa5d1f8ee..75f51487e71e 100644 --- a/clients/client-waf-regional/runtimeConfig.native.ts +++ b/clients/client-waf-regional/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WAFRegionalClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WAFRegionalClientConfig } from "./WAFRegionalClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-waf-regional/runtimeConfig.shared.ts b/clients/client-waf-regional/runtimeConfig.shared.ts index ff1647e0167c..435f962d3fdf 100644 --- a/clients/client-waf-regional/runtimeConfig.shared.ts +++ b/clients/client-waf-regional/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WAFRegionalClientConfig) => ({ apiVersion: "2016-11-28", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WAF Regional", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-waf-regional/runtimeConfig.ts b/clients/client-waf-regional/runtimeConfig.ts index 83985c8d12c6..8b568f175109 100644 --- a/clients/client-waf-regional/runtimeConfig.ts +++ b/clients/client-waf-regional/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WAFRegionalClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WAFRegionalClientConfig } from "./WAFRegionalClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-waf/WAFClient.ts b/clients/client-waf/WAFClient.ts index b7e0b1af69a4..ff300d1b017a 100644 --- a/clients/client-waf/WAFClient.ts +++ b/clients/client-waf/WAFClient.ts @@ -174,7 +174,7 @@ import { } from "./commands/UpdateSqlInjectionMatchSetCommand"; import { UpdateWebACLCommandInput, UpdateWebACLCommandOutput } from "./commands/UpdateWebACLCommand"; import { UpdateXssMatchSetCommandInput, UpdateXssMatchSetCommandOutput } from "./commands/UpdateXssMatchSetCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -548,10 +548,7 @@ export class WAFClient extends __Client< readonly config: WAFClientResolvedConfig; constructor(configuration: WAFClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-waf/runtimeConfig.browser.ts b/clients/client-waf/runtimeConfig.browser.ts index 29417fd604ae..3e977bd97de9 100644 --- a/clients/client-waf/runtimeConfig.browser.ts +++ b/clients/client-waf/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WAFClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WAFClientConfig } from "./WAFClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WAFClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-waf/runtimeConfig.native.ts b/clients/client-waf/runtimeConfig.native.ts index b0ffc8b5f4db..8067dbeff294 100644 --- a/clients/client-waf/runtimeConfig.native.ts +++ b/clients/client-waf/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WAFClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WAFClientConfig } from "./WAFClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WAFClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-waf/runtimeConfig.shared.ts b/clients/client-waf/runtimeConfig.shared.ts index 1e4920f7b72c..666c095ad793 100644 --- a/clients/client-waf/runtimeConfig.shared.ts +++ b/clients/client-waf/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WAFClientConfig) => ({ apiVersion: "2015-08-24", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WAF", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-waf/runtimeConfig.ts b/clients/client-waf/runtimeConfig.ts index 47ca0587542b..6e88163458e9 100644 --- a/clients/client-waf/runtimeConfig.ts +++ b/clients/client-waf/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WAFClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WAFClientConfig } from "./WAFClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WAFClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-wafv2/WAFV2Client.ts b/clients/client-wafv2/WAFV2Client.ts index 7617b416e50c..fc169c1f1594 100644 --- a/clients/client-wafv2/WAFV2Client.ts +++ b/clients/client-wafv2/WAFV2Client.ts @@ -92,7 +92,7 @@ import { } from "./commands/UpdateRegexPatternSetCommand"; import { UpdateRuleGroupCommandInput, UpdateRuleGroupCommandOutput } from "./commands/UpdateRuleGroupCommand"; import { UpdateWebACLCommandInput, UpdateWebACLCommandOutput } from "./commands/UpdateWebACLCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -438,10 +438,7 @@ export class WAFV2Client extends __Client< readonly config: WAFV2ClientResolvedConfig; constructor(configuration: WAFV2ClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-wafv2/runtimeConfig.browser.ts b/clients/client-wafv2/runtimeConfig.browser.ts index 1453fb9cb61c..8fafd5563714 100644 --- a/clients/client-wafv2/runtimeConfig.browser.ts +++ b/clients/client-wafv2/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WAFV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WAFV2ClientConfig } from "./WAFV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WAFV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-wafv2/runtimeConfig.native.ts b/clients/client-wafv2/runtimeConfig.native.ts index 31797ed4b06f..86c51fd783bd 100644 --- a/clients/client-wafv2/runtimeConfig.native.ts +++ b/clients/client-wafv2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WAFV2Client"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WAFV2ClientConfig } from "./WAFV2Client"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WAFV2ClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-wafv2/runtimeConfig.shared.ts b/clients/client-wafv2/runtimeConfig.shared.ts index f96f861d5c3e..c919ba5d2e24 100644 --- a/clients/client-wafv2/runtimeConfig.shared.ts +++ b/clients/client-wafv2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WAFV2ClientConfig) => ({ apiVersion: "2019-07-29", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WAFV2", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-wafv2/runtimeConfig.ts b/clients/client-wafv2/runtimeConfig.ts index a05305c7f170..666dcb9e9026 100644 --- a/clients/client-wafv2/runtimeConfig.ts +++ b/clients/client-wafv2/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WAFV2Client"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WAFV2ClientConfig } from "./WAFV2Client"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WAFV2ClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-wellarchitected/WellArchitectedClient.ts b/clients/client-wellarchitected/WellArchitectedClient.ts index ab0f35c6f458..5a09471b3b8f 100644 --- a/clients/client-wellarchitected/WellArchitectedClient.ts +++ b/clients/client-wellarchitected/WellArchitectedClient.ts @@ -56,7 +56,7 @@ import { UpdateWorkloadShareCommandOutput, } from "./commands/UpdateWorkloadShareCommand"; import { UpgradeLensReviewCommandInput, UpgradeLensReviewCommandOutput } from "./commands/UpgradeLensReviewCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -334,10 +334,7 @@ export class WellArchitectedClient extends __Client< readonly config: WellArchitectedClientResolvedConfig; constructor(configuration: WellArchitectedClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-wellarchitected/runtimeConfig.browser.ts b/clients/client-wellarchitected/runtimeConfig.browser.ts index a1975c17a186..41c548e4195a 100644 --- a/clients/client-wellarchitected/runtimeConfig.browser.ts +++ b/clients/client-wellarchitected/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WellArchitectedClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WellArchitectedClientConfig } from "./WellArchitectedClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-wellarchitected/runtimeConfig.native.ts b/clients/client-wellarchitected/runtimeConfig.native.ts index d32398df2775..fe7fa9d41a6a 100644 --- a/clients/client-wellarchitected/runtimeConfig.native.ts +++ b/clients/client-wellarchitected/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WellArchitectedClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WellArchitectedClientConfig } from "./WellArchitectedClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-wellarchitected/runtimeConfig.shared.ts b/clients/client-wellarchitected/runtimeConfig.shared.ts index 4a86aa5f6d15..d3fafac440cf 100644 --- a/clients/client-wellarchitected/runtimeConfig.shared.ts +++ b/clients/client-wellarchitected/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WellArchitectedClientConfig) => ({ apiVersion: "2020-03-31", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WellArchitected", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-wellarchitected/runtimeConfig.ts b/clients/client-wellarchitected/runtimeConfig.ts index d70a99b5073a..7474155cd9ad 100644 --- a/clients/client-wellarchitected/runtimeConfig.ts +++ b/clients/client-wellarchitected/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WellArchitectedClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WellArchitectedClientConfig } from "./WellArchitectedClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workdocs/WorkDocsClient.ts b/clients/client-workdocs/WorkDocsClient.ts index dc7976d86726..21ac9ba3c874 100644 --- a/clients/client-workdocs/WorkDocsClient.ts +++ b/clients/client-workdocs/WorkDocsClient.ts @@ -87,7 +87,7 @@ import { } from "./commands/UpdateDocumentVersionCommand"; import { UpdateFolderCommandInput, UpdateFolderCommandOutput } from "./commands/UpdateFolderCommand"; import { UpdateUserCommandInput, UpdateUserCommandOutput } from "./commands/UpdateUserCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -411,10 +411,7 @@ export class WorkDocsClient extends __Client< readonly config: WorkDocsClientResolvedConfig; constructor(configuration: WorkDocsClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-workdocs/runtimeConfig.browser.ts b/clients/client-workdocs/runtimeConfig.browser.ts index 24f606674081..78b9167a0201 100644 --- a/clients/client-workdocs/runtimeConfig.browser.ts +++ b/clients/client-workdocs/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WorkDocsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkDocsClientConfig } from "./WorkDocsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkDocsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workdocs/runtimeConfig.native.ts b/clients/client-workdocs/runtimeConfig.native.ts index cb1c286cbcd4..cb415fef94ae 100644 --- a/clients/client-workdocs/runtimeConfig.native.ts +++ b/clients/client-workdocs/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WorkDocsClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WorkDocsClientConfig } from "./WorkDocsClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WorkDocsClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-workdocs/runtimeConfig.shared.ts b/clients/client-workdocs/runtimeConfig.shared.ts index 1c9be0d0d5d2..7f963d040b92 100644 --- a/clients/client-workdocs/runtimeConfig.shared.ts +++ b/clients/client-workdocs/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WorkDocsClientConfig) => ({ apiVersion: "2016-05-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WorkDocs", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-workdocs/runtimeConfig.ts b/clients/client-workdocs/runtimeConfig.ts index c5b0b587dc61..edd73435c1d5 100644 --- a/clients/client-workdocs/runtimeConfig.ts +++ b/clients/client-workdocs/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WorkDocsClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkDocsClientConfig } from "./WorkDocsClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkDocsClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-worklink/WorkLinkClient.ts b/clients/client-worklink/WorkLinkClient.ts index f06d70bb837d..481039a54d3f 100644 --- a/clients/client-worklink/WorkLinkClient.ts +++ b/clients/client-worklink/WorkLinkClient.ts @@ -91,7 +91,7 @@ import { UpdateIdentityProviderConfigurationCommandInput, UpdateIdentityProviderConfigurationCommandOutput, } from "./commands/UpdateIdentityProviderConfigurationCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -373,10 +373,7 @@ export class WorkLinkClient extends __Client< readonly config: WorkLinkClientResolvedConfig; constructor(configuration: WorkLinkClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-worklink/runtimeConfig.browser.ts b/clients/client-worklink/runtimeConfig.browser.ts index e2710867c016..f9610014752c 100644 --- a/clients/client-worklink/runtimeConfig.browser.ts +++ b/clients/client-worklink/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WorkLinkClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkLinkClientConfig } from "./WorkLinkClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkLinkClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-worklink/runtimeConfig.native.ts b/clients/client-worklink/runtimeConfig.native.ts index d0c16bd31f35..456492b61b64 100644 --- a/clients/client-worklink/runtimeConfig.native.ts +++ b/clients/client-worklink/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WorkLinkClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WorkLinkClientConfig } from "./WorkLinkClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WorkLinkClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-worklink/runtimeConfig.shared.ts b/clients/client-worklink/runtimeConfig.shared.ts index c54853fcbc5e..4a63088482c1 100644 --- a/clients/client-worklink/runtimeConfig.shared.ts +++ b/clients/client-worklink/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WorkLinkClientConfig) => ({ apiVersion: "2018-09-25", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WorkLink", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-worklink/runtimeConfig.ts b/clients/client-worklink/runtimeConfig.ts index 28e5b568778e..876372d6c77b 100644 --- a/clients/client-worklink/runtimeConfig.ts +++ b/clients/client-worklink/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WorkLinkClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkLinkClientConfig } from "./WorkLinkClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkLinkClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workmail/WorkMailClient.ts b/clients/client-workmail/WorkMailClient.ts index 0174b60a6086..11566d0daa23 100644 --- a/clients/client-workmail/WorkMailClient.ts +++ b/clients/client-workmail/WorkMailClient.ts @@ -133,7 +133,7 @@ import { UpdatePrimaryEmailAddressCommandOutput, } from "./commands/UpdatePrimaryEmailAddressCommand"; import { UpdateResourceCommandInput, UpdateResourceCommandOutput } from "./commands/UpdateResourceCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -486,10 +486,7 @@ export class WorkMailClient extends __Client< readonly config: WorkMailClientResolvedConfig; constructor(configuration: WorkMailClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-workmail/runtimeConfig.browser.ts b/clients/client-workmail/runtimeConfig.browser.ts index a9fab859256e..dae1040ee6fd 100644 --- a/clients/client-workmail/runtimeConfig.browser.ts +++ b/clients/client-workmail/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WorkMailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkMailClientConfig } from "./WorkMailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkMailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workmail/runtimeConfig.native.ts b/clients/client-workmail/runtimeConfig.native.ts index 568be7b3ea40..85ca4e5c72e4 100644 --- a/clients/client-workmail/runtimeConfig.native.ts +++ b/clients/client-workmail/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WorkMailClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WorkMailClientConfig } from "./WorkMailClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WorkMailClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-workmail/runtimeConfig.shared.ts b/clients/client-workmail/runtimeConfig.shared.ts index 92fae30e87a7..cc8baefeae03 100644 --- a/clients/client-workmail/runtimeConfig.shared.ts +++ b/clients/client-workmail/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WorkMailClientConfig) => ({ apiVersion: "2017-10-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WorkMail", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-workmail/runtimeConfig.ts b/clients/client-workmail/runtimeConfig.ts index 673abe1c39e0..65ca0e7616d9 100644 --- a/clients/client-workmail/runtimeConfig.ts +++ b/clients/client-workmail/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WorkMailClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkMailClientConfig } from "./WorkMailClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkMailClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workmailmessageflow/WorkMailMessageFlowClient.ts b/clients/client-workmailmessageflow/WorkMailMessageFlowClient.ts index 41f38ae16ee7..f0a2db60689e 100644 --- a/clients/client-workmailmessageflow/WorkMailMessageFlowClient.ts +++ b/clients/client-workmailmessageflow/WorkMailMessageFlowClient.ts @@ -6,7 +6,7 @@ import { PutRawMessageContentCommandInput, PutRawMessageContentCommandOutput, } from "./commands/PutRawMessageContentCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -220,10 +220,7 @@ export class WorkMailMessageFlowClient extends __Client< readonly config: WorkMailMessageFlowClientResolvedConfig; constructor(configuration: WorkMailMessageFlowClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-workmailmessageflow/runtimeConfig.browser.ts b/clients/client-workmailmessageflow/runtimeConfig.browser.ts index 4972832f0105..fbf455b7f1e9 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.browser.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WorkMailMessageFlowClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workmailmessageflow/runtimeConfig.native.ts b/clients/client-workmailmessageflow/runtimeConfig.native.ts index 73ad10fb6f6f..dd18da03ced8 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.native.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WorkMailMessageFlowClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-workmailmessageflow/runtimeConfig.shared.ts b/clients/client-workmailmessageflow/runtimeConfig.shared.ts index 99b9acd30dab..c07187a5594e 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.shared.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => ({ apiVersion: "2019-05-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WorkMailMessageFlow", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-workmailmessageflow/runtimeConfig.ts b/clients/client-workmailmessageflow/runtimeConfig.ts index 975cd4d0d853..9b94c9027ad2 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WorkMailMessageFlowClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workspaces/WorkSpacesClient.ts b/clients/client-workspaces/WorkSpacesClient.ts index 47caca73bca5..aecb464038db 100644 --- a/clients/client-workspaces/WorkSpacesClient.ts +++ b/clients/client-workspaces/WorkSpacesClient.ts @@ -150,7 +150,7 @@ import { UpdateWorkspaceImagePermissionCommandInput, UpdateWorkspaceImagePermissionCommandOutput, } from "./commands/UpdateWorkspaceImagePermissionCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -468,10 +468,7 @@ export class WorkSpacesClient extends __Client< readonly config: WorkSpacesClientResolvedConfig; constructor(configuration: WorkSpacesClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-workspaces/runtimeConfig.browser.ts b/clients/client-workspaces/runtimeConfig.browser.ts index 15dac90d2632..7932c62aa844 100644 --- a/clients/client-workspaces/runtimeConfig.browser.ts +++ b/clients/client-workspaces/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./WorkSpacesClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkSpacesClientConfig } from "./WorkSpacesClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-workspaces/runtimeConfig.native.ts b/clients/client-workspaces/runtimeConfig.native.ts index 396313f75e50..8f7a3d0afb66 100644 --- a/clients/client-workspaces/runtimeConfig.native.ts +++ b/clients/client-workspaces/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./WorkSpacesClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { WorkSpacesClientConfig } from "./WorkSpacesClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-workspaces/runtimeConfig.shared.ts b/clients/client-workspaces/runtimeConfig.shared.ts index f8b5cca5b27e..69f67b1e144e 100644 --- a/clients/client-workspaces/runtimeConfig.shared.ts +++ b/clients/client-workspaces/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: WorkSpacesClientConfig) => ({ apiVersion: "2015-04-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "WorkSpaces", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-workspaces/runtimeConfig.ts b/clients/client-workspaces/runtimeConfig.ts index 4b02b097bfd6..4ae8cc7c1ca4 100644 --- a/clients/client-workspaces/runtimeConfig.ts +++ b/clients/client-workspaces/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./WorkSpacesClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { WorkSpacesClientConfig } from "./WorkSpacesClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-xray/XRayClient.ts b/clients/client-xray/XRayClient.ts index 22812cd4956d..397f0be626f8 100644 --- a/clients/client-xray/XRayClient.ts +++ b/clients/client-xray/XRayClient.ts @@ -49,7 +49,7 @@ import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/Ta import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdateGroupCommandInput, UpdateGroupCommandOutput } from "./commands/UpdateGroupCommand"; import { UpdateSamplingRuleCommandInput, UpdateSamplingRuleCommandOutput } from "./commands/UpdateSamplingRuleCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -314,10 +314,7 @@ export class XRayClient extends __Client< readonly config: XRayClientResolvedConfig; constructor(configuration: XRayClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/clients/client-xray/runtimeConfig.browser.ts b/clients/client-xray/runtimeConfig.browser.ts index ab62cf726b2c..c714f84eb8a6 100644 --- a/clients/client-xray/runtimeConfig.browser.ts +++ b/clients/client-xray/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./XRayClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { XRayClientConfig } from "./XRayClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: XRayClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/clients/client-xray/runtimeConfig.native.ts b/clients/client-xray/runtimeConfig.native.ts index b0c08cafda9a..e84fedd14c95 100644 --- a/clients/client-xray/runtimeConfig.native.ts +++ b/clients/client-xray/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./XRayClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { XRayClientConfig } from "./XRayClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: XRayClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/clients/client-xray/runtimeConfig.shared.ts b/clients/client-xray/runtimeConfig.shared.ts index b4652b2f84e4..3dd54b561127 100644 --- a/clients/client-xray/runtimeConfig.shared.ts +++ b/clients/client-xray/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: XRayClientConfig) => ({ apiVersion: "2016-04-12", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "XRay", - urlParser: parseUrl, -}; + 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), +}); diff --git a/clients/client-xray/runtimeConfig.ts b/clients/client-xray/runtimeConfig.ts index a770281c7413..c4fc372102c8 100644 --- a/clients/client-xray/runtimeConfig.ts +++ b/clients/client-xray/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./XRayClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { XRayClientConfig } from "./XRayClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: XRayClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/protocol_tests/aws-ec2/EC2ProtocolClient.ts b/protocol_tests/aws-ec2/EC2ProtocolClient.ts index 104e5e34dc59..2afa2beafaab 100644 --- a/protocol_tests/aws-ec2/EC2ProtocolClient.ts +++ b/protocol_tests/aws-ec2/EC2ProtocolClient.ts @@ -33,7 +33,7 @@ import { XmlEnumsCommandInput, XmlEnumsCommandOutput } from "./commands/XmlEnums import { XmlListsCommandInput, XmlListsCommandOutput } from "./commands/XmlListsCommand"; import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -263,10 +263,7 @@ export class EC2ProtocolClient extends __Client< readonly config: EC2ProtocolClientResolvedConfig; constructor(configuration: EC2ProtocolClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/protocol_tests/aws-ec2/runtimeConfig.browser.ts b/protocol_tests/aws-ec2/runtimeConfig.browser.ts index affd3bccf52c..68da984870c0 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.browser.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.browser.ts @@ -3,31 +3,35 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./EC2ProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-ec2/runtimeConfig.native.ts b/protocol_tests/aws-ec2/runtimeConfig.native.ts index 34df16be30da..6b75cc64d253 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.native.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./EC2ProtocolClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/protocol_tests/aws-ec2/runtimeConfig.shared.ts b/protocol_tests/aws-ec2/runtimeConfig.shared.ts index 08b60e712bbc..096e7be6ce9d 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.shared.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => ({ apiVersion: "2020-01-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "EC2 Protocol", - urlParser: parseUrl, -}; + 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), +}); diff --git a/protocol_tests/aws-ec2/runtimeConfig.ts b/protocol_tests/aws-ec2/runtimeConfig.ts index 08d9087c6bf1..7024dff3ee08 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.ts @@ -4,31 +4,35 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./EC2ProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { EC2ProtocolClientConfig } from "./EC2ProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-json/JsonProtocolClient.ts b/protocol_tests/aws-json/JsonProtocolClient.ts index 7832b368b118..a579bcc72088 100644 --- a/protocol_tests/aws-json/JsonProtocolClient.ts +++ b/protocol_tests/aws-json/JsonProtocolClient.ts @@ -24,7 +24,7 @@ import { SimpleScalarPropertiesCommandInput, SimpleScalarPropertiesCommandOutput, } from "./commands/SimpleScalarPropertiesCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -253,10 +253,7 @@ export class JsonProtocolClient extends __Client< readonly config: JsonProtocolClientResolvedConfig; constructor(configuration: JsonProtocolClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/protocol_tests/aws-json/runtimeConfig.browser.ts b/protocol_tests/aws-json/runtimeConfig.browser.ts index 5e1930bf1189..b9b10c500e0e 100644 --- a/protocol_tests/aws-json/runtimeConfig.browser.ts +++ b/protocol_tests/aws-json/runtimeConfig.browser.ts @@ -4,33 +4,40 @@ import { Sha256 } from "@aws-crypto/sha256-browser"; import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler"; import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./JsonProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: (_: unknown) => () => Promise.reject(new Error("Credential is missing")), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - region: invalidProvider("Region is missing"), - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "browser", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + (_: unknown) => () => Promise.reject(new Error("Credential is missing")) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, DEFAULT_MAX_ATTEMPTS), + region: coalesce(config.region, invalidProvider("Region is missing")), + requestHandler: coalesce(config.requestHandler, new FetchHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, () => Promise.resolve(DEFAULT_RETRY_MODE)), + sha256: coalesce(config.sha256, Sha256), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/protocol_tests/aws-json/runtimeConfig.native.ts b/protocol_tests/aws-json/runtimeConfig.native.ts index b677bfe9f69b..8dc3fe2581ca 100644 --- a/protocol_tests/aws-json/runtimeConfig.native.ts +++ b/protocol_tests/aws-json/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./JsonProtocolClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/protocol_tests/aws-json/runtimeConfig.shared.ts b/protocol_tests/aws-json/runtimeConfig.shared.ts index 1ae33ef57c26..43f6dea5e272 100644 --- a/protocol_tests/aws-json/runtimeConfig.shared.ts +++ b/protocol_tests/aws-json/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => ({ apiVersion: "2018-01-01", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Json Protocol", - urlParser: parseUrl, -}; + 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), +}); diff --git a/protocol_tests/aws-json/runtimeConfig.ts b/protocol_tests/aws-json/runtimeConfig.ts index 092961ef8e30..0e5503c96920 100644 --- a/protocol_tests/aws-json/runtimeConfig.ts +++ b/protocol_tests/aws-json/runtimeConfig.ts @@ -7,33 +7,40 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./JsonProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { JsonProtocolClientConfig } from "./JsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - credentialDefaultProvider: decorateDefaultCredentialProvider(credentialDefaultProvider), - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + return { + ...clientSharedValues, + runtime: "node", + base64Decoder: coalesce(config.base64Decoder, fromBase64), + base64Encoder: coalesce(config.base64Encoder, toBase64), + bodyLengthChecker: coalesce(config.bodyLengthChecker, calculateBodyLength), + credentialDefaultProvider: coalesce( + config.credentialDefaultProvider, + decorateDefaultCredentialProvider(credentialDefaultProvider) + ), + defaultUserAgentProvider: coalesce( + config.defaultUserAgentProvider, + defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }) + ), + maxAttempts: coalesce(config.maxAttempts, loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS)), + region: coalesce(config.region, loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)), + requestHandler: coalesce(config.requestHandler, new NodeHttpHandler()), + retryModeProvider: coalesce(config.retryModeProvider, loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS)), + sha256: coalesce(config.sha256, Hash.bind(null, "sha256")), + streamCollector: coalesce(config.streamCollector, streamCollector), + utf8Decoder: coalesce(config.utf8Decoder, fromUtf8), + utf8Encoder: coalesce(config.utf8Encoder, toUtf8), + }; }; diff --git a/protocol_tests/aws-query/QueryProtocolClient.ts b/protocol_tests/aws-query/QueryProtocolClient.ts index 7c5315fa574c..e0b687a32b6f 100644 --- a/protocol_tests/aws-query/QueryProtocolClient.ts +++ b/protocol_tests/aws-query/QueryProtocolClient.ts @@ -47,7 +47,7 @@ import { XmlMapsCommandInput, XmlMapsCommandOutput } from "./commands/XmlMapsCom import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "./commands/XmlMapsXmlNameCommand"; import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -293,10 +293,7 @@ export class QueryProtocolClient extends __Client< readonly config: QueryProtocolClientResolvedConfig; constructor(configuration: QueryProtocolClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/protocol_tests/aws-query/runtimeConfig.browser.ts b/protocol_tests/aws-query/runtimeConfig.browser.ts index 1e9a8ca0c533..2f471aea3d60 100644 --- a/protocol_tests/aws-query/runtimeConfig.browser.ts +++ b/protocol_tests/aws-query/runtimeConfig.browser.ts @@ -3,31 +3,35 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./QueryProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-query/runtimeConfig.native.ts b/protocol_tests/aws-query/runtimeConfig.native.ts index 293d8ed99c30..eb320f28d338 100644 --- a/protocol_tests/aws-query/runtimeConfig.native.ts +++ b/protocol_tests/aws-query/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./QueryProtocolClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/protocol_tests/aws-query/runtimeConfig.shared.ts b/protocol_tests/aws-query/runtimeConfig.shared.ts index ee35519aea3f..b29dc2a02d2d 100644 --- a/protocol_tests/aws-query/runtimeConfig.shared.ts +++ b/protocol_tests/aws-query/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => ({ apiVersion: "2020-01-08", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Query Protocol", - urlParser: parseUrl, -}; + 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), +}); diff --git a/protocol_tests/aws-query/runtimeConfig.ts b/protocol_tests/aws-query/runtimeConfig.ts index 48f47d1693c7..78890da3c2fc 100644 --- a/protocol_tests/aws-query/runtimeConfig.ts +++ b/protocol_tests/aws-query/runtimeConfig.ts @@ -4,31 +4,35 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./QueryProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { QueryProtocolClientConfig } from "./QueryProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-restjson/RestJsonProtocolClient.ts b/protocol_tests/aws-restjson/RestJsonProtocolClient.ts index ccf4f584993e..87748ea9089f 100644 --- a/protocol_tests/aws-restjson/RestJsonProtocolClient.ts +++ b/protocol_tests/aws-restjson/RestJsonProtocolClient.ts @@ -118,7 +118,7 @@ import { TimestampFormatHeadersCommandInput, TimestampFormatHeadersCommandOutput, } from "./commands/TimestampFormatHeadersCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -398,10 +398,7 @@ export class RestJsonProtocolClient extends __Client< readonly config: RestJsonProtocolClientResolvedConfig; constructor(configuration: RestJsonProtocolClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/protocol_tests/aws-restjson/runtimeConfig.browser.ts b/protocol_tests/aws-restjson/runtimeConfig.browser.ts index a82733c44fbd..b99a9b674149 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.browser.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.browser.ts @@ -3,31 +3,35 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RestJsonProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-restjson/runtimeConfig.native.ts b/protocol_tests/aws-restjson/runtimeConfig.native.ts index 592bb8c091ad..978c64237b94 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.native.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RestJsonProtocolClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/protocol_tests/aws-restjson/runtimeConfig.shared.ts b/protocol_tests/aws-restjson/runtimeConfig.shared.ts index 59da86dcb59b..9f0ad3a7fef5 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.shared.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => ({ apiVersion: "2019-12-16", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Rest Json Protocol", - urlParser: parseUrl, -}; + 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), +}); diff --git a/protocol_tests/aws-restjson/runtimeConfig.ts b/protocol_tests/aws-restjson/runtimeConfig.ts index 102c4eb1fdcd..5e285bcb061d 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.ts @@ -4,31 +4,35 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RestJsonProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-restxml/RestXmlProtocolClient.ts b/protocol_tests/aws-restxml/RestXmlProtocolClient.ts index 61fc864cd1d1..5d508afb4200 100644 --- a/protocol_tests/aws-restxml/RestXmlProtocolClient.ts +++ b/protocol_tests/aws-restxml/RestXmlProtocolClient.ts @@ -135,7 +135,7 @@ import { XmlMapsXmlNameCommandInput, XmlMapsXmlNameCommandOutput } from "./comma import { XmlNamespacesCommandInput, XmlNamespacesCommandOutput } from "./commands/XmlNamespacesCommand"; import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./commands/XmlTimestampsCommand"; import { XmlUnionsCommandInput, XmlUnionsCommandOutput } from "./commands/XmlUnionsCommand"; -import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; import { EndpointsInputConfig, EndpointsResolvedConfig, @@ -431,10 +431,7 @@ export class RestXmlProtocolClient extends __Client< readonly config: RestXmlProtocolClientResolvedConfig; constructor(configuration: RestXmlProtocolClientConfig) { - let _config_0 = { - ...__ClientDefaultValues, - ...configuration, - }; + let _config_0 = __getRuntimeConfig(configuration); let _config_1 = resolveRegionConfig(_config_0); let _config_2 = resolveEndpointsConfig(_config_1); let _config_3 = resolveRetryConfig(_config_2); diff --git a/protocol_tests/aws-restxml/runtimeConfig.browser.ts b/protocol_tests/aws-restxml/runtimeConfig.browser.ts index 2f7de1ac26ad..49803e04c297 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.browser.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.browser.ts @@ -3,31 +3,35 @@ 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"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; -import { ClientDefaults } from "./RestXmlProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "browser", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: DEFAULT_MAX_ATTEMPTS, - requestHandler: new FetchHttpHandler(), - retryModeProvider: () => Promise.resolve(DEFAULT_RETRY_MODE), - sha256: Sha256, - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; diff --git a/protocol_tests/aws-restxml/runtimeConfig.native.ts b/protocol_tests/aws-restxml/runtimeConfig.native.ts index 331db5fe38a3..8572900c816c 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.native.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.native.ts @@ -1,12 +1,16 @@ import { Sha256 } from "@aws-crypto/sha256-js"; -import { ClientDefaults } from "./RestXmlProtocolClient"; -import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; +import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...BrowserDefaults, - runtime: "react-native", - sha256: Sha256, +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { + const browserDefaults = getBrowserRuntimeConfig(config); + return { + ...browserDefaults, + runtime: "react-native", + sha256: coalesce(config.sha256, Sha256), + }; }; diff --git a/protocol_tests/aws-restxml/runtimeConfig.shared.ts b/protocol_tests/aws-restxml/runtimeConfig.shared.ts index 918b732586d8..66a4b4725f53 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.shared.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.shared.ts @@ -1,15 +1,17 @@ import { defaultRegionInfoProvider } from "./endpoints"; +import { 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"; /** * @internal */ -export const ClientSharedValues = { +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => ({ apiVersion: "2019-12-16", - disableHostPrefix: false, - logger: {} as __Logger, - regionInfoProvider: defaultRegionInfoProvider, - serviceId: "Rest Xml Protocol", - urlParser: parseUrl, -}; + 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), +}); diff --git a/protocol_tests/aws-restxml/runtimeConfig.ts b/protocol_tests/aws-restxml/runtimeConfig.ts index 01cef72f70c7..3206b7e4092f 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.ts @@ -4,31 +4,35 @@ import { Hash } from "@aws-sdk/hash-node"; import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry"; import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler"; +import { nullishCoalescing as coalesce } from "@aws-sdk/smithy-client"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; -import { ClientDefaults } from "./RestXmlProtocolClient"; -import { ClientSharedValues } from "./runtimeConfig.shared"; +import { RestXmlProtocolClientConfig } from "./RestXmlProtocolClient"; +import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared"; /** * @internal */ -export const ClientDefaultValues: Required = { - ...ClientSharedValues, - runtime: "node", - base64Decoder: fromBase64, - base64Encoder: toBase64, - bodyLengthChecker: calculateBodyLength, - defaultUserAgentProvider: defaultUserAgent({ - serviceId: ClientSharedValues.serviceId, - clientVersion: packageInfo.version, - }), - maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - requestHandler: new NodeHttpHandler(), - retryModeProvider: loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS), - sha256: Hash.bind(null, "sha256"), - streamCollector, - utf8Decoder: fromUtf8, - utf8Encoder: toUtf8, +export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { + const clientSharedValues = getSharedRuntimeConfig(config); + 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), + }; }; From 123a4cf0cd6995d58581d37f1fd71d72f7adbe17 Mon Sep 17 00:00:00 2001 From: Allan Zheng Date: Mon, 12 Jul 2021 18:41:12 -0700 Subject: [PATCH 3/6] chore: use inline nullish coalescing instead of helper --- .../aws/typescript/codegen/AddEndpointDiscoveryPlugin.java | 2 +- .../codegen/AddEventStreamHandlingDependency.java | 4 ++-- .../codegen/AddTranscribeStreamingDependency.java | 2 +- packages/smithy-client/src/index.ts | 1 - packages/smithy-client/src/nullish-coalescing.ts | 7 ------- 5 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 packages/smithy-client/src/nullish-coalescing.ts diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java index 0427a78ee3b1..960cae5c68e5 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEndpointDiscoveryPlugin.java @@ -108,7 +108,7 @@ public Map> getRuntimeConfigWriters( case BROWSER: return MapUtils.of( "endpointDiscoveryEnabledProvider", writer -> { - writer.write("() => Promise.resolve(undefined)"); + writer.write("(() => Promise.resolve(undefined))"); } ); case NODE: diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java index 8eae90d83a93..d776f3ed05cc 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddEventStreamHandlingDependency.java @@ -107,7 +107,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.INVALID_DEPENDENCY); writer.addImport("invalidFunction", "invalidFunction", TypeScriptDependency.INVALID_DEPENDENCY.packageName); - writer.openBlock("() => ({", "})", () -> { + writer.openBlock("(() => ({", "}))", () -> { writer.write("handle: invalidFunction(\"event stream request is not supported in browser.\"),"); }); }); @@ -121,7 +121,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(TypeScriptDependency.INVALID_DEPENDENCY); writer.addImport("invalidFunction", "invalidFunction", TypeScriptDependency.INVALID_DEPENDENCY.packageName); - writer.openBlock("() => ({", "})", () -> { + writer.openBlock("(() => ({", "}))", () -> { writer.write("handle: invalidFunction(\"event stream request " + "is not supported in ReactNative.\"),"); }); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java index d50435617f21..9a1527f5cca1 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java @@ -67,7 +67,7 @@ public Map> getRuntimeConfigWriters( writer.addDependency(AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE); writer.addImport("eventStreamPayloadHandler", "eventStreamPayloadHandler", AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE.packageName); - writer.write("() => eventStreamPayloadHandler"); + writer.write("(() => eventStreamPayloadHandler)"); }, "requestHandler", writer -> { writer.addDependency(AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE); diff --git a/packages/smithy-client/src/index.ts b/packages/smithy-client/src/index.ts index bac6e85f3f90..c72b2f3e0a18 100644 --- a/packages/smithy-client/src/index.ts +++ b/packages/smithy-client/src/index.ts @@ -4,7 +4,6 @@ export * from "./extended-encode-uri-component"; export * from "./get-array-if-single-item"; export * from "./get-value-from-text-node"; export * from "./lazy-json"; -export * from "./nullish-coalescing"; export * from "./parse-utils"; export * from "./ser-utils"; export * from "./date-utils"; diff --git a/packages/smithy-client/src/nullish-coalescing.ts b/packages/smithy-client/src/nullish-coalescing.ts deleted file mode 100644 index 4bb50a7eab60..000000000000 --- a/packages/smithy-client/src/nullish-coalescing.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Same to nullish coalescing operator(`??`). Used to safe code size of - * JavaScript code. - * - * @internal - */ -export const nullishCoalescing = (a: T | undefined | null, b: T) => (a !== null && a !== void 0 ? a : b); From 660570557ef50229647c51714244e8a867e1391b Mon Sep 17 00:00:00 2001 From: Allan Zheng Date: Mon, 12 Jul 2021 18:43:50 -0700 Subject: [PATCH 4/6] 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, }; }; From d2228a909edfc0b6358fee8752de341ecc5f2578 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Wed, 21 Jul 2021 16:13:33 +0000 Subject: [PATCH 5/6] feat(clients): set configs not modeled in runtimeConfig --- clients/client-accessanalyzer/runtimeConfig.browser.ts | 1 + clients/client-accessanalyzer/runtimeConfig.native.ts | 1 + clients/client-accessanalyzer/runtimeConfig.ts | 1 + clients/client-acm-pca/runtimeConfig.browser.ts | 1 + clients/client-acm-pca/runtimeConfig.native.ts | 1 + clients/client-acm-pca/runtimeConfig.ts | 1 + clients/client-acm/runtimeConfig.browser.ts | 1 + clients/client-acm/runtimeConfig.native.ts | 1 + clients/client-acm/runtimeConfig.ts | 1 + clients/client-alexa-for-business/runtimeConfig.browser.ts | 1 + clients/client-alexa-for-business/runtimeConfig.native.ts | 1 + clients/client-alexa-for-business/runtimeConfig.ts | 1 + clients/client-amp/runtimeConfig.browser.ts | 1 + clients/client-amp/runtimeConfig.native.ts | 1 + clients/client-amp/runtimeConfig.ts | 1 + clients/client-amplify/runtimeConfig.browser.ts | 1 + clients/client-amplify/runtimeConfig.native.ts | 1 + clients/client-amplify/runtimeConfig.ts | 1 + clients/client-amplifybackend/runtimeConfig.browser.ts | 1 + clients/client-amplifybackend/runtimeConfig.native.ts | 1 + clients/client-amplifybackend/runtimeConfig.ts | 1 + clients/client-api-gateway/runtimeConfig.browser.ts | 1 + clients/client-api-gateway/runtimeConfig.native.ts | 1 + clients/client-api-gateway/runtimeConfig.ts | 1 + clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts | 1 + clients/client-apigatewaymanagementapi/runtimeConfig.native.ts | 1 + clients/client-apigatewaymanagementapi/runtimeConfig.ts | 1 + clients/client-apigatewayv2/runtimeConfig.browser.ts | 1 + clients/client-apigatewayv2/runtimeConfig.native.ts | 1 + clients/client-apigatewayv2/runtimeConfig.ts | 1 + clients/client-app-mesh/runtimeConfig.browser.ts | 1 + clients/client-app-mesh/runtimeConfig.native.ts | 1 + clients/client-app-mesh/runtimeConfig.ts | 1 + clients/client-appconfig/runtimeConfig.browser.ts | 1 + clients/client-appconfig/runtimeConfig.native.ts | 1 + clients/client-appconfig/runtimeConfig.ts | 1 + clients/client-appflow/runtimeConfig.browser.ts | 1 + clients/client-appflow/runtimeConfig.native.ts | 1 + clients/client-appflow/runtimeConfig.ts | 1 + clients/client-appintegrations/runtimeConfig.browser.ts | 1 + clients/client-appintegrations/runtimeConfig.native.ts | 1 + clients/client-appintegrations/runtimeConfig.ts | 1 + clients/client-application-auto-scaling/runtimeConfig.browser.ts | 1 + clients/client-application-auto-scaling/runtimeConfig.native.ts | 1 + clients/client-application-auto-scaling/runtimeConfig.ts | 1 + .../runtimeConfig.browser.ts | 1 + .../client-application-discovery-service/runtimeConfig.native.ts | 1 + clients/client-application-discovery-service/runtimeConfig.ts | 1 + clients/client-application-insights/runtimeConfig.browser.ts | 1 + clients/client-application-insights/runtimeConfig.native.ts | 1 + clients/client-application-insights/runtimeConfig.ts | 1 + clients/client-applicationcostprofiler/runtimeConfig.browser.ts | 1 + clients/client-applicationcostprofiler/runtimeConfig.native.ts | 1 + clients/client-applicationcostprofiler/runtimeConfig.ts | 1 + clients/client-apprunner/runtimeConfig.browser.ts | 1 + clients/client-apprunner/runtimeConfig.native.ts | 1 + clients/client-apprunner/runtimeConfig.ts | 1 + clients/client-appstream/runtimeConfig.browser.ts | 1 + clients/client-appstream/runtimeConfig.native.ts | 1 + clients/client-appstream/runtimeConfig.ts | 1 + clients/client-appsync/runtimeConfig.browser.ts | 1 + clients/client-appsync/runtimeConfig.native.ts | 1 + clients/client-appsync/runtimeConfig.ts | 1 + clients/client-athena/runtimeConfig.browser.ts | 1 + clients/client-athena/runtimeConfig.native.ts | 1 + clients/client-athena/runtimeConfig.ts | 1 + clients/client-auditmanager/runtimeConfig.browser.ts | 1 + clients/client-auditmanager/runtimeConfig.native.ts | 1 + clients/client-auditmanager/runtimeConfig.ts | 1 + clients/client-auto-scaling-plans/runtimeConfig.browser.ts | 1 + clients/client-auto-scaling-plans/runtimeConfig.native.ts | 1 + clients/client-auto-scaling-plans/runtimeConfig.ts | 1 + clients/client-auto-scaling/runtimeConfig.browser.ts | 1 + clients/client-auto-scaling/runtimeConfig.native.ts | 1 + clients/client-auto-scaling/runtimeConfig.ts | 1 + clients/client-backup/runtimeConfig.browser.ts | 1 + clients/client-backup/runtimeConfig.native.ts | 1 + clients/client-backup/runtimeConfig.ts | 1 + clients/client-batch/runtimeConfig.browser.ts | 1 + clients/client-batch/runtimeConfig.native.ts | 1 + clients/client-batch/runtimeConfig.ts | 1 + clients/client-braket/runtimeConfig.browser.ts | 1 + clients/client-braket/runtimeConfig.native.ts | 1 + clients/client-braket/runtimeConfig.ts | 1 + clients/client-budgets/runtimeConfig.browser.ts | 1 + clients/client-budgets/runtimeConfig.native.ts | 1 + clients/client-budgets/runtimeConfig.ts | 1 + clients/client-chime/runtimeConfig.browser.ts | 1 + clients/client-chime/runtimeConfig.native.ts | 1 + clients/client-chime/runtimeConfig.ts | 1 + clients/client-cloud9/runtimeConfig.browser.ts | 1 + clients/client-cloud9/runtimeConfig.native.ts | 1 + clients/client-cloud9/runtimeConfig.ts | 1 + clients/client-clouddirectory/runtimeConfig.browser.ts | 1 + clients/client-clouddirectory/runtimeConfig.native.ts | 1 + clients/client-clouddirectory/runtimeConfig.ts | 1 + clients/client-cloudformation/runtimeConfig.browser.ts | 1 + clients/client-cloudformation/runtimeConfig.native.ts | 1 + clients/client-cloudformation/runtimeConfig.ts | 1 + clients/client-cloudfront/runtimeConfig.browser.ts | 1 + clients/client-cloudfront/runtimeConfig.native.ts | 1 + clients/client-cloudfront/runtimeConfig.ts | 1 + clients/client-cloudhsm-v2/runtimeConfig.browser.ts | 1 + clients/client-cloudhsm-v2/runtimeConfig.native.ts | 1 + clients/client-cloudhsm-v2/runtimeConfig.ts | 1 + clients/client-cloudhsm/runtimeConfig.browser.ts | 1 + clients/client-cloudhsm/runtimeConfig.native.ts | 1 + clients/client-cloudhsm/runtimeConfig.ts | 1 + clients/client-cloudsearch-domain/runtimeConfig.browser.ts | 1 + clients/client-cloudsearch-domain/runtimeConfig.native.ts | 1 + clients/client-cloudsearch-domain/runtimeConfig.ts | 1 + clients/client-cloudsearch/runtimeConfig.browser.ts | 1 + clients/client-cloudsearch/runtimeConfig.native.ts | 1 + clients/client-cloudsearch/runtimeConfig.ts | 1 + clients/client-cloudtrail/runtimeConfig.browser.ts | 1 + clients/client-cloudtrail/runtimeConfig.native.ts | 1 + clients/client-cloudtrail/runtimeConfig.ts | 1 + clients/client-cloudwatch-events/runtimeConfig.browser.ts | 1 + clients/client-cloudwatch-events/runtimeConfig.native.ts | 1 + clients/client-cloudwatch-events/runtimeConfig.ts | 1 + clients/client-cloudwatch-logs/runtimeConfig.browser.ts | 1 + clients/client-cloudwatch-logs/runtimeConfig.native.ts | 1 + clients/client-cloudwatch-logs/runtimeConfig.ts | 1 + clients/client-cloudwatch/runtimeConfig.browser.ts | 1 + clients/client-cloudwatch/runtimeConfig.native.ts | 1 + clients/client-cloudwatch/runtimeConfig.ts | 1 + clients/client-codeartifact/runtimeConfig.browser.ts | 1 + clients/client-codeartifact/runtimeConfig.native.ts | 1 + clients/client-codeartifact/runtimeConfig.ts | 1 + clients/client-codebuild/runtimeConfig.browser.ts | 1 + clients/client-codebuild/runtimeConfig.native.ts | 1 + clients/client-codebuild/runtimeConfig.ts | 1 + clients/client-codecommit/runtimeConfig.browser.ts | 1 + clients/client-codecommit/runtimeConfig.native.ts | 1 + clients/client-codecommit/runtimeConfig.ts | 1 + clients/client-codedeploy/runtimeConfig.browser.ts | 1 + clients/client-codedeploy/runtimeConfig.native.ts | 1 + clients/client-codedeploy/runtimeConfig.ts | 1 + clients/client-codeguru-reviewer/runtimeConfig.browser.ts | 1 + clients/client-codeguru-reviewer/runtimeConfig.native.ts | 1 + clients/client-codeguru-reviewer/runtimeConfig.ts | 1 + clients/client-codeguruprofiler/runtimeConfig.browser.ts | 1 + clients/client-codeguruprofiler/runtimeConfig.native.ts | 1 + clients/client-codeguruprofiler/runtimeConfig.ts | 1 + clients/client-codepipeline/runtimeConfig.browser.ts | 1 + clients/client-codepipeline/runtimeConfig.native.ts | 1 + clients/client-codepipeline/runtimeConfig.ts | 1 + clients/client-codestar-connections/runtimeConfig.browser.ts | 1 + clients/client-codestar-connections/runtimeConfig.native.ts | 1 + clients/client-codestar-connections/runtimeConfig.ts | 1 + clients/client-codestar-notifications/runtimeConfig.browser.ts | 1 + clients/client-codestar-notifications/runtimeConfig.native.ts | 1 + clients/client-codestar-notifications/runtimeConfig.ts | 1 + clients/client-codestar/runtimeConfig.browser.ts | 1 + clients/client-codestar/runtimeConfig.native.ts | 1 + clients/client-codestar/runtimeConfig.ts | 1 + .../client-cognito-identity-provider/runtimeConfig.browser.ts | 1 + clients/client-cognito-identity-provider/runtimeConfig.native.ts | 1 + clients/client-cognito-identity-provider/runtimeConfig.ts | 1 + clients/client-cognito-identity/runtimeConfig.browser.ts | 1 + clients/client-cognito-identity/runtimeConfig.native.ts | 1 + clients/client-cognito-identity/runtimeConfig.ts | 1 + clients/client-cognito-sync/runtimeConfig.browser.ts | 1 + clients/client-cognito-sync/runtimeConfig.native.ts | 1 + clients/client-cognito-sync/runtimeConfig.ts | 1 + clients/client-comprehend/runtimeConfig.browser.ts | 1 + clients/client-comprehend/runtimeConfig.native.ts | 1 + clients/client-comprehend/runtimeConfig.ts | 1 + clients/client-comprehendmedical/runtimeConfig.browser.ts | 1 + clients/client-comprehendmedical/runtimeConfig.native.ts | 1 + clients/client-comprehendmedical/runtimeConfig.ts | 1 + clients/client-compute-optimizer/runtimeConfig.browser.ts | 1 + clients/client-compute-optimizer/runtimeConfig.native.ts | 1 + clients/client-compute-optimizer/runtimeConfig.ts | 1 + clients/client-config-service/runtimeConfig.browser.ts | 1 + clients/client-config-service/runtimeConfig.native.ts | 1 + clients/client-config-service/runtimeConfig.ts | 1 + clients/client-connect-contact-lens/runtimeConfig.browser.ts | 1 + clients/client-connect-contact-lens/runtimeConfig.native.ts | 1 + clients/client-connect-contact-lens/runtimeConfig.ts | 1 + clients/client-connect/runtimeConfig.browser.ts | 1 + clients/client-connect/runtimeConfig.native.ts | 1 + clients/client-connect/runtimeConfig.ts | 1 + clients/client-connectparticipant/runtimeConfig.browser.ts | 1 + clients/client-connectparticipant/runtimeConfig.native.ts | 1 + clients/client-connectparticipant/runtimeConfig.ts | 1 + .../runtimeConfig.browser.ts | 1 + .../client-cost-and-usage-report-service/runtimeConfig.native.ts | 1 + clients/client-cost-and-usage-report-service/runtimeConfig.ts | 1 + clients/client-cost-explorer/runtimeConfig.browser.ts | 1 + clients/client-cost-explorer/runtimeConfig.native.ts | 1 + clients/client-cost-explorer/runtimeConfig.ts | 1 + clients/client-customer-profiles/runtimeConfig.browser.ts | 1 + clients/client-customer-profiles/runtimeConfig.native.ts | 1 + clients/client-customer-profiles/runtimeConfig.ts | 1 + clients/client-data-pipeline/runtimeConfig.browser.ts | 1 + clients/client-data-pipeline/runtimeConfig.native.ts | 1 + clients/client-data-pipeline/runtimeConfig.ts | 1 + .../client-database-migration-service/runtimeConfig.browser.ts | 1 + .../client-database-migration-service/runtimeConfig.native.ts | 1 + clients/client-database-migration-service/runtimeConfig.ts | 1 + clients/client-databrew/runtimeConfig.browser.ts | 1 + clients/client-databrew/runtimeConfig.native.ts | 1 + clients/client-databrew/runtimeConfig.ts | 1 + clients/client-dataexchange/runtimeConfig.browser.ts | 1 + clients/client-dataexchange/runtimeConfig.native.ts | 1 + clients/client-dataexchange/runtimeConfig.ts | 1 + clients/client-datasync/runtimeConfig.browser.ts | 1 + clients/client-datasync/runtimeConfig.native.ts | 1 + clients/client-datasync/runtimeConfig.ts | 1 + clients/client-dax/runtimeConfig.browser.ts | 1 + clients/client-dax/runtimeConfig.native.ts | 1 + clients/client-dax/runtimeConfig.ts | 1 + clients/client-detective/runtimeConfig.browser.ts | 1 + clients/client-detective/runtimeConfig.native.ts | 1 + clients/client-detective/runtimeConfig.ts | 1 + clients/client-device-farm/runtimeConfig.browser.ts | 1 + clients/client-device-farm/runtimeConfig.native.ts | 1 + clients/client-device-farm/runtimeConfig.ts | 1 + clients/client-devops-guru/runtimeConfig.browser.ts | 1 + clients/client-devops-guru/runtimeConfig.native.ts | 1 + clients/client-devops-guru/runtimeConfig.ts | 1 + clients/client-direct-connect/runtimeConfig.browser.ts | 1 + clients/client-direct-connect/runtimeConfig.native.ts | 1 + clients/client-direct-connect/runtimeConfig.ts | 1 + clients/client-directory-service/runtimeConfig.browser.ts | 1 + clients/client-directory-service/runtimeConfig.native.ts | 1 + clients/client-directory-service/runtimeConfig.ts | 1 + clients/client-dlm/runtimeConfig.browser.ts | 1 + clients/client-dlm/runtimeConfig.native.ts | 1 + clients/client-dlm/runtimeConfig.ts | 1 + clients/client-docdb/runtimeConfig.browser.ts | 1 + clients/client-docdb/runtimeConfig.native.ts | 1 + clients/client-docdb/runtimeConfig.ts | 1 + clients/client-dynamodb-streams/runtimeConfig.browser.ts | 1 + clients/client-dynamodb-streams/runtimeConfig.native.ts | 1 + clients/client-dynamodb-streams/runtimeConfig.ts | 1 + clients/client-dynamodb/runtimeConfig.browser.ts | 1 + clients/client-dynamodb/runtimeConfig.native.ts | 1 + clients/client-dynamodb/runtimeConfig.ts | 1 + clients/client-ebs/runtimeConfig.browser.ts | 1 + clients/client-ebs/runtimeConfig.native.ts | 1 + clients/client-ebs/runtimeConfig.ts | 1 + clients/client-ec2-instance-connect/runtimeConfig.browser.ts | 1 + clients/client-ec2-instance-connect/runtimeConfig.native.ts | 1 + clients/client-ec2-instance-connect/runtimeConfig.ts | 1 + clients/client-ec2/runtimeConfig.browser.ts | 1 + clients/client-ec2/runtimeConfig.native.ts | 1 + clients/client-ec2/runtimeConfig.ts | 1 + clients/client-ecr-public/runtimeConfig.browser.ts | 1 + clients/client-ecr-public/runtimeConfig.native.ts | 1 + clients/client-ecr-public/runtimeConfig.ts | 1 + clients/client-ecr/runtimeConfig.browser.ts | 1 + clients/client-ecr/runtimeConfig.native.ts | 1 + clients/client-ecr/runtimeConfig.ts | 1 + clients/client-ecs/runtimeConfig.browser.ts | 1 + clients/client-ecs/runtimeConfig.native.ts | 1 + clients/client-ecs/runtimeConfig.ts | 1 + clients/client-efs/runtimeConfig.browser.ts | 1 + clients/client-efs/runtimeConfig.native.ts | 1 + clients/client-efs/runtimeConfig.ts | 1 + clients/client-eks/runtimeConfig.browser.ts | 1 + clients/client-eks/runtimeConfig.native.ts | 1 + clients/client-eks/runtimeConfig.ts | 1 + clients/client-elastic-beanstalk/runtimeConfig.browser.ts | 1 + clients/client-elastic-beanstalk/runtimeConfig.native.ts | 1 + clients/client-elastic-beanstalk/runtimeConfig.ts | 1 + clients/client-elastic-inference/runtimeConfig.browser.ts | 1 + clients/client-elastic-inference/runtimeConfig.native.ts | 1 + clients/client-elastic-inference/runtimeConfig.ts | 1 + .../client-elastic-load-balancing-v2/runtimeConfig.browser.ts | 1 + clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts | 1 + clients/client-elastic-load-balancing-v2/runtimeConfig.ts | 1 + clients/client-elastic-load-balancing/runtimeConfig.browser.ts | 1 + clients/client-elastic-load-balancing/runtimeConfig.native.ts | 1 + clients/client-elastic-load-balancing/runtimeConfig.ts | 1 + clients/client-elastic-transcoder/runtimeConfig.browser.ts | 1 + clients/client-elastic-transcoder/runtimeConfig.native.ts | 1 + clients/client-elastic-transcoder/runtimeConfig.ts | 1 + clients/client-elasticache/runtimeConfig.browser.ts | 1 + clients/client-elasticache/runtimeConfig.native.ts | 1 + clients/client-elasticache/runtimeConfig.ts | 1 + clients/client-elasticsearch-service/runtimeConfig.browser.ts | 1 + clients/client-elasticsearch-service/runtimeConfig.native.ts | 1 + clients/client-elasticsearch-service/runtimeConfig.ts | 1 + clients/client-emr-containers/runtimeConfig.browser.ts | 1 + clients/client-emr-containers/runtimeConfig.native.ts | 1 + clients/client-emr-containers/runtimeConfig.ts | 1 + clients/client-emr/runtimeConfig.browser.ts | 1 + clients/client-emr/runtimeConfig.native.ts | 1 + clients/client-emr/runtimeConfig.ts | 1 + clients/client-eventbridge/runtimeConfig.browser.ts | 1 + clients/client-eventbridge/runtimeConfig.native.ts | 1 + clients/client-eventbridge/runtimeConfig.ts | 1 + clients/client-finspace-data/runtimeConfig.browser.ts | 1 + clients/client-finspace-data/runtimeConfig.native.ts | 1 + clients/client-finspace-data/runtimeConfig.ts | 1 + clients/client-finspace/runtimeConfig.browser.ts | 1 + clients/client-finspace/runtimeConfig.native.ts | 1 + clients/client-finspace/runtimeConfig.ts | 1 + clients/client-firehose/runtimeConfig.browser.ts | 1 + clients/client-firehose/runtimeConfig.native.ts | 1 + clients/client-firehose/runtimeConfig.ts | 1 + clients/client-fis/runtimeConfig.browser.ts | 1 + clients/client-fis/runtimeConfig.native.ts | 1 + clients/client-fis/runtimeConfig.ts | 1 + clients/client-fms/runtimeConfig.browser.ts | 1 + clients/client-fms/runtimeConfig.native.ts | 1 + clients/client-fms/runtimeConfig.ts | 1 + clients/client-forecast/runtimeConfig.browser.ts | 1 + clients/client-forecast/runtimeConfig.native.ts | 1 + clients/client-forecast/runtimeConfig.ts | 1 + clients/client-forecastquery/runtimeConfig.browser.ts | 1 + clients/client-forecastquery/runtimeConfig.native.ts | 1 + clients/client-forecastquery/runtimeConfig.ts | 1 + clients/client-frauddetector/runtimeConfig.browser.ts | 1 + clients/client-frauddetector/runtimeConfig.native.ts | 1 + clients/client-frauddetector/runtimeConfig.ts | 1 + clients/client-fsx/runtimeConfig.browser.ts | 1 + clients/client-fsx/runtimeConfig.native.ts | 1 + clients/client-fsx/runtimeConfig.ts | 1 + clients/client-gamelift/runtimeConfig.browser.ts | 1 + clients/client-gamelift/runtimeConfig.native.ts | 1 + clients/client-gamelift/runtimeConfig.ts | 1 + clients/client-glacier/runtimeConfig.browser.ts | 1 + clients/client-glacier/runtimeConfig.native.ts | 1 + clients/client-glacier/runtimeConfig.ts | 1 + clients/client-global-accelerator/runtimeConfig.browser.ts | 1 + clients/client-global-accelerator/runtimeConfig.native.ts | 1 + clients/client-global-accelerator/runtimeConfig.ts | 1 + clients/client-glue/runtimeConfig.browser.ts | 1 + clients/client-glue/runtimeConfig.native.ts | 1 + clients/client-glue/runtimeConfig.ts | 1 + clients/client-greengrass/runtimeConfig.browser.ts | 1 + clients/client-greengrass/runtimeConfig.native.ts | 1 + clients/client-greengrass/runtimeConfig.ts | 1 + clients/client-greengrassv2/runtimeConfig.browser.ts | 1 + clients/client-greengrassv2/runtimeConfig.native.ts | 1 + clients/client-greengrassv2/runtimeConfig.ts | 1 + clients/client-groundstation/runtimeConfig.browser.ts | 1 + clients/client-groundstation/runtimeConfig.native.ts | 1 + clients/client-groundstation/runtimeConfig.ts | 1 + clients/client-guardduty/runtimeConfig.browser.ts | 1 + clients/client-guardduty/runtimeConfig.native.ts | 1 + clients/client-guardduty/runtimeConfig.ts | 1 + clients/client-health/runtimeConfig.browser.ts | 1 + clients/client-health/runtimeConfig.native.ts | 1 + clients/client-health/runtimeConfig.ts | 1 + clients/client-healthlake/runtimeConfig.browser.ts | 1 + clients/client-healthlake/runtimeConfig.native.ts | 1 + clients/client-healthlake/runtimeConfig.ts | 1 + clients/client-honeycode/runtimeConfig.browser.ts | 1 + clients/client-honeycode/runtimeConfig.native.ts | 1 + clients/client-honeycode/runtimeConfig.ts | 1 + clients/client-iam/runtimeConfig.browser.ts | 1 + clients/client-iam/runtimeConfig.native.ts | 1 + clients/client-iam/runtimeConfig.ts | 1 + clients/client-identitystore/runtimeConfig.browser.ts | 1 + clients/client-identitystore/runtimeConfig.native.ts | 1 + clients/client-identitystore/runtimeConfig.ts | 1 + clients/client-imagebuilder/runtimeConfig.browser.ts | 1 + clients/client-imagebuilder/runtimeConfig.native.ts | 1 + clients/client-imagebuilder/runtimeConfig.ts | 1 + clients/client-inspector/runtimeConfig.browser.ts | 1 + clients/client-inspector/runtimeConfig.native.ts | 1 + clients/client-inspector/runtimeConfig.ts | 1 + .../client-iot-1click-devices-service/runtimeConfig.browser.ts | 1 + .../client-iot-1click-devices-service/runtimeConfig.native.ts | 1 + clients/client-iot-1click-devices-service/runtimeConfig.ts | 1 + clients/client-iot-1click-projects/runtimeConfig.browser.ts | 1 + clients/client-iot-1click-projects/runtimeConfig.native.ts | 1 + clients/client-iot-1click-projects/runtimeConfig.ts | 1 + clients/client-iot-data-plane/runtimeConfig.browser.ts | 1 + clients/client-iot-data-plane/runtimeConfig.native.ts | 1 + clients/client-iot-data-plane/runtimeConfig.ts | 1 + clients/client-iot-events-data/runtimeConfig.browser.ts | 1 + clients/client-iot-events-data/runtimeConfig.native.ts | 1 + clients/client-iot-events-data/runtimeConfig.ts | 1 + clients/client-iot-events/runtimeConfig.browser.ts | 1 + clients/client-iot-events/runtimeConfig.native.ts | 1 + clients/client-iot-events/runtimeConfig.ts | 1 + clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts | 1 + clients/client-iot-jobs-data-plane/runtimeConfig.native.ts | 1 + clients/client-iot-jobs-data-plane/runtimeConfig.ts | 1 + clients/client-iot-wireless/runtimeConfig.browser.ts | 1 + clients/client-iot-wireless/runtimeConfig.native.ts | 1 + clients/client-iot-wireless/runtimeConfig.ts | 1 + clients/client-iot/runtimeConfig.browser.ts | 1 + clients/client-iot/runtimeConfig.native.ts | 1 + clients/client-iot/runtimeConfig.ts | 1 + clients/client-iotanalytics/runtimeConfig.browser.ts | 1 + clients/client-iotanalytics/runtimeConfig.native.ts | 1 + clients/client-iotanalytics/runtimeConfig.ts | 1 + clients/client-iotdeviceadvisor/runtimeConfig.browser.ts | 1 + clients/client-iotdeviceadvisor/runtimeConfig.native.ts | 1 + clients/client-iotdeviceadvisor/runtimeConfig.ts | 1 + clients/client-iotfleethub/runtimeConfig.browser.ts | 1 + clients/client-iotfleethub/runtimeConfig.native.ts | 1 + clients/client-iotfleethub/runtimeConfig.ts | 1 + clients/client-iotsecuretunneling/runtimeConfig.browser.ts | 1 + clients/client-iotsecuretunneling/runtimeConfig.native.ts | 1 + clients/client-iotsecuretunneling/runtimeConfig.ts | 1 + clients/client-iotsitewise/runtimeConfig.browser.ts | 1 + clients/client-iotsitewise/runtimeConfig.native.ts | 1 + clients/client-iotsitewise/runtimeConfig.ts | 1 + clients/client-iotthingsgraph/runtimeConfig.browser.ts | 1 + clients/client-iotthingsgraph/runtimeConfig.native.ts | 1 + clients/client-iotthingsgraph/runtimeConfig.ts | 1 + clients/client-ivs/runtimeConfig.browser.ts | 1 + clients/client-ivs/runtimeConfig.native.ts | 1 + clients/client-ivs/runtimeConfig.ts | 1 + clients/client-kafka/runtimeConfig.browser.ts | 1 + clients/client-kafka/runtimeConfig.native.ts | 1 + clients/client-kafka/runtimeConfig.ts | 1 + clients/client-kendra/runtimeConfig.browser.ts | 1 + clients/client-kendra/runtimeConfig.native.ts | 1 + clients/client-kendra/runtimeConfig.ts | 1 + clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts | 1 + clients/client-kinesis-analytics-v2/runtimeConfig.native.ts | 1 + clients/client-kinesis-analytics-v2/runtimeConfig.ts | 1 + clients/client-kinesis-analytics/runtimeConfig.browser.ts | 1 + clients/client-kinesis-analytics/runtimeConfig.native.ts | 1 + clients/client-kinesis-analytics/runtimeConfig.ts | 1 + .../client-kinesis-video-archived-media/runtimeConfig.browser.ts | 1 + .../client-kinesis-video-archived-media/runtimeConfig.native.ts | 1 + clients/client-kinesis-video-archived-media/runtimeConfig.ts | 1 + clients/client-kinesis-video-media/runtimeConfig.browser.ts | 1 + clients/client-kinesis-video-media/runtimeConfig.native.ts | 1 + clients/client-kinesis-video-media/runtimeConfig.ts | 1 + clients/client-kinesis-video-signaling/runtimeConfig.browser.ts | 1 + clients/client-kinesis-video-signaling/runtimeConfig.native.ts | 1 + clients/client-kinesis-video-signaling/runtimeConfig.ts | 1 + clients/client-kinesis-video/runtimeConfig.browser.ts | 1 + clients/client-kinesis-video/runtimeConfig.native.ts | 1 + clients/client-kinesis-video/runtimeConfig.ts | 1 + clients/client-kinesis/runtimeConfig.browser.ts | 1 + clients/client-kinesis/runtimeConfig.native.ts | 1 + clients/client-kinesis/runtimeConfig.ts | 1 + clients/client-kms/runtimeConfig.browser.ts | 1 + clients/client-kms/runtimeConfig.native.ts | 1 + clients/client-kms/runtimeConfig.ts | 1 + clients/client-lakeformation/runtimeConfig.browser.ts | 1 + clients/client-lakeformation/runtimeConfig.native.ts | 1 + clients/client-lakeformation/runtimeConfig.ts | 1 + clients/client-lambda/runtimeConfig.browser.ts | 1 + clients/client-lambda/runtimeConfig.native.ts | 1 + clients/client-lambda/runtimeConfig.ts | 1 + .../client-lex-model-building-service/runtimeConfig.browser.ts | 1 + .../client-lex-model-building-service/runtimeConfig.native.ts | 1 + clients/client-lex-model-building-service/runtimeConfig.ts | 1 + clients/client-lex-models-v2/runtimeConfig.browser.ts | 1 + clients/client-lex-models-v2/runtimeConfig.native.ts | 1 + clients/client-lex-models-v2/runtimeConfig.ts | 1 + clients/client-lex-runtime-service/runtimeConfig.browser.ts | 1 + clients/client-lex-runtime-service/runtimeConfig.native.ts | 1 + clients/client-lex-runtime-service/runtimeConfig.ts | 1 + clients/client-lex-runtime-v2/runtimeConfig.browser.ts | 1 + clients/client-lex-runtime-v2/runtimeConfig.native.ts | 1 + clients/client-lex-runtime-v2/runtimeConfig.ts | 1 + clients/client-license-manager/runtimeConfig.browser.ts | 1 + clients/client-license-manager/runtimeConfig.native.ts | 1 + clients/client-license-manager/runtimeConfig.ts | 1 + clients/client-lightsail/runtimeConfig.browser.ts | 1 + clients/client-lightsail/runtimeConfig.native.ts | 1 + clients/client-lightsail/runtimeConfig.ts | 1 + clients/client-location/runtimeConfig.browser.ts | 1 + clients/client-location/runtimeConfig.native.ts | 1 + clients/client-location/runtimeConfig.ts | 1 + clients/client-lookoutequipment/runtimeConfig.browser.ts | 1 + clients/client-lookoutequipment/runtimeConfig.native.ts | 1 + clients/client-lookoutequipment/runtimeConfig.ts | 1 + clients/client-lookoutmetrics/runtimeConfig.browser.ts | 1 + clients/client-lookoutmetrics/runtimeConfig.native.ts | 1 + clients/client-lookoutmetrics/runtimeConfig.ts | 1 + clients/client-lookoutvision/runtimeConfig.browser.ts | 1 + clients/client-lookoutvision/runtimeConfig.native.ts | 1 + clients/client-lookoutvision/runtimeConfig.ts | 1 + clients/client-machine-learning/runtimeConfig.browser.ts | 1 + clients/client-machine-learning/runtimeConfig.native.ts | 1 + clients/client-machine-learning/runtimeConfig.ts | 1 + clients/client-macie/runtimeConfig.browser.ts | 1 + clients/client-macie/runtimeConfig.native.ts | 1 + clients/client-macie/runtimeConfig.ts | 1 + clients/client-macie2/runtimeConfig.browser.ts | 1 + clients/client-macie2/runtimeConfig.native.ts | 1 + clients/client-macie2/runtimeConfig.ts | 1 + clients/client-managedblockchain/runtimeConfig.browser.ts | 1 + clients/client-managedblockchain/runtimeConfig.native.ts | 1 + clients/client-managedblockchain/runtimeConfig.ts | 1 + clients/client-marketplace-catalog/runtimeConfig.browser.ts | 1 + clients/client-marketplace-catalog/runtimeConfig.native.ts | 1 + clients/client-marketplace-catalog/runtimeConfig.ts | 1 + .../runtimeConfig.browser.ts | 1 + .../runtimeConfig.native.ts | 1 + clients/client-marketplace-commerce-analytics/runtimeConfig.ts | 1 + .../runtimeConfig.browser.ts | 1 + .../runtimeConfig.native.ts | 1 + clients/client-marketplace-entitlement-service/runtimeConfig.ts | 1 + clients/client-marketplace-metering/runtimeConfig.browser.ts | 1 + clients/client-marketplace-metering/runtimeConfig.native.ts | 1 + clients/client-marketplace-metering/runtimeConfig.ts | 1 + clients/client-mediaconnect/runtimeConfig.browser.ts | 1 + clients/client-mediaconnect/runtimeConfig.native.ts | 1 + clients/client-mediaconnect/runtimeConfig.ts | 1 + clients/client-mediaconvert/runtimeConfig.browser.ts | 1 + clients/client-mediaconvert/runtimeConfig.native.ts | 1 + clients/client-mediaconvert/runtimeConfig.ts | 1 + clients/client-medialive/runtimeConfig.browser.ts | 1 + clients/client-medialive/runtimeConfig.native.ts | 1 + clients/client-medialive/runtimeConfig.ts | 1 + clients/client-mediapackage-vod/runtimeConfig.browser.ts | 1 + clients/client-mediapackage-vod/runtimeConfig.native.ts | 1 + clients/client-mediapackage-vod/runtimeConfig.ts | 1 + clients/client-mediapackage/runtimeConfig.browser.ts | 1 + clients/client-mediapackage/runtimeConfig.native.ts | 1 + clients/client-mediapackage/runtimeConfig.ts | 1 + clients/client-mediastore-data/runtimeConfig.browser.ts | 1 + clients/client-mediastore-data/runtimeConfig.native.ts | 1 + clients/client-mediastore-data/runtimeConfig.ts | 1 + clients/client-mediastore/runtimeConfig.browser.ts | 1 + clients/client-mediastore/runtimeConfig.native.ts | 1 + clients/client-mediastore/runtimeConfig.ts | 1 + clients/client-mediatailor/runtimeConfig.browser.ts | 1 + clients/client-mediatailor/runtimeConfig.native.ts | 1 + clients/client-mediatailor/runtimeConfig.ts | 1 + clients/client-mgn/runtimeConfig.browser.ts | 1 + clients/client-mgn/runtimeConfig.native.ts | 1 + clients/client-mgn/runtimeConfig.ts | 1 + clients/client-migration-hub/runtimeConfig.browser.ts | 1 + clients/client-migration-hub/runtimeConfig.native.ts | 1 + clients/client-migration-hub/runtimeConfig.ts | 1 + clients/client-migrationhub-config/runtimeConfig.browser.ts | 1 + clients/client-migrationhub-config/runtimeConfig.native.ts | 1 + clients/client-migrationhub-config/runtimeConfig.ts | 1 + clients/client-mobile/runtimeConfig.browser.ts | 1 + clients/client-mobile/runtimeConfig.native.ts | 1 + clients/client-mobile/runtimeConfig.ts | 1 + clients/client-mq/runtimeConfig.browser.ts | 1 + clients/client-mq/runtimeConfig.native.ts | 1 + clients/client-mq/runtimeConfig.ts | 1 + clients/client-mturk/runtimeConfig.browser.ts | 1 + clients/client-mturk/runtimeConfig.native.ts | 1 + clients/client-mturk/runtimeConfig.ts | 1 + clients/client-mwaa/runtimeConfig.browser.ts | 1 + clients/client-mwaa/runtimeConfig.native.ts | 1 + clients/client-mwaa/runtimeConfig.ts | 1 + clients/client-neptune/runtimeConfig.browser.ts | 1 + clients/client-neptune/runtimeConfig.native.ts | 1 + clients/client-neptune/runtimeConfig.ts | 1 + clients/client-network-firewall/runtimeConfig.browser.ts | 1 + clients/client-network-firewall/runtimeConfig.native.ts | 1 + clients/client-network-firewall/runtimeConfig.ts | 1 + clients/client-networkmanager/runtimeConfig.browser.ts | 1 + clients/client-networkmanager/runtimeConfig.native.ts | 1 + clients/client-networkmanager/runtimeConfig.ts | 1 + clients/client-nimble/runtimeConfig.browser.ts | 1 + clients/client-nimble/runtimeConfig.native.ts | 1 + clients/client-nimble/runtimeConfig.ts | 1 + clients/client-opsworks/runtimeConfig.browser.ts | 1 + clients/client-opsworks/runtimeConfig.native.ts | 1 + clients/client-opsworks/runtimeConfig.ts | 1 + clients/client-opsworkscm/runtimeConfig.browser.ts | 1 + clients/client-opsworkscm/runtimeConfig.native.ts | 1 + clients/client-opsworkscm/runtimeConfig.ts | 1 + clients/client-organizations/runtimeConfig.browser.ts | 1 + clients/client-organizations/runtimeConfig.native.ts | 1 + clients/client-organizations/runtimeConfig.ts | 1 + clients/client-outposts/runtimeConfig.browser.ts | 1 + clients/client-outposts/runtimeConfig.native.ts | 1 + clients/client-outposts/runtimeConfig.ts | 1 + clients/client-personalize-events/runtimeConfig.browser.ts | 1 + clients/client-personalize-events/runtimeConfig.native.ts | 1 + clients/client-personalize-events/runtimeConfig.ts | 1 + clients/client-personalize-runtime/runtimeConfig.browser.ts | 1 + clients/client-personalize-runtime/runtimeConfig.native.ts | 1 + clients/client-personalize-runtime/runtimeConfig.ts | 1 + clients/client-personalize/runtimeConfig.browser.ts | 1 + clients/client-personalize/runtimeConfig.native.ts | 1 + clients/client-personalize/runtimeConfig.ts | 1 + clients/client-pi/runtimeConfig.browser.ts | 1 + clients/client-pi/runtimeConfig.native.ts | 1 + clients/client-pi/runtimeConfig.ts | 1 + clients/client-pinpoint-email/runtimeConfig.browser.ts | 1 + clients/client-pinpoint-email/runtimeConfig.native.ts | 1 + clients/client-pinpoint-email/runtimeConfig.ts | 1 + clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts | 1 + clients/client-pinpoint-sms-voice/runtimeConfig.native.ts | 1 + clients/client-pinpoint-sms-voice/runtimeConfig.ts | 1 + clients/client-pinpoint/runtimeConfig.browser.ts | 1 + clients/client-pinpoint/runtimeConfig.native.ts | 1 + clients/client-pinpoint/runtimeConfig.ts | 1 + clients/client-polly/runtimeConfig.browser.ts | 1 + clients/client-polly/runtimeConfig.native.ts | 1 + clients/client-polly/runtimeConfig.ts | 1 + clients/client-pricing/runtimeConfig.browser.ts | 1 + clients/client-pricing/runtimeConfig.native.ts | 1 + clients/client-pricing/runtimeConfig.ts | 1 + clients/client-proton/runtimeConfig.browser.ts | 1 + clients/client-proton/runtimeConfig.native.ts | 1 + clients/client-proton/runtimeConfig.ts | 1 + clients/client-qldb-session/runtimeConfig.browser.ts | 1 + clients/client-qldb-session/runtimeConfig.native.ts | 1 + clients/client-qldb-session/runtimeConfig.ts | 1 + clients/client-qldb/runtimeConfig.browser.ts | 1 + clients/client-qldb/runtimeConfig.native.ts | 1 + clients/client-qldb/runtimeConfig.ts | 1 + clients/client-quicksight/runtimeConfig.browser.ts | 1 + clients/client-quicksight/runtimeConfig.native.ts | 1 + clients/client-quicksight/runtimeConfig.ts | 1 + clients/client-ram/runtimeConfig.browser.ts | 1 + clients/client-ram/runtimeConfig.native.ts | 1 + clients/client-ram/runtimeConfig.ts | 1 + clients/client-rds-data/runtimeConfig.browser.ts | 1 + clients/client-rds-data/runtimeConfig.native.ts | 1 + clients/client-rds-data/runtimeConfig.ts | 1 + clients/client-rds/runtimeConfig.browser.ts | 1 + clients/client-rds/runtimeConfig.native.ts | 1 + clients/client-rds/runtimeConfig.ts | 1 + clients/client-redshift-data/runtimeConfig.browser.ts | 1 + clients/client-redshift-data/runtimeConfig.native.ts | 1 + clients/client-redshift-data/runtimeConfig.ts | 1 + clients/client-redshift/runtimeConfig.browser.ts | 1 + clients/client-redshift/runtimeConfig.native.ts | 1 + clients/client-redshift/runtimeConfig.ts | 1 + clients/client-rekognition/runtimeConfig.browser.ts | 1 + clients/client-rekognition/runtimeConfig.native.ts | 1 + clients/client-rekognition/runtimeConfig.ts | 1 + .../client-resource-groups-tagging-api/runtimeConfig.browser.ts | 1 + .../client-resource-groups-tagging-api/runtimeConfig.native.ts | 1 + clients/client-resource-groups-tagging-api/runtimeConfig.ts | 1 + clients/client-resource-groups/runtimeConfig.browser.ts | 1 + clients/client-resource-groups/runtimeConfig.native.ts | 1 + clients/client-resource-groups/runtimeConfig.ts | 1 + clients/client-robomaker/runtimeConfig.browser.ts | 1 + clients/client-robomaker/runtimeConfig.native.ts | 1 + clients/client-robomaker/runtimeConfig.ts | 1 + clients/client-route-53-domains/runtimeConfig.browser.ts | 1 + clients/client-route-53-domains/runtimeConfig.native.ts | 1 + clients/client-route-53-domains/runtimeConfig.ts | 1 + clients/client-route-53/runtimeConfig.browser.ts | 1 + clients/client-route-53/runtimeConfig.native.ts | 1 + clients/client-route-53/runtimeConfig.ts | 1 + clients/client-route53resolver/runtimeConfig.browser.ts | 1 + clients/client-route53resolver/runtimeConfig.native.ts | 1 + clients/client-route53resolver/runtimeConfig.ts | 1 + clients/client-s3-control/runtimeConfig.browser.ts | 1 + clients/client-s3-control/runtimeConfig.native.ts | 1 + clients/client-s3-control/runtimeConfig.ts | 1 + clients/client-s3/runtimeConfig.browser.ts | 1 + clients/client-s3/runtimeConfig.native.ts | 1 + clients/client-s3/runtimeConfig.ts | 1 + clients/client-s3outposts/runtimeConfig.browser.ts | 1 + clients/client-s3outposts/runtimeConfig.native.ts | 1 + clients/client-s3outposts/runtimeConfig.ts | 1 + clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts | 1 + clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts | 1 + clients/client-sagemaker-a2i-runtime/runtimeConfig.ts | 1 + clients/client-sagemaker-edge/runtimeConfig.browser.ts | 1 + clients/client-sagemaker-edge/runtimeConfig.native.ts | 1 + clients/client-sagemaker-edge/runtimeConfig.ts | 1 + .../runtimeConfig.browser.ts | 1 + .../runtimeConfig.native.ts | 1 + clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts | 1 + clients/client-sagemaker-runtime/runtimeConfig.browser.ts | 1 + clients/client-sagemaker-runtime/runtimeConfig.native.ts | 1 + clients/client-sagemaker-runtime/runtimeConfig.ts | 1 + clients/client-sagemaker/runtimeConfig.browser.ts | 1 + clients/client-sagemaker/runtimeConfig.native.ts | 1 + clients/client-sagemaker/runtimeConfig.ts | 1 + clients/client-savingsplans/runtimeConfig.browser.ts | 1 + clients/client-savingsplans/runtimeConfig.native.ts | 1 + clients/client-savingsplans/runtimeConfig.ts | 1 + clients/client-schemas/runtimeConfig.browser.ts | 1 + clients/client-schemas/runtimeConfig.native.ts | 1 + clients/client-schemas/runtimeConfig.ts | 1 + clients/client-secrets-manager/runtimeConfig.browser.ts | 1 + clients/client-secrets-manager/runtimeConfig.native.ts | 1 + clients/client-secrets-manager/runtimeConfig.ts | 1 + clients/client-securityhub/runtimeConfig.browser.ts | 1 + clients/client-securityhub/runtimeConfig.native.ts | 1 + clients/client-securityhub/runtimeConfig.ts | 1 + .../runtimeConfig.browser.ts | 1 + .../runtimeConfig.native.ts | 1 + clients/client-serverlessapplicationrepository/runtimeConfig.ts | 1 + .../client-service-catalog-appregistry/runtimeConfig.browser.ts | 1 + .../client-service-catalog-appregistry/runtimeConfig.native.ts | 1 + clients/client-service-catalog-appregistry/runtimeConfig.ts | 1 + clients/client-service-catalog/runtimeConfig.browser.ts | 1 + clients/client-service-catalog/runtimeConfig.native.ts | 1 + clients/client-service-catalog/runtimeConfig.ts | 1 + clients/client-service-quotas/runtimeConfig.browser.ts | 1 + clients/client-service-quotas/runtimeConfig.native.ts | 1 + clients/client-service-quotas/runtimeConfig.ts | 1 + clients/client-servicediscovery/runtimeConfig.browser.ts | 1 + clients/client-servicediscovery/runtimeConfig.native.ts | 1 + clients/client-servicediscovery/runtimeConfig.ts | 1 + clients/client-ses/runtimeConfig.browser.ts | 1 + clients/client-ses/runtimeConfig.native.ts | 1 + clients/client-ses/runtimeConfig.ts | 1 + clients/client-sesv2/runtimeConfig.browser.ts | 1 + clients/client-sesv2/runtimeConfig.native.ts | 1 + clients/client-sesv2/runtimeConfig.ts | 1 + clients/client-sfn/runtimeConfig.browser.ts | 1 + clients/client-sfn/runtimeConfig.native.ts | 1 + clients/client-sfn/runtimeConfig.ts | 1 + clients/client-shield/runtimeConfig.browser.ts | 1 + clients/client-shield/runtimeConfig.native.ts | 1 + clients/client-shield/runtimeConfig.ts | 1 + clients/client-signer/runtimeConfig.browser.ts | 1 + clients/client-signer/runtimeConfig.native.ts | 1 + clients/client-signer/runtimeConfig.ts | 1 + clients/client-sms/runtimeConfig.browser.ts | 1 + clients/client-sms/runtimeConfig.native.ts | 1 + clients/client-sms/runtimeConfig.ts | 1 + clients/client-snowball/runtimeConfig.browser.ts | 1 + clients/client-snowball/runtimeConfig.native.ts | 1 + clients/client-snowball/runtimeConfig.ts | 1 + clients/client-sns/runtimeConfig.browser.ts | 1 + clients/client-sns/runtimeConfig.native.ts | 1 + clients/client-sns/runtimeConfig.ts | 1 + clients/client-sqs/runtimeConfig.browser.ts | 1 + clients/client-sqs/runtimeConfig.native.ts | 1 + clients/client-sqs/runtimeConfig.ts | 1 + clients/client-ssm-contacts/runtimeConfig.browser.ts | 1 + clients/client-ssm-contacts/runtimeConfig.native.ts | 1 + clients/client-ssm-contacts/runtimeConfig.ts | 1 + clients/client-ssm-incidents/runtimeConfig.browser.ts | 1 + clients/client-ssm-incidents/runtimeConfig.native.ts | 1 + clients/client-ssm-incidents/runtimeConfig.ts | 1 + clients/client-ssm/runtimeConfig.browser.ts | 1 + clients/client-ssm/runtimeConfig.native.ts | 1 + clients/client-ssm/runtimeConfig.ts | 1 + clients/client-sso-admin/runtimeConfig.browser.ts | 1 + clients/client-sso-admin/runtimeConfig.native.ts | 1 + clients/client-sso-admin/runtimeConfig.ts | 1 + clients/client-sso-oidc/runtimeConfig.browser.ts | 1 + clients/client-sso-oidc/runtimeConfig.native.ts | 1 + clients/client-sso-oidc/runtimeConfig.ts | 1 + clients/client-sso/runtimeConfig.browser.ts | 1 + clients/client-sso/runtimeConfig.native.ts | 1 + clients/client-sso/runtimeConfig.ts | 1 + clients/client-storage-gateway/runtimeConfig.browser.ts | 1 + clients/client-storage-gateway/runtimeConfig.native.ts | 1 + clients/client-storage-gateway/runtimeConfig.ts | 1 + clients/client-sts/runtimeConfig.browser.ts | 1 + clients/client-sts/runtimeConfig.native.ts | 1 + clients/client-sts/runtimeConfig.ts | 1 + clients/client-support/runtimeConfig.browser.ts | 1 + clients/client-support/runtimeConfig.native.ts | 1 + clients/client-support/runtimeConfig.ts | 1 + clients/client-swf/runtimeConfig.browser.ts | 1 + clients/client-swf/runtimeConfig.native.ts | 1 + clients/client-swf/runtimeConfig.ts | 1 + clients/client-synthetics/runtimeConfig.browser.ts | 1 + clients/client-synthetics/runtimeConfig.native.ts | 1 + clients/client-synthetics/runtimeConfig.ts | 1 + clients/client-textract/runtimeConfig.browser.ts | 1 + clients/client-textract/runtimeConfig.native.ts | 1 + clients/client-textract/runtimeConfig.ts | 1 + clients/client-timestream-query/runtimeConfig.browser.ts | 1 + clients/client-timestream-query/runtimeConfig.native.ts | 1 + clients/client-timestream-query/runtimeConfig.ts | 1 + clients/client-timestream-write/runtimeConfig.browser.ts | 1 + clients/client-timestream-write/runtimeConfig.native.ts | 1 + clients/client-timestream-write/runtimeConfig.ts | 1 + clients/client-transcribe-streaming/runtimeConfig.browser.ts | 1 + clients/client-transcribe-streaming/runtimeConfig.native.ts | 1 + clients/client-transcribe-streaming/runtimeConfig.ts | 1 + clients/client-transcribe/runtimeConfig.browser.ts | 1 + clients/client-transcribe/runtimeConfig.native.ts | 1 + clients/client-transcribe/runtimeConfig.ts | 1 + clients/client-transfer/runtimeConfig.browser.ts | 1 + clients/client-transfer/runtimeConfig.native.ts | 1 + clients/client-transfer/runtimeConfig.ts | 1 + clients/client-translate/runtimeConfig.browser.ts | 1 + clients/client-translate/runtimeConfig.native.ts | 1 + clients/client-translate/runtimeConfig.ts | 1 + clients/client-waf-regional/runtimeConfig.browser.ts | 1 + clients/client-waf-regional/runtimeConfig.native.ts | 1 + clients/client-waf-regional/runtimeConfig.ts | 1 + clients/client-waf/runtimeConfig.browser.ts | 1 + clients/client-waf/runtimeConfig.native.ts | 1 + clients/client-waf/runtimeConfig.ts | 1 + clients/client-wafv2/runtimeConfig.browser.ts | 1 + clients/client-wafv2/runtimeConfig.native.ts | 1 + clients/client-wafv2/runtimeConfig.ts | 1 + clients/client-wellarchitected/runtimeConfig.browser.ts | 1 + clients/client-wellarchitected/runtimeConfig.native.ts | 1 + clients/client-wellarchitected/runtimeConfig.ts | 1 + clients/client-workdocs/runtimeConfig.browser.ts | 1 + clients/client-workdocs/runtimeConfig.native.ts | 1 + clients/client-workdocs/runtimeConfig.ts | 1 + clients/client-worklink/runtimeConfig.browser.ts | 1 + clients/client-worklink/runtimeConfig.native.ts | 1 + clients/client-worklink/runtimeConfig.ts | 1 + clients/client-workmail/runtimeConfig.browser.ts | 1 + clients/client-workmail/runtimeConfig.native.ts | 1 + clients/client-workmail/runtimeConfig.ts | 1 + clients/client-workmailmessageflow/runtimeConfig.browser.ts | 1 + clients/client-workmailmessageflow/runtimeConfig.native.ts | 1 + clients/client-workmailmessageflow/runtimeConfig.ts | 1 + clients/client-workspaces/runtimeConfig.browser.ts | 1 + clients/client-workspaces/runtimeConfig.native.ts | 1 + clients/client-workspaces/runtimeConfig.ts | 1 + clients/client-xray/runtimeConfig.browser.ts | 1 + clients/client-xray/runtimeConfig.native.ts | 1 + clients/client-xray/runtimeConfig.ts | 1 + protocol_tests/aws-ec2/runtimeConfig.browser.ts | 1 + protocol_tests/aws-ec2/runtimeConfig.native.ts | 1 + protocol_tests/aws-ec2/runtimeConfig.ts | 1 + protocol_tests/aws-json/runtimeConfig.browser.ts | 1 + protocol_tests/aws-json/runtimeConfig.native.ts | 1 + protocol_tests/aws-json/runtimeConfig.ts | 1 + protocol_tests/aws-query/runtimeConfig.browser.ts | 1 + protocol_tests/aws-query/runtimeConfig.native.ts | 1 + protocol_tests/aws-query/runtimeConfig.ts | 1 + protocol_tests/aws-restjson/runtimeConfig.browser.ts | 1 + protocol_tests/aws-restjson/runtimeConfig.native.ts | 1 + protocol_tests/aws-restjson/runtimeConfig.ts | 1 + protocol_tests/aws-restxml/runtimeConfig.browser.ts | 1 + protocol_tests/aws-restxml/runtimeConfig.native.ts | 1 + protocol_tests/aws-restxml/runtimeConfig.ts | 1 + 822 files changed, 822 insertions(+) diff --git a/clients/client-accessanalyzer/runtimeConfig.browser.ts b/clients/client-accessanalyzer/runtimeConfig.browser.ts index 5f00a4bf24e3..ec372020aa98 100644 --- a/clients/client-accessanalyzer/runtimeConfig.browser.ts +++ b/clients/client-accessanalyzer/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-accessanalyzer/runtimeConfig.native.ts b/clients/client-accessanalyzer/runtimeConfig.native.ts index cde2988196d8..4d093d029311 100644 --- a/clients/client-accessanalyzer/runtimeConfig.native.ts +++ b/clients/client-accessanalyzer/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-accessanalyzer/runtimeConfig.ts b/clients/client-accessanalyzer/runtimeConfig.ts index 705b0b702bd6..5b2e0803219c 100644 --- a/clients/client-accessanalyzer/runtimeConfig.ts +++ b/clients/client-accessanalyzer/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-acm-pca/runtimeConfig.browser.ts b/clients/client-acm-pca/runtimeConfig.browser.ts index 5c4bbc1c069a..f697bc7691fb 100644 --- a/clients/client-acm-pca/runtimeConfig.browser.ts +++ b/clients/client-acm-pca/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-acm-pca/runtimeConfig.native.ts b/clients/client-acm-pca/runtimeConfig.native.ts index 93b913bbdddf..22356f998f11 100644 --- a/clients/client-acm-pca/runtimeConfig.native.ts +++ b/clients/client-acm-pca/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-acm-pca/runtimeConfig.ts b/clients/client-acm-pca/runtimeConfig.ts index 803dbcc43df1..ba4b39733f1a 100644 --- a/clients/client-acm-pca/runtimeConfig.ts +++ b/clients/client-acm-pca/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-acm/runtimeConfig.browser.ts b/clients/client-acm/runtimeConfig.browser.ts index 032b5cbbc1db..0f4f5dc701d1 100644 --- a/clients/client-acm/runtimeConfig.browser.ts +++ b/clients/client-acm/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ACMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-acm/runtimeConfig.native.ts b/clients/client-acm/runtimeConfig.native.ts index c7c2fb1eb5c7..bdefb51dd5ab 100644 --- a/clients/client-acm/runtimeConfig.native.ts +++ b/clients/client-acm/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ACMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-acm/runtimeConfig.ts b/clients/client-acm/runtimeConfig.ts index 5f0474bae64f..34ff7b225f82 100644 --- a/clients/client-acm/runtimeConfig.ts +++ b/clients/client-acm/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ACMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-alexa-for-business/runtimeConfig.browser.ts b/clients/client-alexa-for-business/runtimeConfig.browser.ts index db59b40bf4ac..a85aa3882700 100644 --- a/clients/client-alexa-for-business/runtimeConfig.browser.ts +++ b/clients/client-alexa-for-business/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-alexa-for-business/runtimeConfig.native.ts b/clients/client-alexa-for-business/runtimeConfig.native.ts index b35a5c5b8563..632a51d5007c 100644 --- a/clients/client-alexa-for-business/runtimeConfig.native.ts +++ b/clients/client-alexa-for-business/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-alexa-for-business/runtimeConfig.ts b/clients/client-alexa-for-business/runtimeConfig.ts index 06157882a438..dffb80b9f567 100644 --- a/clients/client-alexa-for-business/runtimeConfig.ts +++ b/clients/client-alexa-for-business/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AlexaForBusinessClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-amp/runtimeConfig.browser.ts b/clients/client-amp/runtimeConfig.browser.ts index d51b219b5758..34a288436745 100644 --- a/clients/client-amp/runtimeConfig.browser.ts +++ b/clients/client-amp/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AmpClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-amp/runtimeConfig.native.ts b/clients/client-amp/runtimeConfig.native.ts index b4213d26a208..73c04881cbc3 100644 --- a/clients/client-amp/runtimeConfig.native.ts +++ b/clients/client-amp/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AmpClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-amp/runtimeConfig.ts b/clients/client-amp/runtimeConfig.ts index 760e56148f4a..eff7e277ddb4 100644 --- a/clients/client-amp/runtimeConfig.ts +++ b/clients/client-amp/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AmpClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-amplify/runtimeConfig.browser.ts b/clients/client-amplify/runtimeConfig.browser.ts index dd73740ffc3e..5293a17cfe23 100644 --- a/clients/client-amplify/runtimeConfig.browser.ts +++ b/clients/client-amplify/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AmplifyClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-amplify/runtimeConfig.native.ts b/clients/client-amplify/runtimeConfig.native.ts index 69d58ed9f03b..f0b05d713b4c 100644 --- a/clients/client-amplify/runtimeConfig.native.ts +++ b/clients/client-amplify/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AmplifyClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-amplify/runtimeConfig.ts b/clients/client-amplify/runtimeConfig.ts index 82252600702d..17b13707a85d 100644 --- a/clients/client-amplify/runtimeConfig.ts +++ b/clients/client-amplify/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AmplifyClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-amplifybackend/runtimeConfig.browser.ts b/clients/client-amplifybackend/runtimeConfig.browser.ts index 8776ae6fcd2a..d6375ebc9268 100644 --- a/clients/client-amplifybackend/runtimeConfig.browser.ts +++ b/clients/client-amplifybackend/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-amplifybackend/runtimeConfig.native.ts b/clients/client-amplifybackend/runtimeConfig.native.ts index 8db5111869a3..d6acc4eae6a0 100644 --- a/clients/client-amplifybackend/runtimeConfig.native.ts +++ b/clients/client-amplifybackend/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-amplifybackend/runtimeConfig.ts b/clients/client-amplifybackend/runtimeConfig.ts index 7d48472ffe6d..850f50df4dcc 100644 --- a/clients/client-amplifybackend/runtimeConfig.ts +++ b/clients/client-amplifybackend/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AmplifyBackendClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-api-gateway/runtimeConfig.browser.ts b/clients/client-api-gateway/runtimeConfig.browser.ts index 88a6ea1609f4..f4b0d89f4d38 100644 --- a/clients/client-api-gateway/runtimeConfig.browser.ts +++ b/clients/client-api-gateway/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: APIGatewayClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-api-gateway/runtimeConfig.native.ts b/clients/client-api-gateway/runtimeConfig.native.ts index 622e0f997fab..796480896384 100644 --- a/clients/client-api-gateway/runtimeConfig.native.ts +++ b/clients/client-api-gateway/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: APIGatewayClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-api-gateway/runtimeConfig.ts b/clients/client-api-gateway/runtimeConfig.ts index 24138da57ee2..e48d6a2e4635 100644 --- a/clients/client-api-gateway/runtimeConfig.ts +++ b/clients/client-api-gateway/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: APIGatewayClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts index 224d17ccc226..99a7f12b2ba6 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts index 456afbbcf10c..19a1bc51d975 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-apigatewaymanagementapi/runtimeConfig.ts b/clients/client-apigatewaymanagementapi/runtimeConfig.ts index 7e92c5178641..e082925247df 100644 --- a/clients/client-apigatewaymanagementapi/runtimeConfig.ts +++ b/clients/client-apigatewaymanagementapi/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ApiGatewayManagementApiClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-apigatewayv2/runtimeConfig.browser.ts b/clients/client-apigatewayv2/runtimeConfig.browser.ts index 838833140adb..d522b5d7dfd8 100644 --- a/clients/client-apigatewayv2/runtimeConfig.browser.ts +++ b/clients/client-apigatewayv2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-apigatewayv2/runtimeConfig.native.ts b/clients/client-apigatewayv2/runtimeConfig.native.ts index 851f0aa0f607..1f443824ac8c 100644 --- a/clients/client-apigatewayv2/runtimeConfig.native.ts +++ b/clients/client-apigatewayv2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-apigatewayv2/runtimeConfig.ts b/clients/client-apigatewayv2/runtimeConfig.ts index 0868eefe0a66..6ac2e8d3d111 100644 --- a/clients/client-apigatewayv2/runtimeConfig.ts +++ b/clients/client-apigatewayv2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ApiGatewayV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-app-mesh/runtimeConfig.browser.ts b/clients/client-app-mesh/runtimeConfig.browser.ts index 4dfc86aecc6c..ea7595124d92 100644 --- a/clients/client-app-mesh/runtimeConfig.browser.ts +++ b/clients/client-app-mesh/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppMeshClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-app-mesh/runtimeConfig.native.ts b/clients/client-app-mesh/runtimeConfig.native.ts index ded52b4da78c..2b344fc1aeff 100644 --- a/clients/client-app-mesh/runtimeConfig.native.ts +++ b/clients/client-app-mesh/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppMeshClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-app-mesh/runtimeConfig.ts b/clients/client-app-mesh/runtimeConfig.ts index 2f7e0a37cbcf..434f0e9d5b8c 100644 --- a/clients/client-app-mesh/runtimeConfig.ts +++ b/clients/client-app-mesh/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppMeshClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appconfig/runtimeConfig.browser.ts b/clients/client-appconfig/runtimeConfig.browser.ts index df6628fd76e9..d651e0aa05dc 100644 --- a/clients/client-appconfig/runtimeConfig.browser.ts +++ b/clients/client-appconfig/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppConfigClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appconfig/runtimeConfig.native.ts b/clients/client-appconfig/runtimeConfig.native.ts index f504bd54c7a9..380ae3f836a7 100644 --- a/clients/client-appconfig/runtimeConfig.native.ts +++ b/clients/client-appconfig/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppConfigClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-appconfig/runtimeConfig.ts b/clients/client-appconfig/runtimeConfig.ts index 486542dd45b1..3fbe330c7e23 100644 --- a/clients/client-appconfig/runtimeConfig.ts +++ b/clients/client-appconfig/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppConfigClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appflow/runtimeConfig.browser.ts b/clients/client-appflow/runtimeConfig.browser.ts index 5f2df3d549a4..293ca28aa4a4 100644 --- a/clients/client-appflow/runtimeConfig.browser.ts +++ b/clients/client-appflow/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppflowClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appflow/runtimeConfig.native.ts b/clients/client-appflow/runtimeConfig.native.ts index 9660df46dd6c..a501c9def984 100644 --- a/clients/client-appflow/runtimeConfig.native.ts +++ b/clients/client-appflow/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppflowClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-appflow/runtimeConfig.ts b/clients/client-appflow/runtimeConfig.ts index f36cc250bf5d..464fab832559 100644 --- a/clients/client-appflow/runtimeConfig.ts +++ b/clients/client-appflow/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppflowClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appintegrations/runtimeConfig.browser.ts b/clients/client-appintegrations/runtimeConfig.browser.ts index 29fea133cc63..bb317d658300 100644 --- a/clients/client-appintegrations/runtimeConfig.browser.ts +++ b/clients/client-appintegrations/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appintegrations/runtimeConfig.native.ts b/clients/client-appintegrations/runtimeConfig.native.ts index ef2336055b19..b7c03eb594ac 100644 --- a/clients/client-appintegrations/runtimeConfig.native.ts +++ b/clients/client-appintegrations/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-appintegrations/runtimeConfig.ts b/clients/client-appintegrations/runtimeConfig.ts index 1c3012b54287..8ee808f3c9e6 100644 --- a/clients/client-appintegrations/runtimeConfig.ts +++ b/clients/client-appintegrations/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppIntegrationsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-application-auto-scaling/runtimeConfig.browser.ts b/clients/client-application-auto-scaling/runtimeConfig.browser.ts index e786dc2bee84..d316ee055df9 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.browser.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-application-auto-scaling/runtimeConfig.native.ts b/clients/client-application-auto-scaling/runtimeConfig.native.ts index a2b58b68ca9f..ecb8ad342908 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.native.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-application-auto-scaling/runtimeConfig.ts b/clients/client-application-auto-scaling/runtimeConfig.ts index 5659b80ca02d..70f30a3040c0 100644 --- a/clients/client-application-auto-scaling/runtimeConfig.ts +++ b/clients/client-application-auto-scaling/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ApplicationAutoScalingClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-application-discovery-service/runtimeConfig.browser.ts b/clients/client-application-discovery-service/runtimeConfig.browser.ts index f61609d3bcfa..a79a283e5648 100644 --- a/clients/client-application-discovery-service/runtimeConfig.browser.ts +++ b/clients/client-application-discovery-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-application-discovery-service/runtimeConfig.native.ts b/clients/client-application-discovery-service/runtimeConfig.native.ts index 6334d32e73b2..bff59a209dff 100644 --- a/clients/client-application-discovery-service/runtimeConfig.native.ts +++ b/clients/client-application-discovery-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-application-discovery-service/runtimeConfig.ts b/clients/client-application-discovery-service/runtimeConfig.ts index 481e4586b40e..16ab4e5a3128 100644 --- a/clients/client-application-discovery-service/runtimeConfig.ts +++ b/clients/client-application-discovery-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ApplicationDiscoveryServiceClientConfig const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-application-insights/runtimeConfig.browser.ts b/clients/client-application-insights/runtimeConfig.browser.ts index 1a127f55ecc5..abbb58018f92 100644 --- a/clients/client-application-insights/runtimeConfig.browser.ts +++ b/clients/client-application-insights/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-application-insights/runtimeConfig.native.ts b/clients/client-application-insights/runtimeConfig.native.ts index 715af80c0bf4..226e36318e16 100644 --- a/clients/client-application-insights/runtimeConfig.native.ts +++ b/clients/client-application-insights/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-application-insights/runtimeConfig.ts b/clients/client-application-insights/runtimeConfig.ts index 704da81f8a95..5d6bdfcfac53 100644 --- a/clients/client-application-insights/runtimeConfig.ts +++ b/clients/client-application-insights/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ApplicationInsightsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-applicationcostprofiler/runtimeConfig.browser.ts b/clients/client-applicationcostprofiler/runtimeConfig.browser.ts index d74dc16b6517..2b961c9f3482 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.browser.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-applicationcostprofiler/runtimeConfig.native.ts b/clients/client-applicationcostprofiler/runtimeConfig.native.ts index 3ffbb1813a48..a2592181a759 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.native.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-applicationcostprofiler/runtimeConfig.ts b/clients/client-applicationcostprofiler/runtimeConfig.ts index 565b28f9646f..b15ef6c00941 100644 --- a/clients/client-applicationcostprofiler/runtimeConfig.ts +++ b/clients/client-applicationcostprofiler/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ApplicationCostProfilerClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-apprunner/runtimeConfig.browser.ts b/clients/client-apprunner/runtimeConfig.browser.ts index d8ec991b98b2..204008bcd10a 100644 --- a/clients/client-apprunner/runtimeConfig.browser.ts +++ b/clients/client-apprunner/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppRunnerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-apprunner/runtimeConfig.native.ts b/clients/client-apprunner/runtimeConfig.native.ts index 04a95be0a8bf..908f340c4a11 100644 --- a/clients/client-apprunner/runtimeConfig.native.ts +++ b/clients/client-apprunner/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppRunnerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-apprunner/runtimeConfig.ts b/clients/client-apprunner/runtimeConfig.ts index e0596e00aa58..b63ecea23e10 100644 --- a/clients/client-apprunner/runtimeConfig.ts +++ b/clients/client-apprunner/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppRunnerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appstream/runtimeConfig.browser.ts b/clients/client-appstream/runtimeConfig.browser.ts index c76413d43aed..1e88aab058bc 100644 --- a/clients/client-appstream/runtimeConfig.browser.ts +++ b/clients/client-appstream/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppStreamClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appstream/runtimeConfig.native.ts b/clients/client-appstream/runtimeConfig.native.ts index dd367e061d9e..29143f22ffdf 100644 --- a/clients/client-appstream/runtimeConfig.native.ts +++ b/clients/client-appstream/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppStreamClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-appstream/runtimeConfig.ts b/clients/client-appstream/runtimeConfig.ts index 885f1972f4da..ad7622c1c951 100644 --- a/clients/client-appstream/runtimeConfig.ts +++ b/clients/client-appstream/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppStreamClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appsync/runtimeConfig.browser.ts b/clients/client-appsync/runtimeConfig.browser.ts index 2a8d1dd67aef..ba338ebdf974 100644 --- a/clients/client-appsync/runtimeConfig.browser.ts +++ b/clients/client-appsync/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AppSyncClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-appsync/runtimeConfig.native.ts b/clients/client-appsync/runtimeConfig.native.ts index ae37dc897dfd..46348942f5d8 100644 --- a/clients/client-appsync/runtimeConfig.native.ts +++ b/clients/client-appsync/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AppSyncClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-appsync/runtimeConfig.ts b/clients/client-appsync/runtimeConfig.ts index 4b1a0d4fa4c4..01af6305ae79 100644 --- a/clients/client-appsync/runtimeConfig.ts +++ b/clients/client-appsync/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AppSyncClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-athena/runtimeConfig.browser.ts b/clients/client-athena/runtimeConfig.browser.ts index b1d5dfb98327..58112c98d9ac 100644 --- a/clients/client-athena/runtimeConfig.browser.ts +++ b/clients/client-athena/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AthenaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-athena/runtimeConfig.native.ts b/clients/client-athena/runtimeConfig.native.ts index 9137cd037f7d..67f2064992b4 100644 --- a/clients/client-athena/runtimeConfig.native.ts +++ b/clients/client-athena/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AthenaClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-athena/runtimeConfig.ts b/clients/client-athena/runtimeConfig.ts index a1a8a355e729..f79fb4732c09 100644 --- a/clients/client-athena/runtimeConfig.ts +++ b/clients/client-athena/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AthenaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-auditmanager/runtimeConfig.browser.ts b/clients/client-auditmanager/runtimeConfig.browser.ts index b421fd4b4c2b..9ecccdf24dfd 100644 --- a/clients/client-auditmanager/runtimeConfig.browser.ts +++ b/clients/client-auditmanager/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AuditManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-auditmanager/runtimeConfig.native.ts b/clients/client-auditmanager/runtimeConfig.native.ts index 2d3578ee0fb3..fdef0d81e4d1 100644 --- a/clients/client-auditmanager/runtimeConfig.native.ts +++ b/clients/client-auditmanager/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AuditManagerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-auditmanager/runtimeConfig.ts b/clients/client-auditmanager/runtimeConfig.ts index b07541a47c44..fe79845f0fd3 100644 --- a/clients/client-auditmanager/runtimeConfig.ts +++ b/clients/client-auditmanager/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AuditManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-auto-scaling-plans/runtimeConfig.browser.ts b/clients/client-auto-scaling-plans/runtimeConfig.browser.ts index 95cf4fecf94a..4952af7c20f3 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.browser.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-auto-scaling-plans/runtimeConfig.native.ts b/clients/client-auto-scaling-plans/runtimeConfig.native.ts index 03990f5f3015..321b9a4e61be 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.native.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-auto-scaling-plans/runtimeConfig.ts b/clients/client-auto-scaling-plans/runtimeConfig.ts index ddb3a8ea29e8..febb03bbae09 100644 --- a/clients/client-auto-scaling-plans/runtimeConfig.ts +++ b/clients/client-auto-scaling-plans/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AutoScalingPlansClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-auto-scaling/runtimeConfig.browser.ts b/clients/client-auto-scaling/runtimeConfig.browser.ts index c2e83c1970f2..afb25f4edd99 100644 --- a/clients/client-auto-scaling/runtimeConfig.browser.ts +++ b/clients/client-auto-scaling/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: AutoScalingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-auto-scaling/runtimeConfig.native.ts b/clients/client-auto-scaling/runtimeConfig.native.ts index 4a80d1bd8c39..068cce764e9f 100644 --- a/clients/client-auto-scaling/runtimeConfig.native.ts +++ b/clients/client-auto-scaling/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: AutoScalingClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-auto-scaling/runtimeConfig.ts b/clients/client-auto-scaling/runtimeConfig.ts index 5bbe3e6d5634..9ab70d182202 100644 --- a/clients/client-auto-scaling/runtimeConfig.ts +++ b/clients/client-auto-scaling/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: AutoScalingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-backup/runtimeConfig.browser.ts b/clients/client-backup/runtimeConfig.browser.ts index 85935d46fa30..fe011e964359 100644 --- a/clients/client-backup/runtimeConfig.browser.ts +++ b/clients/client-backup/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: BackupClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-backup/runtimeConfig.native.ts b/clients/client-backup/runtimeConfig.native.ts index c5c2aed531a3..a08ae1ad5b90 100644 --- a/clients/client-backup/runtimeConfig.native.ts +++ b/clients/client-backup/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: BackupClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-backup/runtimeConfig.ts b/clients/client-backup/runtimeConfig.ts index d39b59f6c1a7..0d3252524556 100644 --- a/clients/client-backup/runtimeConfig.ts +++ b/clients/client-backup/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: BackupClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-batch/runtimeConfig.browser.ts b/clients/client-batch/runtimeConfig.browser.ts index e58fd282e680..7925b9612d31 100644 --- a/clients/client-batch/runtimeConfig.browser.ts +++ b/clients/client-batch/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: BatchClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-batch/runtimeConfig.native.ts b/clients/client-batch/runtimeConfig.native.ts index 334b943427f4..fdc9d54e9e36 100644 --- a/clients/client-batch/runtimeConfig.native.ts +++ b/clients/client-batch/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: BatchClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-batch/runtimeConfig.ts b/clients/client-batch/runtimeConfig.ts index c49c0857eca6..c134edf23845 100644 --- a/clients/client-batch/runtimeConfig.ts +++ b/clients/client-batch/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: BatchClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-braket/runtimeConfig.browser.ts b/clients/client-braket/runtimeConfig.browser.ts index f31677451e81..57a219d1a97c 100644 --- a/clients/client-braket/runtimeConfig.browser.ts +++ b/clients/client-braket/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: BraketClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-braket/runtimeConfig.native.ts b/clients/client-braket/runtimeConfig.native.ts index 6bc1083fe1df..dcfa9962a2fe 100644 --- a/clients/client-braket/runtimeConfig.native.ts +++ b/clients/client-braket/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: BraketClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-braket/runtimeConfig.ts b/clients/client-braket/runtimeConfig.ts index 90bc8144e7c1..243de27fbf34 100644 --- a/clients/client-braket/runtimeConfig.ts +++ b/clients/client-braket/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: BraketClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-budgets/runtimeConfig.browser.ts b/clients/client-budgets/runtimeConfig.browser.ts index 1de41b3bd43f..5d98acd5772b 100644 --- a/clients/client-budgets/runtimeConfig.browser.ts +++ b/clients/client-budgets/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: BudgetsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-budgets/runtimeConfig.native.ts b/clients/client-budgets/runtimeConfig.native.ts index 30b6f636e324..ae786be00c39 100644 --- a/clients/client-budgets/runtimeConfig.native.ts +++ b/clients/client-budgets/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: BudgetsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-budgets/runtimeConfig.ts b/clients/client-budgets/runtimeConfig.ts index e078abd0a0da..9d7425295690 100644 --- a/clients/client-budgets/runtimeConfig.ts +++ b/clients/client-budgets/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: BudgetsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-chime/runtimeConfig.browser.ts b/clients/client-chime/runtimeConfig.browser.ts index 8a2dc6e7c420..7bead0242997 100644 --- a/clients/client-chime/runtimeConfig.browser.ts +++ b/clients/client-chime/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ChimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-chime/runtimeConfig.native.ts b/clients/client-chime/runtimeConfig.native.ts index 2110f438d133..9283cddacf2a 100644 --- a/clients/client-chime/runtimeConfig.native.ts +++ b/clients/client-chime/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ChimeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-chime/runtimeConfig.ts b/clients/client-chime/runtimeConfig.ts index afd5bfc37797..3db8cfe98ac0 100644 --- a/clients/client-chime/runtimeConfig.ts +++ b/clients/client-chime/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ChimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloud9/runtimeConfig.browser.ts b/clients/client-cloud9/runtimeConfig.browser.ts index 59c6615296a5..d509cce28b20 100644 --- a/clients/client-cloud9/runtimeConfig.browser.ts +++ b/clients/client-cloud9/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: Cloud9ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloud9/runtimeConfig.native.ts b/clients/client-cloud9/runtimeConfig.native.ts index f49563e9367b..9d76f1e061d2 100644 --- a/clients/client-cloud9/runtimeConfig.native.ts +++ b/clients/client-cloud9/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: Cloud9ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloud9/runtimeConfig.ts b/clients/client-cloud9/runtimeConfig.ts index ce5fbd14aa16..ea29fc9775e8 100644 --- a/clients/client-cloud9/runtimeConfig.ts +++ b/clients/client-cloud9/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: Cloud9ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-clouddirectory/runtimeConfig.browser.ts b/clients/client-clouddirectory/runtimeConfig.browser.ts index 4ac58609525d..b043e3e6a22a 100644 --- a/clients/client-clouddirectory/runtimeConfig.browser.ts +++ b/clients/client-clouddirectory/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-clouddirectory/runtimeConfig.native.ts b/clients/client-clouddirectory/runtimeConfig.native.ts index 1afc324e6365..b57cdb64e630 100644 --- a/clients/client-clouddirectory/runtimeConfig.native.ts +++ b/clients/client-clouddirectory/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-clouddirectory/runtimeConfig.ts b/clients/client-clouddirectory/runtimeConfig.ts index f10d2e260495..f2972d4b8967 100644 --- a/clients/client-clouddirectory/runtimeConfig.ts +++ b/clients/client-clouddirectory/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudDirectoryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudformation/runtimeConfig.browser.ts b/clients/client-cloudformation/runtimeConfig.browser.ts index ea4a99abc384..d9dec74bc00f 100644 --- a/clients/client-cloudformation/runtimeConfig.browser.ts +++ b/clients/client-cloudformation/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudFormationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudformation/runtimeConfig.native.ts b/clients/client-cloudformation/runtimeConfig.native.ts index cdec0360512e..20477947c328 100644 --- a/clients/client-cloudformation/runtimeConfig.native.ts +++ b/clients/client-cloudformation/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudFormationClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudformation/runtimeConfig.ts b/clients/client-cloudformation/runtimeConfig.ts index ff4b523953e4..3bbe114c23f8 100644 --- a/clients/client-cloudformation/runtimeConfig.ts +++ b/clients/client-cloudformation/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudFormationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudfront/runtimeConfig.browser.ts b/clients/client-cloudfront/runtimeConfig.browser.ts index 0443293ad235..902d6b299c4c 100644 --- a/clients/client-cloudfront/runtimeConfig.browser.ts +++ b/clients/client-cloudfront/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudFrontClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudfront/runtimeConfig.native.ts b/clients/client-cloudfront/runtimeConfig.native.ts index 74f8c1bd7251..80fefc46c724 100644 --- a/clients/client-cloudfront/runtimeConfig.native.ts +++ b/clients/client-cloudfront/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudFrontClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudfront/runtimeConfig.ts b/clients/client-cloudfront/runtimeConfig.ts index 8a417b31ee6c..30bdfdb2210a 100644 --- a/clients/client-cloudfront/runtimeConfig.ts +++ b/clients/client-cloudfront/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudFrontClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudhsm-v2/runtimeConfig.browser.ts b/clients/client-cloudhsm-v2/runtimeConfig.browser.ts index e30090301ad7..156413e6af64 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.browser.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudhsm-v2/runtimeConfig.native.ts b/clients/client-cloudhsm-v2/runtimeConfig.native.ts index d103f4861bcd..0f23cd2f33c0 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.native.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudhsm-v2/runtimeConfig.ts b/clients/client-cloudhsm-v2/runtimeConfig.ts index 692cac3a9484..33005cca4fd5 100644 --- a/clients/client-cloudhsm-v2/runtimeConfig.ts +++ b/clients/client-cloudhsm-v2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudHSMV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudhsm/runtimeConfig.browser.ts b/clients/client-cloudhsm/runtimeConfig.browser.ts index 309fdb68765b..d5342e40aaa2 100644 --- a/clients/client-cloudhsm/runtimeConfig.browser.ts +++ b/clients/client-cloudhsm/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudHSMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudhsm/runtimeConfig.native.ts b/clients/client-cloudhsm/runtimeConfig.native.ts index 34b5a5e7837e..cbf82826508b 100644 --- a/clients/client-cloudhsm/runtimeConfig.native.ts +++ b/clients/client-cloudhsm/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudHSMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudhsm/runtimeConfig.ts b/clients/client-cloudhsm/runtimeConfig.ts index 3daa98bdb43f..3208507d3991 100644 --- a/clients/client-cloudhsm/runtimeConfig.ts +++ b/clients/client-cloudhsm/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudHSMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudsearch-domain/runtimeConfig.browser.ts b/clients/client-cloudsearch-domain/runtimeConfig.browser.ts index 92572943b295..23c3fed2b9c3 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.browser.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudsearch-domain/runtimeConfig.native.ts b/clients/client-cloudsearch-domain/runtimeConfig.native.ts index f31f6ce8fef6..ce0a66d8c163 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.native.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudsearch-domain/runtimeConfig.ts b/clients/client-cloudsearch-domain/runtimeConfig.ts index 76ffe641cd41..03eb83ff36d0 100644 --- a/clients/client-cloudsearch-domain/runtimeConfig.ts +++ b/clients/client-cloudsearch-domain/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudsearch/runtimeConfig.browser.ts b/clients/client-cloudsearch/runtimeConfig.browser.ts index 723350a48598..774716319e2e 100644 --- a/clients/client-cloudsearch/runtimeConfig.browser.ts +++ b/clients/client-cloudsearch/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudSearchClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudsearch/runtimeConfig.native.ts b/clients/client-cloudsearch/runtimeConfig.native.ts index 7984f05f957b..c12d94559669 100644 --- a/clients/client-cloudsearch/runtimeConfig.native.ts +++ b/clients/client-cloudsearch/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudSearchClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudsearch/runtimeConfig.ts b/clients/client-cloudsearch/runtimeConfig.ts index fc80815c6609..9341e1f231a8 100644 --- a/clients/client-cloudsearch/runtimeConfig.ts +++ b/clients/client-cloudsearch/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudSearchClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudtrail/runtimeConfig.browser.ts b/clients/client-cloudtrail/runtimeConfig.browser.ts index a8b996771c45..c6ad5995a4ba 100644 --- a/clients/client-cloudtrail/runtimeConfig.browser.ts +++ b/clients/client-cloudtrail/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudTrailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudtrail/runtimeConfig.native.ts b/clients/client-cloudtrail/runtimeConfig.native.ts index e116b68f386a..bc99d2a4b0f0 100644 --- a/clients/client-cloudtrail/runtimeConfig.native.ts +++ b/clients/client-cloudtrail/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudTrailClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudtrail/runtimeConfig.ts b/clients/client-cloudtrail/runtimeConfig.ts index f2b91cb1ce12..62f098cdb2c5 100644 --- a/clients/client-cloudtrail/runtimeConfig.ts +++ b/clients/client-cloudtrail/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudTrailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudwatch-events/runtimeConfig.browser.ts b/clients/client-cloudwatch-events/runtimeConfig.browser.ts index 012219965033..9087a17f9af1 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudwatch-events/runtimeConfig.native.ts b/clients/client-cloudwatch-events/runtimeConfig.native.ts index cb35618f5a21..a01ad3749f22 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.native.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudwatch-events/runtimeConfig.ts b/clients/client-cloudwatch-events/runtimeConfig.ts index e07aea719d64..d3711b4fb70c 100644 --- a/clients/client-cloudwatch-events/runtimeConfig.ts +++ b/clients/client-cloudwatch-events/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudWatchEventsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudwatch-logs/runtimeConfig.browser.ts b/clients/client-cloudwatch-logs/runtimeConfig.browser.ts index e105f21a8ef2..711b786bbd46 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudwatch-logs/runtimeConfig.native.ts b/clients/client-cloudwatch-logs/runtimeConfig.native.ts index c11873e8ee4a..f702eceee478 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.native.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudwatch-logs/runtimeConfig.ts b/clients/client-cloudwatch-logs/runtimeConfig.ts index 322c36bf9c02..df9093a216f6 100644 --- a/clients/client-cloudwatch-logs/runtimeConfig.ts +++ b/clients/client-cloudwatch-logs/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudWatchLogsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudwatch/runtimeConfig.browser.ts b/clients/client-cloudwatch/runtimeConfig.browser.ts index 1e8a53937e7d..8a5d59f8467c 100644 --- a/clients/client-cloudwatch/runtimeConfig.browser.ts +++ b/clients/client-cloudwatch/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CloudWatchClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cloudwatch/runtimeConfig.native.ts b/clients/client-cloudwatch/runtimeConfig.native.ts index 5bb93a2b41d5..88936e068010 100644 --- a/clients/client-cloudwatch/runtimeConfig.native.ts +++ b/clients/client-cloudwatch/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CloudWatchClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cloudwatch/runtimeConfig.ts b/clients/client-cloudwatch/runtimeConfig.ts index 4e719854e512..73df731422cb 100644 --- a/clients/client-cloudwatch/runtimeConfig.ts +++ b/clients/client-cloudwatch/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CloudWatchClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codeartifact/runtimeConfig.browser.ts b/clients/client-codeartifact/runtimeConfig.browser.ts index ca87b30a67fd..59da38ec724a 100644 --- a/clients/client-codeartifact/runtimeConfig.browser.ts +++ b/clients/client-codeartifact/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codeartifact/runtimeConfig.native.ts b/clients/client-codeartifact/runtimeConfig.native.ts index 87be7570fb38..9134d3f19b6d 100644 --- a/clients/client-codeartifact/runtimeConfig.native.ts +++ b/clients/client-codeartifact/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codeartifact/runtimeConfig.ts b/clients/client-codeartifact/runtimeConfig.ts index 80b400194bbe..04922567d036 100644 --- a/clients/client-codeartifact/runtimeConfig.ts +++ b/clients/client-codeartifact/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codebuild/runtimeConfig.browser.ts b/clients/client-codebuild/runtimeConfig.browser.ts index 0c9431a745f4..79cb5c96c4a8 100644 --- a/clients/client-codebuild/runtimeConfig.browser.ts +++ b/clients/client-codebuild/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeBuildClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codebuild/runtimeConfig.native.ts b/clients/client-codebuild/runtimeConfig.native.ts index 8d64aa5f2f70..a196e942fd95 100644 --- a/clients/client-codebuild/runtimeConfig.native.ts +++ b/clients/client-codebuild/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeBuildClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codebuild/runtimeConfig.ts b/clients/client-codebuild/runtimeConfig.ts index f8e08718b5b1..532416fa19fa 100644 --- a/clients/client-codebuild/runtimeConfig.ts +++ b/clients/client-codebuild/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeBuildClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codecommit/runtimeConfig.browser.ts b/clients/client-codecommit/runtimeConfig.browser.ts index 9dc9c2fac106..455eab4a9ddb 100644 --- a/clients/client-codecommit/runtimeConfig.browser.ts +++ b/clients/client-codecommit/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeCommitClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codecommit/runtimeConfig.native.ts b/clients/client-codecommit/runtimeConfig.native.ts index d57cfe46c124..488f92b1a676 100644 --- a/clients/client-codecommit/runtimeConfig.native.ts +++ b/clients/client-codecommit/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeCommitClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codecommit/runtimeConfig.ts b/clients/client-codecommit/runtimeConfig.ts index 32f86d4e9c73..a37a450f1c5d 100644 --- a/clients/client-codecommit/runtimeConfig.ts +++ b/clients/client-codecommit/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeCommitClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codedeploy/runtimeConfig.browser.ts b/clients/client-codedeploy/runtimeConfig.browser.ts index 00a90e202ab7..ccb4bb6b04e8 100644 --- a/clients/client-codedeploy/runtimeConfig.browser.ts +++ b/clients/client-codedeploy/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeDeployClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codedeploy/runtimeConfig.native.ts b/clients/client-codedeploy/runtimeConfig.native.ts index d0a95a19390c..4b0108a9dc39 100644 --- a/clients/client-codedeploy/runtimeConfig.native.ts +++ b/clients/client-codedeploy/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeDeployClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codedeploy/runtimeConfig.ts b/clients/client-codedeploy/runtimeConfig.ts index 0a9425b8b49d..b6a9b20ac691 100644 --- a/clients/client-codedeploy/runtimeConfig.ts +++ b/clients/client-codedeploy/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeDeployClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codeguru-reviewer/runtimeConfig.browser.ts b/clients/client-codeguru-reviewer/runtimeConfig.browser.ts index 008e6bb8e2b1..62d370b19e85 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.browser.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codeguru-reviewer/runtimeConfig.native.ts b/clients/client-codeguru-reviewer/runtimeConfig.native.ts index 4ab1685eafbf..6452f17d3d57 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.native.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codeguru-reviewer/runtimeConfig.ts b/clients/client-codeguru-reviewer/runtimeConfig.ts index a49890d44856..6511cd9ffedb 100644 --- a/clients/client-codeguru-reviewer/runtimeConfig.ts +++ b/clients/client-codeguru-reviewer/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeGuruReviewerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codeguruprofiler/runtimeConfig.browser.ts b/clients/client-codeguruprofiler/runtimeConfig.browser.ts index 3da51b99388c..e9ddaf536a7d 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.browser.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codeguruprofiler/runtimeConfig.native.ts b/clients/client-codeguruprofiler/runtimeConfig.native.ts index ffdbb77be694..4f98bd737c64 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.native.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codeguruprofiler/runtimeConfig.ts b/clients/client-codeguruprofiler/runtimeConfig.ts index 74c73c189816..59e085e448c5 100644 --- a/clients/client-codeguruprofiler/runtimeConfig.ts +++ b/clients/client-codeguruprofiler/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeGuruProfilerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codepipeline/runtimeConfig.browser.ts b/clients/client-codepipeline/runtimeConfig.browser.ts index 54f1a8ea81f7..1f2d8a72e153 100644 --- a/clients/client-codepipeline/runtimeConfig.browser.ts +++ b/clients/client-codepipeline/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodePipelineClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codepipeline/runtimeConfig.native.ts b/clients/client-codepipeline/runtimeConfig.native.ts index 06e03fb7230e..4fcffa0cedca 100644 --- a/clients/client-codepipeline/runtimeConfig.native.ts +++ b/clients/client-codepipeline/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodePipelineClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codepipeline/runtimeConfig.ts b/clients/client-codepipeline/runtimeConfig.ts index 0bb7fe257ee8..be6cf1afaa71 100644 --- a/clients/client-codepipeline/runtimeConfig.ts +++ b/clients/client-codepipeline/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodePipelineClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codestar-connections/runtimeConfig.browser.ts b/clients/client-codestar-connections/runtimeConfig.browser.ts index fae3fa58ddbb..cff9ae1eedf9 100644 --- a/clients/client-codestar-connections/runtimeConfig.browser.ts +++ b/clients/client-codestar-connections/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codestar-connections/runtimeConfig.native.ts b/clients/client-codestar-connections/runtimeConfig.native.ts index 58c99910ab21..2c8cea23c005 100644 --- a/clients/client-codestar-connections/runtimeConfig.native.ts +++ b/clients/client-codestar-connections/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codestar-connections/runtimeConfig.ts b/clients/client-codestar-connections/runtimeConfig.ts index 5396c1ef7cad..562fb403f756 100644 --- a/clients/client-codestar-connections/runtimeConfig.ts +++ b/clients/client-codestar-connections/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeStarConnectionsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codestar-notifications/runtimeConfig.browser.ts b/clients/client-codestar-notifications/runtimeConfig.browser.ts index 9a8221569684..6697827f2f44 100644 --- a/clients/client-codestar-notifications/runtimeConfig.browser.ts +++ b/clients/client-codestar-notifications/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codestar-notifications/runtimeConfig.native.ts b/clients/client-codestar-notifications/runtimeConfig.native.ts index 80ad97502a03..92bbb37555ec 100644 --- a/clients/client-codestar-notifications/runtimeConfig.native.ts +++ b/clients/client-codestar-notifications/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codestar-notifications/runtimeConfig.ts b/clients/client-codestar-notifications/runtimeConfig.ts index 7e898107a995..9775a76fb3be 100644 --- a/clients/client-codestar-notifications/runtimeConfig.ts +++ b/clients/client-codestar-notifications/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodestarNotificationsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codestar/runtimeConfig.browser.ts b/clients/client-codestar/runtimeConfig.browser.ts index 472b1587576b..0ccfc63ebddd 100644 --- a/clients/client-codestar/runtimeConfig.browser.ts +++ b/clients/client-codestar/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CodeStarClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-codestar/runtimeConfig.native.ts b/clients/client-codestar/runtimeConfig.native.ts index dce74c72a623..a73fdec1c940 100644 --- a/clients/client-codestar/runtimeConfig.native.ts +++ b/clients/client-codestar/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CodeStarClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-codestar/runtimeConfig.ts b/clients/client-codestar/runtimeConfig.ts index 52f27c3c86b2..35edad1cb009 100644 --- a/clients/client-codestar/runtimeConfig.ts +++ b/clients/client-codestar/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CodeStarClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cognito-identity-provider/runtimeConfig.browser.ts b/clients/client-cognito-identity-provider/runtimeConfig.browser.ts index 72f109ca248e..63d75f1db140 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.browser.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cognito-identity-provider/runtimeConfig.native.ts b/clients/client-cognito-identity-provider/runtimeConfig.native.ts index 5510ebcb2ff2..d74cf9b0a664 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.native.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cognito-identity-provider/runtimeConfig.ts b/clients/client-cognito-identity-provider/runtimeConfig.ts index 761b2bd362f2..f86ac94c0bbe 100644 --- a/clients/client-cognito-identity-provider/runtimeConfig.ts +++ b/clients/client-cognito-identity-provider/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CognitoIdentityProviderClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cognito-identity/runtimeConfig.browser.ts b/clients/client-cognito-identity/runtimeConfig.browser.ts index 24a7c1f9a68a..b928751e10d4 100644 --- a/clients/client-cognito-identity/runtimeConfig.browser.ts +++ b/clients/client-cognito-identity/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cognito-identity/runtimeConfig.native.ts b/clients/client-cognito-identity/runtimeConfig.native.ts index e7819fbe466f..4fefa77ed160 100644 --- a/clients/client-cognito-identity/runtimeConfig.native.ts +++ b/clients/client-cognito-identity/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cognito-identity/runtimeConfig.ts b/clients/client-cognito-identity/runtimeConfig.ts index f2dece56f913..3a79b257e588 100644 --- a/clients/client-cognito-identity/runtimeConfig.ts +++ b/clients/client-cognito-identity/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CognitoIdentityClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cognito-sync/runtimeConfig.browser.ts b/clients/client-cognito-sync/runtimeConfig.browser.ts index 185de25873be..8e775f19c423 100644 --- a/clients/client-cognito-sync/runtimeConfig.browser.ts +++ b/clients/client-cognito-sync/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cognito-sync/runtimeConfig.native.ts b/clients/client-cognito-sync/runtimeConfig.native.ts index 05447738adc1..477e9c79eba2 100644 --- a/clients/client-cognito-sync/runtimeConfig.native.ts +++ b/clients/client-cognito-sync/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cognito-sync/runtimeConfig.ts b/clients/client-cognito-sync/runtimeConfig.ts index e74c08b30274..3c150945c428 100644 --- a/clients/client-cognito-sync/runtimeConfig.ts +++ b/clients/client-cognito-sync/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CognitoSyncClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-comprehend/runtimeConfig.browser.ts b/clients/client-comprehend/runtimeConfig.browser.ts index 43e393cc7f35..55d017877341 100644 --- a/clients/client-comprehend/runtimeConfig.browser.ts +++ b/clients/client-comprehend/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ComprehendClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-comprehend/runtimeConfig.native.ts b/clients/client-comprehend/runtimeConfig.native.ts index 1c1fbe348ccd..f5e80e54efd1 100644 --- a/clients/client-comprehend/runtimeConfig.native.ts +++ b/clients/client-comprehend/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ComprehendClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-comprehend/runtimeConfig.ts b/clients/client-comprehend/runtimeConfig.ts index 148bbd44b78d..f4d9210eb8d5 100644 --- a/clients/client-comprehend/runtimeConfig.ts +++ b/clients/client-comprehend/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ComprehendClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-comprehendmedical/runtimeConfig.browser.ts b/clients/client-comprehendmedical/runtimeConfig.browser.ts index 534258a06100..be62058ff57e 100644 --- a/clients/client-comprehendmedical/runtimeConfig.browser.ts +++ b/clients/client-comprehendmedical/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-comprehendmedical/runtimeConfig.native.ts b/clients/client-comprehendmedical/runtimeConfig.native.ts index 541ed86dc054..0b05c2ceed14 100644 --- a/clients/client-comprehendmedical/runtimeConfig.native.ts +++ b/clients/client-comprehendmedical/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-comprehendmedical/runtimeConfig.ts b/clients/client-comprehendmedical/runtimeConfig.ts index 734add172cbc..75cb2636da91 100644 --- a/clients/client-comprehendmedical/runtimeConfig.ts +++ b/clients/client-comprehendmedical/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ComprehendMedicalClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-compute-optimizer/runtimeConfig.browser.ts b/clients/client-compute-optimizer/runtimeConfig.browser.ts index caeb9770f34f..463cd5ed4b29 100644 --- a/clients/client-compute-optimizer/runtimeConfig.browser.ts +++ b/clients/client-compute-optimizer/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-compute-optimizer/runtimeConfig.native.ts b/clients/client-compute-optimizer/runtimeConfig.native.ts index 776639b17b62..b5d92c3c32d5 100644 --- a/clients/client-compute-optimizer/runtimeConfig.native.ts +++ b/clients/client-compute-optimizer/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-compute-optimizer/runtimeConfig.ts b/clients/client-compute-optimizer/runtimeConfig.ts index c0381929632f..2fb5f95a280b 100644 --- a/clients/client-compute-optimizer/runtimeConfig.ts +++ b/clients/client-compute-optimizer/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ComputeOptimizerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-config-service/runtimeConfig.browser.ts b/clients/client-config-service/runtimeConfig.browser.ts index f9e793929c41..40a30fde70f4 100644 --- a/clients/client-config-service/runtimeConfig.browser.ts +++ b/clients/client-config-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-config-service/runtimeConfig.native.ts b/clients/client-config-service/runtimeConfig.native.ts index d409e982a33d..fe557cd6e4f2 100644 --- a/clients/client-config-service/runtimeConfig.native.ts +++ b/clients/client-config-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-config-service/runtimeConfig.ts b/clients/client-config-service/runtimeConfig.ts index 02ff6aabae1c..3d8a9671fcba 100644 --- a/clients/client-config-service/runtimeConfig.ts +++ b/clients/client-config-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ConfigServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-connect-contact-lens/runtimeConfig.browser.ts b/clients/client-connect-contact-lens/runtimeConfig.browser.ts index dd20e40cf1c8..571cee436c20 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.browser.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-connect-contact-lens/runtimeConfig.native.ts b/clients/client-connect-contact-lens/runtimeConfig.native.ts index 6a8d17349fae..d5b63ba6b50d 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.native.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-connect-contact-lens/runtimeConfig.ts b/clients/client-connect-contact-lens/runtimeConfig.ts index 92c4c8cf5a54..7de77b8e6465 100644 --- a/clients/client-connect-contact-lens/runtimeConfig.ts +++ b/clients/client-connect-contact-lens/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ConnectContactLensClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-connect/runtimeConfig.browser.ts b/clients/client-connect/runtimeConfig.browser.ts index 79f9a7ae84c0..1d832d6471cb 100644 --- a/clients/client-connect/runtimeConfig.browser.ts +++ b/clients/client-connect/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-connect/runtimeConfig.native.ts b/clients/client-connect/runtimeConfig.native.ts index b5f743e7a094..8c3b2212bfe6 100644 --- a/clients/client-connect/runtimeConfig.native.ts +++ b/clients/client-connect/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ConnectClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-connect/runtimeConfig.ts b/clients/client-connect/runtimeConfig.ts index b9097342f3b6..d7888b4daa0f 100644 --- a/clients/client-connect/runtimeConfig.ts +++ b/clients/client-connect/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-connectparticipant/runtimeConfig.browser.ts b/clients/client-connectparticipant/runtimeConfig.browser.ts index cd7fece2f85e..b349be3166df 100644 --- a/clients/client-connectparticipant/runtimeConfig.browser.ts +++ b/clients/client-connectparticipant/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-connectparticipant/runtimeConfig.native.ts b/clients/client-connectparticipant/runtimeConfig.native.ts index 4667a5c2ab41..ff2985ace01f 100644 --- a/clients/client-connectparticipant/runtimeConfig.native.ts +++ b/clients/client-connectparticipant/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-connectparticipant/runtimeConfig.ts b/clients/client-connectparticipant/runtimeConfig.ts index 54ead025ac32..f194df2fcc2b 100644 --- a/clients/client-connectparticipant/runtimeConfig.ts +++ b/clients/client-connectparticipant/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ConnectParticipantClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, 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 082b32aaf83d..788d4cba961b 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, 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 e3da889e7e26..bec508c37c39 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cost-and-usage-report-service/runtimeConfig.ts b/clients/client-cost-and-usage-report-service/runtimeConfig.ts index 9e58dda4a5a3..ad5422df17b5 100644 --- a/clients/client-cost-and-usage-report-service/runtimeConfig.ts +++ b/clients/client-cost-and-usage-report-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CostAndUsageReportServiceClientConfig) const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cost-explorer/runtimeConfig.browser.ts b/clients/client-cost-explorer/runtimeConfig.browser.ts index a6857cc080f2..4a9bd25ddc97 100644 --- a/clients/client-cost-explorer/runtimeConfig.browser.ts +++ b/clients/client-cost-explorer/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CostExplorerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-cost-explorer/runtimeConfig.native.ts b/clients/client-cost-explorer/runtimeConfig.native.ts index 5ebb48efbb63..6175b496c44c 100644 --- a/clients/client-cost-explorer/runtimeConfig.native.ts +++ b/clients/client-cost-explorer/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CostExplorerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-cost-explorer/runtimeConfig.ts b/clients/client-cost-explorer/runtimeConfig.ts index cd88f709dde5..bef5cf7eb18d 100644 --- a/clients/client-cost-explorer/runtimeConfig.ts +++ b/clients/client-cost-explorer/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CostExplorerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-customer-profiles/runtimeConfig.browser.ts b/clients/client-customer-profiles/runtimeConfig.browser.ts index 5826fce7e40f..bb3571391f0f 100644 --- a/clients/client-customer-profiles/runtimeConfig.browser.ts +++ b/clients/client-customer-profiles/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-customer-profiles/runtimeConfig.native.ts b/clients/client-customer-profiles/runtimeConfig.native.ts index 175282252bf5..a7df02fcacf0 100644 --- a/clients/client-customer-profiles/runtimeConfig.native.ts +++ b/clients/client-customer-profiles/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-customer-profiles/runtimeConfig.ts b/clients/client-customer-profiles/runtimeConfig.ts index 96b16d9012d6..d8dbf7eee35b 100644 --- a/clients/client-customer-profiles/runtimeConfig.ts +++ b/clients/client-customer-profiles/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: CustomerProfilesClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-data-pipeline/runtimeConfig.browser.ts b/clients/client-data-pipeline/runtimeConfig.browser.ts index 13b175e9d717..e4d57aea29be 100644 --- a/clients/client-data-pipeline/runtimeConfig.browser.ts +++ b/clients/client-data-pipeline/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DataPipelineClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-data-pipeline/runtimeConfig.native.ts b/clients/client-data-pipeline/runtimeConfig.native.ts index 4a19734d1b9b..0e6b49560bfd 100644 --- a/clients/client-data-pipeline/runtimeConfig.native.ts +++ b/clients/client-data-pipeline/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DataPipelineClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-data-pipeline/runtimeConfig.ts b/clients/client-data-pipeline/runtimeConfig.ts index b162ec394685..36fb50f51ec6 100644 --- a/clients/client-data-pipeline/runtimeConfig.ts +++ b/clients/client-data-pipeline/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DataPipelineClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-database-migration-service/runtimeConfig.browser.ts b/clients/client-database-migration-service/runtimeConfig.browser.ts index 0af0b4b27b08..17f10e430412 100644 --- a/clients/client-database-migration-service/runtimeConfig.browser.ts +++ b/clients/client-database-migration-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) = const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-database-migration-service/runtimeConfig.native.ts b/clients/client-database-migration-service/runtimeConfig.native.ts index e95a72e99b17..0fbcf65ac3c0 100644 --- a/clients/client-database-migration-service/runtimeConfig.native.ts +++ b/clients/client-database-migration-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) = const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-database-migration-service/runtimeConfig.ts b/clients/client-database-migration-service/runtimeConfig.ts index 7809bd5d4cf6..cccb10a03137 100644 --- a/clients/client-database-migration-service/runtimeConfig.ts +++ b/clients/client-database-migration-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DatabaseMigrationServiceClientConfig) = const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-databrew/runtimeConfig.browser.ts b/clients/client-databrew/runtimeConfig.browser.ts index 582eba8129b7..62100bc8a454 100644 --- a/clients/client-databrew/runtimeConfig.browser.ts +++ b/clients/client-databrew/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DataBrewClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-databrew/runtimeConfig.native.ts b/clients/client-databrew/runtimeConfig.native.ts index f80b61ad1227..e38ce4273968 100644 --- a/clients/client-databrew/runtimeConfig.native.ts +++ b/clients/client-databrew/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DataBrewClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-databrew/runtimeConfig.ts b/clients/client-databrew/runtimeConfig.ts index 02ed064cdb33..5a4e2bb4497a 100644 --- a/clients/client-databrew/runtimeConfig.ts +++ b/clients/client-databrew/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DataBrewClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dataexchange/runtimeConfig.browser.ts b/clients/client-dataexchange/runtimeConfig.browser.ts index 7ff33e62d347..05286455ae15 100644 --- a/clients/client-dataexchange/runtimeConfig.browser.ts +++ b/clients/client-dataexchange/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DataExchangeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dataexchange/runtimeConfig.native.ts b/clients/client-dataexchange/runtimeConfig.native.ts index bf90dbf163a3..28609c42eae8 100644 --- a/clients/client-dataexchange/runtimeConfig.native.ts +++ b/clients/client-dataexchange/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DataExchangeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-dataexchange/runtimeConfig.ts b/clients/client-dataexchange/runtimeConfig.ts index 3dd25284e8ab..5b479c22528c 100644 --- a/clients/client-dataexchange/runtimeConfig.ts +++ b/clients/client-dataexchange/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DataExchangeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-datasync/runtimeConfig.browser.ts b/clients/client-datasync/runtimeConfig.browser.ts index 685baecac246..36c3826bc6bc 100644 --- a/clients/client-datasync/runtimeConfig.browser.ts +++ b/clients/client-datasync/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DataSyncClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-datasync/runtimeConfig.native.ts b/clients/client-datasync/runtimeConfig.native.ts index ebf74f069dee..e369b625b83b 100644 --- a/clients/client-datasync/runtimeConfig.native.ts +++ b/clients/client-datasync/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DataSyncClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-datasync/runtimeConfig.ts b/clients/client-datasync/runtimeConfig.ts index 8de4714b39dd..059eb56a2102 100644 --- a/clients/client-datasync/runtimeConfig.ts +++ b/clients/client-datasync/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DataSyncClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dax/runtimeConfig.browser.ts b/clients/client-dax/runtimeConfig.browser.ts index 3f16f83bc815..acb5562c9799 100644 --- a/clients/client-dax/runtimeConfig.browser.ts +++ b/clients/client-dax/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DAXClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dax/runtimeConfig.native.ts b/clients/client-dax/runtimeConfig.native.ts index 4f358c1accbf..2fab51797620 100644 --- a/clients/client-dax/runtimeConfig.native.ts +++ b/clients/client-dax/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DAXClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-dax/runtimeConfig.ts b/clients/client-dax/runtimeConfig.ts index 36ee98ff4dfa..7391bd05627c 100644 --- a/clients/client-dax/runtimeConfig.ts +++ b/clients/client-dax/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DAXClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-detective/runtimeConfig.browser.ts b/clients/client-detective/runtimeConfig.browser.ts index e369172446d6..88afaefd15e9 100644 --- a/clients/client-detective/runtimeConfig.browser.ts +++ b/clients/client-detective/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DetectiveClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-detective/runtimeConfig.native.ts b/clients/client-detective/runtimeConfig.native.ts index 2fe38d59a5b1..b673d584dc10 100644 --- a/clients/client-detective/runtimeConfig.native.ts +++ b/clients/client-detective/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DetectiveClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-detective/runtimeConfig.ts b/clients/client-detective/runtimeConfig.ts index a44e7ae607b0..ac29b71ee898 100644 --- a/clients/client-detective/runtimeConfig.ts +++ b/clients/client-detective/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DetectiveClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-device-farm/runtimeConfig.browser.ts b/clients/client-device-farm/runtimeConfig.browser.ts index b99c80591613..a8b36d24c814 100644 --- a/clients/client-device-farm/runtimeConfig.browser.ts +++ b/clients/client-device-farm/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-device-farm/runtimeConfig.native.ts b/clients/client-device-farm/runtimeConfig.native.ts index eac7f43569ec..ff60387eea19 100644 --- a/clients/client-device-farm/runtimeConfig.native.ts +++ b/clients/client-device-farm/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-device-farm/runtimeConfig.ts b/clients/client-device-farm/runtimeConfig.ts index 5ce8d1e7bd51..5ef0459d5488 100644 --- a/clients/client-device-farm/runtimeConfig.ts +++ b/clients/client-device-farm/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DeviceFarmClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-devops-guru/runtimeConfig.browser.ts b/clients/client-devops-guru/runtimeConfig.browser.ts index 36130f9dc5d7..9c462d8c9c3a 100644 --- a/clients/client-devops-guru/runtimeConfig.browser.ts +++ b/clients/client-devops-guru/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-devops-guru/runtimeConfig.native.ts b/clients/client-devops-guru/runtimeConfig.native.ts index 599aca6bbcb1..f30ad35da2fb 100644 --- a/clients/client-devops-guru/runtimeConfig.native.ts +++ b/clients/client-devops-guru/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-devops-guru/runtimeConfig.ts b/clients/client-devops-guru/runtimeConfig.ts index 0ed8efc0c8ca..76abd09014fa 100644 --- a/clients/client-devops-guru/runtimeConfig.ts +++ b/clients/client-devops-guru/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DevOpsGuruClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-direct-connect/runtimeConfig.browser.ts b/clients/client-direct-connect/runtimeConfig.browser.ts index 709729c7db6c..21d3ecbfd0d0 100644 --- a/clients/client-direct-connect/runtimeConfig.browser.ts +++ b/clients/client-direct-connect/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DirectConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-direct-connect/runtimeConfig.native.ts b/clients/client-direct-connect/runtimeConfig.native.ts index 0f81b4df9d17..89b80b302aa8 100644 --- a/clients/client-direct-connect/runtimeConfig.native.ts +++ b/clients/client-direct-connect/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DirectConnectClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-direct-connect/runtimeConfig.ts b/clients/client-direct-connect/runtimeConfig.ts index 2f4eb169ed66..d35dea98eb00 100644 --- a/clients/client-direct-connect/runtimeConfig.ts +++ b/clients/client-direct-connect/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DirectConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-directory-service/runtimeConfig.browser.ts b/clients/client-directory-service/runtimeConfig.browser.ts index be1ee8b3d757..1be3963c1b71 100644 --- a/clients/client-directory-service/runtimeConfig.browser.ts +++ b/clients/client-directory-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-directory-service/runtimeConfig.native.ts b/clients/client-directory-service/runtimeConfig.native.ts index f630ed21e32e..82b5727a09cf 100644 --- a/clients/client-directory-service/runtimeConfig.native.ts +++ b/clients/client-directory-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-directory-service/runtimeConfig.ts b/clients/client-directory-service/runtimeConfig.ts index 58934338380b..cb2394a0a010 100644 --- a/clients/client-directory-service/runtimeConfig.ts +++ b/clients/client-directory-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DirectoryServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dlm/runtimeConfig.browser.ts b/clients/client-dlm/runtimeConfig.browser.ts index f08e8c4b24e1..fd564bac50d5 100644 --- a/clients/client-dlm/runtimeConfig.browser.ts +++ b/clients/client-dlm/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DLMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dlm/runtimeConfig.native.ts b/clients/client-dlm/runtimeConfig.native.ts index d6aa44181ac8..e05ec2ab3fbb 100644 --- a/clients/client-dlm/runtimeConfig.native.ts +++ b/clients/client-dlm/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DLMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-dlm/runtimeConfig.ts b/clients/client-dlm/runtimeConfig.ts index 8d24cbaa34ce..73dc87352b45 100644 --- a/clients/client-dlm/runtimeConfig.ts +++ b/clients/client-dlm/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DLMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-docdb/runtimeConfig.browser.ts b/clients/client-docdb/runtimeConfig.browser.ts index ffd88107c7d0..53b0b93f1cb4 100644 --- a/clients/client-docdb/runtimeConfig.browser.ts +++ b/clients/client-docdb/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DocDBClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-docdb/runtimeConfig.native.ts b/clients/client-docdb/runtimeConfig.native.ts index 45d20275def3..06a6bd4b70bf 100644 --- a/clients/client-docdb/runtimeConfig.native.ts +++ b/clients/client-docdb/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DocDBClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-docdb/runtimeConfig.ts b/clients/client-docdb/runtimeConfig.ts index 1500f927bbaa..6f267f154691 100644 --- a/clients/client-docdb/runtimeConfig.ts +++ b/clients/client-docdb/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DocDBClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dynamodb-streams/runtimeConfig.browser.ts b/clients/client-dynamodb-streams/runtimeConfig.browser.ts index 546c16de03a3..9d70d929e7f6 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.browser.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dynamodb-streams/runtimeConfig.native.ts b/clients/client-dynamodb-streams/runtimeConfig.native.ts index ed5218b7641c..60b6a01407d8 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.native.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-dynamodb-streams/runtimeConfig.ts b/clients/client-dynamodb-streams/runtimeConfig.ts index 31bde3af14bf..1aa8d5779ac4 100644 --- a/clients/client-dynamodb-streams/runtimeConfig.ts +++ b/clients/client-dynamodb-streams/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: DynamoDBStreamsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dynamodb/runtimeConfig.browser.ts b/clients/client-dynamodb/runtimeConfig.browser.ts index 62a984ec4062..e0e418fd5927 100644 --- a/clients/client-dynamodb/runtimeConfig.browser.ts +++ b/clients/client-dynamodb/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-dynamodb/runtimeConfig.native.ts b/clients/client-dynamodb/runtimeConfig.native.ts index a1defe39de9d..bb6dc79133d2 100644 --- a/clients/client-dynamodb/runtimeConfig.native.ts +++ b/clients/client-dynamodb/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-dynamodb/runtimeConfig.ts b/clients/client-dynamodb/runtimeConfig.ts index 7a5de90ab683..30105babed08 100644 --- a/clients/client-dynamodb/runtimeConfig.ts +++ b/clients/client-dynamodb/runtimeConfig.ts @@ -22,6 +22,7 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ebs/runtimeConfig.browser.ts b/clients/client-ebs/runtimeConfig.browser.ts index 8cbd86a3959e..c17a53826af1 100644 --- a/clients/client-ebs/runtimeConfig.browser.ts +++ b/clients/client-ebs/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ebs/runtimeConfig.native.ts b/clients/client-ebs/runtimeConfig.native.ts index 84748112b2a0..a11a5399993d 100644 --- a/clients/client-ebs/runtimeConfig.native.ts +++ b/clients/client-ebs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ebs/runtimeConfig.ts b/clients/client-ebs/runtimeConfig.ts index 99b7c90218fb..e6b8c2c62b6c 100644 --- a/clients/client-ebs/runtimeConfig.ts +++ b/clients/client-ebs/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ec2-instance-connect/runtimeConfig.browser.ts b/clients/client-ec2-instance-connect/runtimeConfig.browser.ts index 0ed9a7d37fba..ab6bf404b55e 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.browser.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ec2-instance-connect/runtimeConfig.native.ts b/clients/client-ec2-instance-connect/runtimeConfig.native.ts index 01fb4e780b29..c6a7f283ad01 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.native.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ec2-instance-connect/runtimeConfig.ts b/clients/client-ec2-instance-connect/runtimeConfig.ts index 24ddf94d1806..30c695789e26 100644 --- a/clients/client-ec2-instance-connect/runtimeConfig.ts +++ b/clients/client-ec2-instance-connect/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EC2InstanceConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ec2/runtimeConfig.browser.ts b/clients/client-ec2/runtimeConfig.browser.ts index e0bd4227defe..5d90ad6764e2 100644 --- a/clients/client-ec2/runtimeConfig.browser.ts +++ b/clients/client-ec2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ec2/runtimeConfig.native.ts b/clients/client-ec2/runtimeConfig.native.ts index f9db094c1655..feacabcce215 100644 --- a/clients/client-ec2/runtimeConfig.native.ts +++ b/clients/client-ec2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ec2/runtimeConfig.ts b/clients/client-ec2/runtimeConfig.ts index feab4e127a74..12f3ced93eb6 100644 --- a/clients/client-ec2/runtimeConfig.ts +++ b/clients/client-ec2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ecr-public/runtimeConfig.browser.ts b/clients/client-ecr-public/runtimeConfig.browser.ts index 2d2e9b87c9c7..76c95a942ddb 100644 --- a/clients/client-ecr-public/runtimeConfig.browser.ts +++ b/clients/client-ecr-public/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ecr-public/runtimeConfig.native.ts b/clients/client-ecr-public/runtimeConfig.native.ts index 0395b65c5e03..6c9436148db6 100644 --- a/clients/client-ecr-public/runtimeConfig.native.ts +++ b/clients/client-ecr-public/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ecr-public/runtimeConfig.ts b/clients/client-ecr-public/runtimeConfig.ts index 8fed787ba92c..3c569161eecf 100644 --- a/clients/client-ecr-public/runtimeConfig.ts +++ b/clients/client-ecr-public/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ECRPUBLICClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ecr/runtimeConfig.browser.ts b/clients/client-ecr/runtimeConfig.browser.ts index e28a58938926..367c9899dbd1 100644 --- a/clients/client-ecr/runtimeConfig.browser.ts +++ b/clients/client-ecr/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ECRClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ecr/runtimeConfig.native.ts b/clients/client-ecr/runtimeConfig.native.ts index a76a3742be46..42329907d8eb 100644 --- a/clients/client-ecr/runtimeConfig.native.ts +++ b/clients/client-ecr/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ECRClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ecr/runtimeConfig.ts b/clients/client-ecr/runtimeConfig.ts index 90f87f0c1608..8257a1fdc0fb 100644 --- a/clients/client-ecr/runtimeConfig.ts +++ b/clients/client-ecr/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ECRClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ecs/runtimeConfig.browser.ts b/clients/client-ecs/runtimeConfig.browser.ts index 7fa548a98841..f89c4fbb3994 100644 --- a/clients/client-ecs/runtimeConfig.browser.ts +++ b/clients/client-ecs/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ECSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ecs/runtimeConfig.native.ts b/clients/client-ecs/runtimeConfig.native.ts index 2c8276025554..547c6261c951 100644 --- a/clients/client-ecs/runtimeConfig.native.ts +++ b/clients/client-ecs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ECSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ecs/runtimeConfig.ts b/clients/client-ecs/runtimeConfig.ts index cc8dffe7df60..27e058a49d91 100644 --- a/clients/client-ecs/runtimeConfig.ts +++ b/clients/client-ecs/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ECSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-efs/runtimeConfig.browser.ts b/clients/client-efs/runtimeConfig.browser.ts index 03de71207550..120bdcab46cd 100644 --- a/clients/client-efs/runtimeConfig.browser.ts +++ b/clients/client-efs/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EFSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-efs/runtimeConfig.native.ts b/clients/client-efs/runtimeConfig.native.ts index 4ca0cbfd389a..df59b2a970c3 100644 --- a/clients/client-efs/runtimeConfig.native.ts +++ b/clients/client-efs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EFSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-efs/runtimeConfig.ts b/clients/client-efs/runtimeConfig.ts index 63df74b84c37..cd9244181a34 100644 --- a/clients/client-efs/runtimeConfig.ts +++ b/clients/client-efs/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EFSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-eks/runtimeConfig.browser.ts b/clients/client-eks/runtimeConfig.browser.ts index 5c66b7fa9ce7..96e9708943f4 100644 --- a/clients/client-eks/runtimeConfig.browser.ts +++ b/clients/client-eks/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EKSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-eks/runtimeConfig.native.ts b/clients/client-eks/runtimeConfig.native.ts index 26c869d53fd3..e789dd8b657a 100644 --- a/clients/client-eks/runtimeConfig.native.ts +++ b/clients/client-eks/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EKSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-eks/runtimeConfig.ts b/clients/client-eks/runtimeConfig.ts index cd67ea7ce8bf..39acf72f8437 100644 --- a/clients/client-eks/runtimeConfig.ts +++ b/clients/client-eks/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EKSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-beanstalk/runtimeConfig.browser.ts b/clients/client-elastic-beanstalk/runtimeConfig.browser.ts index 63d2fda584ae..ad81a7df8538 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.browser.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-beanstalk/runtimeConfig.native.ts b/clients/client-elastic-beanstalk/runtimeConfig.native.ts index 7ee21cc6fc02..e9b55f275d8a 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.native.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elastic-beanstalk/runtimeConfig.ts b/clients/client-elastic-beanstalk/runtimeConfig.ts index 28bea3383c9d..6d537b718e1a 100644 --- a/clients/client-elastic-beanstalk/runtimeConfig.ts +++ b/clients/client-elastic-beanstalk/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElasticBeanstalkClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-inference/runtimeConfig.browser.ts b/clients/client-elastic-inference/runtimeConfig.browser.ts index 760e60c653ac..a7886262c962 100644 --- a/clients/client-elastic-inference/runtimeConfig.browser.ts +++ b/clients/client-elastic-inference/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-inference/runtimeConfig.native.ts b/clients/client-elastic-inference/runtimeConfig.native.ts index 5d70e176ce17..9eac357a0308 100644 --- a/clients/client-elastic-inference/runtimeConfig.native.ts +++ b/clients/client-elastic-inference/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elastic-inference/runtimeConfig.ts b/clients/client-elastic-inference/runtimeConfig.ts index c5844fa83c47..a18e13c482aa 100644 --- a/clients/client-elastic-inference/runtimeConfig.ts +++ b/clients/client-elastic-inference/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElasticInferenceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts index 8fbb1f94777e..abc7141ed89e 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts index c4856bd680fa..93305ca1e2a6 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elastic-load-balancing-v2/runtimeConfig.ts b/clients/client-elastic-load-balancing-v2/runtimeConfig.ts index 551077522070..92bd1e1e1133 100644 --- a/clients/client-elastic-load-balancing-v2/runtimeConfig.ts +++ b/clients/client-elastic-load-balancing-v2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingV2ClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-load-balancing/runtimeConfig.browser.ts b/clients/client-elastic-load-balancing/runtimeConfig.browser.ts index d177fe44d1b7..7c5854814a17 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.browser.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-load-balancing/runtimeConfig.native.ts b/clients/client-elastic-load-balancing/runtimeConfig.native.ts index 0e7adb89c828..0f623d9c3adb 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.native.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elastic-load-balancing/runtimeConfig.ts b/clients/client-elastic-load-balancing/runtimeConfig.ts index c058065572c9..7427d893e096 100644 --- a/clients/client-elastic-load-balancing/runtimeConfig.ts +++ b/clients/client-elastic-load-balancing/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElasticLoadBalancingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-transcoder/runtimeConfig.browser.ts b/clients/client-elastic-transcoder/runtimeConfig.browser.ts index a84e0437cbd8..479db6e5012b 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.browser.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elastic-transcoder/runtimeConfig.native.ts b/clients/client-elastic-transcoder/runtimeConfig.native.ts index 14fc1972ade0..57673e5ae316 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.native.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elastic-transcoder/runtimeConfig.ts b/clients/client-elastic-transcoder/runtimeConfig.ts index 8a845154b2f4..5d7251d3c1f1 100644 --- a/clients/client-elastic-transcoder/runtimeConfig.ts +++ b/clients/client-elastic-transcoder/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElasticTranscoderClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elasticache/runtimeConfig.browser.ts b/clients/client-elasticache/runtimeConfig.browser.ts index adaa1d0ffb05..c12f7c303071 100644 --- a/clients/client-elasticache/runtimeConfig.browser.ts +++ b/clients/client-elasticache/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elasticache/runtimeConfig.native.ts b/clients/client-elasticache/runtimeConfig.native.ts index caeae680686f..ed7edb87ba42 100644 --- a/clients/client-elasticache/runtimeConfig.native.ts +++ b/clients/client-elasticache/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elasticache/runtimeConfig.ts b/clients/client-elasticache/runtimeConfig.ts index 1c8e8cdf2311..6b136b30a283 100644 --- a/clients/client-elasticache/runtimeConfig.ts +++ b/clients/client-elasticache/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElastiCacheClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elasticsearch-service/runtimeConfig.browser.ts b/clients/client-elasticsearch-service/runtimeConfig.browser.ts index e0ab494fd388..41c49a671fd0 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.browser.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-elasticsearch-service/runtimeConfig.native.ts b/clients/client-elasticsearch-service/runtimeConfig.native.ts index 043e0d5ba1f7..25a3db513415 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.native.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-elasticsearch-service/runtimeConfig.ts b/clients/client-elasticsearch-service/runtimeConfig.ts index 211842b7595a..3b429b8eb047 100644 --- a/clients/client-elasticsearch-service/runtimeConfig.ts +++ b/clients/client-elasticsearch-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ElasticsearchServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-emr-containers/runtimeConfig.browser.ts b/clients/client-emr-containers/runtimeConfig.browser.ts index d30c4e6a6e03..6b42cdb68043 100644 --- a/clients/client-emr-containers/runtimeConfig.browser.ts +++ b/clients/client-emr-containers/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EMRContainersClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-emr-containers/runtimeConfig.native.ts b/clients/client-emr-containers/runtimeConfig.native.ts index ed7cb675b5ff..f722d3834dbd 100644 --- a/clients/client-emr-containers/runtimeConfig.native.ts +++ b/clients/client-emr-containers/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EMRContainersClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-emr-containers/runtimeConfig.ts b/clients/client-emr-containers/runtimeConfig.ts index 1da38dbe7ee5..d91f8145dbde 100644 --- a/clients/client-emr-containers/runtimeConfig.ts +++ b/clients/client-emr-containers/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EMRContainersClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-emr/runtimeConfig.browser.ts b/clients/client-emr/runtimeConfig.browser.ts index 630912f02d25..1d4a33f508ad 100644 --- a/clients/client-emr/runtimeConfig.browser.ts +++ b/clients/client-emr/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EMRClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-emr/runtimeConfig.native.ts b/clients/client-emr/runtimeConfig.native.ts index 46ff651484c7..cd70b44ad7a9 100644 --- a/clients/client-emr/runtimeConfig.native.ts +++ b/clients/client-emr/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EMRClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-emr/runtimeConfig.ts b/clients/client-emr/runtimeConfig.ts index eb91c3b5a374..de85bc0a11c6 100644 --- a/clients/client-emr/runtimeConfig.ts +++ b/clients/client-emr/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EMRClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-eventbridge/runtimeConfig.browser.ts b/clients/client-eventbridge/runtimeConfig.browser.ts index b7e9e4f9a70e..f4544f513fbb 100644 --- a/clients/client-eventbridge/runtimeConfig.browser.ts +++ b/clients/client-eventbridge/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EventBridgeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-eventbridge/runtimeConfig.native.ts b/clients/client-eventbridge/runtimeConfig.native.ts index df32d3921220..112e116cd128 100644 --- a/clients/client-eventbridge/runtimeConfig.native.ts +++ b/clients/client-eventbridge/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EventBridgeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-eventbridge/runtimeConfig.ts b/clients/client-eventbridge/runtimeConfig.ts index 1415ac46ae6f..5477978a91fc 100644 --- a/clients/client-eventbridge/runtimeConfig.ts +++ b/clients/client-eventbridge/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: EventBridgeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-finspace-data/runtimeConfig.browser.ts b/clients/client-finspace-data/runtimeConfig.browser.ts index ccb6758e9a51..eb3e9ff0476b 100644 --- a/clients/client-finspace-data/runtimeConfig.browser.ts +++ b/clients/client-finspace-data/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-finspace-data/runtimeConfig.native.ts b/clients/client-finspace-data/runtimeConfig.native.ts index 73bc2fcac328..37c48ac01218 100644 --- a/clients/client-finspace-data/runtimeConfig.native.ts +++ b/clients/client-finspace-data/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-finspace-data/runtimeConfig.ts b/clients/client-finspace-data/runtimeConfig.ts index b34478ea15e2..ecaa3deea09f 100644 --- a/clients/client-finspace-data/runtimeConfig.ts +++ b/clients/client-finspace-data/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FinspaceDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-finspace/runtimeConfig.browser.ts b/clients/client-finspace/runtimeConfig.browser.ts index 7c18d94135ea..dc8621120d4d 100644 --- a/clients/client-finspace/runtimeConfig.browser.ts +++ b/clients/client-finspace/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FinspaceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-finspace/runtimeConfig.native.ts b/clients/client-finspace/runtimeConfig.native.ts index 59bbfd81e195..b2443e797ef8 100644 --- a/clients/client-finspace/runtimeConfig.native.ts +++ b/clients/client-finspace/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FinspaceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-finspace/runtimeConfig.ts b/clients/client-finspace/runtimeConfig.ts index d6a5286deda4..ef5795be4e94 100644 --- a/clients/client-finspace/runtimeConfig.ts +++ b/clients/client-finspace/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FinspaceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-firehose/runtimeConfig.browser.ts b/clients/client-firehose/runtimeConfig.browser.ts index 4af3caae3a6a..9b91dc7d0556 100644 --- a/clients/client-firehose/runtimeConfig.browser.ts +++ b/clients/client-firehose/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FirehoseClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-firehose/runtimeConfig.native.ts b/clients/client-firehose/runtimeConfig.native.ts index 675d7a838d20..4d6d907ace03 100644 --- a/clients/client-firehose/runtimeConfig.native.ts +++ b/clients/client-firehose/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FirehoseClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-firehose/runtimeConfig.ts b/clients/client-firehose/runtimeConfig.ts index 3fc4a83f8170..83ae32523eed 100644 --- a/clients/client-firehose/runtimeConfig.ts +++ b/clients/client-firehose/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FirehoseClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-fis/runtimeConfig.browser.ts b/clients/client-fis/runtimeConfig.browser.ts index e897b5205b63..e0be5c0c99cf 100644 --- a/clients/client-fis/runtimeConfig.browser.ts +++ b/clients/client-fis/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FisClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-fis/runtimeConfig.native.ts b/clients/client-fis/runtimeConfig.native.ts index e2ce1ee81f16..4084d14f9da9 100644 --- a/clients/client-fis/runtimeConfig.native.ts +++ b/clients/client-fis/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FisClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-fis/runtimeConfig.ts b/clients/client-fis/runtimeConfig.ts index 5ff4d9e3e995..53ec4324e219 100644 --- a/clients/client-fis/runtimeConfig.ts +++ b/clients/client-fis/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FisClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-fms/runtimeConfig.browser.ts b/clients/client-fms/runtimeConfig.browser.ts index 3375d8c3c0d5..ff413fbcf487 100644 --- a/clients/client-fms/runtimeConfig.browser.ts +++ b/clients/client-fms/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FMSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-fms/runtimeConfig.native.ts b/clients/client-fms/runtimeConfig.native.ts index 2dda547918f9..a7cef71e8566 100644 --- a/clients/client-fms/runtimeConfig.native.ts +++ b/clients/client-fms/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FMSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-fms/runtimeConfig.ts b/clients/client-fms/runtimeConfig.ts index 2fb4abdb2d05..6c83d16376c7 100644 --- a/clients/client-fms/runtimeConfig.ts +++ b/clients/client-fms/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FMSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-forecast/runtimeConfig.browser.ts b/clients/client-forecast/runtimeConfig.browser.ts index 45697fc35554..e2309e951f3c 100644 --- a/clients/client-forecast/runtimeConfig.browser.ts +++ b/clients/client-forecast/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ForecastClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-forecast/runtimeConfig.native.ts b/clients/client-forecast/runtimeConfig.native.ts index f108667776f1..031a2f863fe1 100644 --- a/clients/client-forecast/runtimeConfig.native.ts +++ b/clients/client-forecast/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ForecastClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-forecast/runtimeConfig.ts b/clients/client-forecast/runtimeConfig.ts index dd69f568c52e..905bd9b9c386 100644 --- a/clients/client-forecast/runtimeConfig.ts +++ b/clients/client-forecast/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ForecastClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-forecastquery/runtimeConfig.browser.ts b/clients/client-forecastquery/runtimeConfig.browser.ts index 6b8833566c21..f0f0c9af3e51 100644 --- a/clients/client-forecastquery/runtimeConfig.browser.ts +++ b/clients/client-forecastquery/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-forecastquery/runtimeConfig.native.ts b/clients/client-forecastquery/runtimeConfig.native.ts index 1d773bb1b4b8..1ce473220198 100644 --- a/clients/client-forecastquery/runtimeConfig.native.ts +++ b/clients/client-forecastquery/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-forecastquery/runtimeConfig.ts b/clients/client-forecastquery/runtimeConfig.ts index ef7a0bf425ca..fcfc78e50952 100644 --- a/clients/client-forecastquery/runtimeConfig.ts +++ b/clients/client-forecastquery/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ForecastqueryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-frauddetector/runtimeConfig.browser.ts b/clients/client-frauddetector/runtimeConfig.browser.ts index 5a68ca443498..09b5b33ea76e 100644 --- a/clients/client-frauddetector/runtimeConfig.browser.ts +++ b/clients/client-frauddetector/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-frauddetector/runtimeConfig.native.ts b/clients/client-frauddetector/runtimeConfig.native.ts index 334866ea05e8..a678374e27d7 100644 --- a/clients/client-frauddetector/runtimeConfig.native.ts +++ b/clients/client-frauddetector/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-frauddetector/runtimeConfig.ts b/clients/client-frauddetector/runtimeConfig.ts index 0dd76afef758..b20ce36cbb25 100644 --- a/clients/client-frauddetector/runtimeConfig.ts +++ b/clients/client-frauddetector/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FraudDetectorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-fsx/runtimeConfig.browser.ts b/clients/client-fsx/runtimeConfig.browser.ts index 40c433440d38..45988a794556 100644 --- a/clients/client-fsx/runtimeConfig.browser.ts +++ b/clients/client-fsx/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: FSxClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-fsx/runtimeConfig.native.ts b/clients/client-fsx/runtimeConfig.native.ts index 46445c1cd48b..243207f4fa82 100644 --- a/clients/client-fsx/runtimeConfig.native.ts +++ b/clients/client-fsx/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: FSxClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-fsx/runtimeConfig.ts b/clients/client-fsx/runtimeConfig.ts index 2869c0a18ea9..8c1e7ffc8b46 100644 --- a/clients/client-fsx/runtimeConfig.ts +++ b/clients/client-fsx/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: FSxClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-gamelift/runtimeConfig.browser.ts b/clients/client-gamelift/runtimeConfig.browser.ts index 7615f00c2045..b9daa48fcebb 100644 --- a/clients/client-gamelift/runtimeConfig.browser.ts +++ b/clients/client-gamelift/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GameLiftClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-gamelift/runtimeConfig.native.ts b/clients/client-gamelift/runtimeConfig.native.ts index 001707d029e6..6a584470804a 100644 --- a/clients/client-gamelift/runtimeConfig.native.ts +++ b/clients/client-gamelift/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GameLiftClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-gamelift/runtimeConfig.ts b/clients/client-gamelift/runtimeConfig.ts index db0a9bbb5258..aad3383ccf46 100644 --- a/clients/client-gamelift/runtimeConfig.ts +++ b/clients/client-gamelift/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GameLiftClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-glacier/runtimeConfig.browser.ts b/clients/client-glacier/runtimeConfig.browser.ts index 5f1f3cecbb16..18d0141b87be 100644 --- a/clients/client-glacier/runtimeConfig.browser.ts +++ b/clients/client-glacier/runtimeConfig.browser.ts @@ -19,6 +19,7 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-glacier/runtimeConfig.native.ts b/clients/client-glacier/runtimeConfig.native.ts index 249840f06794..6b52dcc4ae66 100644 --- a/clients/client-glacier/runtimeConfig.native.ts +++ b/clients/client-glacier/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-glacier/runtimeConfig.ts b/clients/client-glacier/runtimeConfig.ts index ac64facfb1e7..f428a6b50689 100644 --- a/clients/client-glacier/runtimeConfig.ts +++ b/clients/client-glacier/runtimeConfig.ts @@ -22,6 +22,7 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-global-accelerator/runtimeConfig.browser.ts b/clients/client-global-accelerator/runtimeConfig.browser.ts index 413f9deac127..a070c1d15fb6 100644 --- a/clients/client-global-accelerator/runtimeConfig.browser.ts +++ b/clients/client-global-accelerator/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-global-accelerator/runtimeConfig.native.ts b/clients/client-global-accelerator/runtimeConfig.native.ts index adf19cf93f08..97bd4c0a5dbd 100644 --- a/clients/client-global-accelerator/runtimeConfig.native.ts +++ b/clients/client-global-accelerator/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-global-accelerator/runtimeConfig.ts b/clients/client-global-accelerator/runtimeConfig.ts index aa1003d6ba27..992a3f19b7e2 100644 --- a/clients/client-global-accelerator/runtimeConfig.ts +++ b/clients/client-global-accelerator/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GlobalAcceleratorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-glue/runtimeConfig.browser.ts b/clients/client-glue/runtimeConfig.browser.ts index 401cebb4ac21..7543e45c0536 100644 --- a/clients/client-glue/runtimeConfig.browser.ts +++ b/clients/client-glue/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GlueClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-glue/runtimeConfig.native.ts b/clients/client-glue/runtimeConfig.native.ts index 0ead0a4aa57d..5f00c06f749f 100644 --- a/clients/client-glue/runtimeConfig.native.ts +++ b/clients/client-glue/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GlueClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-glue/runtimeConfig.ts b/clients/client-glue/runtimeConfig.ts index 154d48ba57e5..96ba1076bf0f 100644 --- a/clients/client-glue/runtimeConfig.ts +++ b/clients/client-glue/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GlueClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-greengrass/runtimeConfig.browser.ts b/clients/client-greengrass/runtimeConfig.browser.ts index a8c753385201..5b00069633ad 100644 --- a/clients/client-greengrass/runtimeConfig.browser.ts +++ b/clients/client-greengrass/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GreengrassClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-greengrass/runtimeConfig.native.ts b/clients/client-greengrass/runtimeConfig.native.ts index 90592bd6f8b7..5bf1543181bf 100644 --- a/clients/client-greengrass/runtimeConfig.native.ts +++ b/clients/client-greengrass/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GreengrassClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-greengrass/runtimeConfig.ts b/clients/client-greengrass/runtimeConfig.ts index 191e18f70a8c..2fd69badb638 100644 --- a/clients/client-greengrass/runtimeConfig.ts +++ b/clients/client-greengrass/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GreengrassClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-greengrassv2/runtimeConfig.browser.ts b/clients/client-greengrassv2/runtimeConfig.browser.ts index 1c51a1c63d02..9e74a92a67da 100644 --- a/clients/client-greengrassv2/runtimeConfig.browser.ts +++ b/clients/client-greengrassv2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-greengrassv2/runtimeConfig.native.ts b/clients/client-greengrassv2/runtimeConfig.native.ts index 647a2bd9ec91..f3c652fc01d8 100644 --- a/clients/client-greengrassv2/runtimeConfig.native.ts +++ b/clients/client-greengrassv2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-greengrassv2/runtimeConfig.ts b/clients/client-greengrassv2/runtimeConfig.ts index 8042bbf69206..901a768ba898 100644 --- a/clients/client-greengrassv2/runtimeConfig.ts +++ b/clients/client-greengrassv2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GreengrassV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-groundstation/runtimeConfig.browser.ts b/clients/client-groundstation/runtimeConfig.browser.ts index d8fa2cb6eb72..fe7b375ac437 100644 --- a/clients/client-groundstation/runtimeConfig.browser.ts +++ b/clients/client-groundstation/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GroundStationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-groundstation/runtimeConfig.native.ts b/clients/client-groundstation/runtimeConfig.native.ts index f992e2ab649a..448b20501319 100644 --- a/clients/client-groundstation/runtimeConfig.native.ts +++ b/clients/client-groundstation/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GroundStationClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-groundstation/runtimeConfig.ts b/clients/client-groundstation/runtimeConfig.ts index c8aae876d9cb..934e402ecb81 100644 --- a/clients/client-groundstation/runtimeConfig.ts +++ b/clients/client-groundstation/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GroundStationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-guardduty/runtimeConfig.browser.ts b/clients/client-guardduty/runtimeConfig.browser.ts index 7afbed16d2b2..3b7c977eb989 100644 --- a/clients/client-guardduty/runtimeConfig.browser.ts +++ b/clients/client-guardduty/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: GuardDutyClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-guardduty/runtimeConfig.native.ts b/clients/client-guardduty/runtimeConfig.native.ts index 9c14cb839bdc..bbe34fc60105 100644 --- a/clients/client-guardduty/runtimeConfig.native.ts +++ b/clients/client-guardduty/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: GuardDutyClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-guardduty/runtimeConfig.ts b/clients/client-guardduty/runtimeConfig.ts index fa68e5e4aaaf..f674441819e3 100644 --- a/clients/client-guardduty/runtimeConfig.ts +++ b/clients/client-guardduty/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: GuardDutyClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-health/runtimeConfig.browser.ts b/clients/client-health/runtimeConfig.browser.ts index dbd288ec84cd..cf92f97be361 100644 --- a/clients/client-health/runtimeConfig.browser.ts +++ b/clients/client-health/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: HealthClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-health/runtimeConfig.native.ts b/clients/client-health/runtimeConfig.native.ts index 32346d57336d..ba4414cfbbb7 100644 --- a/clients/client-health/runtimeConfig.native.ts +++ b/clients/client-health/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: HealthClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-health/runtimeConfig.ts b/clients/client-health/runtimeConfig.ts index 475a7d43b3b2..a4a9a5e422fb 100644 --- a/clients/client-health/runtimeConfig.ts +++ b/clients/client-health/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: HealthClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-healthlake/runtimeConfig.browser.ts b/clients/client-healthlake/runtimeConfig.browser.ts index ec22301ef894..3b83fece8a93 100644 --- a/clients/client-healthlake/runtimeConfig.browser.ts +++ b/clients/client-healthlake/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: HealthLakeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-healthlake/runtimeConfig.native.ts b/clients/client-healthlake/runtimeConfig.native.ts index cb88b5fb4e56..02a80ebe2a90 100644 --- a/clients/client-healthlake/runtimeConfig.native.ts +++ b/clients/client-healthlake/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: HealthLakeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-healthlake/runtimeConfig.ts b/clients/client-healthlake/runtimeConfig.ts index 68707b8475f4..0342a655eed3 100644 --- a/clients/client-healthlake/runtimeConfig.ts +++ b/clients/client-healthlake/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: HealthLakeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-honeycode/runtimeConfig.browser.ts b/clients/client-honeycode/runtimeConfig.browser.ts index 28de5cf3e337..cc8ef6a609bb 100644 --- a/clients/client-honeycode/runtimeConfig.browser.ts +++ b/clients/client-honeycode/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: HoneycodeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-honeycode/runtimeConfig.native.ts b/clients/client-honeycode/runtimeConfig.native.ts index 78f0ba4e4f7e..c3a556dc6b6e 100644 --- a/clients/client-honeycode/runtimeConfig.native.ts +++ b/clients/client-honeycode/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: HoneycodeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-honeycode/runtimeConfig.ts b/clients/client-honeycode/runtimeConfig.ts index 5073960e2658..f9f3149f2168 100644 --- a/clients/client-honeycode/runtimeConfig.ts +++ b/clients/client-honeycode/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: HoneycodeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iam/runtimeConfig.browser.ts b/clients/client-iam/runtimeConfig.browser.ts index d1d2e4ae84bc..cbab4359cdad 100644 --- a/clients/client-iam/runtimeConfig.browser.ts +++ b/clients/client-iam/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IAMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iam/runtimeConfig.native.ts b/clients/client-iam/runtimeConfig.native.ts index f2c504292102..d221e60fab82 100644 --- a/clients/client-iam/runtimeConfig.native.ts +++ b/clients/client-iam/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IAMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iam/runtimeConfig.ts b/clients/client-iam/runtimeConfig.ts index 7fc4a8133bed..4b362166f98b 100644 --- a/clients/client-iam/runtimeConfig.ts +++ b/clients/client-iam/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IAMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-identitystore/runtimeConfig.browser.ts b/clients/client-identitystore/runtimeConfig.browser.ts index 8de443b11266..6f1e5a1ee0ef 100644 --- a/clients/client-identitystore/runtimeConfig.browser.ts +++ b/clients/client-identitystore/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-identitystore/runtimeConfig.native.ts b/clients/client-identitystore/runtimeConfig.native.ts index 45910532c2aa..268e07d28878 100644 --- a/clients/client-identitystore/runtimeConfig.native.ts +++ b/clients/client-identitystore/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-identitystore/runtimeConfig.ts b/clients/client-identitystore/runtimeConfig.ts index 11d4be2c400c..aa5f8a393039 100644 --- a/clients/client-identitystore/runtimeConfig.ts +++ b/clients/client-identitystore/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IdentitystoreClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-imagebuilder/runtimeConfig.browser.ts b/clients/client-imagebuilder/runtimeConfig.browser.ts index ee437b9a965c..da4a2ed128c6 100644 --- a/clients/client-imagebuilder/runtimeConfig.browser.ts +++ b/clients/client-imagebuilder/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-imagebuilder/runtimeConfig.native.ts b/clients/client-imagebuilder/runtimeConfig.native.ts index 581fca9e5e06..fb92dff232cd 100644 --- a/clients/client-imagebuilder/runtimeConfig.native.ts +++ b/clients/client-imagebuilder/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-imagebuilder/runtimeConfig.ts b/clients/client-imagebuilder/runtimeConfig.ts index 244159902e88..75676fc8add6 100644 --- a/clients/client-imagebuilder/runtimeConfig.ts +++ b/clients/client-imagebuilder/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ImagebuilderClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-inspector/runtimeConfig.browser.ts b/clients/client-inspector/runtimeConfig.browser.ts index 11754d57f0ee..84c01966e702 100644 --- a/clients/client-inspector/runtimeConfig.browser.ts +++ b/clients/client-inspector/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: InspectorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-inspector/runtimeConfig.native.ts b/clients/client-inspector/runtimeConfig.native.ts index 809e1be41e99..9916d3f67913 100644 --- a/clients/client-inspector/runtimeConfig.native.ts +++ b/clients/client-inspector/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: InspectorClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-inspector/runtimeConfig.ts b/clients/client-inspector/runtimeConfig.ts index f452e0f3b653..500fabf45472 100644 --- a/clients/client-inspector/runtimeConfig.ts +++ b/clients/client-inspector/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: InspectorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts b/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts index d433cd48ceb2..aac868b53e37 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.native.ts b/clients/client-iot-1click-devices-service/runtimeConfig.native.ts index 5011eb3b8ad8..92a20c7792eb 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.native.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-1click-devices-service/runtimeConfig.ts b/clients/client-iot-1click-devices-service/runtimeConfig.ts index 13b4b9f5fdd8..929a62b7d983 100644 --- a/clients/client-iot-1click-devices-service/runtimeConfig.ts +++ b/clients/client-iot-1click-devices-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoT1ClickDevicesServiceClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-1click-projects/runtimeConfig.browser.ts b/clients/client-iot-1click-projects/runtimeConfig.browser.ts index 606f042a4771..85954523d680 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.browser.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-1click-projects/runtimeConfig.native.ts b/clients/client-iot-1click-projects/runtimeConfig.native.ts index 59a04b72b5b2..4635b922d3be 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.native.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-1click-projects/runtimeConfig.ts b/clients/client-iot-1click-projects/runtimeConfig.ts index 5ba477eef38c..e455a2defed2 100644 --- a/clients/client-iot-1click-projects/runtimeConfig.ts +++ b/clients/client-iot-1click-projects/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoT1ClickProjectsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-data-plane/runtimeConfig.browser.ts b/clients/client-iot-data-plane/runtimeConfig.browser.ts index a6532a107533..d3d57f0a40b6 100644 --- a/clients/client-iot-data-plane/runtimeConfig.browser.ts +++ b/clients/client-iot-data-plane/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-data-plane/runtimeConfig.native.ts b/clients/client-iot-data-plane/runtimeConfig.native.ts index 8db703a78a68..aaf57f58a32a 100644 --- a/clients/client-iot-data-plane/runtimeConfig.native.ts +++ b/clients/client-iot-data-plane/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-data-plane/runtimeConfig.ts b/clients/client-iot-data-plane/runtimeConfig.ts index 0955a2bf7660..7a03cb83ca48 100644 --- a/clients/client-iot-data-plane/runtimeConfig.ts +++ b/clients/client-iot-data-plane/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTDataPlaneClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-events-data/runtimeConfig.browser.ts b/clients/client-iot-events-data/runtimeConfig.browser.ts index 04da09a6e578..d7f8fc6326a7 100644 --- a/clients/client-iot-events-data/runtimeConfig.browser.ts +++ b/clients/client-iot-events-data/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-events-data/runtimeConfig.native.ts b/clients/client-iot-events-data/runtimeConfig.native.ts index 7ad120754263..f925574a33f3 100644 --- a/clients/client-iot-events-data/runtimeConfig.native.ts +++ b/clients/client-iot-events-data/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-events-data/runtimeConfig.ts b/clients/client-iot-events-data/runtimeConfig.ts index 3d2657783124..ebcd80bbd86d 100644 --- a/clients/client-iot-events-data/runtimeConfig.ts +++ b/clients/client-iot-events-data/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTEventsDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-events/runtimeConfig.browser.ts b/clients/client-iot-events/runtimeConfig.browser.ts index 0415edfe9d1c..328da661ba67 100644 --- a/clients/client-iot-events/runtimeConfig.browser.ts +++ b/clients/client-iot-events/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTEventsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-events/runtimeConfig.native.ts b/clients/client-iot-events/runtimeConfig.native.ts index 0758402b9721..67fca378f730 100644 --- a/clients/client-iot-events/runtimeConfig.native.ts +++ b/clients/client-iot-events/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTEventsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-events/runtimeConfig.ts b/clients/client-iot-events/runtimeConfig.ts index 432b3b405d65..f59e61a96a0b 100644 --- a/clients/client-iot-events/runtimeConfig.ts +++ b/clients/client-iot-events/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTEventsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts index 5f06648756e9..2f80c81dfe4f 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts index e71ff357b739..423d1d958cb2 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-jobs-data-plane/runtimeConfig.ts b/clients/client-iot-jobs-data-plane/runtimeConfig.ts index 08366094dce3..47daf361a316 100644 --- a/clients/client-iot-jobs-data-plane/runtimeConfig.ts +++ b/clients/client-iot-jobs-data-plane/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTJobsDataPlaneClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-wireless/runtimeConfig.browser.ts b/clients/client-iot-wireless/runtimeConfig.browser.ts index e1e8dc74ca98..5bafc877f573 100644 --- a/clients/client-iot-wireless/runtimeConfig.browser.ts +++ b/clients/client-iot-wireless/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot-wireless/runtimeConfig.native.ts b/clients/client-iot-wireless/runtimeConfig.native.ts index 906ff4ffc2f8..855d3281eae3 100644 --- a/clients/client-iot-wireless/runtimeConfig.native.ts +++ b/clients/client-iot-wireless/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot-wireless/runtimeConfig.ts b/clients/client-iot-wireless/runtimeConfig.ts index 0df9c60f8b8e..5dc4940d70a0 100644 --- a/clients/client-iot-wireless/runtimeConfig.ts +++ b/clients/client-iot-wireless/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTWirelessClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot/runtimeConfig.browser.ts b/clients/client-iot/runtimeConfig.browser.ts index 49dfaa65b36a..6db689dda83a 100644 --- a/clients/client-iot/runtimeConfig.browser.ts +++ b/clients/client-iot/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iot/runtimeConfig.native.ts b/clients/client-iot/runtimeConfig.native.ts index 1c62088ec8b7..de6fbdc29e04 100644 --- a/clients/client-iot/runtimeConfig.native.ts +++ b/clients/client-iot/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iot/runtimeConfig.ts b/clients/client-iot/runtimeConfig.ts index e195a8c6cc43..fab89af60852 100644 --- a/clients/client-iot/runtimeConfig.ts +++ b/clients/client-iot/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotanalytics/runtimeConfig.browser.ts b/clients/client-iotanalytics/runtimeConfig.browser.ts index 8e2b2da493e6..179523da62ce 100644 --- a/clients/client-iotanalytics/runtimeConfig.browser.ts +++ b/clients/client-iotanalytics/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotanalytics/runtimeConfig.native.ts b/clients/client-iotanalytics/runtimeConfig.native.ts index 3d7f2f4f3c31..174810610b29 100644 --- a/clients/client-iotanalytics/runtimeConfig.native.ts +++ b/clients/client-iotanalytics/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iotanalytics/runtimeConfig.ts b/clients/client-iotanalytics/runtimeConfig.ts index 4ed685d59df3..36dbfbde6e89 100644 --- a/clients/client-iotanalytics/runtimeConfig.ts +++ b/clients/client-iotanalytics/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTAnalyticsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts b/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts index 0e9b4dd5b540..cc21dac4eb3b 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.native.ts b/clients/client-iotdeviceadvisor/runtimeConfig.native.ts index b563e1a8bd3a..1d82eeafd9fe 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.native.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iotdeviceadvisor/runtimeConfig.ts b/clients/client-iotdeviceadvisor/runtimeConfig.ts index 0adb960912e2..2e93862053b8 100644 --- a/clients/client-iotdeviceadvisor/runtimeConfig.ts +++ b/clients/client-iotdeviceadvisor/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IotDeviceAdvisorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotfleethub/runtimeConfig.browser.ts b/clients/client-iotfleethub/runtimeConfig.browser.ts index 9fdfa6856ee4..83a7e0d8418b 100644 --- a/clients/client-iotfleethub/runtimeConfig.browser.ts +++ b/clients/client-iotfleethub/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotfleethub/runtimeConfig.native.ts b/clients/client-iotfleethub/runtimeConfig.native.ts index af762151143f..15bddb6b57f2 100644 --- a/clients/client-iotfleethub/runtimeConfig.native.ts +++ b/clients/client-iotfleethub/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iotfleethub/runtimeConfig.ts b/clients/client-iotfleethub/runtimeConfig.ts index 2fdd3997ac6a..d6e54df8edba 100644 --- a/clients/client-iotfleethub/runtimeConfig.ts +++ b/clients/client-iotfleethub/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTFleetHubClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotsecuretunneling/runtimeConfig.browser.ts b/clients/client-iotsecuretunneling/runtimeConfig.browser.ts index ac22562c410d..01013153f6ad 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.browser.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotsecuretunneling/runtimeConfig.native.ts b/clients/client-iotsecuretunneling/runtimeConfig.native.ts index d6847b12f0c0..21d4fc7d00e3 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.native.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iotsecuretunneling/runtimeConfig.ts b/clients/client-iotsecuretunneling/runtimeConfig.ts index b98aa790b523..344916d1ac2b 100644 --- a/clients/client-iotsecuretunneling/runtimeConfig.ts +++ b/clients/client-iotsecuretunneling/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTSecureTunnelingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotsitewise/runtimeConfig.browser.ts b/clients/client-iotsitewise/runtimeConfig.browser.ts index 49c28f4fac04..6bad9b95fa9b 100644 --- a/clients/client-iotsitewise/runtimeConfig.browser.ts +++ b/clients/client-iotsitewise/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotsitewise/runtimeConfig.native.ts b/clients/client-iotsitewise/runtimeConfig.native.ts index 37c90663bfd2..c43466b24ae7 100644 --- a/clients/client-iotsitewise/runtimeConfig.native.ts +++ b/clients/client-iotsitewise/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iotsitewise/runtimeConfig.ts b/clients/client-iotsitewise/runtimeConfig.ts index 7f70d55514a3..3a8fd56123f4 100644 --- a/clients/client-iotsitewise/runtimeConfig.ts +++ b/clients/client-iotsitewise/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTSiteWiseClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotthingsgraph/runtimeConfig.browser.ts b/clients/client-iotthingsgraph/runtimeConfig.browser.ts index 56464348b1a0..99a7269772c2 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.browser.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-iotthingsgraph/runtimeConfig.native.ts b/clients/client-iotthingsgraph/runtimeConfig.native.ts index ea667db5e7ff..d97fc41d1e3f 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.native.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-iotthingsgraph/runtimeConfig.ts b/clients/client-iotthingsgraph/runtimeConfig.ts index a8519bbe79de..d91fbaeb2994 100644 --- a/clients/client-iotthingsgraph/runtimeConfig.ts +++ b/clients/client-iotthingsgraph/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IoTThingsGraphClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ivs/runtimeConfig.browser.ts b/clients/client-ivs/runtimeConfig.browser.ts index 79261579e356..5f85c9138630 100644 --- a/clients/client-ivs/runtimeConfig.browser.ts +++ b/clients/client-ivs/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: IvsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ivs/runtimeConfig.native.ts b/clients/client-ivs/runtimeConfig.native.ts index 7e0e60bb5dff..d1cbe19911e8 100644 --- a/clients/client-ivs/runtimeConfig.native.ts +++ b/clients/client-ivs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: IvsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ivs/runtimeConfig.ts b/clients/client-ivs/runtimeConfig.ts index c413171238b7..1cb76cd8d0a4 100644 --- a/clients/client-ivs/runtimeConfig.ts +++ b/clients/client-ivs/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: IvsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kafka/runtimeConfig.browser.ts b/clients/client-kafka/runtimeConfig.browser.ts index adaff51d7d38..8562d039dadb 100644 --- a/clients/client-kafka/runtimeConfig.browser.ts +++ b/clients/client-kafka/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KafkaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kafka/runtimeConfig.native.ts b/clients/client-kafka/runtimeConfig.native.ts index 386e5305795c..4bc8cfff5ce5 100644 --- a/clients/client-kafka/runtimeConfig.native.ts +++ b/clients/client-kafka/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KafkaClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kafka/runtimeConfig.ts b/clients/client-kafka/runtimeConfig.ts index 8eef6f679fd2..6b1869378053 100644 --- a/clients/client-kafka/runtimeConfig.ts +++ b/clients/client-kafka/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KafkaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kendra/runtimeConfig.browser.ts b/clients/client-kendra/runtimeConfig.browser.ts index 52b4a73c2ebb..9766e630bfe3 100644 --- a/clients/client-kendra/runtimeConfig.browser.ts +++ b/clients/client-kendra/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KendraClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kendra/runtimeConfig.native.ts b/clients/client-kendra/runtimeConfig.native.ts index de8f97859d4a..4b9896fe5183 100644 --- a/clients/client-kendra/runtimeConfig.native.ts +++ b/clients/client-kendra/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KendraClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kendra/runtimeConfig.ts b/clients/client-kendra/runtimeConfig.ts index bdac3d41173d..3016ebe9cdd5 100644 --- a/clients/client-kendra/runtimeConfig.ts +++ b/clients/client-kendra/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KendraClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts index 012de9be3812..b08ab42a0df4 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts index c131eb6cc900..192a06fd4985 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis-analytics-v2/runtimeConfig.ts b/clients/client-kinesis-analytics-v2/runtimeConfig.ts index 5e66e7a9d26c..40d682ea245c 100644 --- a/clients/client-kinesis-analytics-v2/runtimeConfig.ts +++ b/clients/client-kinesis-analytics-v2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KinesisAnalyticsV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-analytics/runtimeConfig.browser.ts b/clients/client-kinesis-analytics/runtimeConfig.browser.ts index 98135263aba7..d2c7681c79de 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.browser.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-analytics/runtimeConfig.native.ts b/clients/client-kinesis-analytics/runtimeConfig.native.ts index 779d59b499d7..a1a9c9f64514 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.native.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis-analytics/runtimeConfig.ts b/clients/client-kinesis-analytics/runtimeConfig.ts index 82c78f566a4d..22e3866cde01 100644 --- a/clients/client-kinesis-analytics/runtimeConfig.ts +++ b/clients/client-kinesis-analytics/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KinesisAnalyticsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts index 6c432c6b9cbe..46aee5b2aa1a 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts index b6f3afad2bbd..4d5e2eeb88a1 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis-video-archived-media/runtimeConfig.ts b/clients/client-kinesis-video-archived-media/runtimeConfig.ts index 84c8b09cb8af..205bce509e5d 100644 --- a/clients/client-kinesis-video-archived-media/runtimeConfig.ts +++ b/clients/client-kinesis-video-archived-media/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video-media/runtimeConfig.browser.ts b/clients/client-kinesis-video-media/runtimeConfig.browser.ts index f5fbc1b1ec57..93262a2f8885 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video-media/runtimeConfig.native.ts b/clients/client-kinesis-video-media/runtimeConfig.native.ts index b4208b04bc00..1615e63802ee 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis-video-media/runtimeConfig.ts b/clients/client-kinesis-video-media/runtimeConfig.ts index 0cd1b8c0dae2..0b7dce958c00 100644 --- a/clients/client-kinesis-video-media/runtimeConfig.ts +++ b/clients/client-kinesis-video-media/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts b/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts index 69a5a14687b3..d971cedee136 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.native.ts b/clients/client-kinesis-video-signaling/runtimeConfig.native.ts index 319816924f38..eb4303d1b422 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.native.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis-video-signaling/runtimeConfig.ts b/clients/client-kinesis-video-signaling/runtimeConfig.ts index d88c64f9b99b..d1d7f0a6cc61 100644 --- a/clients/client-kinesis-video-signaling/runtimeConfig.ts +++ b/clients/client-kinesis-video-signaling/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KinesisVideoSignalingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video/runtimeConfig.browser.ts b/clients/client-kinesis-video/runtimeConfig.browser.ts index 93ddaabb2d5c..09eb8597af36 100644 --- a/clients/client-kinesis-video/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis-video/runtimeConfig.native.ts b/clients/client-kinesis-video/runtimeConfig.native.ts index f75bdcf96a3f..4d1c87ceb345 100644 --- a/clients/client-kinesis-video/runtimeConfig.native.ts +++ b/clients/client-kinesis-video/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis-video/runtimeConfig.ts b/clients/client-kinesis-video/runtimeConfig.ts index 9fcb23352e77..c344f6e657ac 100644 --- a/clients/client-kinesis-video/runtimeConfig.ts +++ b/clients/client-kinesis-video/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KinesisVideoClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis/runtimeConfig.browser.ts b/clients/client-kinesis/runtimeConfig.browser.ts index f6451b061ed8..b36398ee67a8 100644 --- a/clients/client-kinesis/runtimeConfig.browser.ts +++ b/clients/client-kinesis/runtimeConfig.browser.ts @@ -19,6 +19,7 @@ export const getRuntimeConfig = (config: KinesisClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kinesis/runtimeConfig.native.ts b/clients/client-kinesis/runtimeConfig.native.ts index c1b4ac75be1c..ec82e232a1c6 100644 --- a/clients/client-kinesis/runtimeConfig.native.ts +++ b/clients/client-kinesis/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KinesisClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kinesis/runtimeConfig.ts b/clients/client-kinesis/runtimeConfig.ts index bf125444536c..9b0fa80fe2d1 100644 --- a/clients/client-kinesis/runtimeConfig.ts +++ b/clients/client-kinesis/runtimeConfig.ts @@ -22,6 +22,7 @@ export const getRuntimeConfig = (config: KinesisClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kms/runtimeConfig.browser.ts b/clients/client-kms/runtimeConfig.browser.ts index 5e9cd1e53625..013b4271902e 100644 --- a/clients/client-kms/runtimeConfig.browser.ts +++ b/clients/client-kms/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: KMSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-kms/runtimeConfig.native.ts b/clients/client-kms/runtimeConfig.native.ts index 4dc49db068a0..09025cc4b6b7 100644 --- a/clients/client-kms/runtimeConfig.native.ts +++ b/clients/client-kms/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: KMSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-kms/runtimeConfig.ts b/clients/client-kms/runtimeConfig.ts index 84021cb128e5..e8d4c951052e 100644 --- a/clients/client-kms/runtimeConfig.ts +++ b/clients/client-kms/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: KMSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lakeformation/runtimeConfig.browser.ts b/clients/client-lakeformation/runtimeConfig.browser.ts index eb2eb0b01a94..8117f894d2ce 100644 --- a/clients/client-lakeformation/runtimeConfig.browser.ts +++ b/clients/client-lakeformation/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lakeformation/runtimeConfig.native.ts b/clients/client-lakeformation/runtimeConfig.native.ts index 666de6800766..ee0c111f979d 100644 --- a/clients/client-lakeformation/runtimeConfig.native.ts +++ b/clients/client-lakeformation/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lakeformation/runtimeConfig.ts b/clients/client-lakeformation/runtimeConfig.ts index 31ef1a348783..dcabc19ca764 100644 --- a/clients/client-lakeformation/runtimeConfig.ts +++ b/clients/client-lakeformation/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lambda/runtimeConfig.browser.ts b/clients/client-lambda/runtimeConfig.browser.ts index d565d68ed084..bdddc7b9ca66 100644 --- a/clients/client-lambda/runtimeConfig.browser.ts +++ b/clients/client-lambda/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LambdaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lambda/runtimeConfig.native.ts b/clients/client-lambda/runtimeConfig.native.ts index 068ce95d4f57..9a1d443b8f5f 100644 --- a/clients/client-lambda/runtimeConfig.native.ts +++ b/clients/client-lambda/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LambdaClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lambda/runtimeConfig.ts b/clients/client-lambda/runtimeConfig.ts index 50aa6e7335d1..4a441ddd4d27 100644 --- a/clients/client-lambda/runtimeConfig.ts +++ b/clients/client-lambda/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LambdaClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-model-building-service/runtimeConfig.browser.ts b/clients/client-lex-model-building-service/runtimeConfig.browser.ts index 033fc0bf126d..a93051744aa0 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.browser.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-model-building-service/runtimeConfig.native.ts b/clients/client-lex-model-building-service/runtimeConfig.native.ts index 5cb29cdaf215..782012a13f58 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.native.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lex-model-building-service/runtimeConfig.ts b/clients/client-lex-model-building-service/runtimeConfig.ts index d46ba64b929b..aab767216da7 100644 --- a/clients/client-lex-model-building-service/runtimeConfig.ts +++ b/clients/client-lex-model-building-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LexModelBuildingServiceClientConfig) => const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-models-v2/runtimeConfig.browser.ts b/clients/client-lex-models-v2/runtimeConfig.browser.ts index 13070113f4fe..7a7b9d773752 100644 --- a/clients/client-lex-models-v2/runtimeConfig.browser.ts +++ b/clients/client-lex-models-v2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-models-v2/runtimeConfig.native.ts b/clients/client-lex-models-v2/runtimeConfig.native.ts index 5709cd2413da..40c02fd41fb2 100644 --- a/clients/client-lex-models-v2/runtimeConfig.native.ts +++ b/clients/client-lex-models-v2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lex-models-v2/runtimeConfig.ts b/clients/client-lex-models-v2/runtimeConfig.ts index 156018f85951..f2cbbe6d9d12 100644 --- a/clients/client-lex-models-v2/runtimeConfig.ts +++ b/clients/client-lex-models-v2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LexModelsV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-runtime-service/runtimeConfig.browser.ts b/clients/client-lex-runtime-service/runtimeConfig.browser.ts index fa946e6d4a55..53deb97ce5fc 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-runtime-service/runtimeConfig.native.ts b/clients/client-lex-runtime-service/runtimeConfig.native.ts index 2fc68aba5d96..42836d1de452 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.native.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lex-runtime-service/runtimeConfig.ts b/clients/client-lex-runtime-service/runtimeConfig.ts index 19f173d42b47..5998674c0f9d 100644 --- a/clients/client-lex-runtime-service/runtimeConfig.ts +++ b/clients/client-lex-runtime-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-runtime-v2/runtimeConfig.browser.ts b/clients/client-lex-runtime-v2/runtimeConfig.browser.ts index 4fce14bae264..8740dc76753b 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.browser.ts @@ -19,6 +19,7 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lex-runtime-v2/runtimeConfig.native.ts b/clients/client-lex-runtime-v2/runtimeConfig.native.ts index bd3b739eb0ed..7759af6b6fb2 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.native.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.native.ts @@ -10,6 +10,7 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", eventStreamPayloadHandlerProvider: config.eventStreamPayloadHandlerProvider ?? diff --git a/clients/client-lex-runtime-v2/runtimeConfig.ts b/clients/client-lex-runtime-v2/runtimeConfig.ts index c952856655e2..e295fa3332f5 100644 --- a/clients/client-lex-runtime-v2/runtimeConfig.ts +++ b/clients/client-lex-runtime-v2/runtimeConfig.ts @@ -23,6 +23,7 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-license-manager/runtimeConfig.browser.ts b/clients/client-license-manager/runtimeConfig.browser.ts index 4338716c7d43..6763167e54ab 100644 --- a/clients/client-license-manager/runtimeConfig.browser.ts +++ b/clients/client-license-manager/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-license-manager/runtimeConfig.native.ts b/clients/client-license-manager/runtimeConfig.native.ts index bda51354b66a..acbb4326de39 100644 --- a/clients/client-license-manager/runtimeConfig.native.ts +++ b/clients/client-license-manager/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-license-manager/runtimeConfig.ts b/clients/client-license-manager/runtimeConfig.ts index 05f676d3d5cf..3e15122a7bd2 100644 --- a/clients/client-license-manager/runtimeConfig.ts +++ b/clients/client-license-manager/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LicenseManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lightsail/runtimeConfig.browser.ts b/clients/client-lightsail/runtimeConfig.browser.ts index d4abdac9bda9..37dcab8839fa 100644 --- a/clients/client-lightsail/runtimeConfig.browser.ts +++ b/clients/client-lightsail/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LightsailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lightsail/runtimeConfig.native.ts b/clients/client-lightsail/runtimeConfig.native.ts index d22e9608f7c1..96fbee9722f2 100644 --- a/clients/client-lightsail/runtimeConfig.native.ts +++ b/clients/client-lightsail/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LightsailClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lightsail/runtimeConfig.ts b/clients/client-lightsail/runtimeConfig.ts index a39ded4572e7..35fcfd8d5ce0 100644 --- a/clients/client-lightsail/runtimeConfig.ts +++ b/clients/client-lightsail/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LightsailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-location/runtimeConfig.browser.ts b/clients/client-location/runtimeConfig.browser.ts index aa568adb37b9..f0f11dc436a2 100644 --- a/clients/client-location/runtimeConfig.browser.ts +++ b/clients/client-location/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LocationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-location/runtimeConfig.native.ts b/clients/client-location/runtimeConfig.native.ts index bf6581a1ce41..dc5e90f6305d 100644 --- a/clients/client-location/runtimeConfig.native.ts +++ b/clients/client-location/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LocationClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-location/runtimeConfig.ts b/clients/client-location/runtimeConfig.ts index eeed2876c2c1..0e91bf395fcb 100644 --- a/clients/client-location/runtimeConfig.ts +++ b/clients/client-location/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LocationClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lookoutequipment/runtimeConfig.browser.ts b/clients/client-lookoutequipment/runtimeConfig.browser.ts index 74add981eb0d..3bbbd3d6b076 100644 --- a/clients/client-lookoutequipment/runtimeConfig.browser.ts +++ b/clients/client-lookoutequipment/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lookoutequipment/runtimeConfig.native.ts b/clients/client-lookoutequipment/runtimeConfig.native.ts index fa758311a031..e2d82f55e76e 100644 --- a/clients/client-lookoutequipment/runtimeConfig.native.ts +++ b/clients/client-lookoutequipment/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lookoutequipment/runtimeConfig.ts b/clients/client-lookoutequipment/runtimeConfig.ts index 9c3eacbcf832..4ad2507111d8 100644 --- a/clients/client-lookoutequipment/runtimeConfig.ts +++ b/clients/client-lookoutequipment/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LookoutEquipmentClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lookoutmetrics/runtimeConfig.browser.ts b/clients/client-lookoutmetrics/runtimeConfig.browser.ts index f0e81766318f..d08d93cee7cd 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.browser.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lookoutmetrics/runtimeConfig.native.ts b/clients/client-lookoutmetrics/runtimeConfig.native.ts index 3f754d99668f..69623a0fc2c6 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.native.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lookoutmetrics/runtimeConfig.ts b/clients/client-lookoutmetrics/runtimeConfig.ts index 4bb505d3a742..4ba43e40be55 100644 --- a/clients/client-lookoutmetrics/runtimeConfig.ts +++ b/clients/client-lookoutmetrics/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LookoutMetricsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lookoutvision/runtimeConfig.browser.ts b/clients/client-lookoutvision/runtimeConfig.browser.ts index ede630012a76..189c12bae491 100644 --- a/clients/client-lookoutvision/runtimeConfig.browser.ts +++ b/clients/client-lookoutvision/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-lookoutvision/runtimeConfig.native.ts b/clients/client-lookoutvision/runtimeConfig.native.ts index 32002583ad34..21110b8630bf 100644 --- a/clients/client-lookoutvision/runtimeConfig.native.ts +++ b/clients/client-lookoutvision/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-lookoutvision/runtimeConfig.ts b/clients/client-lookoutvision/runtimeConfig.ts index 789c573146de..977aedcee071 100644 --- a/clients/client-lookoutvision/runtimeConfig.ts +++ b/clients/client-lookoutvision/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: LookoutVisionClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-machine-learning/runtimeConfig.browser.ts b/clients/client-machine-learning/runtimeConfig.browser.ts index 4700269bd2a4..6e32aca7c09e 100644 --- a/clients/client-machine-learning/runtimeConfig.browser.ts +++ b/clients/client-machine-learning/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MachineLearningClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-machine-learning/runtimeConfig.native.ts b/clients/client-machine-learning/runtimeConfig.native.ts index d6673fb6f895..6842d86b340a 100644 --- a/clients/client-machine-learning/runtimeConfig.native.ts +++ b/clients/client-machine-learning/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MachineLearningClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-machine-learning/runtimeConfig.ts b/clients/client-machine-learning/runtimeConfig.ts index 59c8044ace35..37e55ec0a929 100644 --- a/clients/client-machine-learning/runtimeConfig.ts +++ b/clients/client-machine-learning/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MachineLearningClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-macie/runtimeConfig.browser.ts b/clients/client-macie/runtimeConfig.browser.ts index 80ea8a615083..ea5222a1a9c1 100644 --- a/clients/client-macie/runtimeConfig.browser.ts +++ b/clients/client-macie/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MacieClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-macie/runtimeConfig.native.ts b/clients/client-macie/runtimeConfig.native.ts index b2e0cf8dc18c..9761cf41075f 100644 --- a/clients/client-macie/runtimeConfig.native.ts +++ b/clients/client-macie/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MacieClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-macie/runtimeConfig.ts b/clients/client-macie/runtimeConfig.ts index fe9550718dae..2d4531519f70 100644 --- a/clients/client-macie/runtimeConfig.ts +++ b/clients/client-macie/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MacieClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-macie2/runtimeConfig.browser.ts b/clients/client-macie2/runtimeConfig.browser.ts index cfc4f709a0d6..79b12691291d 100644 --- a/clients/client-macie2/runtimeConfig.browser.ts +++ b/clients/client-macie2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: Macie2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-macie2/runtimeConfig.native.ts b/clients/client-macie2/runtimeConfig.native.ts index 2fc35ac9381b..b4f8d93069ed 100644 --- a/clients/client-macie2/runtimeConfig.native.ts +++ b/clients/client-macie2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: Macie2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-macie2/runtimeConfig.ts b/clients/client-macie2/runtimeConfig.ts index 4d0fc28831a7..ee87d5c61aaa 100644 --- a/clients/client-macie2/runtimeConfig.ts +++ b/clients/client-macie2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: Macie2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-managedblockchain/runtimeConfig.browser.ts b/clients/client-managedblockchain/runtimeConfig.browser.ts index 18c269ce94cf..e0c98bff5e1f 100644 --- a/clients/client-managedblockchain/runtimeConfig.browser.ts +++ b/clients/client-managedblockchain/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-managedblockchain/runtimeConfig.native.ts b/clients/client-managedblockchain/runtimeConfig.native.ts index ca9333a714b0..8158e30ac5a0 100644 --- a/clients/client-managedblockchain/runtimeConfig.native.ts +++ b/clients/client-managedblockchain/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-managedblockchain/runtimeConfig.ts b/clients/client-managedblockchain/runtimeConfig.ts index d38f4ba011b9..6d19c044e279 100644 --- a/clients/client-managedblockchain/runtimeConfig.ts +++ b/clients/client-managedblockchain/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ManagedBlockchainClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-catalog/runtimeConfig.browser.ts b/clients/client-marketplace-catalog/runtimeConfig.browser.ts index 0997608db769..0bcb2b943157 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.browser.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-catalog/runtimeConfig.native.ts b/clients/client-marketplace-catalog/runtimeConfig.native.ts index 123677904e75..5ea89c06b7ff 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.native.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-marketplace-catalog/runtimeConfig.ts b/clients/client-marketplace-catalog/runtimeConfig.ts index 9cf794aa2b27..1ead06a0bc93 100644 --- a/clients/client-marketplace-catalog/runtimeConfig.ts +++ b/clients/client-marketplace-catalog/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MarketplaceCatalogClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts index c7c8757cc19c..a4d95a572634 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfi const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts index 8b6528944b62..9624ca81b950 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfi const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-marketplace-commerce-analytics/runtimeConfig.ts b/clients/client-marketplace-commerce-analytics/runtimeConfig.ts index b9e885ca7645..8ba61381f1b6 100644 --- a/clients/client-marketplace-commerce-analytics/runtimeConfig.ts +++ b/clients/client-marketplace-commerce-analytics/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MarketplaceCommerceAnalyticsClientConfi const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts index 4110308e5316..84ae854d1b0b 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConf const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts index 21419bebe7e3..17515cbe98c7 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConf const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-marketplace-entitlement-service/runtimeConfig.ts b/clients/client-marketplace-entitlement-service/runtimeConfig.ts index 4151534fa6ec..9ed6fadb656c 100644 --- a/clients/client-marketplace-entitlement-service/runtimeConfig.ts +++ b/clients/client-marketplace-entitlement-service/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MarketplaceEntitlementServiceClientConf const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-metering/runtimeConfig.browser.ts b/clients/client-marketplace-metering/runtimeConfig.browser.ts index 6bf2305cd942..39c81273d988 100644 --- a/clients/client-marketplace-metering/runtimeConfig.browser.ts +++ b/clients/client-marketplace-metering/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-marketplace-metering/runtimeConfig.native.ts b/clients/client-marketplace-metering/runtimeConfig.native.ts index a7cb857ad09b..8b8292bc9850 100644 --- a/clients/client-marketplace-metering/runtimeConfig.native.ts +++ b/clients/client-marketplace-metering/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-marketplace-metering/runtimeConfig.ts b/clients/client-marketplace-metering/runtimeConfig.ts index dbb5d54dca04..53e3784f9dfc 100644 --- a/clients/client-marketplace-metering/runtimeConfig.ts +++ b/clients/client-marketplace-metering/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MarketplaceMeteringClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediaconnect/runtimeConfig.browser.ts b/clients/client-mediaconnect/runtimeConfig.browser.ts index f5e420954751..19402b6da068 100644 --- a/clients/client-mediaconnect/runtimeConfig.browser.ts +++ b/clients/client-mediaconnect/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediaconnect/runtimeConfig.native.ts b/clients/client-mediaconnect/runtimeConfig.native.ts index 3c1f5fe33ecd..44cee921ec25 100644 --- a/clients/client-mediaconnect/runtimeConfig.native.ts +++ b/clients/client-mediaconnect/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaConnectClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediaconnect/runtimeConfig.ts b/clients/client-mediaconnect/runtimeConfig.ts index 7a81c2614a26..85502d8a7df7 100644 --- a/clients/client-mediaconnect/runtimeConfig.ts +++ b/clients/client-mediaconnect/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaConnectClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediaconvert/runtimeConfig.browser.ts b/clients/client-mediaconvert/runtimeConfig.browser.ts index bda05ea2741b..107cf3c18f75 100644 --- a/clients/client-mediaconvert/runtimeConfig.browser.ts +++ b/clients/client-mediaconvert/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaConvertClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediaconvert/runtimeConfig.native.ts b/clients/client-mediaconvert/runtimeConfig.native.ts index 12b5f834f04b..6a0ca580eb7d 100644 --- a/clients/client-mediaconvert/runtimeConfig.native.ts +++ b/clients/client-mediaconvert/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaConvertClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediaconvert/runtimeConfig.ts b/clients/client-mediaconvert/runtimeConfig.ts index 05ad709c93a0..cf508455f0d2 100644 --- a/clients/client-mediaconvert/runtimeConfig.ts +++ b/clients/client-mediaconvert/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaConvertClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-medialive/runtimeConfig.browser.ts b/clients/client-medialive/runtimeConfig.browser.ts index d968931bef9b..151492f6b302 100644 --- a/clients/client-medialive/runtimeConfig.browser.ts +++ b/clients/client-medialive/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-medialive/runtimeConfig.native.ts b/clients/client-medialive/runtimeConfig.native.ts index 1058d93bf5c1..ed3797f0668e 100644 --- a/clients/client-medialive/runtimeConfig.native.ts +++ b/clients/client-medialive/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-medialive/runtimeConfig.ts b/clients/client-medialive/runtimeConfig.ts index 6f65abb4f1e2..8f88dc21bf6a 100644 --- a/clients/client-medialive/runtimeConfig.ts +++ b/clients/client-medialive/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediapackage-vod/runtimeConfig.browser.ts b/clients/client-mediapackage-vod/runtimeConfig.browser.ts index 4f7dcce4dbb4..9997c3031359 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.browser.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediapackage-vod/runtimeConfig.native.ts b/clients/client-mediapackage-vod/runtimeConfig.native.ts index c0be50b57dac..490b2d171e36 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.native.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediapackage-vod/runtimeConfig.ts b/clients/client-mediapackage-vod/runtimeConfig.ts index 52251d69b89d..a604f995de56 100644 --- a/clients/client-mediapackage-vod/runtimeConfig.ts +++ b/clients/client-mediapackage-vod/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaPackageVodClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediapackage/runtimeConfig.browser.ts b/clients/client-mediapackage/runtimeConfig.browser.ts index 8e65970580fb..61666e1594aa 100644 --- a/clients/client-mediapackage/runtimeConfig.browser.ts +++ b/clients/client-mediapackage/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaPackageClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediapackage/runtimeConfig.native.ts b/clients/client-mediapackage/runtimeConfig.native.ts index 6cf299daa526..94a68712a298 100644 --- a/clients/client-mediapackage/runtimeConfig.native.ts +++ b/clients/client-mediapackage/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaPackageClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediapackage/runtimeConfig.ts b/clients/client-mediapackage/runtimeConfig.ts index 50155d71f7da..f09912607eeb 100644 --- a/clients/client-mediapackage/runtimeConfig.ts +++ b/clients/client-mediapackage/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaPackageClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediastore-data/runtimeConfig.browser.ts b/clients/client-mediastore-data/runtimeConfig.browser.ts index e72709e87ca1..ed1b7db9f593 100644 --- a/clients/client-mediastore-data/runtimeConfig.browser.ts +++ b/clients/client-mediastore-data/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediastore-data/runtimeConfig.native.ts b/clients/client-mediastore-data/runtimeConfig.native.ts index 7693357b511a..2bf097d28c53 100644 --- a/clients/client-mediastore-data/runtimeConfig.native.ts +++ b/clients/client-mediastore-data/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediastore-data/runtimeConfig.ts b/clients/client-mediastore-data/runtimeConfig.ts index a9443fff210a..5507b7676a35 100644 --- a/clients/client-mediastore-data/runtimeConfig.ts +++ b/clients/client-mediastore-data/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediastore/runtimeConfig.browser.ts b/clients/client-mediastore/runtimeConfig.browser.ts index 4b7cdaacdc43..558513a13441 100644 --- a/clients/client-mediastore/runtimeConfig.browser.ts +++ b/clients/client-mediastore/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaStoreClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediastore/runtimeConfig.native.ts b/clients/client-mediastore/runtimeConfig.native.ts index dc283a2c28e2..625cca134c51 100644 --- a/clients/client-mediastore/runtimeConfig.native.ts +++ b/clients/client-mediastore/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaStoreClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediastore/runtimeConfig.ts b/clients/client-mediastore/runtimeConfig.ts index 6325f63ef7a1..4456eb58d932 100644 --- a/clients/client-mediastore/runtimeConfig.ts +++ b/clients/client-mediastore/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaStoreClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediatailor/runtimeConfig.browser.ts b/clients/client-mediatailor/runtimeConfig.browser.ts index 228fcd9ece7e..61a02ef6e9bd 100644 --- a/clients/client-mediatailor/runtimeConfig.browser.ts +++ b/clients/client-mediatailor/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MediaTailorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mediatailor/runtimeConfig.native.ts b/clients/client-mediatailor/runtimeConfig.native.ts index 49522ca7f95d..e905f01da136 100644 --- a/clients/client-mediatailor/runtimeConfig.native.ts +++ b/clients/client-mediatailor/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MediaTailorClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mediatailor/runtimeConfig.ts b/clients/client-mediatailor/runtimeConfig.ts index ba98168a1938..32c22c1102d4 100644 --- a/clients/client-mediatailor/runtimeConfig.ts +++ b/clients/client-mediatailor/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MediaTailorClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mgn/runtimeConfig.browser.ts b/clients/client-mgn/runtimeConfig.browser.ts index af22c936e7c2..1921effa74ad 100644 --- a/clients/client-mgn/runtimeConfig.browser.ts +++ b/clients/client-mgn/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MgnClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mgn/runtimeConfig.native.ts b/clients/client-mgn/runtimeConfig.native.ts index 3637313f7063..d9a33dfdd418 100644 --- a/clients/client-mgn/runtimeConfig.native.ts +++ b/clients/client-mgn/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MgnClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mgn/runtimeConfig.ts b/clients/client-mgn/runtimeConfig.ts index 3299fe1cbe48..040761f9e4bd 100644 --- a/clients/client-mgn/runtimeConfig.ts +++ b/clients/client-mgn/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MgnClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-migration-hub/runtimeConfig.browser.ts b/clients/client-migration-hub/runtimeConfig.browser.ts index a9fe13486347..835fbcbd717e 100644 --- a/clients/client-migration-hub/runtimeConfig.browser.ts +++ b/clients/client-migration-hub/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MigrationHubClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-migration-hub/runtimeConfig.native.ts b/clients/client-migration-hub/runtimeConfig.native.ts index 4cfd771c0d6c..534225442de1 100644 --- a/clients/client-migration-hub/runtimeConfig.native.ts +++ b/clients/client-migration-hub/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MigrationHubClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-migration-hub/runtimeConfig.ts b/clients/client-migration-hub/runtimeConfig.ts index 820b6544d5e8..082480789a99 100644 --- a/clients/client-migration-hub/runtimeConfig.ts +++ b/clients/client-migration-hub/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MigrationHubClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-migrationhub-config/runtimeConfig.browser.ts b/clients/client-migrationhub-config/runtimeConfig.browser.ts index 55ec9b506f6c..e8c24b1b5d89 100644 --- a/clients/client-migrationhub-config/runtimeConfig.browser.ts +++ b/clients/client-migrationhub-config/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-migrationhub-config/runtimeConfig.native.ts b/clients/client-migrationhub-config/runtimeConfig.native.ts index 5ba5d70b74ef..0e0edc48a431 100644 --- a/clients/client-migrationhub-config/runtimeConfig.native.ts +++ b/clients/client-migrationhub-config/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-migrationhub-config/runtimeConfig.ts b/clients/client-migrationhub-config/runtimeConfig.ts index 4f59f538b990..2285946facc0 100644 --- a/clients/client-migrationhub-config/runtimeConfig.ts +++ b/clients/client-migrationhub-config/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MigrationHubConfigClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mobile/runtimeConfig.browser.ts b/clients/client-mobile/runtimeConfig.browser.ts index 7835ffe8c011..281b5d2c10c4 100644 --- a/clients/client-mobile/runtimeConfig.browser.ts +++ b/clients/client-mobile/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MobileClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mobile/runtimeConfig.native.ts b/clients/client-mobile/runtimeConfig.native.ts index e1580f4a5bd3..7b8cbccb335c 100644 --- a/clients/client-mobile/runtimeConfig.native.ts +++ b/clients/client-mobile/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MobileClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mobile/runtimeConfig.ts b/clients/client-mobile/runtimeConfig.ts index 5aed0aa81dda..c7ccd8a84f43 100644 --- a/clients/client-mobile/runtimeConfig.ts +++ b/clients/client-mobile/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MobileClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mq/runtimeConfig.browser.ts b/clients/client-mq/runtimeConfig.browser.ts index 114fd9a69ca8..640f70497094 100644 --- a/clients/client-mq/runtimeConfig.browser.ts +++ b/clients/client-mq/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MqClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mq/runtimeConfig.native.ts b/clients/client-mq/runtimeConfig.native.ts index 94db10392a7f..c073bd049201 100644 --- a/clients/client-mq/runtimeConfig.native.ts +++ b/clients/client-mq/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MqClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mq/runtimeConfig.ts b/clients/client-mq/runtimeConfig.ts index 024a66c3a3ab..07c8df455819 100644 --- a/clients/client-mq/runtimeConfig.ts +++ b/clients/client-mq/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MqClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mturk/runtimeConfig.browser.ts b/clients/client-mturk/runtimeConfig.browser.ts index 623cb67bbdc8..02327dfb9ac3 100644 --- a/clients/client-mturk/runtimeConfig.browser.ts +++ b/clients/client-mturk/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MTurkClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mturk/runtimeConfig.native.ts b/clients/client-mturk/runtimeConfig.native.ts index 92ab9d313184..c2bf64607e5a 100644 --- a/clients/client-mturk/runtimeConfig.native.ts +++ b/clients/client-mturk/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MTurkClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mturk/runtimeConfig.ts b/clients/client-mturk/runtimeConfig.ts index 090fb22b5598..c6e6c34b1f9f 100644 --- a/clients/client-mturk/runtimeConfig.ts +++ b/clients/client-mturk/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MTurkClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mwaa/runtimeConfig.browser.ts b/clients/client-mwaa/runtimeConfig.browser.ts index 9e01bf68450c..b4b4a813be58 100644 --- a/clients/client-mwaa/runtimeConfig.browser.ts +++ b/clients/client-mwaa/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: MWAAClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-mwaa/runtimeConfig.native.ts b/clients/client-mwaa/runtimeConfig.native.ts index 50f9a66db5ab..f41c59335acf 100644 --- a/clients/client-mwaa/runtimeConfig.native.ts +++ b/clients/client-mwaa/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: MWAAClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-mwaa/runtimeConfig.ts b/clients/client-mwaa/runtimeConfig.ts index c8c281611d1d..0f275cd30db4 100644 --- a/clients/client-mwaa/runtimeConfig.ts +++ b/clients/client-mwaa/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: MWAAClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-neptune/runtimeConfig.browser.ts b/clients/client-neptune/runtimeConfig.browser.ts index 4dd19dbcceee..3b4611c71b7b 100644 --- a/clients/client-neptune/runtimeConfig.browser.ts +++ b/clients/client-neptune/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: NeptuneClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-neptune/runtimeConfig.native.ts b/clients/client-neptune/runtimeConfig.native.ts index a57f6a1ec2a2..ffaa9958be08 100644 --- a/clients/client-neptune/runtimeConfig.native.ts +++ b/clients/client-neptune/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: NeptuneClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-neptune/runtimeConfig.ts b/clients/client-neptune/runtimeConfig.ts index 34e1481a1c99..73a338068500 100644 --- a/clients/client-neptune/runtimeConfig.ts +++ b/clients/client-neptune/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: NeptuneClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-network-firewall/runtimeConfig.browser.ts b/clients/client-network-firewall/runtimeConfig.browser.ts index 5b3e345bf22b..731fe5ea01d2 100644 --- a/clients/client-network-firewall/runtimeConfig.browser.ts +++ b/clients/client-network-firewall/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-network-firewall/runtimeConfig.native.ts b/clients/client-network-firewall/runtimeConfig.native.ts index e2aa538bc36f..5eb62f50bade 100644 --- a/clients/client-network-firewall/runtimeConfig.native.ts +++ b/clients/client-network-firewall/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-network-firewall/runtimeConfig.ts b/clients/client-network-firewall/runtimeConfig.ts index 8a72ab60f70f..97c73bca9368 100644 --- a/clients/client-network-firewall/runtimeConfig.ts +++ b/clients/client-network-firewall/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: NetworkFirewallClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-networkmanager/runtimeConfig.browser.ts b/clients/client-networkmanager/runtimeConfig.browser.ts index 0c4389d14de0..6220eb0e58f4 100644 --- a/clients/client-networkmanager/runtimeConfig.browser.ts +++ b/clients/client-networkmanager/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-networkmanager/runtimeConfig.native.ts b/clients/client-networkmanager/runtimeConfig.native.ts index fbf849c13917..d3d5afd733ac 100644 --- a/clients/client-networkmanager/runtimeConfig.native.ts +++ b/clients/client-networkmanager/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-networkmanager/runtimeConfig.ts b/clients/client-networkmanager/runtimeConfig.ts index 432282e92d04..2f9de3c71338 100644 --- a/clients/client-networkmanager/runtimeConfig.ts +++ b/clients/client-networkmanager/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: NetworkManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-nimble/runtimeConfig.browser.ts b/clients/client-nimble/runtimeConfig.browser.ts index 3edadab78af5..20d31010fea9 100644 --- a/clients/client-nimble/runtimeConfig.browser.ts +++ b/clients/client-nimble/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: NimbleClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-nimble/runtimeConfig.native.ts b/clients/client-nimble/runtimeConfig.native.ts index 9924d221b642..46f0102fb9d3 100644 --- a/clients/client-nimble/runtimeConfig.native.ts +++ b/clients/client-nimble/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: NimbleClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-nimble/runtimeConfig.ts b/clients/client-nimble/runtimeConfig.ts index 4591a51e6a33..d24fde95d29f 100644 --- a/clients/client-nimble/runtimeConfig.ts +++ b/clients/client-nimble/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: NimbleClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-opsworks/runtimeConfig.browser.ts b/clients/client-opsworks/runtimeConfig.browser.ts index a29b44085408..d7c4314b39d4 100644 --- a/clients/client-opsworks/runtimeConfig.browser.ts +++ b/clients/client-opsworks/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: OpsWorksClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-opsworks/runtimeConfig.native.ts b/clients/client-opsworks/runtimeConfig.native.ts index 398257d03f1b..b84b319fa24c 100644 --- a/clients/client-opsworks/runtimeConfig.native.ts +++ b/clients/client-opsworks/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: OpsWorksClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-opsworks/runtimeConfig.ts b/clients/client-opsworks/runtimeConfig.ts index 9b4bc0de2938..836460b070dc 100644 --- a/clients/client-opsworks/runtimeConfig.ts +++ b/clients/client-opsworks/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: OpsWorksClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-opsworkscm/runtimeConfig.browser.ts b/clients/client-opsworkscm/runtimeConfig.browser.ts index 0b93ad83dc66..e595c5e481e9 100644 --- a/clients/client-opsworkscm/runtimeConfig.browser.ts +++ b/clients/client-opsworkscm/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-opsworkscm/runtimeConfig.native.ts b/clients/client-opsworkscm/runtimeConfig.native.ts index ce26b10b44b8..ac409b3308ad 100644 --- a/clients/client-opsworkscm/runtimeConfig.native.ts +++ b/clients/client-opsworkscm/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-opsworkscm/runtimeConfig.ts b/clients/client-opsworkscm/runtimeConfig.ts index 8775c2072496..6322764bddfc 100644 --- a/clients/client-opsworkscm/runtimeConfig.ts +++ b/clients/client-opsworkscm/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: OpsWorksCMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-organizations/runtimeConfig.browser.ts b/clients/client-organizations/runtimeConfig.browser.ts index ceebf16cc519..218f2233d5f3 100644 --- a/clients/client-organizations/runtimeConfig.browser.ts +++ b/clients/client-organizations/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: OrganizationsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-organizations/runtimeConfig.native.ts b/clients/client-organizations/runtimeConfig.native.ts index cc354aaefc56..01164331286a 100644 --- a/clients/client-organizations/runtimeConfig.native.ts +++ b/clients/client-organizations/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: OrganizationsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-organizations/runtimeConfig.ts b/clients/client-organizations/runtimeConfig.ts index 31e0dba0ff0b..c886d004212b 100644 --- a/clients/client-organizations/runtimeConfig.ts +++ b/clients/client-organizations/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: OrganizationsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-outposts/runtimeConfig.browser.ts b/clients/client-outposts/runtimeConfig.browser.ts index 71fb1d38b857..0ee3943f45d1 100644 --- a/clients/client-outposts/runtimeConfig.browser.ts +++ b/clients/client-outposts/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: OutpostsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-outposts/runtimeConfig.native.ts b/clients/client-outposts/runtimeConfig.native.ts index a71d28378fc5..189f77bfff41 100644 --- a/clients/client-outposts/runtimeConfig.native.ts +++ b/clients/client-outposts/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: OutpostsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-outposts/runtimeConfig.ts b/clients/client-outposts/runtimeConfig.ts index 56b7c5443ea6..f3876a186ce6 100644 --- a/clients/client-outposts/runtimeConfig.ts +++ b/clients/client-outposts/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: OutpostsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-personalize-events/runtimeConfig.browser.ts b/clients/client-personalize-events/runtimeConfig.browser.ts index 805326fa8fdc..2c00c395711d 100644 --- a/clients/client-personalize-events/runtimeConfig.browser.ts +++ b/clients/client-personalize-events/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-personalize-events/runtimeConfig.native.ts b/clients/client-personalize-events/runtimeConfig.native.ts index 23953cabe172..47f42cf255b0 100644 --- a/clients/client-personalize-events/runtimeConfig.native.ts +++ b/clients/client-personalize-events/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-personalize-events/runtimeConfig.ts b/clients/client-personalize-events/runtimeConfig.ts index 094590baa564..d456e8689dc8 100644 --- a/clients/client-personalize-events/runtimeConfig.ts +++ b/clients/client-personalize-events/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PersonalizeEventsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-personalize-runtime/runtimeConfig.browser.ts b/clients/client-personalize-runtime/runtimeConfig.browser.ts index 3ac83afab8e3..167bf2b8893d 100644 --- a/clients/client-personalize-runtime/runtimeConfig.browser.ts +++ b/clients/client-personalize-runtime/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-personalize-runtime/runtimeConfig.native.ts b/clients/client-personalize-runtime/runtimeConfig.native.ts index 970d3989b14a..1f4b4c4bbfc5 100644 --- a/clients/client-personalize-runtime/runtimeConfig.native.ts +++ b/clients/client-personalize-runtime/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-personalize-runtime/runtimeConfig.ts b/clients/client-personalize-runtime/runtimeConfig.ts index 009c93a3ff08..7718eef303d6 100644 --- a/clients/client-personalize-runtime/runtimeConfig.ts +++ b/clients/client-personalize-runtime/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-personalize/runtimeConfig.browser.ts b/clients/client-personalize/runtimeConfig.browser.ts index c0283e9c7df6..fc31eb0d8fad 100644 --- a/clients/client-personalize/runtimeConfig.browser.ts +++ b/clients/client-personalize/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PersonalizeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-personalize/runtimeConfig.native.ts b/clients/client-personalize/runtimeConfig.native.ts index ad38344a46fb..06612f2451a2 100644 --- a/clients/client-personalize/runtimeConfig.native.ts +++ b/clients/client-personalize/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PersonalizeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-personalize/runtimeConfig.ts b/clients/client-personalize/runtimeConfig.ts index d3d6a246c069..d604bc4bf093 100644 --- a/clients/client-personalize/runtimeConfig.ts +++ b/clients/client-personalize/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PersonalizeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pi/runtimeConfig.browser.ts b/clients/client-pi/runtimeConfig.browser.ts index fb579d40154c..351296bae3c3 100644 --- a/clients/client-pi/runtimeConfig.browser.ts +++ b/clients/client-pi/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PIClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pi/runtimeConfig.native.ts b/clients/client-pi/runtimeConfig.native.ts index 9d6147b0e952..67d833bbce28 100644 --- a/clients/client-pi/runtimeConfig.native.ts +++ b/clients/client-pi/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PIClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-pi/runtimeConfig.ts b/clients/client-pi/runtimeConfig.ts index 11b550e290ba..ac2c888420ad 100644 --- a/clients/client-pi/runtimeConfig.ts +++ b/clients/client-pi/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PIClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pinpoint-email/runtimeConfig.browser.ts b/clients/client-pinpoint-email/runtimeConfig.browser.ts index fedf5201ca20..9684a001f3d4 100644 --- a/clients/client-pinpoint-email/runtimeConfig.browser.ts +++ b/clients/client-pinpoint-email/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pinpoint-email/runtimeConfig.native.ts b/clients/client-pinpoint-email/runtimeConfig.native.ts index ae4e4ae823a4..50979281f95f 100644 --- a/clients/client-pinpoint-email/runtimeConfig.native.ts +++ b/clients/client-pinpoint-email/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-pinpoint-email/runtimeConfig.ts b/clients/client-pinpoint-email/runtimeConfig.ts index dffeb68a9fa9..112d60241489 100644 --- a/clients/client-pinpoint-email/runtimeConfig.ts +++ b/clients/client-pinpoint-email/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PinpointEmailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts index a1a4a0cd1ee0..a1bf560e646a 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts index b5c1e7ebd780..9e470ca4d3c8 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-pinpoint-sms-voice/runtimeConfig.ts b/clients/client-pinpoint-sms-voice/runtimeConfig.ts index d2f8f8d1858c..32c18fd5e2a4 100644 --- a/clients/client-pinpoint-sms-voice/runtimeConfig.ts +++ b/clients/client-pinpoint-sms-voice/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PinpointSMSVoiceClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pinpoint/runtimeConfig.browser.ts b/clients/client-pinpoint/runtimeConfig.browser.ts index 6a00541adb7e..d2be1d445d59 100644 --- a/clients/client-pinpoint/runtimeConfig.browser.ts +++ b/clients/client-pinpoint/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PinpointClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pinpoint/runtimeConfig.native.ts b/clients/client-pinpoint/runtimeConfig.native.ts index 36887aedff5a..eda3832734d6 100644 --- a/clients/client-pinpoint/runtimeConfig.native.ts +++ b/clients/client-pinpoint/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PinpointClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-pinpoint/runtimeConfig.ts b/clients/client-pinpoint/runtimeConfig.ts index f1b369469fdd..f1bcc4b5bfdb 100644 --- a/clients/client-pinpoint/runtimeConfig.ts +++ b/clients/client-pinpoint/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PinpointClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-polly/runtimeConfig.browser.ts b/clients/client-polly/runtimeConfig.browser.ts index 67b251451301..19f7ac9fdd02 100644 --- a/clients/client-polly/runtimeConfig.browser.ts +++ b/clients/client-polly/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-polly/runtimeConfig.native.ts b/clients/client-polly/runtimeConfig.native.ts index fa24a372671c..395e99222592 100644 --- a/clients/client-polly/runtimeConfig.native.ts +++ b/clients/client-polly/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-polly/runtimeConfig.ts b/clients/client-polly/runtimeConfig.ts index a914d91fec8d..cd32462fffe6 100644 --- a/clients/client-polly/runtimeConfig.ts +++ b/clients/client-polly/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pricing/runtimeConfig.browser.ts b/clients/client-pricing/runtimeConfig.browser.ts index 839647f20d2e..18fd15dfc0c8 100644 --- a/clients/client-pricing/runtimeConfig.browser.ts +++ b/clients/client-pricing/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: PricingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-pricing/runtimeConfig.native.ts b/clients/client-pricing/runtimeConfig.native.ts index 78921837f11f..05f7637bebee 100644 --- a/clients/client-pricing/runtimeConfig.native.ts +++ b/clients/client-pricing/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: PricingClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-pricing/runtimeConfig.ts b/clients/client-pricing/runtimeConfig.ts index d677f5f4a320..e7743a2121c3 100644 --- a/clients/client-pricing/runtimeConfig.ts +++ b/clients/client-pricing/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: PricingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-proton/runtimeConfig.browser.ts b/clients/client-proton/runtimeConfig.browser.ts index ebf1f47ce871..ba0589bfb3f9 100644 --- a/clients/client-proton/runtimeConfig.browser.ts +++ b/clients/client-proton/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ProtonClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-proton/runtimeConfig.native.ts b/clients/client-proton/runtimeConfig.native.ts index acf001c36ae9..03c2a0d10e09 100644 --- a/clients/client-proton/runtimeConfig.native.ts +++ b/clients/client-proton/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ProtonClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-proton/runtimeConfig.ts b/clients/client-proton/runtimeConfig.ts index 5cc4bcd6af6d..b8c0f5fb0878 100644 --- a/clients/client-proton/runtimeConfig.ts +++ b/clients/client-proton/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ProtonClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-qldb-session/runtimeConfig.browser.ts b/clients/client-qldb-session/runtimeConfig.browser.ts index 00861c48e689..e82588999a3d 100644 --- a/clients/client-qldb-session/runtimeConfig.browser.ts +++ b/clients/client-qldb-session/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-qldb-session/runtimeConfig.native.ts b/clients/client-qldb-session/runtimeConfig.native.ts index a44c6c4121cc..9350e29fa5b8 100644 --- a/clients/client-qldb-session/runtimeConfig.native.ts +++ b/clients/client-qldb-session/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-qldb-session/runtimeConfig.ts b/clients/client-qldb-session/runtimeConfig.ts index c96f108bdcb0..86aa73861a51 100644 --- a/clients/client-qldb-session/runtimeConfig.ts +++ b/clients/client-qldb-session/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: QLDBSessionClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-qldb/runtimeConfig.browser.ts b/clients/client-qldb/runtimeConfig.browser.ts index 4bff1490e1f0..5a49dff4f3ea 100644 --- a/clients/client-qldb/runtimeConfig.browser.ts +++ b/clients/client-qldb/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: QLDBClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-qldb/runtimeConfig.native.ts b/clients/client-qldb/runtimeConfig.native.ts index a1c69a276eb5..e209ac561cef 100644 --- a/clients/client-qldb/runtimeConfig.native.ts +++ b/clients/client-qldb/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: QLDBClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-qldb/runtimeConfig.ts b/clients/client-qldb/runtimeConfig.ts index 4885571e663a..b4cc80ff4ba7 100644 --- a/clients/client-qldb/runtimeConfig.ts +++ b/clients/client-qldb/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: QLDBClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-quicksight/runtimeConfig.browser.ts b/clients/client-quicksight/runtimeConfig.browser.ts index b5bef039d97b..f4434420efe6 100644 --- a/clients/client-quicksight/runtimeConfig.browser.ts +++ b/clients/client-quicksight/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: QuickSightClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-quicksight/runtimeConfig.native.ts b/clients/client-quicksight/runtimeConfig.native.ts index a4e260b60406..263cc4b0a765 100644 --- a/clients/client-quicksight/runtimeConfig.native.ts +++ b/clients/client-quicksight/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: QuickSightClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-quicksight/runtimeConfig.ts b/clients/client-quicksight/runtimeConfig.ts index 5fc211137a1a..3f72f66b4f0a 100644 --- a/clients/client-quicksight/runtimeConfig.ts +++ b/clients/client-quicksight/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: QuickSightClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ram/runtimeConfig.browser.ts b/clients/client-ram/runtimeConfig.browser.ts index afaad4cfa3c4..d5aaad456d73 100644 --- a/clients/client-ram/runtimeConfig.browser.ts +++ b/clients/client-ram/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RAMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ram/runtimeConfig.native.ts b/clients/client-ram/runtimeConfig.native.ts index 2a2884a3e327..6d7410c768ff 100644 --- a/clients/client-ram/runtimeConfig.native.ts +++ b/clients/client-ram/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RAMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ram/runtimeConfig.ts b/clients/client-ram/runtimeConfig.ts index 7e2843fa6b57..0c78f4316853 100644 --- a/clients/client-ram/runtimeConfig.ts +++ b/clients/client-ram/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RAMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-rds-data/runtimeConfig.browser.ts b/clients/client-rds-data/runtimeConfig.browser.ts index c9eb07fab559..c9bd710c7c61 100644 --- a/clients/client-rds-data/runtimeConfig.browser.ts +++ b/clients/client-rds-data/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RDSDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-rds-data/runtimeConfig.native.ts b/clients/client-rds-data/runtimeConfig.native.ts index d23027f09cd3..0593e91f5f9d 100644 --- a/clients/client-rds-data/runtimeConfig.native.ts +++ b/clients/client-rds-data/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RDSDataClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-rds-data/runtimeConfig.ts b/clients/client-rds-data/runtimeConfig.ts index 12b90ee7d3ec..d97464df5cc4 100644 --- a/clients/client-rds-data/runtimeConfig.ts +++ b/clients/client-rds-data/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RDSDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-rds/runtimeConfig.browser.ts b/clients/client-rds/runtimeConfig.browser.ts index c9548e8db2e8..5794fb811b9f 100644 --- a/clients/client-rds/runtimeConfig.browser.ts +++ b/clients/client-rds/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-rds/runtimeConfig.native.ts b/clients/client-rds/runtimeConfig.native.ts index c930926ad42e..8e3bad2acf80 100644 --- a/clients/client-rds/runtimeConfig.native.ts +++ b/clients/client-rds/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-rds/runtimeConfig.ts b/clients/client-rds/runtimeConfig.ts index df44d7066509..845e8a9725ec 100644 --- a/clients/client-rds/runtimeConfig.ts +++ b/clients/client-rds/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-redshift-data/runtimeConfig.browser.ts b/clients/client-redshift-data/runtimeConfig.browser.ts index 03b6b8c512ca..aad32b59e691 100644 --- a/clients/client-redshift-data/runtimeConfig.browser.ts +++ b/clients/client-redshift-data/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-redshift-data/runtimeConfig.native.ts b/clients/client-redshift-data/runtimeConfig.native.ts index 9432cc08026b..0e9e3e117175 100644 --- a/clients/client-redshift-data/runtimeConfig.native.ts +++ b/clients/client-redshift-data/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-redshift-data/runtimeConfig.ts b/clients/client-redshift-data/runtimeConfig.ts index a266ae22e33a..ea4573050a6b 100644 --- a/clients/client-redshift-data/runtimeConfig.ts +++ b/clients/client-redshift-data/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RedshiftDataClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-redshift/runtimeConfig.browser.ts b/clients/client-redshift/runtimeConfig.browser.ts index 744f84174cc3..f3c52c63b072 100644 --- a/clients/client-redshift/runtimeConfig.browser.ts +++ b/clients/client-redshift/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RedshiftClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-redshift/runtimeConfig.native.ts b/clients/client-redshift/runtimeConfig.native.ts index 71c1aff64ef2..29360a336d15 100644 --- a/clients/client-redshift/runtimeConfig.native.ts +++ b/clients/client-redshift/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RedshiftClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-redshift/runtimeConfig.ts b/clients/client-redshift/runtimeConfig.ts index 8355360e0625..6ce05fae7658 100644 --- a/clients/client-redshift/runtimeConfig.ts +++ b/clients/client-redshift/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RedshiftClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-rekognition/runtimeConfig.browser.ts b/clients/client-rekognition/runtimeConfig.browser.ts index f45a649fe17b..cf2cef7850d5 100644 --- a/clients/client-rekognition/runtimeConfig.browser.ts +++ b/clients/client-rekognition/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RekognitionClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-rekognition/runtimeConfig.native.ts b/clients/client-rekognition/runtimeConfig.native.ts index fd19fde869f9..090454466fdd 100644 --- a/clients/client-rekognition/runtimeConfig.native.ts +++ b/clients/client-rekognition/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RekognitionClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-rekognition/runtimeConfig.ts b/clients/client-rekognition/runtimeConfig.ts index 07e718653551..e8ff60537d6c 100644 --- a/clients/client-rekognition/runtimeConfig.ts +++ b/clients/client-rekognition/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RekognitionClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts index dbd9763efea3..ef408a052008 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) = const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts index 63b6fee7525b..efc10fd63894 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) = const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-resource-groups-tagging-api/runtimeConfig.ts b/clients/client-resource-groups-tagging-api/runtimeConfig.ts index 844cee839595..661f203d54bb 100644 --- a/clients/client-resource-groups-tagging-api/runtimeConfig.ts +++ b/clients/client-resource-groups-tagging-api/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ResourceGroupsTaggingAPIClientConfig) = const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-resource-groups/runtimeConfig.browser.ts b/clients/client-resource-groups/runtimeConfig.browser.ts index de5c20dd8e04..49050b01b2ff 100644 --- a/clients/client-resource-groups/runtimeConfig.browser.ts +++ b/clients/client-resource-groups/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-resource-groups/runtimeConfig.native.ts b/clients/client-resource-groups/runtimeConfig.native.ts index f4262dc56358..95a2df4f6dd0 100644 --- a/clients/client-resource-groups/runtimeConfig.native.ts +++ b/clients/client-resource-groups/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-resource-groups/runtimeConfig.ts b/clients/client-resource-groups/runtimeConfig.ts index 8ad8425dd225..cd1df6cef423 100644 --- a/clients/client-resource-groups/runtimeConfig.ts +++ b/clients/client-resource-groups/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ResourceGroupsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-robomaker/runtimeConfig.browser.ts b/clients/client-robomaker/runtimeConfig.browser.ts index f833a3c7b0f7..8d4fa5411e75 100644 --- a/clients/client-robomaker/runtimeConfig.browser.ts +++ b/clients/client-robomaker/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RoboMakerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-robomaker/runtimeConfig.native.ts b/clients/client-robomaker/runtimeConfig.native.ts index 0e0646e9542c..b2922309b48f 100644 --- a/clients/client-robomaker/runtimeConfig.native.ts +++ b/clients/client-robomaker/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RoboMakerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-robomaker/runtimeConfig.ts b/clients/client-robomaker/runtimeConfig.ts index d592d717c4ae..5b7a0824ccf6 100644 --- a/clients/client-robomaker/runtimeConfig.ts +++ b/clients/client-robomaker/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: RoboMakerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-route-53-domains/runtimeConfig.browser.ts b/clients/client-route-53-domains/runtimeConfig.browser.ts index 606ee7ac2e16..00d1003aa27e 100644 --- a/clients/client-route-53-domains/runtimeConfig.browser.ts +++ b/clients/client-route-53-domains/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-route-53-domains/runtimeConfig.native.ts b/clients/client-route-53-domains/runtimeConfig.native.ts index aaf795bb4fb9..cc2c631e6cab 100644 --- a/clients/client-route-53-domains/runtimeConfig.native.ts +++ b/clients/client-route-53-domains/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-route-53-domains/runtimeConfig.ts b/clients/client-route-53-domains/runtimeConfig.ts index 01af7a7ba392..12173951ff87 100644 --- a/clients/client-route-53-domains/runtimeConfig.ts +++ b/clients/client-route-53-domains/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: Route53DomainsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-route-53/runtimeConfig.browser.ts b/clients/client-route-53/runtimeConfig.browser.ts index 015fe85a5dc3..4e673774835e 100644 --- a/clients/client-route-53/runtimeConfig.browser.ts +++ b/clients/client-route-53/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: Route53ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-route-53/runtimeConfig.native.ts b/clients/client-route-53/runtimeConfig.native.ts index b494702cfa89..2f411d9bdca3 100644 --- a/clients/client-route-53/runtimeConfig.native.ts +++ b/clients/client-route-53/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: Route53ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-route-53/runtimeConfig.ts b/clients/client-route-53/runtimeConfig.ts index e4865992e51a..09ff09787221 100644 --- a/clients/client-route-53/runtimeConfig.ts +++ b/clients/client-route-53/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: Route53ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-route53resolver/runtimeConfig.browser.ts b/clients/client-route53resolver/runtimeConfig.browser.ts index abe4bf378dd1..932d043f932c 100644 --- a/clients/client-route53resolver/runtimeConfig.browser.ts +++ b/clients/client-route53resolver/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-route53resolver/runtimeConfig.native.ts b/clients/client-route53resolver/runtimeConfig.native.ts index ef7fe6dcd34d..76c79bb74043 100644 --- a/clients/client-route53resolver/runtimeConfig.native.ts +++ b/clients/client-route53resolver/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-route53resolver/runtimeConfig.ts b/clients/client-route53resolver/runtimeConfig.ts index 43b8a123642a..1629690442e0 100644 --- a/clients/client-route53resolver/runtimeConfig.ts +++ b/clients/client-route53resolver/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: Route53ResolverClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-s3-control/runtimeConfig.browser.ts b/clients/client-s3-control/runtimeConfig.browser.ts index a0e26f34412d..0b53a9558a0d 100644 --- a/clients/client-s3-control/runtimeConfig.browser.ts +++ b/clients/client-s3-control/runtimeConfig.browser.ts @@ -20,6 +20,7 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-s3-control/runtimeConfig.native.ts b/clients/client-s3-control/runtimeConfig.native.ts index 9a8b4135c55f..973ea862230b 100644 --- a/clients/client-s3-control/runtimeConfig.native.ts +++ b/clients/client-s3-control/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-s3-control/runtimeConfig.ts b/clients/client-s3-control/runtimeConfig.ts index 78c9d8f27f4b..7d7a8260e28e 100644 --- a/clients/client-s3-control/runtimeConfig.ts +++ b/clients/client-s3-control/runtimeConfig.ts @@ -23,6 +23,7 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-s3/runtimeConfig.browser.ts b/clients/client-s3/runtimeConfig.browser.ts index 668341bc3ec9..57ec0e655ffd 100644 --- a/clients/client-s3/runtimeConfig.browser.ts +++ b/clients/client-s3/runtimeConfig.browser.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-s3/runtimeConfig.native.ts b/clients/client-s3/runtimeConfig.native.ts index b38d48466e14..26979d09e809 100644 --- a/clients/client-s3/runtimeConfig.native.ts +++ b/clients/client-s3/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-s3/runtimeConfig.ts b/clients/client-s3/runtimeConfig.ts index 1a368ecfb515..3b9f08531129 100644 --- a/clients/client-s3/runtimeConfig.ts +++ b/clients/client-s3/runtimeConfig.ts @@ -25,6 +25,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-s3outposts/runtimeConfig.browser.ts b/clients/client-s3outposts/runtimeConfig.browser.ts index c075ba67897a..c47019c8f644 100644 --- a/clients/client-s3outposts/runtimeConfig.browser.ts +++ b/clients/client-s3outposts/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-s3outposts/runtimeConfig.native.ts b/clients/client-s3outposts/runtimeConfig.native.ts index bb9446cf50ff..acc637dc6273 100644 --- a/clients/client-s3outposts/runtimeConfig.native.ts +++ b/clients/client-s3outposts/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-s3outposts/runtimeConfig.ts b/clients/client-s3outposts/runtimeConfig.ts index 0f18ef3fb2f4..c4c56945be66 100644 --- a/clients/client-s3outposts/runtimeConfig.ts +++ b/clients/client-s3outposts/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: S3OutpostsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts index efa640e5b9f5..03580f17e177 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts index 7e67981ac68c..094ea469e328 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts b/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts index 6a1da302b0d1..89867ca646c3 100644 --- a/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-a2i-runtime/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SageMakerA2IRuntimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-edge/runtimeConfig.browser.ts b/clients/client-sagemaker-edge/runtimeConfig.browser.ts index 4124dce7bed6..2f561d611d11 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-edge/runtimeConfig.native.ts b/clients/client-sagemaker-edge/runtimeConfig.native.ts index 065c4d97995a..fd6b7cd12823 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.native.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sagemaker-edge/runtimeConfig.ts b/clients/client-sagemaker-edge/runtimeConfig.ts index bf7ff9a5e396..133bab8978c1 100644 --- a/clients/client-sagemaker-edge/runtimeConfig.ts +++ b/clients/client-sagemaker-edge/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SagemakerEdgeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts index 469231b51bdf..f40d20513cb8 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfi const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts index 5b7ceae1fb05..e4f4ad59212e 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfi const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts index d99ada3d60ae..f5b10a4ccfc2 100644 --- a/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-featurestore-runtime/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SageMakerFeatureStoreRuntimeClientConfi const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-runtime/runtimeConfig.browser.ts b/clients/client-sagemaker-runtime/runtimeConfig.browser.ts index e547ad865d08..7a8cc9e62e3e 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.browser.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker-runtime/runtimeConfig.native.ts b/clients/client-sagemaker-runtime/runtimeConfig.native.ts index 1adb304caabc..51063ff4b631 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.native.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sagemaker-runtime/runtimeConfig.ts b/clients/client-sagemaker-runtime/runtimeConfig.ts index aac945ff0ee4..d04bd1b730f5 100644 --- a/clients/client-sagemaker-runtime/runtimeConfig.ts +++ b/clients/client-sagemaker-runtime/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker/runtimeConfig.browser.ts b/clients/client-sagemaker/runtimeConfig.browser.ts index f2eda3b5da41..825521a31221 100644 --- a/clients/client-sagemaker/runtimeConfig.browser.ts +++ b/clients/client-sagemaker/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SageMakerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sagemaker/runtimeConfig.native.ts b/clients/client-sagemaker/runtimeConfig.native.ts index fd42e8a9f29e..7c01d313a010 100644 --- a/clients/client-sagemaker/runtimeConfig.native.ts +++ b/clients/client-sagemaker/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SageMakerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sagemaker/runtimeConfig.ts b/clients/client-sagemaker/runtimeConfig.ts index 5e6e3b0ee28e..2989f4601777 100644 --- a/clients/client-sagemaker/runtimeConfig.ts +++ b/clients/client-sagemaker/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SageMakerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-savingsplans/runtimeConfig.browser.ts b/clients/client-savingsplans/runtimeConfig.browser.ts index f9e4e459e84e..4cc6b1d2eed2 100644 --- a/clients/client-savingsplans/runtimeConfig.browser.ts +++ b/clients/client-savingsplans/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SavingsplansClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-savingsplans/runtimeConfig.native.ts b/clients/client-savingsplans/runtimeConfig.native.ts index caf23ab9cb5d..48a0b7d11ba5 100644 --- a/clients/client-savingsplans/runtimeConfig.native.ts +++ b/clients/client-savingsplans/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SavingsplansClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-savingsplans/runtimeConfig.ts b/clients/client-savingsplans/runtimeConfig.ts index e7fff7ea5f08..af5e973d0f8e 100644 --- a/clients/client-savingsplans/runtimeConfig.ts +++ b/clients/client-savingsplans/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SavingsplansClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-schemas/runtimeConfig.browser.ts b/clients/client-schemas/runtimeConfig.browser.ts index a85f4b3c1fcd..12cb4aa42289 100644 --- a/clients/client-schemas/runtimeConfig.browser.ts +++ b/clients/client-schemas/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SchemasClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-schemas/runtimeConfig.native.ts b/clients/client-schemas/runtimeConfig.native.ts index bd76413b58ac..0898502c4bdf 100644 --- a/clients/client-schemas/runtimeConfig.native.ts +++ b/clients/client-schemas/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SchemasClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-schemas/runtimeConfig.ts b/clients/client-schemas/runtimeConfig.ts index 720b2f347059..21388a685059 100644 --- a/clients/client-schemas/runtimeConfig.ts +++ b/clients/client-schemas/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SchemasClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-secrets-manager/runtimeConfig.browser.ts b/clients/client-secrets-manager/runtimeConfig.browser.ts index e2d3c8880448..32cc1889c963 100644 --- a/clients/client-secrets-manager/runtimeConfig.browser.ts +++ b/clients/client-secrets-manager/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-secrets-manager/runtimeConfig.native.ts b/clients/client-secrets-manager/runtimeConfig.native.ts index 7cde3cc687e2..1ce38b48fccf 100644 --- a/clients/client-secrets-manager/runtimeConfig.native.ts +++ b/clients/client-secrets-manager/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-secrets-manager/runtimeConfig.ts b/clients/client-secrets-manager/runtimeConfig.ts index 5b1dc7792bf6..243aeb3bf30f 100644 --- a/clients/client-secrets-manager/runtimeConfig.ts +++ b/clients/client-secrets-manager/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SecretsManagerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-securityhub/runtimeConfig.browser.ts b/clients/client-securityhub/runtimeConfig.browser.ts index eb67b5226435..e962f7439f6b 100644 --- a/clients/client-securityhub/runtimeConfig.browser.ts +++ b/clients/client-securityhub/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SecurityHubClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-securityhub/runtimeConfig.native.ts b/clients/client-securityhub/runtimeConfig.native.ts index e6396937aaea..f838f18dd207 100644 --- a/clients/client-securityhub/runtimeConfig.native.ts +++ b/clients/client-securityhub/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SecurityHubClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-securityhub/runtimeConfig.ts b/clients/client-securityhub/runtimeConfig.ts index 8ba6d8799447..3dddb6159305 100644 --- a/clients/client-securityhub/runtimeConfig.ts +++ b/clients/client-securityhub/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SecurityHubClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts index ce890e22370d..82bc48b0a9f3 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientCo const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts index 5fbaa0e3ffe5..34e427da43b6 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientCo const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-serverlessapplicationrepository/runtimeConfig.ts b/clients/client-serverlessapplicationrepository/runtimeConfig.ts index 0da9428b54bd..48131d80c2ac 100644 --- a/clients/client-serverlessapplicationrepository/runtimeConfig.ts +++ b/clients/client-serverlessapplicationrepository/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ServerlessApplicationRepositoryClientCo const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts b/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts index d0170ae61e53..1b5632b05971 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.native.ts b/clients/client-service-catalog-appregistry/runtimeConfig.native.ts index b8b27934fcea..0c90d94b5fcf 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.native.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-service-catalog-appregistry/runtimeConfig.ts b/clients/client-service-catalog-appregistry/runtimeConfig.ts index d386a510d55b..6830204f9eed 100644 --- a/clients/client-service-catalog-appregistry/runtimeConfig.ts +++ b/clients/client-service-catalog-appregistry/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ServiceCatalogAppRegistryClientConfig) const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-service-catalog/runtimeConfig.browser.ts b/clients/client-service-catalog/runtimeConfig.browser.ts index 3dc8e4ec387d..dbdab34f1eb7 100644 --- a/clients/client-service-catalog/runtimeConfig.browser.ts +++ b/clients/client-service-catalog/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-service-catalog/runtimeConfig.native.ts b/clients/client-service-catalog/runtimeConfig.native.ts index 16fd0b48e170..85fabe8cfd8e 100644 --- a/clients/client-service-catalog/runtimeConfig.native.ts +++ b/clients/client-service-catalog/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-service-catalog/runtimeConfig.ts b/clients/client-service-catalog/runtimeConfig.ts index a1d8a60e83cc..410a13671db2 100644 --- a/clients/client-service-catalog/runtimeConfig.ts +++ b/clients/client-service-catalog/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ServiceCatalogClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-service-quotas/runtimeConfig.browser.ts b/clients/client-service-quotas/runtimeConfig.browser.ts index e45809a11815..5719907f105b 100644 --- a/clients/client-service-quotas/runtimeConfig.browser.ts +++ b/clients/client-service-quotas/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-service-quotas/runtimeConfig.native.ts b/clients/client-service-quotas/runtimeConfig.native.ts index cc1a203d22e7..027a23122832 100644 --- a/clients/client-service-quotas/runtimeConfig.native.ts +++ b/clients/client-service-quotas/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-service-quotas/runtimeConfig.ts b/clients/client-service-quotas/runtimeConfig.ts index bc18e3d32f51..19f13ccbd6b4 100644 --- a/clients/client-service-quotas/runtimeConfig.ts +++ b/clients/client-service-quotas/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ServiceQuotasClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-servicediscovery/runtimeConfig.browser.ts b/clients/client-servicediscovery/runtimeConfig.browser.ts index 9ed4b5eded4f..572e617e1baa 100644 --- a/clients/client-servicediscovery/runtimeConfig.browser.ts +++ b/clients/client-servicediscovery/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-servicediscovery/runtimeConfig.native.ts b/clients/client-servicediscovery/runtimeConfig.native.ts index 98d4eb79875e..ca61275a1075 100644 --- a/clients/client-servicediscovery/runtimeConfig.native.ts +++ b/clients/client-servicediscovery/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-servicediscovery/runtimeConfig.ts b/clients/client-servicediscovery/runtimeConfig.ts index b4fdad32e8ee..0382691f03ad 100644 --- a/clients/client-servicediscovery/runtimeConfig.ts +++ b/clients/client-servicediscovery/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ServiceDiscoveryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ses/runtimeConfig.browser.ts b/clients/client-ses/runtimeConfig.browser.ts index b51f7361c90d..e94546f157bc 100644 --- a/clients/client-ses/runtimeConfig.browser.ts +++ b/clients/client-ses/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SESClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ses/runtimeConfig.native.ts b/clients/client-ses/runtimeConfig.native.ts index b4ded618bc74..0d784cebbd61 100644 --- a/clients/client-ses/runtimeConfig.native.ts +++ b/clients/client-ses/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SESClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ses/runtimeConfig.ts b/clients/client-ses/runtimeConfig.ts index 44a38fb0ae2c..e6d1cc41fd0c 100644 --- a/clients/client-ses/runtimeConfig.ts +++ b/clients/client-ses/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SESClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sesv2/runtimeConfig.browser.ts b/clients/client-sesv2/runtimeConfig.browser.ts index 410f70995732..0c120e3f2948 100644 --- a/clients/client-sesv2/runtimeConfig.browser.ts +++ b/clients/client-sesv2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SESv2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sesv2/runtimeConfig.native.ts b/clients/client-sesv2/runtimeConfig.native.ts index 04fb9d6765ec..4192f5782da1 100644 --- a/clients/client-sesv2/runtimeConfig.native.ts +++ b/clients/client-sesv2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SESv2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sesv2/runtimeConfig.ts b/clients/client-sesv2/runtimeConfig.ts index 0c43975e9789..2b4479195199 100644 --- a/clients/client-sesv2/runtimeConfig.ts +++ b/clients/client-sesv2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SESv2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sfn/runtimeConfig.browser.ts b/clients/client-sfn/runtimeConfig.browser.ts index 36621e75bf9b..0c59b3950c2c 100644 --- a/clients/client-sfn/runtimeConfig.browser.ts +++ b/clients/client-sfn/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SFNClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sfn/runtimeConfig.native.ts b/clients/client-sfn/runtimeConfig.native.ts index ec3037c48d38..b52aeabdec13 100644 --- a/clients/client-sfn/runtimeConfig.native.ts +++ b/clients/client-sfn/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SFNClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sfn/runtimeConfig.ts b/clients/client-sfn/runtimeConfig.ts index 7ac887f1813b..f92fbf0b63db 100644 --- a/clients/client-sfn/runtimeConfig.ts +++ b/clients/client-sfn/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SFNClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-shield/runtimeConfig.browser.ts b/clients/client-shield/runtimeConfig.browser.ts index 3b001a687897..b6b34c7e8395 100644 --- a/clients/client-shield/runtimeConfig.browser.ts +++ b/clients/client-shield/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: ShieldClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-shield/runtimeConfig.native.ts b/clients/client-shield/runtimeConfig.native.ts index b923449c4df9..d5aca17e5346 100644 --- a/clients/client-shield/runtimeConfig.native.ts +++ b/clients/client-shield/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: ShieldClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-shield/runtimeConfig.ts b/clients/client-shield/runtimeConfig.ts index c32f29b5da20..d44f9813b0b9 100644 --- a/clients/client-shield/runtimeConfig.ts +++ b/clients/client-shield/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: ShieldClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-signer/runtimeConfig.browser.ts b/clients/client-signer/runtimeConfig.browser.ts index f2b22e206414..c2e8465bed36 100644 --- a/clients/client-signer/runtimeConfig.browser.ts +++ b/clients/client-signer/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SignerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-signer/runtimeConfig.native.ts b/clients/client-signer/runtimeConfig.native.ts index ce0dcb33a6f0..8ebf00324e41 100644 --- a/clients/client-signer/runtimeConfig.native.ts +++ b/clients/client-signer/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SignerClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-signer/runtimeConfig.ts b/clients/client-signer/runtimeConfig.ts index 6a4fa58ae211..15afc47c26c2 100644 --- a/clients/client-signer/runtimeConfig.ts +++ b/clients/client-signer/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SignerClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sms/runtimeConfig.browser.ts b/clients/client-sms/runtimeConfig.browser.ts index 2c4d73eaa4e9..08e1d6a68b2f 100644 --- a/clients/client-sms/runtimeConfig.browser.ts +++ b/clients/client-sms/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SMSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sms/runtimeConfig.native.ts b/clients/client-sms/runtimeConfig.native.ts index 3a4acb105dc3..06a638d1f449 100644 --- a/clients/client-sms/runtimeConfig.native.ts +++ b/clients/client-sms/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SMSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sms/runtimeConfig.ts b/clients/client-sms/runtimeConfig.ts index 444bdee7ba8a..d6cc5768b246 100644 --- a/clients/client-sms/runtimeConfig.ts +++ b/clients/client-sms/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SMSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-snowball/runtimeConfig.browser.ts b/clients/client-snowball/runtimeConfig.browser.ts index 67ea5ac0e920..72a0017a4b15 100644 --- a/clients/client-snowball/runtimeConfig.browser.ts +++ b/clients/client-snowball/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SnowballClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-snowball/runtimeConfig.native.ts b/clients/client-snowball/runtimeConfig.native.ts index 45ca88d4dcc8..a4e443880ff8 100644 --- a/clients/client-snowball/runtimeConfig.native.ts +++ b/clients/client-snowball/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SnowballClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-snowball/runtimeConfig.ts b/clients/client-snowball/runtimeConfig.ts index 26a3edf7c9b1..86725821f830 100644 --- a/clients/client-snowball/runtimeConfig.ts +++ b/clients/client-snowball/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SnowballClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sns/runtimeConfig.browser.ts b/clients/client-sns/runtimeConfig.browser.ts index 378bd99a500d..aa4532c24ced 100644 --- a/clients/client-sns/runtimeConfig.browser.ts +++ b/clients/client-sns/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SNSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sns/runtimeConfig.native.ts b/clients/client-sns/runtimeConfig.native.ts index 26360b8e3e6b..8c44aa86d2cf 100644 --- a/clients/client-sns/runtimeConfig.native.ts +++ b/clients/client-sns/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SNSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sns/runtimeConfig.ts b/clients/client-sns/runtimeConfig.ts index c9fd7ad6e9da..dde2b51d791f 100644 --- a/clients/client-sns/runtimeConfig.ts +++ b/clients/client-sns/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SNSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sqs/runtimeConfig.browser.ts b/clients/client-sqs/runtimeConfig.browser.ts index 97b796f978d7..67915dafa360 100644 --- a/clients/client-sqs/runtimeConfig.browser.ts +++ b/clients/client-sqs/runtimeConfig.browser.ts @@ -19,6 +19,7 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sqs/runtimeConfig.native.ts b/clients/client-sqs/runtimeConfig.native.ts index 9cf8c8ad0df5..ae80b26a042d 100644 --- a/clients/client-sqs/runtimeConfig.native.ts +++ b/clients/client-sqs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sqs/runtimeConfig.ts b/clients/client-sqs/runtimeConfig.ts index e3f090188482..0fcbb6ba5e09 100644 --- a/clients/client-sqs/runtimeConfig.ts +++ b/clients/client-sqs/runtimeConfig.ts @@ -22,6 +22,7 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ssm-contacts/runtimeConfig.browser.ts b/clients/client-ssm-contacts/runtimeConfig.browser.ts index fddf06063acb..1b6e86a05a23 100644 --- a/clients/client-ssm-contacts/runtimeConfig.browser.ts +++ b/clients/client-ssm-contacts/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SSMContactsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ssm-contacts/runtimeConfig.native.ts b/clients/client-ssm-contacts/runtimeConfig.native.ts index 13bb1298a07f..7280824773cb 100644 --- a/clients/client-ssm-contacts/runtimeConfig.native.ts +++ b/clients/client-ssm-contacts/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SSMContactsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ssm-contacts/runtimeConfig.ts b/clients/client-ssm-contacts/runtimeConfig.ts index 8eb01eaa3357..0c7f34974378 100644 --- a/clients/client-ssm-contacts/runtimeConfig.ts +++ b/clients/client-ssm-contacts/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SSMContactsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ssm-incidents/runtimeConfig.browser.ts b/clients/client-ssm-incidents/runtimeConfig.browser.ts index 44b28ff9ce84..9a4ec3b4209c 100644 --- a/clients/client-ssm-incidents/runtimeConfig.browser.ts +++ b/clients/client-ssm-incidents/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ssm-incidents/runtimeConfig.native.ts b/clients/client-ssm-incidents/runtimeConfig.native.ts index 4cccc72dbc6e..7072b47f9468 100644 --- a/clients/client-ssm-incidents/runtimeConfig.native.ts +++ b/clients/client-ssm-incidents/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ssm-incidents/runtimeConfig.ts b/clients/client-ssm-incidents/runtimeConfig.ts index 56fba615e3e3..b73ec370a90e 100644 --- a/clients/client-ssm-incidents/runtimeConfig.ts +++ b/clients/client-ssm-incidents/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SSMIncidentsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ssm/runtimeConfig.browser.ts b/clients/client-ssm/runtimeConfig.browser.ts index 5a538b7b3d92..221b75b7001b 100644 --- a/clients/client-ssm/runtimeConfig.browser.ts +++ b/clients/client-ssm/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SSMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-ssm/runtimeConfig.native.ts b/clients/client-ssm/runtimeConfig.native.ts index d3adbe91a515..0340061eb5e0 100644 --- a/clients/client-ssm/runtimeConfig.native.ts +++ b/clients/client-ssm/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SSMClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-ssm/runtimeConfig.ts b/clients/client-ssm/runtimeConfig.ts index 29ddf902eb88..388f8276744c 100644 --- a/clients/client-ssm/runtimeConfig.ts +++ b/clients/client-ssm/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SSMClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sso-admin/runtimeConfig.browser.ts b/clients/client-sso-admin/runtimeConfig.browser.ts index 503c6db98c5b..bb52d83c1910 100644 --- a/clients/client-sso-admin/runtimeConfig.browser.ts +++ b/clients/client-sso-admin/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SSOAdminClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sso-admin/runtimeConfig.native.ts b/clients/client-sso-admin/runtimeConfig.native.ts index f5b0a9171dd2..b4c213747458 100644 --- a/clients/client-sso-admin/runtimeConfig.native.ts +++ b/clients/client-sso-admin/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SSOAdminClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sso-admin/runtimeConfig.ts b/clients/client-sso-admin/runtimeConfig.ts index ed17b62459eb..1f7c734f1674 100644 --- a/clients/client-sso-admin/runtimeConfig.ts +++ b/clients/client-sso-admin/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SSOAdminClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sso-oidc/runtimeConfig.browser.ts b/clients/client-sso-oidc/runtimeConfig.browser.ts index 244c3fa30fb1..7be6353d8f60 100644 --- a/clients/client-sso-oidc/runtimeConfig.browser.ts +++ b/clients/client-sso-oidc/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sso-oidc/runtimeConfig.native.ts b/clients/client-sso-oidc/runtimeConfig.native.ts index fc30cb1b0590..7a5350f947a0 100644 --- a/clients/client-sso-oidc/runtimeConfig.native.ts +++ b/clients/client-sso-oidc/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sso-oidc/runtimeConfig.ts b/clients/client-sso-oidc/runtimeConfig.ts index c0db11b6aaa8..49ae653c9b53 100644 --- a/clients/client-sso-oidc/runtimeConfig.ts +++ b/clients/client-sso-oidc/runtimeConfig.ts @@ -19,6 +19,7 @@ export const getRuntimeConfig = (config: SSOOIDCClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sso/runtimeConfig.browser.ts b/clients/client-sso/runtimeConfig.browser.ts index 3894e6e30cec..e8612cdea7f4 100644 --- a/clients/client-sso/runtimeConfig.browser.ts +++ b/clients/client-sso/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SSOClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sso/runtimeConfig.native.ts b/clients/client-sso/runtimeConfig.native.ts index df75366396b0..856d06c34ed1 100644 --- a/clients/client-sso/runtimeConfig.native.ts +++ b/clients/client-sso/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SSOClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sso/runtimeConfig.ts b/clients/client-sso/runtimeConfig.ts index 607c005f11d6..de0259d129a5 100644 --- a/clients/client-sso/runtimeConfig.ts +++ b/clients/client-sso/runtimeConfig.ts @@ -19,6 +19,7 @@ export const getRuntimeConfig = (config: SSOClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-storage-gateway/runtimeConfig.browser.ts b/clients/client-storage-gateway/runtimeConfig.browser.ts index d2ccd98f6e45..532f24e01383 100644 --- a/clients/client-storage-gateway/runtimeConfig.browser.ts +++ b/clients/client-storage-gateway/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-storage-gateway/runtimeConfig.native.ts b/clients/client-storage-gateway/runtimeConfig.native.ts index 64eca773ab1f..fff0573e27ad 100644 --- a/clients/client-storage-gateway/runtimeConfig.native.ts +++ b/clients/client-storage-gateway/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-storage-gateway/runtimeConfig.ts b/clients/client-storage-gateway/runtimeConfig.ts index 6da8752bd614..196084b2e384 100644 --- a/clients/client-storage-gateway/runtimeConfig.ts +++ b/clients/client-storage-gateway/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: StorageGatewayClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sts/runtimeConfig.browser.ts b/clients/client-sts/runtimeConfig.browser.ts index 6b2e9c6194d4..40404e0e3c6d 100644 --- a/clients/client-sts/runtimeConfig.browser.ts +++ b/clients/client-sts/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: STSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-sts/runtimeConfig.native.ts b/clients/client-sts/runtimeConfig.native.ts index a3921c0b95ca..7bc8be08f35c 100644 --- a/clients/client-sts/runtimeConfig.native.ts +++ b/clients/client-sts/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: STSClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-sts/runtimeConfig.ts b/clients/client-sts/runtimeConfig.ts index 2ad5a321cb70..65a5b71e5a10 100644 --- a/clients/client-sts/runtimeConfig.ts +++ b/clients/client-sts/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: STSClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-support/runtimeConfig.browser.ts b/clients/client-support/runtimeConfig.browser.ts index fc56d02697d7..61c69502c46f 100644 --- a/clients/client-support/runtimeConfig.browser.ts +++ b/clients/client-support/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SupportClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-support/runtimeConfig.native.ts b/clients/client-support/runtimeConfig.native.ts index 65731f7a39be..a36ac5bb1368 100644 --- a/clients/client-support/runtimeConfig.native.ts +++ b/clients/client-support/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SupportClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-support/runtimeConfig.ts b/clients/client-support/runtimeConfig.ts index fce88ef54a88..d0202fc742b2 100644 --- a/clients/client-support/runtimeConfig.ts +++ b/clients/client-support/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SupportClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-swf/runtimeConfig.browser.ts b/clients/client-swf/runtimeConfig.browser.ts index 439055d2d04a..46b9d079d6b5 100644 --- a/clients/client-swf/runtimeConfig.browser.ts +++ b/clients/client-swf/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SWFClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-swf/runtimeConfig.native.ts b/clients/client-swf/runtimeConfig.native.ts index b1672de682a0..84b9fe66a718 100644 --- a/clients/client-swf/runtimeConfig.native.ts +++ b/clients/client-swf/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SWFClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-swf/runtimeConfig.ts b/clients/client-swf/runtimeConfig.ts index ac3228f04d76..5e5ade5afecf 100644 --- a/clients/client-swf/runtimeConfig.ts +++ b/clients/client-swf/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SWFClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-synthetics/runtimeConfig.browser.ts b/clients/client-synthetics/runtimeConfig.browser.ts index 5dbfd2cada88..5698baff4ace 100644 --- a/clients/client-synthetics/runtimeConfig.browser.ts +++ b/clients/client-synthetics/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: SyntheticsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-synthetics/runtimeConfig.native.ts b/clients/client-synthetics/runtimeConfig.native.ts index 7a44381e0fb9..0e673e457854 100644 --- a/clients/client-synthetics/runtimeConfig.native.ts +++ b/clients/client-synthetics/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: SyntheticsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-synthetics/runtimeConfig.ts b/clients/client-synthetics/runtimeConfig.ts index 97f441bf5a47..877932fb5593 100644 --- a/clients/client-synthetics/runtimeConfig.ts +++ b/clients/client-synthetics/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: SyntheticsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-textract/runtimeConfig.browser.ts b/clients/client-textract/runtimeConfig.browser.ts index f4ba29ed5ca9..3435ef50150c 100644 --- a/clients/client-textract/runtimeConfig.browser.ts +++ b/clients/client-textract/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: TextractClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-textract/runtimeConfig.native.ts b/clients/client-textract/runtimeConfig.native.ts index 4ba5631077fd..4426daf1e7d0 100644 --- a/clients/client-textract/runtimeConfig.native.ts +++ b/clients/client-textract/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: TextractClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-textract/runtimeConfig.ts b/clients/client-textract/runtimeConfig.ts index 0e357fe98937..a5a3fb162e4f 100644 --- a/clients/client-textract/runtimeConfig.ts +++ b/clients/client-textract/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: TextractClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-timestream-query/runtimeConfig.browser.ts b/clients/client-timestream-query/runtimeConfig.browser.ts index 5326c3a9b051..8f96f81b3c33 100644 --- a/clients/client-timestream-query/runtimeConfig.browser.ts +++ b/clients/client-timestream-query/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-timestream-query/runtimeConfig.native.ts b/clients/client-timestream-query/runtimeConfig.native.ts index 2bfdc7616f0e..e1c1d8a02fab 100644 --- a/clients/client-timestream-query/runtimeConfig.native.ts +++ b/clients/client-timestream-query/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-timestream-query/runtimeConfig.ts b/clients/client-timestream-query/runtimeConfig.ts index 3f5c28d78d16..3da5c5d99498 100644 --- a/clients/client-timestream-query/runtimeConfig.ts +++ b/clients/client-timestream-query/runtimeConfig.ts @@ -22,6 +22,7 @@ export const getRuntimeConfig = (config: TimestreamQueryClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-timestream-write/runtimeConfig.browser.ts b/clients/client-timestream-write/runtimeConfig.browser.ts index 8b143e47108b..04010b3aedfb 100644 --- a/clients/client-timestream-write/runtimeConfig.browser.ts +++ b/clients/client-timestream-write/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-timestream-write/runtimeConfig.native.ts b/clients/client-timestream-write/runtimeConfig.native.ts index c9fd4f0ecef2..74b3aad59f84 100644 --- a/clients/client-timestream-write/runtimeConfig.native.ts +++ b/clients/client-timestream-write/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-timestream-write/runtimeConfig.ts b/clients/client-timestream-write/runtimeConfig.ts index e81e92431330..79b333bb3f9a 100644 --- a/clients/client-timestream-write/runtimeConfig.ts +++ b/clients/client-timestream-write/runtimeConfig.ts @@ -22,6 +22,7 @@ export const getRuntimeConfig = (config: TimestreamWriteClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-transcribe-streaming/runtimeConfig.browser.ts b/clients/client-transcribe-streaming/runtimeConfig.browser.ts index 7c23ad59edfa..eba17d97bb2c 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.browser.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.browser.ts @@ -20,6 +20,7 @@ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-transcribe-streaming/runtimeConfig.native.ts b/clients/client-transcribe-streaming/runtimeConfig.native.ts index fbca279ab002..e736bbfbd126 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.native.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.native.ts @@ -10,6 +10,7 @@ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", eventStreamPayloadHandlerProvider: config.eventStreamPayloadHandlerProvider ?? (() => eventStreamPayloadHandler), requestHandler: config.requestHandler ?? new WebSocketHandler(), diff --git a/clients/client-transcribe-streaming/runtimeConfig.ts b/clients/client-transcribe-streaming/runtimeConfig.ts index 65f9786befca..58279df7806e 100644 --- a/clients/client-transcribe-streaming/runtimeConfig.ts +++ b/clients/client-transcribe-streaming/runtimeConfig.ts @@ -23,6 +23,7 @@ export const getRuntimeConfig = (config: TranscribeStreamingClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-transcribe/runtimeConfig.browser.ts b/clients/client-transcribe/runtimeConfig.browser.ts index d8a590fbbdbe..285c18f0f779 100644 --- a/clients/client-transcribe/runtimeConfig.browser.ts +++ b/clients/client-transcribe/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: TranscribeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-transcribe/runtimeConfig.native.ts b/clients/client-transcribe/runtimeConfig.native.ts index 09e552977d4e..db617994c305 100644 --- a/clients/client-transcribe/runtimeConfig.native.ts +++ b/clients/client-transcribe/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: TranscribeClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-transcribe/runtimeConfig.ts b/clients/client-transcribe/runtimeConfig.ts index 80f34e9467fa..6d00cf21f47f 100644 --- a/clients/client-transcribe/runtimeConfig.ts +++ b/clients/client-transcribe/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: TranscribeClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-transfer/runtimeConfig.browser.ts b/clients/client-transfer/runtimeConfig.browser.ts index ff090c6a6c62..9aab0dd1646a 100644 --- a/clients/client-transfer/runtimeConfig.browser.ts +++ b/clients/client-transfer/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: TransferClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-transfer/runtimeConfig.native.ts b/clients/client-transfer/runtimeConfig.native.ts index 998720b189aa..febeac64d926 100644 --- a/clients/client-transfer/runtimeConfig.native.ts +++ b/clients/client-transfer/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: TransferClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-transfer/runtimeConfig.ts b/clients/client-transfer/runtimeConfig.ts index 088ec05b468a..97ad03ff5b8b 100644 --- a/clients/client-transfer/runtimeConfig.ts +++ b/clients/client-transfer/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: TransferClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-translate/runtimeConfig.browser.ts b/clients/client-translate/runtimeConfig.browser.ts index f5d9de40c6c0..9a19b9291645 100644 --- a/clients/client-translate/runtimeConfig.browser.ts +++ b/clients/client-translate/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: TranslateClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-translate/runtimeConfig.native.ts b/clients/client-translate/runtimeConfig.native.ts index d9e89d5b7b8b..ed240daba5e1 100644 --- a/clients/client-translate/runtimeConfig.native.ts +++ b/clients/client-translate/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: TranslateClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-translate/runtimeConfig.ts b/clients/client-translate/runtimeConfig.ts index 5aa2f463abf6..3c1214034640 100644 --- a/clients/client-translate/runtimeConfig.ts +++ b/clients/client-translate/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: TranslateClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-waf-regional/runtimeConfig.browser.ts b/clients/client-waf-regional/runtimeConfig.browser.ts index 72d9eae09ed1..9450c037fa6a 100644 --- a/clients/client-waf-regional/runtimeConfig.browser.ts +++ b/clients/client-waf-regional/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-waf-regional/runtimeConfig.native.ts b/clients/client-waf-regional/runtimeConfig.native.ts index 57fab14d953c..ba2d3dd880cd 100644 --- a/clients/client-waf-regional/runtimeConfig.native.ts +++ b/clients/client-waf-regional/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-waf-regional/runtimeConfig.ts b/clients/client-waf-regional/runtimeConfig.ts index 49624837c050..1c9708073499 100644 --- a/clients/client-waf-regional/runtimeConfig.ts +++ b/clients/client-waf-regional/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WAFRegionalClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-waf/runtimeConfig.browser.ts b/clients/client-waf/runtimeConfig.browser.ts index 762a454a54d8..e35b95a34526 100644 --- a/clients/client-waf/runtimeConfig.browser.ts +++ b/clients/client-waf/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WAFClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-waf/runtimeConfig.native.ts b/clients/client-waf/runtimeConfig.native.ts index fa8c97dc6e38..28bc340fc9f7 100644 --- a/clients/client-waf/runtimeConfig.native.ts +++ b/clients/client-waf/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WAFClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-waf/runtimeConfig.ts b/clients/client-waf/runtimeConfig.ts index b33b1d713ce2..de6225fe8202 100644 --- a/clients/client-waf/runtimeConfig.ts +++ b/clients/client-waf/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WAFClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-wafv2/runtimeConfig.browser.ts b/clients/client-wafv2/runtimeConfig.browser.ts index df3b0dc232d0..2783915f551f 100644 --- a/clients/client-wafv2/runtimeConfig.browser.ts +++ b/clients/client-wafv2/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WAFV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-wafv2/runtimeConfig.native.ts b/clients/client-wafv2/runtimeConfig.native.ts index 2f4a6cdb182d..8a353e24fa5e 100644 --- a/clients/client-wafv2/runtimeConfig.native.ts +++ b/clients/client-wafv2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WAFV2ClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-wafv2/runtimeConfig.ts b/clients/client-wafv2/runtimeConfig.ts index 3baa535aa9b1..6cf9ce9ba868 100644 --- a/clients/client-wafv2/runtimeConfig.ts +++ b/clients/client-wafv2/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WAFV2ClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-wellarchitected/runtimeConfig.browser.ts b/clients/client-wellarchitected/runtimeConfig.browser.ts index 0e550520c5d7..3f530a2dfda6 100644 --- a/clients/client-wellarchitected/runtimeConfig.browser.ts +++ b/clients/client-wellarchitected/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-wellarchitected/runtimeConfig.native.ts b/clients/client-wellarchitected/runtimeConfig.native.ts index 90eb74678793..98f5444be901 100644 --- a/clients/client-wellarchitected/runtimeConfig.native.ts +++ b/clients/client-wellarchitected/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-wellarchitected/runtimeConfig.ts b/clients/client-wellarchitected/runtimeConfig.ts index c287bba64998..ed72722951f6 100644 --- a/clients/client-wellarchitected/runtimeConfig.ts +++ b/clients/client-wellarchitected/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WellArchitectedClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workdocs/runtimeConfig.browser.ts b/clients/client-workdocs/runtimeConfig.browser.ts index 3a92cce4795a..bdadfda0a082 100644 --- a/clients/client-workdocs/runtimeConfig.browser.ts +++ b/clients/client-workdocs/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WorkDocsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workdocs/runtimeConfig.native.ts b/clients/client-workdocs/runtimeConfig.native.ts index 8fd81cd63cd5..165de5494341 100644 --- a/clients/client-workdocs/runtimeConfig.native.ts +++ b/clients/client-workdocs/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WorkDocsClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-workdocs/runtimeConfig.ts b/clients/client-workdocs/runtimeConfig.ts index f5b5baf3f3f6..926fe1f3a45f 100644 --- a/clients/client-workdocs/runtimeConfig.ts +++ b/clients/client-workdocs/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WorkDocsClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-worklink/runtimeConfig.browser.ts b/clients/client-worklink/runtimeConfig.browser.ts index 7bec8729fc9a..b48b68d83b93 100644 --- a/clients/client-worklink/runtimeConfig.browser.ts +++ b/clients/client-worklink/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WorkLinkClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-worklink/runtimeConfig.native.ts b/clients/client-worklink/runtimeConfig.native.ts index 190eac1bbc63..d0494982981e 100644 --- a/clients/client-worklink/runtimeConfig.native.ts +++ b/clients/client-worklink/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WorkLinkClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-worklink/runtimeConfig.ts b/clients/client-worklink/runtimeConfig.ts index 435144d99655..3542ed9d4c04 100644 --- a/clients/client-worklink/runtimeConfig.ts +++ b/clients/client-worklink/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WorkLinkClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workmail/runtimeConfig.browser.ts b/clients/client-workmail/runtimeConfig.browser.ts index a23b63e38cab..58d72407a58b 100644 --- a/clients/client-workmail/runtimeConfig.browser.ts +++ b/clients/client-workmail/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WorkMailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workmail/runtimeConfig.native.ts b/clients/client-workmail/runtimeConfig.native.ts index d055816d988c..de230e2a5793 100644 --- a/clients/client-workmail/runtimeConfig.native.ts +++ b/clients/client-workmail/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WorkMailClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-workmail/runtimeConfig.ts b/clients/client-workmail/runtimeConfig.ts index 3d550c3e6d55..4e15648aaabc 100644 --- a/clients/client-workmail/runtimeConfig.ts +++ b/clients/client-workmail/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WorkMailClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workmailmessageflow/runtimeConfig.browser.ts b/clients/client-workmailmessageflow/runtimeConfig.browser.ts index 82d3a1cd3f34..41ef2f768fe5 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.browser.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workmailmessageflow/runtimeConfig.native.ts b/clients/client-workmailmessageflow/runtimeConfig.native.ts index 0a95c5bc8fa1..05d248127b45 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.native.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-workmailmessageflow/runtimeConfig.ts b/clients/client-workmailmessageflow/runtimeConfig.ts index 84de55eb4862..d179e0228887 100644 --- a/clients/client-workmailmessageflow/runtimeConfig.ts +++ b/clients/client-workmailmessageflow/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workspaces/runtimeConfig.browser.ts b/clients/client-workspaces/runtimeConfig.browser.ts index f218ec877cfb..a65667d31a54 100644 --- a/clients/client-workspaces/runtimeConfig.browser.ts +++ b/clients/client-workspaces/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-workspaces/runtimeConfig.native.ts b/clients/client-workspaces/runtimeConfig.native.ts index 1fb7f78c6a3e..c67830ae4a2f 100644 --- a/clients/client-workspaces/runtimeConfig.native.ts +++ b/clients/client-workspaces/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-workspaces/runtimeConfig.ts b/clients/client-workspaces/runtimeConfig.ts index 1dec89ee7108..b6f966238321 100644 --- a/clients/client-workspaces/runtimeConfig.ts +++ b/clients/client-workspaces/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: WorkSpacesClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-xray/runtimeConfig.browser.ts b/clients/client-xray/runtimeConfig.browser.ts index 8cbf5640d875..bd583e7b6c64 100644 --- a/clients/client-xray/runtimeConfig.browser.ts +++ b/clients/client-xray/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: XRayClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/clients/client-xray/runtimeConfig.native.ts b/clients/client-xray/runtimeConfig.native.ts index 18fff60e860f..495c4b18b04f 100644 --- a/clients/client-xray/runtimeConfig.native.ts +++ b/clients/client-xray/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: XRayClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/clients/client-xray/runtimeConfig.ts b/clients/client-xray/runtimeConfig.ts index 708d53bc56f5..57a098be9496 100644 --- a/clients/client-xray/runtimeConfig.ts +++ b/clients/client-xray/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: XRayClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-ec2/runtimeConfig.browser.ts b/protocol_tests/aws-ec2/runtimeConfig.browser.ts index 1939fcce2074..bf9d886b56ef 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.browser.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.browser.ts @@ -17,6 +17,7 @@ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-ec2/runtimeConfig.native.ts b/protocol_tests/aws-ec2/runtimeConfig.native.ts index f468922b2b00..59fabb634ffc 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.native.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/protocol_tests/aws-ec2/runtimeConfig.ts b/protocol_tests/aws-ec2/runtimeConfig.ts index 5d8b2cdf772e..8c8b1087c1f2 100644 --- a/protocol_tests/aws-ec2/runtimeConfig.ts +++ b/protocol_tests/aws-ec2/runtimeConfig.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: EC2ProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-json/runtimeConfig.browser.ts b/protocol_tests/aws-json/runtimeConfig.browser.ts index 11ed8d938354..e3596882e9b8 100644 --- a/protocol_tests/aws-json/runtimeConfig.browser.ts +++ b/protocol_tests/aws-json/runtimeConfig.browser.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-json/runtimeConfig.native.ts b/protocol_tests/aws-json/runtimeConfig.native.ts index 16b874f11e45..29b0dfc4d655 100644 --- a/protocol_tests/aws-json/runtimeConfig.native.ts +++ b/protocol_tests/aws-json/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/protocol_tests/aws-json/runtimeConfig.ts b/protocol_tests/aws-json/runtimeConfig.ts index 05554aad747e..1c18134c4c47 100644 --- a/protocol_tests/aws-json/runtimeConfig.ts +++ b/protocol_tests/aws-json/runtimeConfig.ts @@ -21,6 +21,7 @@ export const getRuntimeConfig = (config: JsonProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-query/runtimeConfig.browser.ts b/protocol_tests/aws-query/runtimeConfig.browser.ts index a326d696cc73..bf2e9caa761b 100644 --- a/protocol_tests/aws-query/runtimeConfig.browser.ts +++ b/protocol_tests/aws-query/runtimeConfig.browser.ts @@ -17,6 +17,7 @@ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-query/runtimeConfig.native.ts b/protocol_tests/aws-query/runtimeConfig.native.ts index 3eae6cafc0a2..f2ad16dca456 100644 --- a/protocol_tests/aws-query/runtimeConfig.native.ts +++ b/protocol_tests/aws-query/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/protocol_tests/aws-query/runtimeConfig.ts b/protocol_tests/aws-query/runtimeConfig.ts index c31339d4e4f8..afda48d9f09c 100644 --- a/protocol_tests/aws-query/runtimeConfig.ts +++ b/protocol_tests/aws-query/runtimeConfig.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: QueryProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-restjson/runtimeConfig.browser.ts b/protocol_tests/aws-restjson/runtimeConfig.browser.ts index 3c78225503de..7b8325c072a4 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.browser.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.browser.ts @@ -17,6 +17,7 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-restjson/runtimeConfig.native.ts b/protocol_tests/aws-restjson/runtimeConfig.native.ts index 6bd6635f2547..d1e3ffd93f4a 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.native.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/protocol_tests/aws-restjson/runtimeConfig.ts b/protocol_tests/aws-restjson/runtimeConfig.ts index 3c82965fc08e..b7c082d17f31 100644 --- a/protocol_tests/aws-restjson/runtimeConfig.ts +++ b/protocol_tests/aws-restjson/runtimeConfig.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-restxml/runtimeConfig.browser.ts b/protocol_tests/aws-restxml/runtimeConfig.browser.ts index ff3ee52ad04e..ba8197bcb581 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.browser.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.browser.ts @@ -17,6 +17,7 @@ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "browser", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, diff --git a/protocol_tests/aws-restxml/runtimeConfig.native.ts b/protocol_tests/aws-restxml/runtimeConfig.native.ts index cb50ba51bcb8..16990ad4fe8d 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.native.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.native.ts @@ -9,6 +9,7 @@ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { const browserDefaults = getBrowserRuntimeConfig(config); return { ...browserDefaults, + ...config, runtime: "react-native", sha256: config.sha256 ?? Sha256, }; diff --git a/protocol_tests/aws-restxml/runtimeConfig.ts b/protocol_tests/aws-restxml/runtimeConfig.ts index 4c4f87baff9a..38c5968134d1 100644 --- a/protocol_tests/aws-restxml/runtimeConfig.ts +++ b/protocol_tests/aws-restxml/runtimeConfig.ts @@ -18,6 +18,7 @@ export const getRuntimeConfig = (config: RestXmlProtocolClientConfig) => { const clientSharedValues = getSharedRuntimeConfig(config); return { ...clientSharedValues, + ...config, runtime: "node", base64Decoder: config.base64Decoder ?? fromBase64, base64Encoder: config.base64Encoder ?? toBase64, From 37212cc299c0229876a986599e431ce9b97d6963 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Thu, 22 Jul 2021 17:53:56 +0000 Subject: [PATCH 6/6] test: fix codegen test --- .../codegen/AddAwsAuthPluginTest.java | 6 +- .../codegen/AddAwsRuntimeConfigTest.java | 10 +-- .../codegen/AddUserAgentDependencyTest.java | 4 +- scripts/generate-clients/copy-to-clients.js | 71 +++++++++++++------ scripts/generate-clients/index.js | 2 +- 5 files changed, 62 insertions(+), 31 deletions(-) diff --git a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPluginTest.java b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPluginTest.java index 201f22d6b445..5eef6af88762 100644 --- a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPluginTest.java +++ b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPluginTest.java @@ -42,7 +42,7 @@ public void awsClient() { // Check config files assertThat(manifest.getFileString("runtimeConfig.ts").get(), - containsString("credentialDefaultProvider: decorateDefaultCredentialProvider")); + containsString("decorateDefaultCredentialProvider")); assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("Credential is missing")); assertThat(manifest.getFileString("runtimeConfig.shared.ts").get(), not(containsString("signingName:"))); @@ -81,7 +81,7 @@ public void sigV4GenericClient() { // Check config files assertThat(manifest.getFileString("runtimeConfig.ts").get(), - containsString("credentialDefaultProvider: decorateDefaultCredentialProvider")); + containsString("decorateDefaultCredentialProvider")); assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("Credential is missing")); assertThat(manifest.getFileString("runtimeConfig.shared.ts").get(), containsString("signingName:")); @@ -120,7 +120,7 @@ public void notSigV4GenericClient() { // Check config files assertThat(manifest.getFileString("runtimeConfig.ts").get(), - not(containsString("credentialDefaultProvider: decorateDefaultCredentialProvider"))); + not(containsString("decorateDefaultCredentialProvider"))); assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), not(containsString("Credential is missing"))); assertThat(manifest.getFileString("runtimeConfig.shared.ts").get(), not(containsString("signingName:"))); diff --git a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfigTest.java b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfigTest.java index 4fd4bcfac6b8..f2f60a437f2a 100644 --- a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfigTest.java +++ b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddAwsRuntimeConfigTest.java @@ -44,9 +44,9 @@ public void awsClient() { assertThat(manifest.getFileString("NotSameClient.ts").get(), containsString("region?:")); // Check config files - assertThat(manifest.getFileString("runtimeConfig.shared.ts").get(), containsString("serviceId: \"Not Same\"")); - assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("region: invalidProvider")); - assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("region: loadNodeConfig")); + assertThat(manifest.getFileString("runtimeConfig.shared.ts").get(), containsString("serviceId: config.serviceId ?? \"Not Same\"")); + assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("region: config.region ?? invalidProvider")); + assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("region: config.region ?? loadNodeConfig")); } @Test @@ -81,8 +81,8 @@ public void sigV4GenericClient() { // Check config files assertThat(manifest.getFileString("runtimeConfig.shared.ts").get(), not(containsString("serviceId:"))); - assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("region: invalidProvider")); - assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("region: loadNodeConfig")); + assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("region: config.region ?? invalidProvider")); + assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("region: config.region ?? loadNodeConfig")); } @Test diff --git a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependencyTest.java b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependencyTest.java index f655e7b1f339..9a8513d23e0d 100644 --- a/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependencyTest.java +++ b/codegen/smithy-aws-typescript-codegen/src/test/java/software/amazon/smithy/aws/typescript/codegen/AddUserAgentDependencyTest.java @@ -42,11 +42,11 @@ public void awsClient() { // Check config files assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("defaultUserAgent")); assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("packageInfo.version")); - assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("ClientSharedValues.serviceId")); + assertThat(manifest.getFileString("runtimeConfig.ts").get(), containsString("clientSharedValues.serviceId")); assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("defaultUserAgent")); assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("packageInfo.version")); - assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("ClientSharedValues.serviceId")); + assertThat(manifest.getFileString("runtimeConfig.browser.ts").get(), containsString("clientSharedValues.serviceId")); // Check the config resolution and middleware plugin assertThat(manifest.getFileString("NotSameClient.ts").get(), containsString("resolveUserAgentConfig")); diff --git a/scripts/generate-clients/copy-to-clients.js b/scripts/generate-clients/copy-to-clients.js index c47cafbfb4bd..a2395af8e878 100644 --- a/scripts/generate-clients/copy-to-clients.js +++ b/scripts/generate-clients/copy-to-clients.js @@ -3,8 +3,39 @@ const { normalize, join } = require("path"); const { copySync, removeSync } = require("fs-extra"); const { readdirSync, lstatSync, readFileSync, existsSync, writeFileSync } = require("fs"); -const getOverwritablePredicate = (packageName) => (pathName) => { - const overwritablePathnames = [ +// const getOverwritablePredicate = (packageName) => (pathName) => { +// const overwritablePathnames = [ +// "commands", +// "models", +// "protocols", +// "pagination", +// "tests", +// "waiters", +// "LICENCE", +// "runtimeConfig.ts", +// "runtimeConfig.browser.ts", +// "runtimeConfig.shared.ts", +// "runtimeConfig.native.ts", +// "index.ts", +// "endpoints.ts", +// "README.md", +// ]; +// const additionalGeneratedFiles = { +// "@aws-sdk/client-sts": ["defaultRoleAssumers.ts", "defaultStsRoleAssumers.ts", "defaultRoleAssumers.spec.ts"], +// }; +// return ( +// // pathName +// // .toLowerCase() +// // .startsWith( +// // packageName.toLowerCase().replace("@aws-sdk/client-", "").replace("@aws-sdk/aws-", "").replace(/-/g, "") +// // ) || +// pathName.endsWith("Client.ts") && +// overwritablePathnames.indexOf(pathName) >= 0 || +// additionalGeneratedFiles[packageName.toLowerCase()]?.indexOf(pathName) >= 0 +// ); +// }; +const getOverwritableDirectories = (subDirectories) => { + const overwritableDirectories = [ "commands", "models", "protocols", @@ -19,19 +50,17 @@ const getOverwritablePredicate = (packageName) => (pathName) => { "index.ts", "endpoints.ts", "README.md", + // @aws-sdk/client-sts special files + "defaultRoleAssumers.ts", + "defaultStsRoleAssumers.ts", + "defaultRoleAssumers.spec.ts", ]; - const additionalGeneratedFiles = { - "@aws-sdk/client-sts": ["defaultRoleAssumers.ts", "defaultStsRoleAssumers.ts", "defaultRoleAssumers.spec.ts"], - }; - return ( - pathName - .toLowerCase() - .startsWith( - packageName.toLowerCase().replace("@aws-sdk/client-", "").replace("@aws-sdk/aws-", "").replace(/-/g, "") - ) || - overwritablePathnames.indexOf(pathName) >= 0 || - additionalGeneratedFiles[packageName.toLowerCase()]?.indexOf(pathName) >= 0 - ); + return subDirectories.filter((subDirectory) => { + const isBareBoneClient = + subDirectory.endsWith("Client.ts") && subDirectories.includes(subDirectory.replace("Client.ts", ".ts")); + const isAggregateClient = subDirectories.includes(subDirectory.replace(".ts", "Client.ts")); + return isBareBoneClient || isAggregateClient || overwritableDirectories.indexOf(subDirectory) >= 0; + }); }; /** @@ -109,7 +138,6 @@ const copyToClients = async (sourceDir, destinationDir) => { console.log(`copying ${packageName} from ${artifactPath} to ${destinationDir}`); const destPath = join(destinationDir, clientName); - const overwritablePredicate = getOverwritablePredicate(packageName); // Code to move files/folders prefixed with `doc-client-` to `lib/lib-dynamodb` if (clientName === "client-dynamodb") { @@ -124,7 +152,9 @@ const copyToClients = async (sourceDir, destinationDir) => { } } - for (const packageSub of readdirSync(artifactPath)) { + const packageSubs = readdirSync(artifactPath); + const overWritableSubs = getOverwritableDirectories(packageSubs); + for (const packageSub of packageSubs) { const packageSubPath = join(artifactPath, packageSub); const destSubPath = join(destPath, packageSub); @@ -141,7 +171,7 @@ const copyToClients = async (sourceDir, destinationDir) => { }, }; writeFileSync(destSubPath, JSON.stringify(mergedManifest, null, 2).concat(`\n`)); - } else if (overwritablePredicate(packageSub) || !existsSync(destSubPath)) { + } else if (overWritableSubs.includes(packageSub) || !existsSync(destSubPath)) { if (lstatSync(packageSubPath).isDirectory()) removeSync(destSubPath); copySync(packageSubPath, destSubPath, { overwrite: true, @@ -168,9 +198,10 @@ const copyServerTests = async (sourceDir, destinationDir) => { console.log(`copying ${packageName} from ${artifactPath} to ${destinationDir}`); const destPath = join(destinationDir, testName); - const overwritablePredicate = getOverwritablePredicate(packageName); - for (const packageSub of readdirSync(artifactPath)) { + const packageSubs = readdirSync(artifactPath); + const overWritableSubs = getOverwritableDirectories(packageSubs); + for (const packageSub of packageSubs) { const packageSubPath = join(artifactPath, packageSub); const destSubPath = join(destPath, packageSub); @@ -187,7 +218,7 @@ const copyServerTests = async (sourceDir, destinationDir) => { }, }; writeFileSync(destSubPath, JSON.stringify(mergedManifest, null, 2).concat(`\n`)); - } else if (overwritablePredicate(packageSub) || !existsSync(destSubPath)) { + } else if (overWritableSubs.includes(packageSub) || !existsSync(destSubPath)) { if (lstatSync(packageSubPath).isDirectory()) removeSync(destSubPath); copySync(packageSubPath, destSubPath, { overwrite: true, diff --git a/scripts/generate-clients/index.js b/scripts/generate-clients/index.js index ef3fb695a166..128df68ddaf9 100644 --- a/scripts/generate-clients/index.js +++ b/scripts/generate-clients/index.js @@ -48,7 +48,7 @@ const { await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); await copyServerTests(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR, PROTOCOL_TESTS_CLIENTS_DIR); - emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); + // emptyDirSync(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR); emptyDirSync(TEMP_CODE_GEN_INPUT_DIR); rmdirSync(TEMP_CODE_GEN_INPUT_DIR);