diff --git a/clients/client-accessanalyzer/runtimeConfig.browser.ts b/clients/client-accessanalyzer/runtimeConfig.browser.ts index d3895fe48b5cc..5f00a4bf24e3e 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 266c4ac75f484..cde2988196d82 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 8ccf5c5f00ec0..f7f45588b59c8 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 b19d12b030150..705b0b702bd63 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 19438c479c92b..5c4bbc1c069a4 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 540388f283c0f..93b913bbdddf4 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 385564aacfb88..05f24099b2a93 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 02576cf4a5051..803dbcc43df11 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 24710fe5920f5..032b5cbbc1dba 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 627bcdefb3eed..c7c2fb1eb5c7c 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 d3c954159b313..0da4e1b7fdf74 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 485d6d79d428d..5f0474bae64f4 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 6a802f698c314..db59b40bf4acb 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 37dbd643673d0..b35a5c5b8563d 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 79e3677b09114..19e68ce9d7a07 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 7988b4f0c3750..06157882a438e 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 08cf24decd85f..d51b219b57583 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 04d7bef9f6fb9..b4213d26a208c 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 e1ff634c30612..3d86a96ffff27 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 4cafe36391f64..760e56148f4a5 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 1aaddefb2186c..dd73740ffc3ee 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 b92765b60ded2..69d58ed9f03ba 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 6ed63c799d3d6..b68484771e1a5 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 1228edc5ec7b7..82252600702df 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 3009695c225de..8776ae6fcd2a2 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 6a4cea8aeb9fb..8db5111869a3f 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 d902bdb3ffedb..6263392d52b8e 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 ab777efdc5293..7d48472ffe6db 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 d6a8064caab11..88a6ea1609f43 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 48a31a85f1318..622e0f997fab9 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 831375ea5ab65..fb7b75780100a 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 fb069e599b622..24138da57ee24 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 875de387d1d49..224d17ccc2265 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 07e8d18f5ef6b..456afbbcf10c6 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 2f903feda05a8..43a4ec6346024 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 87fa950fb50b8..7e92c5178641a 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 eb774107f37cf..838833140adb6 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 18dff7e1e68f6..851f0aa0f6076 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 83fc2d3ee3991..bd9e538f766c2 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 9741793fa852f..0868eefe0a666 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 8e465cc48a04c..4dfc86aecc6ce 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 a789dd2fe4f40..ded52b4da78cf 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 f38588afa1411..02ae0264ef0c0 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 324ba16bc204e..2f7e0a37cbcfd 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 51c0a8469e984..df6628fd76e91 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 f7afb10a6c66d..f504bd54c7a9d 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 64c719a9dc8e0..d7ecc8a3fdce4 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 9e7b60f2dde04..486542dd45b15 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 ac54e3e96ab12..5f2df3d549a4c 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 1bf3cbfea8808..9660df46dd6ca 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 5f7399e6bf47b..e60f86337d26f 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 9657d05c985ae..f36cc250bf5de 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 8de6bb23120f5..29fea133cc639 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 88367effd7116..ef2336055b193 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 18c3b85790c0a..238845e4b1e98 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 a2a757663488b..1c3012b54287f 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 9340fdce146b0..e786dc2bee845 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 d1e15579df8fa..a2b58b68ca9f9 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 620194a353aab..41cbb47f62236 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 2340548fd8059..5659b80ca02d3 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 154251d25a30f..f61609d3bcfa1 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 92b23d8c926b5..6334d32e73b24 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 492b2b0a92447..a9d656fa056cd 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 e165bc2d36ee5..481e4586b40e8 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 51c779f60f58b..1a127f55ecc56 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 fd1245431ea98..715af80c0bf47 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 91e509070dee3..dc5fcdd0a58b2 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 9dbb6863abd37..704da81f8a954 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 94afd4c69fd93..d74dc16b6517e 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 42b4c685d62c7..3ffbb1813a487 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 41fc8c4d9cdd1..5d44e99b066e6 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 e0106ca0ccc7f..565b28f9646f3 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 f1bcb1e465b6a..d8ec991b98b22 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 1ab920a2547e7..04a95be0a8bf1 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 f303435e66c0f..5c1842a952c9d 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 c4948467f5613..e0596e00aa583 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 fbe936e1ec3bf..c76413d43aeda 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 0b394c83570c8..dd367e061d9ed 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 4834f533423f0..9b814cad013a6 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 a76c8c80bb87c..885f1972f4daf 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 318ee565e9418..2a8d1dd67aef6 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 6b6bd47484158..ae37dc897dfd1 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 76614ea2cb7aa..0f75b5f6dabe4 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 fd6f77e4a8630..4b1a0d4fa4c43 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 50a6d14a83126..b1d5dfb98327f 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 68b91cd4a7677..9137cd037f7d0 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 6bf9fafee104c..c1c0b24fca4b1 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 4a1cd0116c554..a1a8a355e729f 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 21881a3e84a6e..b421fd4b4c2bd 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 7d23d24661002..2d3578ee0fb37 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 e1256494cd524..20d217539d3e5 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 322ffd641f994..b07541a47c448 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 26ad2cd6dc1ad..95cf4fecf94ae 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 9230a3edfe30a..03990f5f30157 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 8d44a1462c2a5..1a65afce7c4dd 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 f6ac522cd8567..ddb3a8ea29e83 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 8a7981ef42a6a..c2e83c1970f2d 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 b33ea892e40b4..4a80d1bd8c393 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 6dedc161e346b..d6a93ec729e94 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 cb24b9688838b..5bbe3e6d56348 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 79315c3f0519a..85935d46fa30b 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 263f86f04c7a3..c5c2aed531a37 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 2db2d7d8d06d6..c712f778d85d5 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 497334c10cd0a..d39b59f6c1a7d 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 e209ad761646f..e58fd282e680b 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 73bb573704c5c..334b943427f42 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 54ebdb65bc169..c257dc78ff7b3 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 4cd9e04e7c278..c49c0857eca62 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 5e68f9d18bddd..f31677451e81e 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 d6d57fa580e3e..6bc1083fe1dfa 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 ace8c7f5e937f..d1c06d24464d1 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 d399205b0013d..90bc8144e7c13 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 10ca56c80dad3..1de41b3bd43f1 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 1816ab11a6c46..30b6f636e3248 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 42d3b8d21f670..5520c35361edf 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 9886143724d35..e078abd0a0da2 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 a5820b0e3c7eb..8a2dc6e7c4204 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 e79da1753faf9..2110f438d1332 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 e5d18e9f30b56..8b2cacbe499f4 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 e562141a7ff3e..afd5bfc37797b 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 4eadc599c97b1..59c6615296a57 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 2db9112e9d3c9..f49563e9367bb 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 1bdb31db3fe51..f6ccfa23b88d4 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 33fda76e29cc9..ce5fbd14aa16f 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 30cb36da4f60a..4ac58609525da 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 e7ac4035e9f31..1afc324e63656 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 22af83c5b64a5..7537a543fab70 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 c71ed505e0cb6..f10d2e2604952 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 9a2267815670f..ea4a99abc384d 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 9b7e753d75491..cdec0360512ee 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 fdfbcee258aa0..37b4948a5de5b 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 4b4234429245a..ff4b523953e4c 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 7935c014c867d..0443293ad2356 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 1310d0c9a6739..74f8c1bd72517 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 a26a88d5c3c36..271074be5529a 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 c8cb1e6fe6bba..8a417b31ee6c3 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 de043bcaeb1cb..e30090301ad7a 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 a425ef3525c80..d103f4861bcd5 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 e851195c6e2b1..cc5a30b4f9b29 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 011190a259af5..692cac3a9484d 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 13a780f7473df..309fdb68765b6 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 d9474da95fcec..34b5a5e7837ea 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 29e2dbb2fc3a3..24c82fc5ccb2d 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 ca0804209d78c..3daa98bdb43f3 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 ab13de455e019..92572943b2957 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 a16cef2a5fe0b..f31f6ce8fef6f 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 80cff7c4880f8..f9459ddb86202 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 9ada80c26276f..76ffe641cd418 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 f9f07dd88c220..723350a485986 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 57ec0d2df85c5..7984f05f957be 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 c719753aca8ed..24184a693bc51 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 15a5a26010614..fc80815c66097 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 9edcd1a78b431..a8b996771c453 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 943d9bba92e0f..e116b68f386ab 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 27726fe72b7fa..08565aca1826a 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 68807c8a88be9..f2b91cb1ce120 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 8f637477411b9..0122199650335 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 14db27281f130..cb35618f5a212 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 ec42c45324e8b..a55678ec8a8a0 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 0d454ec3f8c53..e07aea719d643 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 00ad40d242939..e105f21a8ef21 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 9f09e9b9c7e98..c11873e8ee4ae 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 f731ad3e19067..17fcc27c2eb3b 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 a73e7590ca7a0..322c36bf9c02d 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 e49595a4e64f0..1e8a53937e7d5 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 f82a57c9d0ee6..5bb93a2b41d5e 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 4decbb65a59c8..0cb8e20cb0bea 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 35bc8b3ded7a8..4e719854e512c 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 7549f9392956b..ca87b30a67fdd 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 54e390612449b..87be7570fb389 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 a03875716efb1..a03ba08abdfda 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 3b4d921c8cac4..80b400194bbef 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 0bd5e5f00a93f..0c9431a745f4a 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 a245856511e6a..8d64aa5f2f70d 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 d944bb9ab192a..97f7006aaab09 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 b713a7cf32ec0..f8e08718b5b1e 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 ceb3a613fe88a..9dc9c2fac106e 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 c9a651ce13db9..d57cfe46c1245 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 ad7b674af96a7..a99f80a0f3898 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 6ffb150c8680d..32f86d4e9c733 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 655fadfdcdf45..00a90e202ab7c 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 4c6d84fb67c97..d0a95a19390c4 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 5e4d2e6801ca4..f3a7437c5e00e 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 202f773f1dbfe..0a9425b8b49d7 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 02d5f070abe01..008e6bb8e2b19 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 1fda4dec9f436..4ab1685eafbff 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 51a95b877b0d3..7d47e1e91aaff 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 3bb9808fcc157..a49890d44856b 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 d932c778f3cf7..3da51b99388c0 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 f6fd36f662865..ffdbb77be694a 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 be62bd3a12f1e..2e37e581700df 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 b30ea34464436..74c73c189816d 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 163fef31407d1..54f1a8ea81f79 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 dd5dd1e44dec9..06e03fb7230e5 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 e4b3d11044386..eb5b492ca6f0d 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 0294567cafc71..0bb7fe257ee8e 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 60af51e9f0738..fae3fa58ddbb8 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 8492a53129c5e..58c99910ab216 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 18339da87c426..f03d78bea11c0 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 7ed7813d34f1b..5396c1ef7cad6 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 bfedc47689fee..9a82215696843 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 d3821264ca568..80ad97502a037 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 7aa426f5d4fee..53c0e07df1ba0 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 92690bf1686a8..7e898107a995b 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 e3ec59ef54418..472b1587576b4 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 6da04e101c95d..dce74c72a6239 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 ad2f8009b4523..1f5861569efd7 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 ecf6fa2a27382..52f27c3c86b25 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 afcc338daef59..72f109ca248ea 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 0a8e71f3a4a99..5510ebcb2ff22 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 daab9efa68808..f7bfd581c863a 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 4bd6cd47a25b4..761b2bd362f28 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 2b7d5f6d215bb..24a7c1f9a68af 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 2661b9ea9cdb1..e7819fbe466fa 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 d37beb7a9b835..5c934131a68c5 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 d88e33af0ee0e..f2dece56f913a 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 63908d39bff7c..185de25873beb 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 59c958d87fc85..05447738adc14 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 b2aaf4ce2ca68..95424ae31495c 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 61734a2dc09c0..e74c08b302746 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 ce7dc33795c53..43e393cc7f355 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 d924c8f133195..1c1fbe348ccdd 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 bca1aaa1f2f91..5818b4127e2f9 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 9d12c1e05f2cd..148bbd44b78d6 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 087acb0ba93b0..534258a061008 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 9cc51fa66449d..541ed86dc0540 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 da3bfc1fc5e77..2f24087746681 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 a733561770065..734add172cbc4 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 cd4e889888ca5..caeb9770f34fb 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 05dce3f9c3606..776639b17b623 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 b0db78e5d8fd8..57d7512e3d43c 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 ec93bba0faac7..c0381929632f2 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 be9ac386865eb..f9e793929c415 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 74979d0d98251..d409e982a33d3 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 663c06cbcdb29..699c6b0090e21 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 c254e970f9cc6..02ff6aabae1c1 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 5e00e6587103f..dd20e40cf1c89 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 3f0422a765585..6a8d17349fae2 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 f6e2cbe89c773..0f7b1ffa90fc8 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 cc250f0da546b..92c4c8cf5a542 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 80b3ae9dc3b10..79f9a7ae84c0d 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 e30c65207a14c..b5f743e7a0945 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 ea772058db8ac..56359a9a3c514 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 a7547acc12463..b9097342f3b62 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 5bad0de5183d4..cd7fece2f85e8 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 5bfadbb3ef081..4667a5c2ab41c 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 33b86ba14350d..c077cf8056a1d 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 53e9ad9e9cbbc..54ead025ac327 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 b91170c17a5bd..082b32aaf83df 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 d6d57a68583ab..e3da889e7e264 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 3a3a30d1bbd9a..7a26edc74f753 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 030cef8c304dc..9e58dda4a5a33 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 e2334efdc4208..a6857cc080f24 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 34d16bea3ee59..5ebb48efbb633 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 304751b45b9f6..4ae8b043dde55 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 bd89a403be659..cd88f709dde5a 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 2d5528cde6cc6..5826fce7e40f7 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 2ad209846f252..175282252bf55 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 0c2d2d4af17af..00928c07418c4 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 f7c7ac30994a3..96b16d9012d62 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 c2a244cda7c56..13b175e9d7170 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 0c61638e8cd9d..4a19734d1b9b4 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 a6ec2e7111b4b..d4338f572b76d 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 96195bef78f1b..b162ec3946857 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 c945aafce95a7..0af0b4b27b08b 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 048250220f71f..e95a72e99b175 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 e00aa4e19904d..1a22deed676dd 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 e1d082b807158..7809bd5d4cf65 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 e5c053bf9c861..582eba8129b71 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 b9e00b3d4c4c7..f80b61ad12279 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 e4e8983fe35ce..112131f119e6f 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 839e00f0db8a8..02ed064cdb33d 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 c340db953111b..7ff33e62d347d 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 bf308de7667e6..bf90dbf163a3a 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 215570e16ba94..068f6cb826e8b 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 e821ba9ad7f24..3dd25284e8ab6 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 74a2f5c4dff10..685baecac2467 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 29754840f0e4c..ebf74f069dee4 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 cb05a5a261fab..f9cdf5b39a910 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 a3bea7d9b1e46..8de4714b39ddc 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 6228da7cb30f8..3f16f83bc8159 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 1bdbbc26494be..4f358c1accbfd 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 4224d57db56db..ecf9d8c628e53 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 81e1e2917134f..36ee98ff4dfab 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 911a92b5d9188..e369172446d6b 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 59a82738976a4..2fe38d59a5b19 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 9727b9ba7e1d0..cbd3aecdff96f 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 026f33698cf55..a44e7ae607b07 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 b07fe815dacf4..b99c805916133 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 5dc204a62e751..eac7f43569ec7 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 5af9a28fec9cb..cf3d897679ce1 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 9aade7e0d6f1f..5ce8d1e7bd513 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 b58ac961424e8..36130f9dc5d7b 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 c40957151a739..599aca6bbcb1e 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 e9190049064fb..1e2648d1d5939 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 2e498ab0f6cef..0ed8efc0c8ca8 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 824482a976b09..709729c7db6cd 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 3341c93d1d5bc..0f81b4df9d179 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 791d2ac74bcfa..b80eb3005bef4 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 87bb983a4d726..2f4eb169ed66b 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 b4a7a87596183..be1ee8b3d757f 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 14fd0adae2b6f..f630ed21e32e6 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 36fe6b4116198..2469ccba760d2 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 284f9105f49f5..58934338380b7 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 24fd476ad78f3..f08e8c4b24e13 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 19d3d7c44435d..d6aa44181ac88 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 f69992be4b8aa..33c003f3a2aae 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 c9239cb7424b3..8d24cbaa34ce2 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 0d69938658279..ffd88107c7d08 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 76cc648439946..45d20275def3e 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 084c2ca80b6f5..a8c2ae41a4b14 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 4e405ac5778b4..1500f927bbaa5 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 b7cda41363887..546c16de03a3a 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 f6a066129dba2..ed5218b7641ca 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 ca6917dcc6469..dee631eccef12 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 017a0c90033df..31bde3af14bf6 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 8fc83b6151b14..62a984ec40625 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 25740861703b2..a1defe39de9d2 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 50db37959f502..aab6347f744bb 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 02062b80f4dcb..7a5de90ab6834 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 be9b4ebe64fc8..8cbd86a3959e5 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 4fbda83098a69..84748112b2a06 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 bf7683b8458a5..55b67ca11295c 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 b0dbf48d137e6..99b7c90218fbe 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 430c6992e5162..0ed9a7d37fba7 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 f31e91adfba2d..01fb4e780b29e 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 e9369207b9670..130909cc58376 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 51c9a952aa2c3..24ddf94d1806d 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 b3334bc42482c..e0bd4227defea 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 cdd4483a7c533..f9db094c1655b 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 8b482c343394e..6caa26acd1329 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 172655c3317ed..feab4e127a745 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 bb51fc55dd257..2d2e9b87c9c70 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 8dc4c8e7b74d7..0395b65c5e031 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 d23efee0458a4..b5f610186b747 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 d5e531eecb5fe..8fed787ba92c3 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 62d609e57fdc9..e28a58938926d 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 70d12c470e70a..a76a3742be46b 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 e7a53398f8dc1..144f0c864b489 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 6a239462849a7..90f87f0c1608b 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 fcb41b8305e06..7fa548a988417 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 f39aa5813283b..2c82760255545 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 1903832b65f7b..3ac2f4389a53f 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 706ed44a5a4e0..cc8dffe7df60b 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 805ebc4f07eef..03de71207550c 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 c28070a5e0f8c..4ca0cbfd389a4 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 b0b8409a13618..d1e66f6d3774c 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 ccbddc00e54aa..63df74b84c371 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 ea2803b7e022e..5c66b7fa9ce77 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 46322dfbfbe8c..26c869d53fd39 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 ad95a430ba3d7..a3bfa26157b5f 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 385535df4dbc7..cd67ea7ce8bf6 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 6b6f5803100e3..63d2fda584ae6 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 5a1d8137327ae..7ee21cc6fc02d 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 10ae99bbd83f7..ef06e8a029b90 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 dbf6c8f115641..28bea3383c9dc 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 2e65a8bb77872..760e60c653acf 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 9ab69006cdbff..5d70e176ce17e 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 505452b4a8cc2..c7bc71743b1f3 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 fd67f402027c8..c5844fa83c47b 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 b60a396d87433..8fbb1f94777e3 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 f0061b1cdec3e..c4856bd680fa6 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 e7376ed8f29e7..52cf89c111199 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 6821fa6852718..551077522070d 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 a4c27af53c917..d177fe44d1b7b 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 98e06446363ce..0e7adb89c8285 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 523379a181029..c76e8fefc7e2f 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 8d2740e983a6f..c058065572c98 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 3b2e5fefbb5eb..a84e0437cbd8c 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 034011c2a5d35..14fc1972ade07 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 e2b3407dd310c..8b932fecaf18f 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 fd54a4c03d763..8a845154b2f47 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 57957c140e63e..adaa1d0ffb055 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 056c3bd7a1cae..caeae680686f0 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 fc5beeb4817bc..861fb559db63d 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 8caa837b38d20..1c8e8cdf23119 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 ec0e50b0e13a8..e0ab494fd3882 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 8e40095a93c85..043e0d5ba1f72 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 3ecd54216d986..2e8e06dbb6754 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 20a594ac68920..211842b7595a5 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 2d994da08c0b2..d30c4e6a6e03f 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 0c1068696647a..ed7cb675b5ffd 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 96666485bb45d..6660f5cfbe75d 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 8e7d6e5d26e4c..1da38dbe7ee5b 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 2efa4794061ca..630912f02d258 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 163987ae525af..46ff651484c7f 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 0d9c66b6b0b98..7eb98c1bfe76a 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 82bd0ca8466ab..eb91c3b5a374e 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 852e3cbf0293a..b7e9e4f9a70e5 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 d19ba27cdb34d..df32d39212204 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 7073ca9a32a17..95c827eb66e18 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 0dade41b89870..1415ac46ae6f9 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 bc5f468181da2..ccb6758e9a514 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 e3ddd8e060eeb..73bc2fcac3289 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 38de2432e6492..b4cd2f4e86847 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 0e5d525f43940..b34478ea15e2e 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 b9428233d2be4..7c18d94135ea6 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 2c18dee7e37d6..59bbfd81e1956 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 a8cf08d1c4627..4d2b7949be890 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 db78c2011f3c5..d6a5286deda47 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 70799f5bfaa2c..4af3caae3a6ac 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 41ae1e006c6e1..675d7a838d20f 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 a22dbf3c9b6d9..cd59da498c545 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 855f775db6113..3fc4a83f81703 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 efcb64964b2a8..e897b5205b632 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 620186b13efaf..e2ce1ee81f16c 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 6e10f41cba4a0..817d2bc8927a7 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 21ff5f9159f05..5ff4d9e3e9955 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 3a04d3ae250e9..3375d8c3c0d56 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 b5cb15635c2bc..2dda547918f92 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 c53e422bae45a..d53ed016bbb39 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 a4d9143000c7c..2fb4abdb2d054 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 009e7cb082bd3..45697fc355549 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 6e03b1a3603a2..f108667776f19 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 6acedd3e5493d..5cb077f9dc820 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 d6081bc8e3db8..dd69f568c52e1 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 6fd6ac0154d99..6b8833566c21f 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 d47804eb07fb6..1d773bb1b4b8b 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 e39e2ac449ff4..96de7f5a545ed 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 2e5c2b93f264c..ef7a0bf425ca6 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 9def664cada41..5a68ca4434983 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 6dbd4c007822b..334866ea05e8a 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 d7ea624655181..dbab0f6547e6c 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 3f08bd42cd48d..0dd76afef7586 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 ae30d27da9040..40c433440d38a 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 c13e02b7c25f7..46445c1cd48b6 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 3d884982c9fc3..bd08ffa6d94c8 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 909f62e8cd226..2869c0a18ea90 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 a3632d7044820..7615f00c2045e 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 0b6dcfcd8a7e7..001707d029e64 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 b584306c08a6b..4ba8a3f3db1fd 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 b8ec6cc0c7962..db0a9bbb52589 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 d2b5d52cd9741..5f1f3cecbb163 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 76c84a150c3fd..249840f067945 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 4e29f2cc5c14e..b8867e891b053 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 a9912d37d1d1a..ac64facfb1e7a 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 b74af69fcfbdd..413f9deac1273 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 abb684ecd9c96..adf19cf93f089 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 2c08f2e49f0d8..59ddead7208af 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 bb8a5d2ee0251..aa1003d6ba27e 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 8c52b251146bf..401cebb4ac217 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 044e25fe8792f..0ead0a4aa57d3 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 59509e87e333a..214a06eb76f9e 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 560a47c3f23bb..154d48ba57e51 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 5040f33ba598d..a8c7533852012 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 80ba04fa6b2e9..90592bd6f8b73 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 72f52f13268cf..b0b29241c21fa 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 574e923cedfae..191e18f70a8c2 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 5553f4b46116a..1c51a1c63d02b 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 5b695722c15b7..647a2bd9ec919 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 6a994478aa74c..0a68ff83b4ecd 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 5e639cfa966c7..8042bbf692068 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 bfef6e555445e..d8fa2cb6eb724 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 701b0cc35f6b5..f992e2ab649ac 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 da6f0dbf4ea09..e84d268a68bfb 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 f07684723254d..c8aae876d9cba 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 566ffb121b613..7afbed16d2b27 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 e85a04b93b0cc..9c14cb839bdc8 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 fe8df7bbc439f..f0b1b406dfa4e 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 94dd11d78f4ce..fa68e5e4aaaf0 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 5a17c23f21661..dbd288ec84cd1 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 ffa52344e51ee..32346d57336df 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 24aa9abad813c..749b19072aeb5 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 5f65ebd623658..475a7d43b3b2c 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 e6bf685d3d0b7..ec22301ef8947 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 a0e0a26a92800..cb88b5fb4e56a 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 24a3490679b58..87d86b911834d 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 acfa42ee40ced..68707b8475f46 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 5811497c9d569..28de5cf3e337f 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 f4ca3196745bf..78f0ba4e4f7ee 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 c77c332887850..748b828c065e7 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 66c4c8dcb38ed..5073960e26583 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 ed2a642a66cf3..d1d2e4ae84bc1 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 e2dc8d83cdab8..f2c504292102f 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 812be93483f49..f2c648466388f 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 f73e319dd8c06..7fc4a8133bed7 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 9913cda5a827f..8de443b11266d 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 17de8197cecfd..45910532c2aab 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 256e035255742..924de6c0e1f2b 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 07fbfc92ac6a0..11d4be2c400c6 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 9eb2537da89c9..ee437b9a965c3 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 e064e6fc18fcd..581fca9e5e06b 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 5a5793d781d82..7618708bd8c83 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 3cb76938bbe94..244159902e88f 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 ca9da1a757f76..11754d57f0ee6 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 07a3f85dd817c..809e1be41e996 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 54cf5566169de..9f2d1d67ccf37 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 91934c4a3b204..f452e0f3b6531 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 fe654a06ee08a..d433cd48ceb29 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 b8480e11b568c..5011eb3b8ad89 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 a4c9bd469bf90..a4db5db5b163e 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 f7ad305379d68..13b4b9f5fdd82 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 44bb5812982f9..606f042a47719 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 aaabc89746e62..59a04b72b5b23 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 7e3153e6f5854..c0e8c308f9e9e 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 48b7b9a0bee6d..5ba477eef38c3 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 ac987cc62acd1..a6532a107533a 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 11f7741ba6cb6..8db703a78a687 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 efe9ef3131e83..1b22298e8de09 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 af620240a35ea..0955a2bf7660f 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 29bf7304fa86c..04da09a6e5787 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 4f810c0b95e0e..7ad1207542630 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 981d48f0d6090..195f511b14dc1 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 fd514c21cc4c7..3d2657783124f 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 3e600ffde421c..0415edfe9d1c0 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 724f828020edb..0758402b9721f 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 d9658124a9c9d..359b6d3c556e0 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 7c12fc54f5265..432b3b405d65b 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 f03f7d382f80b..5f06648756e98 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 3dce822679a7e..e71ff357b7392 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 56f6f0096f4a6..d4f858ef4a7cc 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 25157fa8b1cd0..08366094dce31 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 30ee8603cdc25..e1e8dc74ca98d 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 80dcc236e7413..906ff4ffc2f89 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 d6d80ec8cf6a9..87be4d64605d3 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 7cae259bd619c..0df9c60f8b8e8 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 45ab72b06ad2e..49dfaa65b36a2 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 3108081e4319a..1c62088ec8b7c 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 fb9f0c76b6909..d619d030aa618 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 9cacee7af8300..e195a8c6cc434 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 8aa54e7d5be10..8e2b2da493e62 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 430163b191722..3d7f2f4f3c31c 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 f306a536ed47b..6e709be0c39fe 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 cd2780120e91e..4ed685d59df3b 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 dd7b438a560fc..0e9b4dd5b5403 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 df1b8cad55fa2..b563e1a8bd3af 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 ec0c03f4e9c73..14174fdff0dff 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 48ba3bda00e65..0adb960912e2d 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 49ab16a748b6b..9fdfa6856ee48 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 ccde355e602f1..af762151143f0 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 66d62d984daa3..291046dc167b4 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 58c6a747d8d50..2fdd3997ac6a0 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 8c319862fbd27..ac22562c410d6 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 4407b576f65b2..d6847b12f0c04 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 e9250c21d0291..c5c92ec34b424 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 812572e280fa5..b98aa790b5237 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 aa28b30be66a7..49c28f4fac049 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 35a4bd461eb25..37c90663bfd26 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 20c1db8a2bca8..f9170625c10cb 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 344c435215e7e..7f70d55514a3f 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 6acedc3ac4623..56464348b1a00 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 43e2e572f227a..ea667db5e7ff2 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 ed26144685b08..ec1e7f7112e9d 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 e4a6cd1ccbd07..a8519bbe79ded 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 e90f14b5a0413..79261579e3562 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 c6091b8b4d82b..7e0e60bb5dff3 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 a1a6204c053d6..eb40e88a03624 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 066198b1b59d4..c413171238b7f 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 6338137043f71..adaff51d7d38c 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 23bfd3dc3db0f..386e5305795c2 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 d0b81dc6154b4..b3018256d8fba 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 fb610f178cf48..8eef6f679fd25 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 c265f4d442afb..52b4a73c2ebb3 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 1d66d0b54f822..de8f97859d4a3 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 30b48a5a8fe99..2fd4a11e61622 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 288f7d6c4e17f..bdac3d41173df 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 7408676eb9825..012de9be38123 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 365340444e167..c131eb6cc900f 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 5b8fc9388b788..07053bda9de1a 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 8be9ef410907e..5e66e7a9d26c7 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 d86916d518328..98135263aba72 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 98b9c709bb2f2..779d59b499d77 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 b978fa19a4d78..2351e4420bacd 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 b66adb3dce70d..82c78f566a4d8 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 b2d65f3b777c3..6c432c6b9cbe6 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 25f5a9d592fab..b6f3afad2bbdf 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 4e227fa248a65..25b0cb8de7b7c 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 2762e82352cd1..84c8b09cb8afd 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 f6923681db318..f5fbc1b1ec57d 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 3341bd0ee9ed9..b4208b04bc000 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 112299c36e226..46d6c7aa077c0 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 86d5c4134577f..0cd1b8c0dae22 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 4f54b9eedc989..69a5a14687b30 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 69fc8cd75484c..319816924f385 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 619af9f9bb7b4..2624a06a30ea7 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 6f78bc3f5f8fc..d88c64f9b99b9 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 2d82bad375aee..93ddaabb2d5c0 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 a669e2d9ab9f2..f75bdcf96a3f4 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 06b4664be87b8..066ff5635678a 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 3c0200b97cc9e..9fcb23352e77a 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 2700b3fd05ba4..f6451b061ed8a 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 276f093ebcbd2..c1b4ac75be1c9 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 b53b7b1a1615a..1c87d24ceb37e 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 3087e7b8802b9..bf125444536c2 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 abbddc2346954..5e9cd1e536256 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 e426e6f278901..4dc49db068a03 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 5274f00a8609b..c151af1a1b14e 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 fa8bb2dc76b75..84021cb128e52 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 418ea4aca1294..eb2eb0b01a94a 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 7397564ce63c9..666de68007669 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 cceb1836053b1..935ea38cb4a66 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 3b44eb8934f43..31ef1a3487839 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 1b6fc13cb50ff..d565d68ed084e 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 4368e814724ca..068ce95d4f572 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 8f46c4192aa0b..63c56ec86933a 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 5b9a549a97656..50aa6e7335d1d 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 3e3a444656216..033fc0bf126d7 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 10e6cf5ff294c..5cb29cdaf2156 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 a12436040ee1a..375e02df6627c 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 1f5c2b0f6a33a..d46ba64b929b6 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 040ca250a9472..13070113f4fe4 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 e5d45a76662d0..5709cd2413dab 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 d9bb45695592d..40a3a1fd6576b 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 ef8b50e627044..156018f859511 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 f44745868a7a5..fa946e6d4a559 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 3c19d736f8909..2fc68aba5d967 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 fe280a6f9615d..95d4cfecfddea 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 39754a4cf8428..19f173d42b474 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 76b49e3feab60..4fce14bae2644 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 3b172e7755937..bd3b739eb0edc 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 5352fdc5acf60..5f49afca340b8 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 f3ae75d4fa2ef..c952856655e22 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 3fbf35e9bc9e6..4338716c7d437 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 6d71cdb1608ba..bda51354b66a3 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 0b8d1cc98cf96..f58e465766d79 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 21c061cb189db..05f676d3d5cf1 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 0ec8c11082e1a..d4abdac9bda9c 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 ca0c181cd9de4..d22e9608f7c1c 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 4e974352baf7c..5891055cb9bab 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 e1b6bf5d16e15..a39ded4572e79 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 ef8555b91d422..aa568adb37b91 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 105e0ca05d7b1..bf6581a1ce412 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 8d9816594226c..e1465543f59e6 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 c3bcafd0c81b6..eeed2876c2c1e 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 bd25dbbbab898..74add981eb0d5 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 98ebe3cde2847..fa758311a0315 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 df973247d6493..0150d461a4618 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 f2b562a73c5ab..9c3eacbcf8322 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 e5afd986b30eb..f0e81766318f2 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 3e390f95bf0c7..3f754d99668ff 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 98a8ee63bb9fd..69eb25ecbce1e 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 4f37514777554..4bb505d3a7424 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 008c8091a976b..ede630012a769 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 f1f298346b0dc..32002583ad344 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 c683032c00f87..2b92cd9bd350a 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 6793ca40a4c20..789c573146de0 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 aaf82a9a5cfd4..4700269bd2a4d 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 9b2e162015dc3..d6673fb6f895d 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 2b32916e6c22a..5c7984e2685b7 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 3b56ca294a627..59c8044ace35a 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 ef5c6be00d289..80ea8a6150835 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 084dac9559777..b2e0cf8dc18cc 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 c22bfe26ba8b1..cdfcde30d2636 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 8cd81972763c0..fe9550718daeb 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 cb057712c8fde..cfc4f709a0d6b 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 3a751b4b222d6..2fc35ac9381b8 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 669ea733c60ab..0d668c406a639 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 d5934c07b2811..4d0fc28831a79 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 6ef6d68b02ec1..18c269ce94cf8 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 25cbecb27bbff..ca9333a714b05 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 3e2c9cb587654..eaa5d25fbd362 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 9599151ef9d29..d38f4ba011b9f 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 a9617495216aa..0997608db769b 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 4c3289e2ab143..123677904e754 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 4d4ead6fe67d7..2ea07c1177d65 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 4563ea96c1be1..9cf794aa2b274 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 8ea84f28f8619..c7c8757cc19c1 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 c7c3ca189128b..8b6528944b62a 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 6dac3f383e79c..063c145fc639a 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 5fc431332652b..b9e885ca7645a 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 2ccedecaa5472..4110308e53167 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 44c82053812b3..21419bebe7e30 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 728f474f18ecc..7d12cdb07b53d 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 d523b69a87e9c..4151534fa6ec9 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 a3495633c3c24..6bf2305cd942b 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 792d30700b483..a7cb857ad09b6 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 7001f097788ab..259ea3e789a77 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 326a7e962712b..dbb5d54dca04a 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 5fe79d1e8c567..f5e420954751f 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 da5e58626666c..3c1f5fe33ecd6 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 6bb9382910e1e..8cecb4ab28ac7 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 7dad56947cc2d..7a81c2614a260 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 efe9f90db4f35..bda05ea2741b4 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 e3dbbfa234740..12b5f834f04b9 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 4b3c9c238e169..4e0273b13b51f 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 dc53526af52d9..05ad709c93a0e 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 84380f92e1732..d968931bef9b7 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 8f5e5d84a8afc..1058d93bf5c14 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 c461ea8dec50a..9135f59d2cba5 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 00cd0b6005c9c..6f65abb4f1e2e 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 5f00924e2a741..4f7dcce4dbb46 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 d838283f8620c..c0be50b57dac3 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 1b3211ed0ff1c..4a0a7d0f02025 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 3ab63f8ce1911..52251d69b89d0 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 ac40489f0e23a..8e65970580fb2 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 0825a2ab1c987..6cf299daa5263 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 56d7908e2e5e1..458c7ed644269 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 6d8bcf9d9d9de..50155d71f7da1 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 ed32721bb8522..e72709e87ca1b 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 7025fda54b31c..7693357b511a1 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 9d285c35af901..9511d38fbdc78 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 1ab1c8a49c894..a9443fff210a3 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 7c7d4a8853d6a..4b7cdaacdc43f 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 a63434794260b..dc283a2c28e2d 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 c703dbd8f4662..e7fb05c9eaf77 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 785ca0e3ec602..6325f63ef7a18 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 f7920aa825c62..228fcd9ece7ea 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 9e43b514ab16e..49522ca7f95da 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 29e80ed508cc8..29adcafc4a746 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 ce36af66e5aea..ba98168a19387 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 bc171a2746de2..af22c936e7c20 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 485f148418d7b..3637313f70630 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 64e8c940eacd0..adcec5ac4db04 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 87c1d41fc0ceb..3299fe1cbe485 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 16a9d505d7a77..a9fe134863472 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 69cff771ce681..4cfd771c0d6c5 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 603cc97185fb2..33d7600f6eaf7 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 ccf1c50a576d6..820b6544d5e8f 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 153aa8c45af0f..55ec9b506f6c6 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 3d6f6a4a45d52..5ba5d70b74ef5 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 5a839ed0f96fd..99e7cc3ed331d 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 e3311b66ab3e9..4f59f538b9901 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 865321e6e99c9..7835ffe8c011e 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 471b293ad0a17..e1580f4a5bd3a 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 b10f89b162658..c2fa7896ea0bb 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 2b6e88a5da01f..5aed0aa81dda8 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 e4fc13fa6f3fa..114fd9a69ca8e 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 f67d42e6c0593..94db10392a7f2 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 e05c5fb038c49..b6b3d86ac06a7 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 a538f8f42bc72..024a66c3a3abf 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 41c0a0c965280..623cb67bbdc89 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 d3517fa03fc1d..92ab9d3131841 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 f5f8398866df2..354d5b5996b53 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 aba42ad804706..090fb22b55980 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 9055ca8cd9107..9e01bf68450c3 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 ec15971d92fed..50f9a66db5abf 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 b869a3b7c9577..ae4802e378d46 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 806a74c47848d..c8c281611d1d4 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 dde7a4e057b38..4dd19dbcceee9 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 628624017a9dd..a57f6a1ec2a22 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 97a8fe60841a1..2089db65bf851 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 a9257ead09177..34e1481a1c992 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 e5336c66a5cc8..5b3e345bf22b2 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 7607f909a6df3..e2aa538bc36fd 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 22ae53fecafbe..0872b41a15435 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 601b85ac70380..8a72ab60f70f6 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 4c665a6c8888d..0c4389d14de0c 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 f7b5378553241..fbf849c13917e 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 71c30bad757fc..dfeec1ecb7896 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 27206d3731dd0..432282e92d041 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 20a9b404e9783..3edadab78af5b 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 da8de8eb267af..9924d221b6421 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 7c5e202fc4531..014bc7e31a80e 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 d9d9cc0041825..4591a51e6a332 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 8d2c10edb3607..a29b440854083 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 f8f2c12423fbb..398257d03f1b9 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 20781da0ea8c4..4fabc99fb3d99 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 1706e94cceddf..9b4bc0de2938f 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 67c77040358a1..0b93ad83dc668 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 0e56e7650f4af..ce26b10b44b8e 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 a132b93eb6217..767b9edaba2b6 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 20fa04b024469..8775c20724962 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 49df9cac86aa6..ceebf16cc5198 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 9f17d2db5bb7b..cc354aaefc561 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 3c7259ec78f61..11da91c92f16a 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 747a282932c64..31e0dba0ff0b9 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 0d922925cdb44..71fb1d38b857c 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 4c0667c4243ea..a71d28378fc56 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 4f2e4256725ac..1e7a9fcb75b61 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 07467e00a47b5..56b7c5443ea67 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 1177cb74d56c6..805326fa8fdcc 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 aa08b29d51042..23953cabe1723 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 779410622d2a0..3c77f09768ffe 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 3658495c1e83e..094590baa564e 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 61e5cf3ce6a7e..3ac83afab8e33 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 87fa4a6f0b343..970d3989b14a8 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 f35cd83510d76..17879be9c2fa2 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 c249f5ab53d3d..009c93a3ff08b 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 a440e5069db1d..c0283e9c7df61 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 a727655a2f513..ad38344a46fb0 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 3d2a62b64e04f..9fa72c876aa81 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 f026a0a3e4b03..d3d6a246c0692 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 58e8cf8ad8f49..fb579d40154c5 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 4015f2544017b..9d6147b0e9524 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 d1c0828d25a0b..5ce6edc9bc937 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 f638ef945510f..11b550e290baa 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 044f652b2c445..fedf5201ca204 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 b4fce4cb0e12b..ae4e4ae823a46 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 999604c9bef4a..6770b3806a1d2 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 767db04f3ab6b..dffeb68a9fa9a 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 b94b6be0fb4da..a1a4a0cd1ee04 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 8765ff11cd6b5..b5c1e7ebd780e 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 d977240ead363..5a26506585a2d 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 9b463beb84014..d2f8f8d1858ce 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 065ccf920a7e7..6a00541adb7e1 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 a0ff77228c817..36887aedff5ad 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 c79df02063caf..a4c2c867f307a 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 9eba058728c00..f1b369469fdd0 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 4f9870929b46a..67b251451301b 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 8b2c6c14e77f8..fa24a372671cc 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 9ad20ca4a96e6..ecf27e50dc571 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 a7f9e0f378f34..a914d91fec8db 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 23a123eefc17a..839647f20d2e8 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 7d2ae936ec5e1..78921837f11f2 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 e0f5f13d2fd1d..dbb218d0b2a8f 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 809a741c840bf..d677f5f4a320b 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 37363e5753d95..ebf1f47ce8719 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 d4c88e4e15d67..acf001c36ae98 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 e8adb689433e3..0926c4fac30aa 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 64b1c5f789a95..5cc4bcd6af6d3 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 67f7f77fb6392..00861c48e6896 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 55bd445cc116e..a44c6c4121cce 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 98f169fb8f64a..56b95c40ee52a 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 894b7573b477f..c96f108bdcb04 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 6b21628b8fc30..4bff1490e1f0b 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 c5aa5cd97bb89..a1c69a276eb59 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 927d2bedc0393..41a3fda07474e 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 1dcf0b86b2711..4885571e663a1 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 e377a4a75d1ea..b5bef039d97b7 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 32c13d7598c0c..a4e260b604061 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 82fa0be9b2abe..9f2d3198267ae 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 9f4507e7aa594..5fc211137a1a0 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 4fe6da9bf39fd..afaad4cfa3c4d 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 a8a57b775c4b6..2a2884a3e3275 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 e990b456242e0..cd94f0fba434a 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 343db7124c772..7e2843fa6b574 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 ca2776424a65d..c9eb07fab5598 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 c80a2658d80ef..d23027f09cd38 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 e1d555a38cac4..9b3ed733470a9 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 bc666e2d58c08..12b90ee7d3ece 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 b4dba2df9990b..c9548e8db2e84 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 98df5a5eb18a6..c930926ad42e3 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 be3380eace31a..b3f26db10e55a 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 45876c0b79d8f..df44d70665091 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 c0c0706d18a29..03b6b8c512cad 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 0cf75193ab475..9432cc08026bf 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 f93ca644acdcb..4bfb1f7a10e13 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 ef6d2dbd99762..a266ae22e33aa 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 e0564e5a8238e..744f84174cc37 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 d5aec847b22d8..71c1aff64ef24 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 c081a64650bdf..9e9d6d2c42936 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 335a35f02382b..8355360e06256 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 67dd6e59172eb..f45a649fe17bd 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 00b1a3ceb69cf..fd19fde869f93 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 bc069be4e9fcb..87c181841e9e5 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 b8a13cb643270..07e718653551f 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 2cf0c6ef58251..dbd9763efea39 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 72971da9999e6..63b6fee7525bc 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 6faf5ebddc068..c6e0e5157049d 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 abdcd189ba88c..844cee839595e 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 ce9b088e5c688..de5c20dd8e04a 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 d3ebdd2048ad8..f4262dc563585 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 dc8652e37e107..b147faad5ce7d 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 c21da395d2706..8ad8425dd225b 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 767652fb30387..f833a3c7b0f7a 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 420ef059da3f2..0e0646e9542c3 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 21258d2b06c02..2169217105383 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 64f5ef11b5466..d592d717c4ae4 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 25a08e2ba2078..606ee7ac2e16b 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 1e6f1fbe9851b..aaf795bb4fb9f 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 bd7104fee816d..c891f5d588925 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 302f646f9d10e..01af7a7ba392b 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 efac281faf8f8..015fe85a5dc3a 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 64f58f4e9d11d..b494702cfa890 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 f943de048d1ca..c8a06cb888fb7 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 5b8e1c442b1dd..e4865992e51a7 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 e29da76721d14..abe4bf378dd1a 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 d6985490e34f6..ef7fe6dcd34d1 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 e3517c2243a4b..4492b5845167a 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 ccde1fd096ca4..43b8a123642a8 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 e2ebfee2f28db..a0e26f34412d4 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 a7d1ac2fb9cd4..9a8b4135c55fe 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 31de9c02513c0..7ec8a6d6b1234 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 e4cc864de2242..78c9d8f27f4b6 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 e2d776265092b..668341bc3ec97 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 8efb9ec87db3a..b38d48466e14f 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 092315d576395..9d5ae1dc693de 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 efbf888ece9c0..1a368ecfb5157 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 6b85b3db64a0f..c075ba67897a4 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 d182168dbc5bd..bb9446cf50ffb 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 d4984129669d7..7e2056de6197d 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 4f333a5049ede..0f18ef3fb2f40 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 2018025cfc0c4..efa640e5b9f5f 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 36fc446f16d8b..7e67981ac68c5 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 796d751ad1d1f..97fa844e91c99 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 7bb8c5fb3a949..6a1da302b0d11 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 0bca073628be9..4124dce7bed6a 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 f25034e479956..065c4d97995a3 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 8d3ce59c69b52..92ed0520ec6c0 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 60f546bb05e12..bf7ff9a5e396c 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 dc78beb9c19d1..469231b51bdfd 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 4b37f7bb7f887..5b7ceae1fb055 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 508c7214ef53a..34be1771f9ede 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 f536787204c99..d99ada3d60aed 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 b8a2f96f9c871..e547ad865d084 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 a97a0f1d4c7ac..1adb304caabce 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 43c8684ed0e90..69521077eed49 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 1c26b0a1abc64..aac945ff0ee46 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 be22313138b49..f2eda3b5da410 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 b556688a4e0de..fd42e8a9f29ec 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 175584c27044b..15f6a80c9dada 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 0b8b485ce4cde..5e6e3b0ee28e6 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 45f5967ffbb72..f9e4e459e84e3 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 bf3759005ba9c..caf23ab9cb5d6 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 98f5cf4e93edf..a02d35d1680e5 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 52c572fef6268..e7fff7ea5f088 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 6364c5699d110..a85f4b3c1fcda 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 9ba5924e7b1ae..bd76413b58aca 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 ee08e57f34bfc..3623abe9e6657 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 293220c6081e1..720b2f347059d 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 3298a80df5ac5..e2d3c8880448c 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 1ccaf3355f1fb..7cde3cc687e2d 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 54481603122b4..a39e27bbf482b 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 3e32b0d41c9ec..5b1dc7792bf69 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 11025a3644dad..eb67b5226435e 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 7038eac096f39..e6396937aaeac 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 0d54fd69fde54..f46bb72d44105 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 1cd4fed735955..8ba6d87994477 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 63774eeb34b54..ce890e22370d7 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 a35d12455b580..5fbaa0e3ffe58 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 01afcc816eace..21466de3636b2 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 f1914b2d98a26..0da9428b54bd9 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 80e5dbe762151..d0170ae61e537 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 83be1797fa2a6..b8b27934fcea3 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 6ae09cc64c458..ea2d942814c23 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 9bc57d96e4256..d386a510d55b6 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 6b0567f5bac46..3dc8e4ec387da 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 c9f4d428bb4e0..16fd0b48e170f 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 30221f33faec2..97cb2331e4781 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 de21008ccece1..a1d8a60e83cc3 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 2ca15836a718c..e45809a11815d 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 98e211579e0de..cc1a203d22e78 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 14e5b4fce867e..298cdea303d66 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 be7cf1d954166..bc18e3d32f515 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 42c8cfcd7bbbc..9ed4b5eded4fc 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 f2a99154fbc18..98d4eb79875e2 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 7feed2fbf4ff2..5a6736b460aa8 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 06adc9c67b0ae..b4fdad32e8ee2 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 97bff76a99bba..b51f7361c90d6 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 649f29a9de638..b4ded618bc748 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 c9265b7649404..edb372f6e8b7b 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 b0be125b7d3a6..44a38fb0ae2ce 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 58febb05226e0..410f709957323 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 e6590b83cc0a3..04fb9d6765ecb 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 ecf866367fb08..9f59f23ccdc85 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 c2a9a141a1629..0c43975e9789a 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 f803a4e18efac..36621e75bf9b5 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 896632286aefe..ec3037c48d38b 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 400a7a3e233f8..869ac6e9a1850 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 32b353f28802e..7ac887f1813b9 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 16e2f0fd4be0b..3b001a687897d 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 03eaa0befec45..b923449c4df9d 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 75c5f9551b6ea..e80e574fe9920 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 dbcada6f525c8..c32f29b5da208 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 c0b85031cbd38..f2b22e206414d 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 e2a702e158b3f..ce0dcb33a6f00 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 7d77a2af14699..e607e33048dc9 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 3c061b2533130..6a4fa58ae2114 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 cd8475128f2c1..2c4d73eaa4e94 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 2e4c16b966332..3a4acb105dc34 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 680872d9349c3..8eed773e9eea9 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 7988e0eb15384..444bdee7ba8a8 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 9bf283274efac..67ea5ac0e920f 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 80ffab53f4e2b..45ca88d4dcc82 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 c1378d3abd0f8..5bbb4b923b958 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 91d340b352ae7..26a3edf7c9b1b 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 870fed24d2715..378bd99a500da 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 d74d757d9b2ce..26360b8e3e6b7 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 ce56e55d1f442..b5dad9ecbca34 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 61b5d998b284c..c9fd7ad6e9da4 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 0dd6079c42e5c..97b796f978d73 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 dccf3d4b5e68f..9cf8c8ad0df50 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 25f316d6c42b3..1331b6fa83d76 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 20f52f6e12874..e3f090188482a 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 c2f97e8dd2793..fddf06063acbe 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 45f8d5f7c991d..13bb1298a07f5 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 8ec31254e6a04..660a260e8e1c5 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 fab0909af83d8..8eb01eaa33572 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 d389b5a7a9469..44b28ff9ce841 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 2bfe051357257..4cccc72dbc6ed 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 a9cdfed808adb..2d52470917277 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 9dbba54c28989..56fba615e3e3e 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 779f98e61ba13..5a538b7b3d92f 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 ec07027d7456a..d3adbe91a5151 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 5920915165443..65558141959b4 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 6ab81a671fc8c..29ddf902eb886 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 9b739eaec3244..503c6db98c5b8 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 3c90e1f3b228e..f5b0a9171dd23 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 97d8106dd019d..5e9686124986e 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 294acfc53c83c..ed17b62459eb7 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 8664ef899474b..244c3fa30fb1d 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 9a6943b356a8f..fc30cb1b0590c 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 745e137718d1a..b3829f8c8a5b2 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 eeacc76819636..c0db11b6aaa85 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 1dcb396ea01c0..3894e6e30cecd 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 f4d246d931754..df75366396b02 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 c1441744dea21..b4d8b853c2feb 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 21c2d15e9f243..607c005f11d68 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 5565fe93308be..d2ccd98f6e457 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 62c924c70c085..64eca773ab1fb 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 05c945ea146cd..6b6f838e8970a 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 81f6f5d3b83a7..6da8752bd6143 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 51160dde4fb13..6b2e9c6194d46 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 7047a77a820fd..a3921c0b95ca1 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 777ec6fdfa73d..14c6ba0e6bf49 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 98af351b6ebb9..2ad5a321cb709 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 fc04f407df250..fc56d02697d78 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 500fc82525e8f..65731f7a39be1 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 f16e15482f3e8..faf5a2f3ec8f9 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 68b392eb17a60..fce88ef54a886 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 4eb4d35993196..439055d2d04a4 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 8201f02ac15b7..b1672de682a0c 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 5c883695cf1c9..77dcf6b234d2c 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 06f63b2bb6d8b..ac3228f04d765 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 31cd8600f4cb0..5dbfd2cada88d 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 cc722ef73066b..7a44381e0fb94 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 ab83cb7582578..785a0b1571f0b 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 a7879849e904e..97f441bf5a473 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 bb1305a14bdaf..f4ba29ed5ca9d 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 d76dfdc9941d3..4ba5631077fdf 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 240dd093378eb..4e61159d2c0e1 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 5ab08585e150c..0e357fe98937d 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 5e38480f08199..5326c3a9b051f 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 3b0920787d3b5..2bfdc7616f0e3 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 eb199ba32ad93..e798be9fccdbf 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 7d7d178e3a7bc..3f5c28d78d163 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 0643e5a866da8..8b143e47108b9 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 20800593eea35..c9fd4f0ecef2e 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 0a9677839d3ef..5fc1f5a6964ab 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 c935344cb3493..e81e924313302 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 81e2c09d1e333..7c23ad59edfa9 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 f23d625d6f8b8..fbca279ab0028 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 8c7110d1f8768..7f210dd95861a 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 393cf487309d2..65f9786befcac 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 d3f706bb49246..d8a590fbbdbe1 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 d4fde6829f2b9..09e552977d4e3 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 5526af7278290..14f75f01a029d 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 655db52b9eab4..80f34e9467fa7 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 21871088e47a8..ff090c6a6c622 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 5262e3c42aa7e..998720b189aa1 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 d736fdbddfe04..81f21593a83ba 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 9478e7b53fa21..088ec05b468ac 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 831f83e11288a..f5d9de40c6c04 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 3000fdd06a9f7..d9e89d5b7b8b0 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 665409ef182b4..84193d8988d5d 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 d8a93a8923349..5aa2f463abf61 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 20ff9e8f7c468..72d9eae09ed14 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 75f51487e71e7..57fab14d953cb 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 435f962d3fdf1..73afd7903ca34 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 8b568f175109c..49624837c050c 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 3e977bd97de9e..762a454a54d81 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 8067dbeff2940..fa8c97dc6e385 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 666c095ad793f..4b68edfd526cb 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 6e88163458e9c..b33b1d713ce26 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 8fafd5563714c..df3b0dc232d01 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 86c51fd783bd7..2f4a6cdb182d0 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 c919ba5d2e247..bf895f24b3879 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 666dcb9e9026e..3baa535aa9b15 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 41c548e4195ab..0e550520c5d7f 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 fe7fa9d41a6a0..90eb746787937 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 d3fafac440cf0..e76acfdeeb886 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 7474155cd9ad2..c287bba649984 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 78b9167a02013..3a92cce4795a8 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 cb415fef94aec..8fd81cd63cd5b 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 7f963d040b929..0e5273436ed91 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 edd73435c1d5c..f5b5baf3f3f6c 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 f9610014752c8..7bec8729fc9a7 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 456492b61b644..190eac1bbc633 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 4a63088482c14..ef47be7e3d065 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 876372d6c77bd..435144d996554 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 dae1040ee6fdc..a23b63e38cabd 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 85ca4e5c72e4f..d055816d988c2 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 cc8baefeae036..6225607d715fc 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 65ca0e7616d97..3d550c3e6d554 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 fbf455b7f1e97..82d3a1cd3f34c 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 dd18da03ced81..0a95c5bc8fa17 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 c07187a5594e7..afd6df75ff590 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 9b94c9027ad2a..84de55eb48624 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 7932c62aa8441..f218ec877cfb4 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 8f7a3d0afb665..1fb7f78c6a3e0 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 69f67b1e144eb..920fabf5eaeab 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 4ae8cc7c1ca4a..1dec89ee7108e 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 c714f84eb8a60..8cbf5640d8759 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 e84fedd14c958..18fff60e860f6 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 3dd54b5611271..4bba2bbb89525 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 c4fc372102c87..708d53bc56f54 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 68da984870c0a..1939fcce20746 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 6b75cc64d2538..f468922b2b005 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 096e7be6ce9d5..e6edff2e1ed32 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 7024dff3ee084..5d8b2cdf772e1 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 b9b10c500e0e1..11ed8d938354d 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 8dc3fe2581cab..16b874f11e458 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 43f6dea5e272f..273795b696f9b 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 0e5503c96920b..05554aad747ea 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 2f471aea3d609..a326d696cc739 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 eb320f28d3381..3eae6cafc0a21 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 b29dc2a02d2d6..86ac2fe07c66c 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 78890da3c2fcb..c31339d4e4f8c 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-query/tests/functional/awsquery.spec.ts b/protocol_tests/aws-query/tests/functional/awsquery.spec.ts index 3ee7927adf461..9da18f01a1a7d 100644 --- a/protocol_tests/aws-query/tests/functional/awsquery.spec.ts +++ b/protocol_tests/aws-query/tests/functional/awsquery.spec.ts @@ -607,7 +607,6 @@ it("QueryComplexError:Error:GreetingWithErrors", async () => { Sender ComplexError - Hi Top level bar diff --git a/protocol_tests/aws-restjson/RestJsonProtocol.ts b/protocol_tests/aws-restjson/RestJsonProtocol.ts index 401bd8dae9c74..f69f1655be000 100644 --- a/protocol_tests/aws-restjson/RestJsonProtocol.ts +++ b/protocol_tests/aws-restjson/RestJsonProtocol.ts @@ -44,6 +44,11 @@ import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput, } from "./commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommand, + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "./commands/HostWithPathOperationCommand"; import { HttpEnumPayloadCommand, HttpEnumPayloadCommandInput, @@ -501,6 +506,35 @@ export class RestJsonProtocol extends RestJsonProtocolClient { } } + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): void; + public hostWithPathOperation( + args: HostWithPathOperationCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: HostWithPathOperationCommandOutput) => void), + cb?: (err: any, data?: HostWithPathOperationCommandOutput) => void + ): Promise | void { + const command = new HostWithPathOperationCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + public httpEnumPayload( args: HttpEnumPayloadCommandInput, options?: __HttpHandlerOptions diff --git a/protocol_tests/aws-restjson/commands/HostWithPathOperationCommand.ts b/protocol_tests/aws-restjson/commands/HostWithPathOperationCommand.ts new file mode 100644 index 0000000000000..34763d1b309a2 --- /dev/null +++ b/protocol_tests/aws-restjson/commands/HostWithPathOperationCommand.ts @@ -0,0 +1,76 @@ +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; +import { + deserializeAws_restJson1HostWithPathOperationCommand, + serializeAws_restJson1HostWithPathOperationCommand, +} from "../protocols/Aws_restJson1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +export interface HostWithPathOperationCommandInput {} +export interface HostWithPathOperationCommandOutput extends __MetadataBearer {} + +export class HostWithPathOperationCommand extends $Command< + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, + RestJsonProtocolClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: HostWithPathOperationCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: RestJsonProtocolClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "RestJsonProtocolClient"; + const commandName = "HostWithPathOperationCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (input: any) => input, + outputFilterSensitiveLog: (output: any) => output, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: HostWithPathOperationCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_restJson1HostWithPathOperationCommand(input, context); + } + + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return deserializeAws_restJson1HostWithPathOperationCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/protocol_tests/aws-restjson/index.ts b/protocol_tests/aws-restjson/index.ts index 2ce6c57683c58..12efcdf0ce7fa 100644 --- a/protocol_tests/aws-restjson/index.ts +++ b/protocol_tests/aws-restjson/index.ts @@ -9,6 +9,7 @@ export * from "./commands/EmptyInputAndEmptyOutputCommand"; export * from "./commands/EndpointOperationCommand"; export * from "./commands/EndpointWithHostLabelOperationCommand"; export * from "./commands/GreetingWithErrorsCommand"; +export * from "./commands/HostWithPathOperationCommand"; export * from "./commands/HttpEnumPayloadCommand"; export * from "./commands/HttpPayloadTraitsCommand"; export * from "./commands/HttpPayloadTraitsWithMediaTypeCommand"; diff --git a/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts b/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts index 3261cd324a82e..ba4060c0a0f25 100644 --- a/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts +++ b/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts @@ -25,6 +25,10 @@ import { EndpointWithHostLabelOperationCommandOutput, } from "../commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommandInput, GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand"; +import { + HostWithPathOperationCommandInput, + HostWithPathOperationCommandOutput, +} from "../commands/HostWithPathOperationCommand"; import { HttpEnumPayloadCommandInput, HttpEnumPayloadCommandOutput } from "../commands/HttpEnumPayloadCommand"; import { HttpPayloadTraitsCommandInput, HttpPayloadTraitsCommandOutput } from "../commands/HttpPayloadTraitsCommand"; import { @@ -442,6 +446,28 @@ export const serializeAws_restJson1GreetingWithErrorsCommand = async ( }); }; +export const serializeAws_restJson1HostWithPathOperationCommand = async ( + input: HostWithPathOperationCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const headers: any = { + "content-type": "application/json", + }; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HostWithPathOperation"; + let body: any; + body = ""; + return new __HttpRequest({ + protocol, + hostname, + port, + method: "GET", + headers, + path: resolvedPath, + body, + }); +}; + export const serializeAws_restJson1HttpEnumPayloadCommand = async ( input: HttpEnumPayloadCommandInput, context: __SerdeContext @@ -2020,6 +2046,49 @@ const deserializeAws_restJson1GreetingWithErrorsCommandError = async ( return Promise.reject(Object.assign(new Error(message), response)); }; +export const deserializeAws_restJson1HostWithPathOperationCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return deserializeAws_restJson1HostWithPathOperationCommandError(output, context); + } + const contents: HostWithPathOperationCommandOutput = { + $metadata: deserializeMetadata(output), + }; + await collectBody(output.body, context); + return Promise.resolve(contents); +}; + +const deserializeAws_restJson1HostWithPathOperationCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __SmithyException & __MetadataBearer & { [key: string]: any }; + let errorCode: string = "UnknownError"; + errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + default: + const parsedBody = parsedOutput.body; + errorCode = parsedBody.code || parsedBody.Code || errorCode; + response = { + ...parsedBody, + name: `${errorCode}`, + message: parsedBody.message || parsedBody.Message || errorCode, + $fault: "client", + $metadata: deserializeMetadata(output), + } as any; + } + const message = response.message || response.Message || errorCode; + response.message = message; + delete response.Message; + return Promise.reject(Object.assign(new Error(message), response)); +}; + export const deserializeAws_restJson1HttpEnumPayloadCommand = async ( output: __HttpResponse, context: __SerdeContext diff --git a/protocol_tests/aws-restjson/runtimeConfig.browser.ts b/protocol_tests/aws-restjson/runtimeConfig.browser.ts index b99a9b6741495..3c78225503dec 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 978c64237b949..6bd6635f2547b 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 9f0ad3a7fef5f..98d03051adb9e 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 5e285bcb061d6..3c82965fc08ed 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-restjson/tests/functional/restjson1.spec.ts b/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts index 50dcb70da407b..b0087892ab41a 100644 --- a/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts +++ b/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts @@ -8,6 +8,7 @@ import { EmptyInputAndEmptyOutputCommand } from "../../commands/EmptyInputAndEmp import { EndpointOperationCommand } from "../../commands/EndpointOperationCommand"; import { EndpointWithHostLabelOperationCommand } from "../../commands/EndpointWithHostLabelOperationCommand"; import { GreetingWithErrorsCommand } from "../../commands/GreetingWithErrorsCommand"; +import { HostWithPathOperationCommand } from "../../commands/HostWithPathOperationCommand"; import { HttpEnumPayloadCommand } from "../../commands/HttpEnumPayloadCommand"; import { HttpPayloadTraitsCommand } from "../../commands/HttpPayloadTraitsCommand"; import { HttpPayloadTraitsWithMediaTypeCommand } from "../../commands/HttpPayloadTraitsWithMediaTypeCommand"; @@ -1862,6 +1863,34 @@ it("RestJsonInvalidGreetingError:Error:GreetingWithErrors", async () => { fail("Expected an exception to be thrown from response"); }); +/** + * Custom endpoints supplied by users can have paths + */ +it("RestJsonHostWithPath:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + endpoint: "https://example.com/custom", + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new HostWithPathOperationCommand({}); + try { + await client.send(command); + fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown"); + return; + } catch (err) { + if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) { + fail(err); + return; + } + const r = err.request; + expect(r.method).toBe("GET"); + expect(r.path).toBe("/custom/HostWithPathOperation"); + + expect(r.body).toBeFalsy(); + } +}); + it("EnumPayloadRequest:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, diff --git a/protocol_tests/aws-restxml/runtimeConfig.browser.ts b/protocol_tests/aws-restxml/runtimeConfig.browser.ts index 49803e04c2974..ff3ee52ad04e5 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 8572900c816cf..cb50ba51bcb88 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 66a4b4725f53d..d3d1efaee5ac8 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 3206b7e4092f4..4c4f87baff9a8 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, }; };