@aws-sdk/core 3.974.9 → 3.974.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.js +4 -6
- package/dist-cjs/submodules/client/index.browser.js +595 -0
- package/dist-cjs/submodules/client/index.js +715 -0
- package/dist-cjs/submodules/client/index.native.js +588 -0
- package/dist-es/index.js +3 -3
- package/dist-es/submodules/client/index.browser.js +36 -0
- package/dist-es/submodules/client/index.js +26 -4
- package/dist-es/submodules/client/index.native.js +37 -0
- package/dist-es/submodules/client/middleware-host-header/hostHeaderMiddleware.js +33 -0
- package/dist-es/submodules/client/middleware-logger/loggerMiddleware.js +42 -0
- package/dist-es/submodules/client/middleware-recursion-detection/configuration.js +7 -0
- package/dist-es/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.js +3 -0
- package/dist-es/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.js +7 -0
- package/dist-es/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.browser.js +1 -0
- package/dist-es/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.js +29 -0
- package/dist-es/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.native.js +1 -0
- package/dist-es/submodules/client/middleware-user-agent/check-features.js +49 -0
- package/dist-es/submodules/client/middleware-user-agent/configurations.js +28 -0
- package/dist-es/submodules/client/middleware-user-agent/constants.js +7 -0
- package/dist-es/submodules/client/middleware-user-agent/encode-features.js +18 -0
- package/dist-es/submodules/client/middleware-user-agent/user-agent-middleware.js +82 -0
- package/dist-es/submodules/client/region-config-resolver/awsRegionConfig.js +2 -0
- package/dist-es/submodules/client/region-config-resolver/extensions.js +15 -0
- package/dist-es/submodules/client/region-config-resolver/stsRegionDefaultResolver.browser.js +3 -0
- package/dist-es/submodules/client/region-config-resolver/stsRegionDefaultResolver.js +15 -0
- package/dist-es/submodules/client/region-config-resolver/stsRegionDefaultResolver.native.js +3 -0
- package/dist-es/submodules/client/util-endpoints/aws.js +10 -0
- package/dist-es/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.js +25 -0
- package/dist-es/submodules/client/util-endpoints/lib/aws/parseArn.js +18 -0
- package/dist-es/submodules/client/util-endpoints/lib/aws/partition.js +41 -0
- package/dist-es/submodules/client/util-endpoints/lib/aws/partitions.js +1 -0
- package/dist-es/submodules/client/util-endpoints/lib/isIpAddress.js +1 -0
- package/dist-es/submodules/client/util-endpoints/resolveDefaultAwsRegionalEndpointsConfig.js +21 -0
- package/dist-es/submodules/client/util-endpoints/resolveEndpoint.js +1 -0
- package/dist-es/submodules/client/util-endpoints/types/EndpointError.js +1 -0
- package/dist-es/submodules/client/util-endpoints/types/EndpointRuleObject.js +1 -0
- package/dist-es/submodules/client/util-endpoints/types/ErrorRuleObject.js +1 -0
- package/dist-es/submodules/client/util-endpoints/types/RuleSetObject.js +1 -0
- package/dist-es/submodules/client/util-endpoints/types/TreeRuleObject.js +1 -0
- package/dist-es/submodules/client/util-endpoints/types/shared.js +1 -0
- package/dist-es/submodules/client/util-user-agent-browser/configurations.js +1 -0
- package/dist-es/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.js +20 -0
- package/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.browser.js +1 -0
- package/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.js +53 -0
- package/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.native.js +18 -0
- package/dist-es/submodules/client/util-user-agent-node/crt-availability.js +3 -0
- package/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js +36 -0
- package/dist-es/submodules/client/util-user-agent-node/getNodeModulesParentDirs.js +15 -0
- package/dist-es/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.js +10 -0
- package/dist-es/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.js +14 -0
- package/dist-es/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.js +9 -0
- package/dist-es/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.js +75 -0
- package/dist-es/submodules/client/util-user-agent-node/is-crt-available.js +7 -0
- package/dist-es/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.js +9 -0
- package/dist-types/api-extractor-type-index.d.ts +3 -2
- package/dist-types/index.d.ts +12 -14
- package/dist-types/submodules/client/index.browser.d.ts +47 -0
- package/dist-types/submodules/client/index.d.ts +38 -4
- package/dist-types/submodules/client/index.native.d.ts +48 -0
- package/dist-types/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts +35 -0
- package/dist-types/submodules/client/middleware-logger/loggerMiddleware.d.ts +4 -0
- package/dist-types/submodules/client/middleware-recursion-detection/configuration.d.ts +5 -0
- package/dist-types/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts +5 -0
- package/dist-types/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +5 -0
- package/dist-types/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.browser.d.ts +6 -0
- package/dist-types/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.d.ts +6 -0
- package/dist-types/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.native.d.ts +6 -0
- package/dist-types/submodules/client/middleware-user-agent/check-features.d.ts +20 -0
- package/dist-types/submodules/client/middleware-user-agent/configurations.d.ts +44 -0
- package/dist-types/submodules/client/middleware-user-agent/constants.d.ts +7 -0
- package/dist-types/submodules/client/middleware-user-agent/encode-features.d.ts +5 -0
- package/dist-types/submodules/client/middleware-user-agent/user-agent-middleware.d.ts +18 -0
- package/dist-types/submodules/client/region-config-resolver/awsRegionConfig.d.ts +15 -0
- package/dist-types/submodules/client/region-config-resolver/extensions.d.ts +16 -0
- package/dist-types/submodules/client/region-config-resolver/stsRegionDefaultResolver.browser.d.ts +4 -0
- package/dist-types/submodules/client/region-config-resolver/stsRegionDefaultResolver.d.ts +14 -0
- package/dist-types/submodules/client/region-config-resolver/stsRegionDefaultResolver.native.d.ts +4 -0
- package/dist-types/submodules/client/util-endpoints/aws.d.ts +2 -0
- package/dist-types/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.d.ts +5 -0
- package/dist-types/submodules/client/util-endpoints/lib/aws/parseArn.d.ts +7 -0
- package/dist-types/submodules/client/util-endpoints/lib/aws/partition.d.ts +38 -0
- package/dist-types/submodules/client/util-endpoints/lib/aws/partitions.d.ts +638 -0
- package/dist-types/submodules/client/util-endpoints/lib/isIpAddress.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -0
- package/dist-types/submodules/client/util-endpoints/resolveEndpoint.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/types/EndpointError.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/types/EndpointRuleObject.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/types/ErrorRuleObject.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/types/RuleSetObject.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/types/TreeRuleObject.d.ts +1 -0
- package/dist-types/submodules/client/util-endpoints/types/shared.d.ts +1 -0
- package/dist-types/submodules/client/util-user-agent-browser/configurations.d.ts +7 -0
- package/dist-types/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.d.ts +14 -0
- package/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +1 -0
- package/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts +27 -0
- package/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts +18 -0
- package/dist-types/submodules/client/util-user-agent-node/crt-availability.d.ts +8 -0
- package/dist-types/submodules/client/util-user-agent-node/defaultUserAgent.d.ts +28 -0
- package/dist-types/submodules/client/util-user-agent-node/getNodeModulesParentDirs.d.ts +10 -0
- package/dist-types/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.d.ts +6 -0
- package/dist-types/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.d.ts +8 -0
- package/dist-types/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.d.ts +8 -0
- package/dist-types/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.d.ts +6 -0
- package/dist-types/submodules/client/util-user-agent-node/is-crt-available.d.ts +5 -0
- package/dist-types/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.d.ts +13 -0
- package/dist-types/ts3.4/api-extractor-type-index.d.ts +0 -2
- package/dist-types/ts3.4/index.d.ts +65 -3
- package/dist-types/ts3.4/submodules/client/index.browser.d.ts +116 -0
- package/dist-types/ts3.4/submodules/client/index.d.ts +123 -4
- package/dist-types/ts3.4/submodules/client/index.native.d.ts +116 -0
- package/dist-types/ts3.4/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts +29 -0
- package/dist-types/ts3.4/submodules/client/middleware-logger/loggerMiddleware.d.ts +17 -0
- package/dist-types/ts3.4/submodules/client/middleware-recursion-detection/configuration.d.ts +3 -0
- package/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts +4 -0
- package/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +4 -0
- package/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.browser.d.ts +5 -0
- package/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.d.ts +5 -0
- package/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.native.d.ts +5 -0
- package/dist-types/ts3.4/submodules/client/middleware-user-agent/check-features.d.ts +20 -0
- package/dist-types/ts3.4/submodules/client/middleware-user-agent/configurations.d.ts +21 -0
- package/dist-types/ts3.4/submodules/client/middleware-user-agent/constants.d.ts +7 -0
- package/dist-types/ts3.4/submodules/client/middleware-user-agent/encode-features.d.ts +2 -0
- package/dist-types/ts3.4/submodules/client/middleware-user-agent/user-agent-middleware.d.ts +21 -0
- package/dist-types/ts3.4/submodules/client/region-config-resolver/awsRegionConfig.d.ts +8 -0
- package/dist-types/ts3.4/submodules/client/region-config-resolver/extensions.d.ts +14 -0
- package/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.browser.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.d.ts +7 -0
- package/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.native.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/aws.d.ts +2 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.d.ts +4 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/parseArn.d.ts +2 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partition.d.ts +28 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partitions.d.ts +647 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/lib/isIpAddress.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/resolveDefaultAwsRegionalEndpointsConfig.d.ts +35 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/resolveEndpoint.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointError.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointRuleObject.d.ts +6 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/types/ErrorRuleObject.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/types/RuleSetObject.d.ts +5 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/types/TreeRuleObject.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-endpoints/types/shared.d.ts +12 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-browser/configurations.d.ts +4 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.d.ts +9 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts +22 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts +17 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/crt-availability.d.ts +3 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/defaultUserAgent.d.ts +21 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getNodeModulesParentDirs.d.ts +1 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.d.ts +2 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.d.ts +3 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.d.ts +3 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.d.ts +4 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/is-crt-available.d.ts +2 -0
- package/dist-types/ts3.4/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.d.ts +6 -0
- package/package.json +27 -8
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const no = Symbol.for("node-only");
|
|
2
|
+
export const emitWarningIfUnsupportedVersion = no;
|
|
3
|
+
export const state = no;
|
|
4
|
+
export { getLongPollPlugin } from "./longPollMiddleware";
|
|
5
|
+
export { setCredentialFeature } from "./setCredentialFeature";
|
|
6
|
+
export { setFeature } from "./setFeature";
|
|
7
|
+
export { setTokenFeature } from "./setTokenFeature";
|
|
8
|
+
export { hostHeaderMiddleware, hostHeaderMiddlewareOptions, getHostHeaderPlugin, resolveHostHeaderConfig, } from "./middleware-host-header/hostHeaderMiddleware";
|
|
9
|
+
export { loggerMiddleware, loggerMiddlewareOptions, getLoggerPlugin } from "./middleware-logger/loggerMiddleware";
|
|
10
|
+
export { recursionDetectionMiddlewareOptions } from "./middleware-recursion-detection/configuration";
|
|
11
|
+
export { getRecursionDetectionPlugin } from "./middleware-recursion-detection/getRecursionDetectionPlugin.browser";
|
|
12
|
+
export { recursionDetectionMiddleware } from "./middleware-recursion-detection/recursionDetectionMiddleware.native";
|
|
13
|
+
export { DEFAULT_UA_APP_ID, resolveUserAgentConfig } from "./middleware-user-agent/configurations";
|
|
14
|
+
export { userAgentMiddleware, getUserAgentMiddlewareOptions, getUserAgentPlugin, } from "./middleware-user-agent/user-agent-middleware";
|
|
15
|
+
export { createDefaultUserAgentProvider, defaultUserAgent } from "./util-user-agent-browser/defaultUserAgent.native";
|
|
16
|
+
export const crtAvailability = no;
|
|
17
|
+
export const NODE_APP_ID_CONFIG_OPTIONS = no;
|
|
18
|
+
export const UA_APP_ID_ENV_NAME = no;
|
|
19
|
+
export const UA_APP_ID_INI_NAME = no;
|
|
20
|
+
export { fallback } from "./util-user-agent-browser/defaultUserAgent";
|
|
21
|
+
export { createUserAgentStringParsingProvider } from "./util-user-agent-browser/createUserAgentStringParsingProvider";
|
|
22
|
+
export { awsEndpointFunctions } from "./util-endpoints/aws";
|
|
23
|
+
export { resolveEndpoint } from "./util-endpoints/resolveEndpoint";
|
|
24
|
+
export { resolveDefaultAwsRegionalEndpointsConfig, toEndpointV1, } from "./util-endpoints/resolveDefaultAwsRegionalEndpointsConfig";
|
|
25
|
+
export { isIpAddress } from "./util-endpoints/lib/isIpAddress";
|
|
26
|
+
export { isVirtualHostableS3Bucket } from "./util-endpoints/lib/aws/isVirtualHostableS3Bucket";
|
|
27
|
+
export { parseArn } from "./util-endpoints/lib/aws/parseArn";
|
|
28
|
+
export { partition, setPartitionInfo, useDefaultPartitionInfo, getUserAgentPrefix, } from "./util-endpoints/lib/aws/partition";
|
|
29
|
+
export { EndpointError } from "./util-endpoints/types/EndpointError";
|
|
30
|
+
export const REGION_ENV_NAME = no;
|
|
31
|
+
export const REGION_INI_NAME = no;
|
|
32
|
+
export const NODE_REGION_CONFIG_OPTIONS = no;
|
|
33
|
+
export const NODE_REGION_CONFIG_FILE_OPTIONS = no;
|
|
34
|
+
export { resolveRegionConfig } from "./region-config-resolver/awsRegionConfig";
|
|
35
|
+
export { stsRegionDefaultResolver } from "./region-config-resolver/stsRegionDefaultResolver.native";
|
|
36
|
+
export const stsRegionWarning = no;
|
|
37
|
+
export { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "./region-config-resolver/extensions";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
2
|
+
export function resolveHostHeaderConfig(input) {
|
|
3
|
+
return input;
|
|
4
|
+
}
|
|
5
|
+
export const hostHeaderMiddleware = (options) => (next) => async (args) => {
|
|
6
|
+
if (!HttpRequest.isInstance(args.request))
|
|
7
|
+
return next(args);
|
|
8
|
+
const { request } = args;
|
|
9
|
+
const { handlerProtocol = "" } = options.requestHandler.metadata || {};
|
|
10
|
+
if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
|
|
11
|
+
delete request.headers["host"];
|
|
12
|
+
request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : "");
|
|
13
|
+
}
|
|
14
|
+
else if (!request.headers["host"]) {
|
|
15
|
+
let host = request.hostname;
|
|
16
|
+
if (request.port != null)
|
|
17
|
+
host += `:${request.port}`;
|
|
18
|
+
request.headers["host"] = host;
|
|
19
|
+
}
|
|
20
|
+
return next(args);
|
|
21
|
+
};
|
|
22
|
+
export const hostHeaderMiddlewareOptions = {
|
|
23
|
+
name: "hostHeaderMiddleware",
|
|
24
|
+
step: "build",
|
|
25
|
+
priority: "low",
|
|
26
|
+
tags: ["HOST"],
|
|
27
|
+
override: true,
|
|
28
|
+
};
|
|
29
|
+
export const getHostHeaderPlugin = (options) => ({
|
|
30
|
+
applyToStack: (clientStack) => {
|
|
31
|
+
clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const loggerMiddleware = () => (next, context) => async (args) => {
|
|
2
|
+
try {
|
|
3
|
+
const response = await next(args);
|
|
4
|
+
const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
|
|
5
|
+
const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
6
|
+
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
7
|
+
const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
|
|
8
|
+
const { $metadata, ...outputWithoutMetadata } = response.output;
|
|
9
|
+
logger?.info?.({
|
|
10
|
+
clientName,
|
|
11
|
+
commandName,
|
|
12
|
+
input: inputFilterSensitiveLog(args.input),
|
|
13
|
+
output: outputFilterSensitiveLog(outputWithoutMetadata),
|
|
14
|
+
metadata: $metadata,
|
|
15
|
+
});
|
|
16
|
+
return response;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
|
|
20
|
+
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
21
|
+
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
22
|
+
logger?.error?.({
|
|
23
|
+
clientName,
|
|
24
|
+
commandName,
|
|
25
|
+
input: inputFilterSensitiveLog(args.input),
|
|
26
|
+
error,
|
|
27
|
+
metadata: error.$metadata,
|
|
28
|
+
});
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const loggerMiddlewareOptions = {
|
|
33
|
+
name: "loggerMiddleware",
|
|
34
|
+
tags: ["LOGGER"],
|
|
35
|
+
step: "initialize",
|
|
36
|
+
override: true,
|
|
37
|
+
};
|
|
38
|
+
export const getLoggerPlugin = (options) => ({
|
|
39
|
+
applyToStack: (clientStack) => {
|
|
40
|
+
clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);
|
|
41
|
+
},
|
|
42
|
+
});
|
package/dist-es/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { recursionDetectionMiddlewareOptions } from "./configuration";
|
|
2
|
+
import { recursionDetectionMiddleware } from "./recursionDetectionMiddleware";
|
|
3
|
+
export const getRecursionDetectionPlugin = (options) => ({
|
|
4
|
+
applyToStack: (clientStack) => {
|
|
5
|
+
clientStack.add(recursionDetectionMiddleware(), recursionDetectionMiddlewareOptions);
|
|
6
|
+
},
|
|
7
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const recursionDetectionMiddleware = () => (next) => async (args) => next(args);
|
package/dist-es/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InvokeStore } from "@aws/lambda-invoke-store";
|
|
2
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
|
+
const TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
|
|
4
|
+
const ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
|
|
5
|
+
const ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
|
|
6
|
+
export const recursionDetectionMiddleware = () => (next) => async (args) => {
|
|
7
|
+
const { request } = args;
|
|
8
|
+
if (!HttpRequest.isInstance(request)) {
|
|
9
|
+
return next(args);
|
|
10
|
+
}
|
|
11
|
+
const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ??
|
|
12
|
+
TRACE_ID_HEADER_NAME;
|
|
13
|
+
if (request.headers.hasOwnProperty(traceIdHeader)) {
|
|
14
|
+
return next(args);
|
|
15
|
+
}
|
|
16
|
+
const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
|
|
17
|
+
const traceIdFromEnv = process.env[ENV_TRACE_ID];
|
|
18
|
+
const invokeStore = await InvokeStore.getInstanceAsync();
|
|
19
|
+
const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
|
|
20
|
+
const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
|
|
21
|
+
const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
|
|
22
|
+
if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
|
|
23
|
+
request.headers[TRACE_ID_HEADER_NAME] = traceId;
|
|
24
|
+
}
|
|
25
|
+
return next({
|
|
26
|
+
...args,
|
|
27
|
+
request,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const recursionDetectionMiddleware = () => (next) => async (args) => next(args);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RETRY_MODES } from "@smithy/core/retry";
|
|
2
|
+
import { setFeature } from "../setFeature";
|
|
3
|
+
const ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
|
|
4
|
+
export async function checkFeatures(context, config, args) {
|
|
5
|
+
const request = args.request;
|
|
6
|
+
if (request?.headers?.["smithy-protocol"] === "rpc-v2-cbor") {
|
|
7
|
+
setFeature(context, "PROTOCOL_RPC_V2_CBOR", "M");
|
|
8
|
+
}
|
|
9
|
+
if (typeof config.retryStrategy === "function") {
|
|
10
|
+
const retryStrategy = await config.retryStrategy();
|
|
11
|
+
if (typeof retryStrategy.mode === "string") {
|
|
12
|
+
switch (retryStrategy.mode) {
|
|
13
|
+
case RETRY_MODES.ADAPTIVE:
|
|
14
|
+
setFeature(context, "RETRY_MODE_ADAPTIVE", "F");
|
|
15
|
+
break;
|
|
16
|
+
case RETRY_MODES.STANDARD:
|
|
17
|
+
setFeature(context, "RETRY_MODE_STANDARD", "E");
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (typeof config.accountIdEndpointMode === "function") {
|
|
23
|
+
const endpointV2 = context.endpointV2;
|
|
24
|
+
if (String(endpointV2?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)) {
|
|
25
|
+
setFeature(context, "ACCOUNT_ID_ENDPOINT", "O");
|
|
26
|
+
}
|
|
27
|
+
switch (await config.accountIdEndpointMode?.()) {
|
|
28
|
+
case "disabled":
|
|
29
|
+
setFeature(context, "ACCOUNT_ID_MODE_DISABLED", "Q");
|
|
30
|
+
break;
|
|
31
|
+
case "preferred":
|
|
32
|
+
setFeature(context, "ACCOUNT_ID_MODE_PREFERRED", "P");
|
|
33
|
+
break;
|
|
34
|
+
case "required":
|
|
35
|
+
setFeature(context, "ACCOUNT_ID_MODE_REQUIRED", "R");
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const identity = context.__smithy_context?.selectedHttpAuthScheme?.identity;
|
|
40
|
+
if (identity?.$source) {
|
|
41
|
+
const credentials = identity;
|
|
42
|
+
if (credentials.accountId) {
|
|
43
|
+
setFeature(context, "RESOLVED_ACCOUNT_ID", "T");
|
|
44
|
+
}
|
|
45
|
+
for (const [key, value] of Object.entries(credentials.$source ?? {})) {
|
|
46
|
+
setFeature(context, key, value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { normalizeProvider } from "@smithy/core";
|
|
2
|
+
export const DEFAULT_UA_APP_ID = undefined;
|
|
3
|
+
function isValidUserAgentAppId(appId) {
|
|
4
|
+
if (appId === undefined) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return typeof appId === "string" && appId.length <= 50;
|
|
8
|
+
}
|
|
9
|
+
export function resolveUserAgentConfig(input) {
|
|
10
|
+
const normalizedAppIdProvider = normalizeProvider(input.userAgentAppId ?? DEFAULT_UA_APP_ID);
|
|
11
|
+
const { customUserAgent } = input;
|
|
12
|
+
return Object.assign(input, {
|
|
13
|
+
customUserAgent: typeof customUserAgent === "string" ? [[customUserAgent]] : customUserAgent,
|
|
14
|
+
userAgentAppId: async () => {
|
|
15
|
+
const appId = await normalizedAppIdProvider();
|
|
16
|
+
if (!isValidUserAgentAppId(appId)) {
|
|
17
|
+
const logger = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
|
|
18
|
+
if (typeof appId !== "string") {
|
|
19
|
+
logger?.warn("userAgentAppId must be a string or undefined.");
|
|
20
|
+
}
|
|
21
|
+
else if (appId.length > 50) {
|
|
22
|
+
logger?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return appId;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const USER_AGENT = "user-agent";
|
|
2
|
+
export const X_AMZ_USER_AGENT = "x-amz-user-agent";
|
|
3
|
+
export const SPACE = " ";
|
|
4
|
+
export const UA_NAME_SEPARATOR = "/";
|
|
5
|
+
export const UA_NAME_ESCAPE_REGEX = /[^!$%&'*+\-.^_`|~\w]/g;
|
|
6
|
+
export const UA_VALUE_ESCAPE_REGEX = /[^!$%&'*+\-.^_`|~\w#]/g;
|
|
7
|
+
export const UA_ESCAPE_CHAR = "-";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const BYTE_LIMIT = 1024;
|
|
2
|
+
export function encodeFeatures(features) {
|
|
3
|
+
let buffer = "";
|
|
4
|
+
for (const key in features) {
|
|
5
|
+
const val = features[key];
|
|
6
|
+
if (buffer.length + val.length + 1 <= BYTE_LIMIT) {
|
|
7
|
+
if (buffer.length) {
|
|
8
|
+
buffer += "," + val;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
buffer += val;
|
|
12
|
+
}
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
return buffer;
|
|
18
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
2
|
+
import { getUserAgentPrefix } from "../util-endpoints/lib/aws/partition";
|
|
3
|
+
import { checkFeatures } from "./check-features";
|
|
4
|
+
import { SPACE, UA_ESCAPE_CHAR, UA_NAME_ESCAPE_REGEX, UA_NAME_SEPARATOR, UA_VALUE_ESCAPE_REGEX, USER_AGENT, X_AMZ_USER_AGENT, } from "./constants";
|
|
5
|
+
import { encodeFeatures } from "./encode-features";
|
|
6
|
+
export const userAgentMiddleware = (options) => (next, context) => async (args) => {
|
|
7
|
+
const { request } = args;
|
|
8
|
+
if (!HttpRequest.isInstance(request)) {
|
|
9
|
+
return next(args);
|
|
10
|
+
}
|
|
11
|
+
const { headers } = request;
|
|
12
|
+
const userAgent = context?.userAgent?.map(escapeUserAgent) || [];
|
|
13
|
+
const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent);
|
|
14
|
+
await checkFeatures(context, options, args);
|
|
15
|
+
const awsContext = context;
|
|
16
|
+
defaultUserAgent.push(`m/${encodeFeatures(Object.assign({}, context.__smithy_context?.features, awsContext.__aws_sdk_context?.features))}`);
|
|
17
|
+
const customUserAgent = options?.customUserAgent?.map(escapeUserAgent) || [];
|
|
18
|
+
const appId = await options.userAgentAppId();
|
|
19
|
+
if (appId) {
|
|
20
|
+
defaultUserAgent.push(escapeUserAgent([`app`, `${appId}`]));
|
|
21
|
+
}
|
|
22
|
+
const prefix = getUserAgentPrefix();
|
|
23
|
+
const sdkUserAgentValue = (prefix ? [prefix] : [])
|
|
24
|
+
.concat([...defaultUserAgent, ...userAgent, ...customUserAgent])
|
|
25
|
+
.join(SPACE);
|
|
26
|
+
const normalUAValue = [
|
|
27
|
+
...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")),
|
|
28
|
+
...customUserAgent,
|
|
29
|
+
].join(SPACE);
|
|
30
|
+
if (options.runtime !== "browser") {
|
|
31
|
+
if (normalUAValue) {
|
|
32
|
+
headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT]
|
|
33
|
+
? `${headers[USER_AGENT]} ${normalUAValue}`
|
|
34
|
+
: normalUAValue;
|
|
35
|
+
}
|
|
36
|
+
headers[USER_AGENT] = sdkUserAgentValue;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
headers[X_AMZ_USER_AGENT] = sdkUserAgentValue;
|
|
40
|
+
}
|
|
41
|
+
return next({
|
|
42
|
+
...args,
|
|
43
|
+
request,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const escapeUserAgent = (userAgentPair) => {
|
|
47
|
+
const name = userAgentPair[0]
|
|
48
|
+
.split(UA_NAME_SEPARATOR)
|
|
49
|
+
.map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR))
|
|
50
|
+
.join(UA_NAME_SEPARATOR);
|
|
51
|
+
const version = userAgentPair[1]?.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR);
|
|
52
|
+
const prefixSeparatorIndex = name.indexOf(UA_NAME_SEPARATOR);
|
|
53
|
+
const prefix = name.substring(0, prefixSeparatorIndex);
|
|
54
|
+
let uaName = name.substring(prefixSeparatorIndex + 1);
|
|
55
|
+
if (prefix === "api") {
|
|
56
|
+
uaName = uaName.toLowerCase();
|
|
57
|
+
}
|
|
58
|
+
return [prefix, uaName, version]
|
|
59
|
+
.filter((item) => item && item.length > 0)
|
|
60
|
+
.reduce((acc, item, index) => {
|
|
61
|
+
switch (index) {
|
|
62
|
+
case 0:
|
|
63
|
+
return item;
|
|
64
|
+
case 1:
|
|
65
|
+
return `${acc}/${item}`;
|
|
66
|
+
default:
|
|
67
|
+
return `${acc}#${item}`;
|
|
68
|
+
}
|
|
69
|
+
}, "");
|
|
70
|
+
};
|
|
71
|
+
export const getUserAgentMiddlewareOptions = {
|
|
72
|
+
name: "getUserAgentMiddleware",
|
|
73
|
+
step: "build",
|
|
74
|
+
priority: "low",
|
|
75
|
+
tags: ["SET_USER_AGENT", "USER_AGENT"],
|
|
76
|
+
override: true,
|
|
77
|
+
};
|
|
78
|
+
export const getUserAgentPlugin = (config) => ({
|
|
79
|
+
applyToStack: (clientStack) => {
|
|
80
|
+
clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);
|
|
81
|
+
},
|
|
82
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const getAwsRegionExtensionConfiguration = (runtimeConfig) => {
|
|
2
|
+
return {
|
|
3
|
+
setRegion(region) {
|
|
4
|
+
runtimeConfig.region = region;
|
|
5
|
+
},
|
|
6
|
+
region() {
|
|
7
|
+
return runtimeConfig.region;
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export const resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => {
|
|
12
|
+
return {
|
|
13
|
+
region: awsRegionExtensionConfiguration.region(),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { loadConfig, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, } from "@smithy/core/config";
|
|
2
|
+
export function stsRegionDefaultResolver(loaderConfig = {}) {
|
|
3
|
+
return loadConfig({
|
|
4
|
+
...NODE_REGION_CONFIG_OPTIONS,
|
|
5
|
+
async default() {
|
|
6
|
+
if (!warning.silence) {
|
|
7
|
+
console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.");
|
|
8
|
+
}
|
|
9
|
+
return "us-east-1";
|
|
10
|
+
},
|
|
11
|
+
}, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig });
|
|
12
|
+
}
|
|
13
|
+
export const warning = {
|
|
14
|
+
silence: false,
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { customEndpointFunctions } from "@smithy/core/endpoints";
|
|
2
|
+
import { isVirtualHostableS3Bucket } from "./lib/aws/isVirtualHostableS3Bucket";
|
|
3
|
+
import { parseArn } from "./lib/aws/parseArn";
|
|
4
|
+
import { partition } from "./lib/aws/partition";
|
|
5
|
+
export const awsEndpointFunctions = {
|
|
6
|
+
isVirtualHostableS3Bucket: isVirtualHostableS3Bucket,
|
|
7
|
+
parseArn: parseArn,
|
|
8
|
+
partition: partition,
|
|
9
|
+
};
|
|
10
|
+
customEndpointFunctions.aws = awsEndpointFunctions;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isValidHostLabel } from "@smithy/core/endpoints";
|
|
2
|
+
import { isIpAddress } from "../isIpAddress";
|
|
3
|
+
export const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
|
|
4
|
+
if (allowSubDomains) {
|
|
5
|
+
for (const label of value.split(".")) {
|
|
6
|
+
if (!isVirtualHostableS3Bucket(label)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (!isValidHostLabel(value)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (value.length < 3 || value.length > 63) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (value !== value.toLowerCase()) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (isIpAddress(value)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const ARN_DELIMITER = ":";
|
|
2
|
+
const RESOURCE_DELIMITER = "/";
|
|
3
|
+
export const parseArn = (value) => {
|
|
4
|
+
const segments = value.split(ARN_DELIMITER);
|
|
5
|
+
if (segments.length < 6)
|
|
6
|
+
return null;
|
|
7
|
+
const [arn, partition, service, region, accountId, ...resourcePath] = segments;
|
|
8
|
+
if (arn !== "arn" || partition === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "")
|
|
9
|
+
return null;
|
|
10
|
+
const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
|
|
11
|
+
return {
|
|
12
|
+
partition,
|
|
13
|
+
service,
|
|
14
|
+
region,
|
|
15
|
+
accountId,
|
|
16
|
+
resourceId,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { partitionsInfo } from "./partitions";
|
|
2
|
+
let selectedPartitionsInfo = partitionsInfo;
|
|
3
|
+
let selectedUserAgentPrefix = "";
|
|
4
|
+
export const partition = (value) => {
|
|
5
|
+
const { partitions } = selectedPartitionsInfo;
|
|
6
|
+
for (const partition of partitions) {
|
|
7
|
+
const { regions, outputs } = partition;
|
|
8
|
+
for (const [region, regionData] of Object.entries(regions)) {
|
|
9
|
+
if (region === value) {
|
|
10
|
+
return {
|
|
11
|
+
...outputs,
|
|
12
|
+
...regionData,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (const partition of partitions) {
|
|
18
|
+
const { regionRegex, outputs } = partition;
|
|
19
|
+
if (new RegExp(regionRegex).test(value)) {
|
|
20
|
+
return {
|
|
21
|
+
...outputs,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws");
|
|
26
|
+
if (!DEFAULT_PARTITION) {
|
|
27
|
+
throw new Error("Provided region was not found in the partition array or regex," +
|
|
28
|
+
" and default partition with id 'aws' doesn't exist.");
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
...DEFAULT_PARTITION.outputs,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export const setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => {
|
|
35
|
+
selectedPartitionsInfo = partitionsInfo;
|
|
36
|
+
selectedUserAgentPrefix = userAgentPrefix;
|
|
37
|
+
};
|
|
38
|
+
export const useDefaultPartitionInfo = () => {
|
|
39
|
+
setPartitionInfo(partitionsInfo, "");
|
|
40
|
+
};
|
|
41
|
+
export const getUserAgentPrefix = () => selectedUserAgentPrefix;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const partitionsInfo = { "partitions": [{ "id": "aws", "outputs": { "dnsSuffix": "amazonaws.com", "dualStackDnsSuffix": "api.aws", "implicitGlobalRegion": "us-east-1", "name": "aws", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$", "regions": { "af-south-1": { "description": "Africa (Cape Town)" }, "ap-east-1": { "description": "Asia Pacific (Hong Kong)" }, "ap-east-2": { "description": "Asia Pacific (Taipei)" }, "ap-northeast-1": { "description": "Asia Pacific (Tokyo)" }, "ap-northeast-2": { "description": "Asia Pacific (Seoul)" }, "ap-northeast-3": { "description": "Asia Pacific (Osaka)" }, "ap-south-1": { "description": "Asia Pacific (Mumbai)" }, "ap-south-2": { "description": "Asia Pacific (Hyderabad)" }, "ap-southeast-1": { "description": "Asia Pacific (Singapore)" }, "ap-southeast-2": { "description": "Asia Pacific (Sydney)" }, "ap-southeast-3": { "description": "Asia Pacific (Jakarta)" }, "ap-southeast-4": { "description": "Asia Pacific (Melbourne)" }, "ap-southeast-5": { "description": "Asia Pacific (Malaysia)" }, "ap-southeast-6": { "description": "Asia Pacific (New Zealand)" }, "ap-southeast-7": { "description": "Asia Pacific (Thailand)" }, "aws-global": { "description": "aws global region" }, "ca-central-1": { "description": "Canada (Central)" }, "ca-west-1": { "description": "Canada West (Calgary)" }, "eu-central-1": { "description": "Europe (Frankfurt)" }, "eu-central-2": { "description": "Europe (Zurich)" }, "eu-north-1": { "description": "Europe (Stockholm)" }, "eu-south-1": { "description": "Europe (Milan)" }, "eu-south-2": { "description": "Europe (Spain)" }, "eu-west-1": { "description": "Europe (Ireland)" }, "eu-west-2": { "description": "Europe (London)" }, "eu-west-3": { "description": "Europe (Paris)" }, "il-central-1": { "description": "Israel (Tel Aviv)" }, "me-central-1": { "description": "Middle East (UAE)" }, "me-south-1": { "description": "Middle East (Bahrain)" }, "mx-central-1": { "description": "Mexico (Central)" }, "sa-east-1": { "description": "South America (Sao Paulo)" }, "us-east-1": { "description": "US East (N. Virginia)" }, "us-east-2": { "description": "US East (Ohio)" }, "us-west-1": { "description": "US West (N. California)" }, "us-west-2": { "description": "US West (Oregon)" } } }, { "id": "aws-cn", "outputs": { "dnsSuffix": "amazonaws.com.cn", "dualStackDnsSuffix": "api.amazonwebservices.com.cn", "implicitGlobalRegion": "cn-northwest-1", "name": "aws-cn", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^cn\\-\\w+\\-\\d+$", "regions": { "aws-cn-global": { "description": "aws-cn global region" }, "cn-north-1": { "description": "China (Beijing)" }, "cn-northwest-1": { "description": "China (Ningxia)" } } }, { "id": "aws-eusc", "outputs": { "dnsSuffix": "amazonaws.eu", "dualStackDnsSuffix": "api.amazonwebservices.eu", "implicitGlobalRegion": "eusc-de-east-1", "name": "aws-eusc", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^eusc\\-(de)\\-\\w+\\-\\d+$", "regions": { "eusc-de-east-1": { "description": "AWS European Sovereign Cloud (Germany)" } } }, { "id": "aws-iso", "outputs": { "dnsSuffix": "c2s.ic.gov", "dualStackDnsSuffix": "api.aws.ic.gov", "implicitGlobalRegion": "us-iso-east-1", "name": "aws-iso", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-iso\\-\\w+\\-\\d+$", "regions": { "aws-iso-global": { "description": "aws-iso global region" }, "us-iso-east-1": { "description": "US ISO East" }, "us-iso-west-1": { "description": "US ISO WEST" } } }, { "id": "aws-iso-b", "outputs": { "dnsSuffix": "sc2s.sgov.gov", "dualStackDnsSuffix": "api.aws.scloud", "implicitGlobalRegion": "us-isob-east-1", "name": "aws-iso-b", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-isob\\-\\w+\\-\\d+$", "regions": { "aws-iso-b-global": { "description": "aws-iso-b global region" }, "us-isob-east-1": { "description": "US ISOB East (Ohio)" }, "us-isob-west-1": { "description": "US ISOB West" } } }, { "id": "aws-iso-e", "outputs": { "dnsSuffix": "cloud.adc-e.uk", "dualStackDnsSuffix": "api.cloud-aws.adc-e.uk", "implicitGlobalRegion": "eu-isoe-west-1", "name": "aws-iso-e", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^eu\\-isoe\\-\\w+\\-\\d+$", "regions": { "aws-iso-e-global": { "description": "aws-iso-e global region" }, "eu-isoe-west-1": { "description": "EU ISOE West" } } }, { "id": "aws-iso-f", "outputs": { "dnsSuffix": "csp.hci.ic.gov", "dualStackDnsSuffix": "api.aws.hci.ic.gov", "implicitGlobalRegion": "us-isof-south-1", "name": "aws-iso-f", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-isof\\-\\w+\\-\\d+$", "regions": { "aws-iso-f-global": { "description": "aws-iso-f global region" }, "us-isof-east-1": { "description": "US ISOF EAST" }, "us-isof-south-1": { "description": "US ISOF SOUTH" } } }, { "id": "aws-us-gov", "outputs": { "dnsSuffix": "amazonaws.com", "dualStackDnsSuffix": "api.aws", "implicitGlobalRegion": "us-gov-west-1", "name": "aws-us-gov", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-gov\\-\\w+\\-\\d+$", "regions": { "aws-us-gov-global": { "description": "aws-us-gov global region" }, "us-gov-east-1": { "description": "AWS GovCloud (US-East)" }, "us-gov-west-1": { "description": "AWS GovCloud (US-West)" } } }], "version": "1.1" };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isIpAddress } from "@smithy/core/endpoints";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseUrl } from "@smithy/core/protocols";
|
|
2
|
+
export const resolveDefaultAwsRegionalEndpointsConfig = (input) => {
|
|
3
|
+
if (typeof input.endpointProvider !== "function") {
|
|
4
|
+
throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");
|
|
5
|
+
}
|
|
6
|
+
const { endpoint } = input;
|
|
7
|
+
if (endpoint === undefined) {
|
|
8
|
+
input.endpoint = async () => {
|
|
9
|
+
return toEndpointV1(input.endpointProvider({
|
|
10
|
+
Region: typeof input.region === "function" ? await input.region() : input.region,
|
|
11
|
+
UseDualStack: typeof input.useDualstackEndpoint === "function"
|
|
12
|
+
? await input.useDualstackEndpoint()
|
|
13
|
+
: input.useDualstackEndpoint,
|
|
14
|
+
UseFIPS: typeof input.useFipsEndpoint === "function" ? await input.useFipsEndpoint() : input.useFipsEndpoint,
|
|
15
|
+
Endpoint: undefined,
|
|
16
|
+
}, { logger: input.logger }));
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return input;
|
|
20
|
+
};
|
|
21
|
+
export const toEndpointV1 = (endpoint) => parseUrl(endpoint.url);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveEndpoint } from "@smithy/core/endpoints";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EndpointError } from "@smithy/core/endpoints";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist-es/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const createUserAgentStringParsingProvider = ({ serviceId, clientVersion }) => async (config) => {
|
|
2
|
+
const module = await import("bowser");
|
|
3
|
+
const parse = module.parse ?? module.default.parse ?? (() => "");
|
|
4
|
+
const parsedUA = typeof window !== "undefined" && window?.navigator?.userAgent ? parse(window.navigator.userAgent) : undefined;
|
|
5
|
+
const sections = [
|
|
6
|
+
["aws-sdk-js", clientVersion],
|
|
7
|
+
["ua", "2.1"],
|
|
8
|
+
[`os/${parsedUA?.os?.name || "other"}`, parsedUA?.os?.version],
|
|
9
|
+
["lang/js"],
|
|
10
|
+
["md/browser", `${parsedUA?.browser?.name ?? "unknown"}_${parsedUA?.browser?.version ?? "unknown"}`],
|
|
11
|
+
];
|
|
12
|
+
if (serviceId) {
|
|
13
|
+
sections.push([`api/${serviceId}`, clientVersion]);
|
|
14
|
+
}
|
|
15
|
+
const appId = await config?.userAgentAppId?.();
|
|
16
|
+
if (appId) {
|
|
17
|
+
sections.push([`app/${appId}`]);
|
|
18
|
+
}
|
|
19
|
+
return sections;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./defaultUserAgent";
|