@smithy/core 3.24.4 → 3.24.6
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 +3 -4
- package/dist-cjs/submodules/client/index.js +3 -11
- package/dist-cjs/submodules/config/index.browser.js +2 -2
- package/dist-cjs/submodules/config/index.js +2 -2
- package/dist-cjs/submodules/config/index.native.js +2 -2
- package/dist-cjs/submodules/endpoints/index.browser.js +9 -40
- package/dist-cjs/submodules/endpoints/index.js +9 -40
- package/dist-cjs/submodules/protocols/index.js +12 -142
- package/dist-cjs/submodules/retry/index.browser.js +39 -22
- package/dist-cjs/submodules/retry/index.js +39 -22
- package/dist-cjs/submodules/schema/index.js +7 -9
- package/dist-cjs/submodules/serde/index.browser.js +2 -2
- package/dist-cjs/submodules/serde/index.js +2 -2
- package/dist-cjs/submodules/serde/index.native.js +2 -2
- package/dist-cjs/submodules/transport/index.js +184 -0
- package/dist-es/index.js +6 -6
- package/dist-es/submodules/client/index.js +2 -2
- package/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js +1 -1
- package/dist-es/submodules/endpoints/index.browser.js +2 -2
- package/dist-es/submodules/endpoints/index.js +2 -2
- package/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js +1 -1
- package/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js +1 -1
- package/dist-es/submodules/endpoints/util-endpoints/lib/index.js +1 -1
- package/dist-es/submodules/protocols/HttpBindingProtocol.js +1 -1
- package/dist-es/submodules/protocols/HttpProtocol.js +1 -2
- package/dist-es/submodules/protocols/RpcProtocol.js +1 -1
- package/dist-es/submodules/protocols/index.js +5 -5
- package/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js +1 -1
- package/dist-es/submodules/protocols/requestBuilder.js +1 -1
- package/dist-es/submodules/retry/middleware-retry/configurations.js +19 -6
- package/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +4 -5
- package/dist-es/submodules/retry/service-error-classification/constants.js +1 -1
- package/dist-es/submodules/retry/util-retry/ConfiguredRetryStrategy.js +4 -5
- package/dist-es/submodules/retry/util-retry/DefaultRetryToken.js +3 -0
- package/dist-es/submodules/retry/util-retry/StandardRetryStrategy.js +9 -5
- package/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +3 -4
- package/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +1 -2
- package/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js +1 -1
- package/dist-es/submodules/transport/index.js +9 -0
- package/dist-es/submodules/{protocols/url-parser → transport}/parseUrl.js +1 -1
- package/dist-es/submodules/{endpoints → transport}/toEndpointV1.js +1 -1
- package/dist-types/index.d.ts +10 -6
- package/dist-types/submodules/client/index.d.ts +2 -2
- package/dist-types/submodules/endpoints/index.browser.d.ts +2 -2
- package/dist-types/submodules/endpoints/index.d.ts +2 -2
- package/dist-types/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.d.ts +2 -2
- package/dist-types/submodules/endpoints/util-endpoints/lib/index.d.ts +1 -1
- package/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +1 -1
- package/dist-types/submodules/protocols/index.d.ts +5 -5
- package/dist-types/submodules/protocols/protocol-http/httpHandler.d.ts +1 -2
- package/dist-types/submodules/protocols/requestBuilder.d.ts +1 -1
- package/dist-types/submodules/retry/middleware-retry/configurations.d.ts +4 -1
- package/dist-types/submodules/retry/util-retry/ConfiguredRetryStrategy.d.ts +1 -2
- package/dist-types/submodules/retry/util-retry/DefaultRetryToken.d.ts +3 -0
- package/dist-types/submodules/retry/util-retry/StandardRetryStrategy.d.ts +1 -1
- package/dist-types/submodules/transport/index.d.ts +9 -0
- package/package.json +20 -11
- package/transport.d.ts +5 -0
- package/transport.js +5 -0
- package/dist-cjs/getSmithyContext.js +0 -6
- package/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -21
- package/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +0 -21
- package/dist-cjs/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +0 -46
- package/dist-cjs/middleware-http-auth-scheme/index.js +0 -6
- package/dist-cjs/middleware-http-auth-scheme/resolveAuthOptions.js +0 -24
- package/dist-cjs/middleware-http-signing/getHttpSigningMiddleware.js +0 -19
- package/dist-cjs/middleware-http-signing/httpSigningMiddleware.js +0 -27
- package/dist-cjs/middleware-http-signing/index.js +0 -5
- package/dist-cjs/normalizeProvider.js +0 -10
- package/dist-cjs/pagination/createPaginator.js +0 -44
- package/dist-cjs/request-builder/requestBuilder.js +0 -5
- package/dist-cjs/setFeature.js +0 -14
- package/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +0 -18
- package/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js +0 -38
- package/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js +0 -15
- package/dist-cjs/util-identity-and-auth/httpAuthSchemes/index.js +0 -6
- package/dist-cjs/util-identity-and-auth/httpAuthSchemes/noAuth.js +0 -9
- package/dist-cjs/util-identity-and-auth/index.js +0 -6
- package/dist-cjs/util-identity-and-auth/memoizeIdentityProvider.js +0 -61
- package/dist-es/request-builder/requestBuilder.js +0 -1
- package/dist-es/submodules/client/util-middleware/getSmithyContext.js +0 -2
- package/dist-es/submodules/event-streams/eventstream-codec/TestVectors.fixture.js +0 -146
- package/dist-es/submodules/event-streams/eventstream-codec/vectorTypes.fixture.js +0 -1
- package/dist-types/request-builder/requestBuilder.d.ts +0 -6
- package/dist-types/submodules/client/util-middleware/getSmithyContext.d.ts +0 -5
- package/dist-types/submodules/event-streams/eventstream-codec/TestVectors.fixture.d.ts +0 -2
- package/dist-types/submodules/event-streams/eventstream-codec/vectorTypes.fixture.d.ts +0 -12
- /package/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -0
- /package/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemePlugin.js +0 -0
- /package/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/httpAuthSchemeMiddleware.js +0 -0
- /package/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/index.js +0 -0
- /package/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/resolveAuthOptions.js +0 -0
- /package/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/getHttpSigningMiddleware.js +0 -0
- /package/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/httpSigningMiddleware.js +0 -0
- /package/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/index.js +0 -0
- /package/dist-es/{pagination → legacy-root-exports/pagination}/createPaginator.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/DefaultIdentityProviderConfig.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpApiKeyAuth.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpBearerAuth.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/index.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/noAuth.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/index.js +0 -0
- /package/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/memoizeIdentityProvider.js +0 -0
- /package/dist-es/{getSmithyContext.js → submodules/transport/getSmithyContext.js} +0 -0
- /package/dist-es/submodules/{protocols/protocol-http → transport}/httpRequest.js +0 -0
- /package/dist-es/submodules/{protocols/protocol-http → transport}/httpResponse.js +0 -0
- /package/dist-es/submodules/{endpoints/util-endpoints/lib → transport}/isValidHostLabel.js +0 -0
- /package/dist-es/submodules/{protocols/protocol-http → transport}/isValidHostname.js +0 -0
- /package/dist-es/submodules/{client/util-middleware → transport}/normalizeProvider.js +0 -0
- /package/dist-es/submodules/{protocols/querystring-parser → transport}/parseQueryString.js +0 -0
- /package/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemeEndpointRuleSetPlugin.d.ts +0 -0
- /package/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemePlugin.d.ts +0 -0
- /package/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/httpAuthSchemeMiddleware.d.ts +0 -0
- /package/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/index.d.ts +0 -0
- /package/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/resolveAuthOptions.d.ts +0 -0
- /package/dist-types/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/getHttpSigningMiddleware.d.ts +0 -0
- /package/dist-types/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/httpSigningMiddleware.d.ts +0 -0
- /package/dist-types/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/index.d.ts +0 -0
- /package/dist-types/{pagination → legacy-root-exports/pagination}/createPaginator.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/DefaultIdentityProviderConfig.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpApiKeyAuth.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpBearerAuth.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/index.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/noAuth.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/index.d.ts +0 -0
- /package/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/memoizeIdentityProvider.d.ts +0 -0
- /package/dist-types/{getSmithyContext.d.ts → submodules/transport/getSmithyContext.d.ts} +0 -0
- /package/dist-types/submodules/{protocols/protocol-http → transport}/httpRequest.d.ts +0 -0
- /package/dist-types/submodules/{protocols/protocol-http → transport}/httpResponse.d.ts +0 -0
- /package/dist-types/submodules/{endpoints/util-endpoints/lib → transport}/isValidHostLabel.d.ts +0 -0
- /package/dist-types/submodules/{protocols/protocol-http → transport}/isValidHostname.d.ts +0 -0
- /package/dist-types/submodules/{client/util-middleware → transport}/normalizeProvider.d.ts +0 -0
- /package/dist-types/submodules/{protocols/querystring-parser → transport}/parseQueryString.d.ts +0 -0
- /package/dist-types/submodules/{protocols/url-parser → transport}/parseUrl.d.ts +0 -0
- /package/dist-types/submodules/{endpoints → transport}/toEndpointV1.d.ts +0 -0
|
@@ -13,13 +13,13 @@ export * from "./serde/determineTimestampFormat";
|
|
|
13
13
|
export * from "./SerdeContext";
|
|
14
14
|
export { Field } from "./protocol-http/Field";
|
|
15
15
|
export { Fields } from "./protocol-http/Fields";
|
|
16
|
-
export { HttpRequest } from "
|
|
17
|
-
export { HttpResponse } from "
|
|
18
|
-
export { isValidHostname } from "
|
|
16
|
+
export { HttpRequest } from "@smithy/core/transport";
|
|
17
|
+
export { HttpResponse } from "@smithy/core/transport";
|
|
18
|
+
export { isValidHostname } from "@smithy/core/transport";
|
|
19
19
|
export { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig, } from "./protocol-http/extensions/httpExtensionConfiguration";
|
|
20
20
|
export { contentLengthMiddleware, contentLengthMiddlewareOptions, getContentLengthPlugin, } from "./middleware-content-length/contentLengthMiddleware";
|
|
21
21
|
export { escapeUri } from "./util-uri-escape/escape-uri";
|
|
22
22
|
export { escapeUriPath } from "./util-uri-escape/escape-uri-path";
|
|
23
23
|
export { buildQueryString } from "./querystring-builder/buildQueryString";
|
|
24
|
-
export { parseQueryString } from "
|
|
25
|
-
export { parseUrl } from "
|
|
24
|
+
export { parseQueryString } from "@smithy/core/transport";
|
|
25
|
+
export { parseUrl } from "@smithy/core/transport";
|
|
@@ -2,6 +2,7 @@ import { normalizeProvider } from "@smithy/core/client";
|
|
|
2
2
|
import { AdaptiveRetryStrategy } from "../util-retry/AdaptiveRetryStrategy";
|
|
3
3
|
import { StandardRetryStrategy } from "../util-retry/StandardRetryStrategy";
|
|
4
4
|
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE, RETRY_MODES } from "../util-retry/config";
|
|
5
|
+
import { Retry } from "../util-retry/retries-2026-config";
|
|
5
6
|
export const ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
|
|
6
7
|
export const CONFIG_MAX_ATTEMPTS = "max_attempts";
|
|
7
8
|
export const NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
|
|
@@ -27,17 +28,29 @@ export const NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
|
|
|
27
28
|
},
|
|
28
29
|
default: DEFAULT_MAX_ATTEMPTS,
|
|
29
30
|
};
|
|
30
|
-
export const resolveRetryConfig = (input) => {
|
|
31
|
+
export const resolveRetryConfig = (input, defaults) => {
|
|
31
32
|
const { retryStrategy, retryMode } = input;
|
|
32
|
-
const
|
|
33
|
+
const { defaultMaxAttempts = DEFAULT_MAX_ATTEMPTS, defaultBaseDelay = Retry.delay() } = defaults ?? {};
|
|
34
|
+
const maxAttemptsProvider = normalizeProvider(input.maxAttempts ?? defaultMaxAttempts);
|
|
33
35
|
let controller = retryStrategy
|
|
34
36
|
? Promise.resolve(retryStrategy)
|
|
35
37
|
: undefined;
|
|
36
|
-
const getDefault = async () =>
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const getDefault = async () => {
|
|
39
|
+
const maxAttempts = await maxAttemptsProvider();
|
|
40
|
+
const adaptive = (await normalizeProvider(retryMode)()) === RETRY_MODES.ADAPTIVE;
|
|
41
|
+
if (adaptive) {
|
|
42
|
+
return new AdaptiveRetryStrategy(maxAttemptsProvider, {
|
|
43
|
+
maxAttempts,
|
|
44
|
+
baseDelay: defaultBaseDelay,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return new StandardRetryStrategy({
|
|
48
|
+
maxAttempts,
|
|
49
|
+
baseDelay: defaultBaseDelay,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
39
52
|
return Object.assign(input, {
|
|
40
|
-
maxAttempts,
|
|
53
|
+
maxAttempts: maxAttemptsProvider,
|
|
41
54
|
retryStrategy: () => (controller ??= getDefault()),
|
|
42
55
|
});
|
|
43
56
|
};
|
|
@@ -42,9 +42,6 @@ export function bindRetryMiddleware(isStreamingPayload) {
|
|
|
42
42
|
retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
|
|
43
43
|
}
|
|
44
44
|
catch (refreshError) {
|
|
45
|
-
if (typeof refreshError.$backoff === "number") {
|
|
46
|
-
await cooldown(refreshError.$backoff);
|
|
47
|
-
}
|
|
48
45
|
if (!lastError.$metadata) {
|
|
49
46
|
lastError.$metadata = {};
|
|
50
47
|
}
|
|
@@ -54,8 +51,10 @@ export function bindRetryMiddleware(isStreamingPayload) {
|
|
|
54
51
|
}
|
|
55
52
|
attempts = retryToken.getRetryCount();
|
|
56
53
|
const delay = retryToken.getRetryDelay();
|
|
57
|
-
totalRetryDelay += delay;
|
|
58
|
-
|
|
54
|
+
totalRetryDelay += (retryToken?.$retryLog?.acquisitionDelay ?? 0) + delay;
|
|
55
|
+
if (delay > 0) {
|
|
56
|
+
await cooldown(delay);
|
|
57
|
+
}
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -25,4 +25,4 @@ export const THROTTLING_ERROR_CODES = [
|
|
|
25
25
|
export const TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
|
|
26
26
|
export const TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
|
|
27
27
|
export const NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
|
|
28
|
-
export const NODEJS_NETWORK_ERROR_CODES = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND"];
|
|
28
|
+
export const NODEJS_NETWORK_ERROR_CODES = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND", "EAI_AGAIN"];
|
|
@@ -10,10 +10,9 @@ export class ConfiguredRetryStrategy extends StandardRetryStrategy {
|
|
|
10
10
|
else {
|
|
11
11
|
this.computeNextBackoffDelay = computeNextBackoffDelay;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return token;
|
|
13
|
+
this.retryBackoffStrategy.computeNextBackoffDelay = (completedAttempt) => {
|
|
14
|
+
const nextAttempt = completedAttempt + 1;
|
|
15
|
+
return this.computeNextBackoffDelay(nextAttempt);
|
|
16
|
+
};
|
|
18
17
|
}
|
|
19
18
|
}
|
|
@@ -10,8 +10,8 @@ const refusal = {
|
|
|
10
10
|
};
|
|
11
11
|
export class StandardRetryStrategy {
|
|
12
12
|
mode = RETRY_MODES.STANDARD;
|
|
13
|
-
capacity = INITIAL_RETRY_TOKENS;
|
|
14
13
|
retryBackoffStrategy;
|
|
14
|
+
capacity = INITIAL_RETRY_TOKENS;
|
|
15
15
|
maxAttemptsProvider;
|
|
16
16
|
baseDelay;
|
|
17
17
|
constructor(arg1) {
|
|
@@ -47,14 +47,18 @@ export class StandardRetryStrategy {
|
|
|
47
47
|
retryDelay = Math.max(delayFromErrorType, Math.min(errorInfo.retryAfterHint.getTime() - Date.now(), delayFromErrorType + 5_000));
|
|
48
48
|
}
|
|
49
49
|
if (!shouldRetry) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const longPollBackoff = Retry.v2026 && retryCode === refusal.capacity && isLongPoll ? retryDelay : 0;
|
|
51
|
+
if (longPollBackoff > 0) {
|
|
52
|
+
await new Promise((r) => setTimeout(r, longPollBackoff));
|
|
53
|
+
}
|
|
53
54
|
}
|
|
54
55
|
else {
|
|
55
56
|
const capacityCost = this.getCapacityCost(errorType);
|
|
56
57
|
this.capacity -= capacityCost;
|
|
57
|
-
|
|
58
|
+
const nextToken = new DefaultRetryToken(0, token.getRetryCount() + 1, capacityCost, token.isLongPoll?.() ?? false);
|
|
59
|
+
await new Promise((r) => setTimeout(r, retryDelay));
|
|
60
|
+
nextToken.$retryLog.acquisitionDelay = retryDelay;
|
|
61
|
+
return nextToken;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
throw new Error("No retry token available");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getSmithyContext } from "@smithy/core/
|
|
2
|
-
import { HttpResponse } from "@smithy/core/protocols";
|
|
1
|
+
import { HttpResponse, getSmithyContext } from "@smithy/core/transport";
|
|
3
2
|
import { operation } from "../schemas/operation";
|
|
4
3
|
export const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
|
|
5
4
|
const { response } = await next(args);
|
|
@@ -42,10 +41,10 @@ export const schemaDeserializationMiddleware = (config) => (next, context) => as
|
|
|
42
41
|
}
|
|
43
42
|
try {
|
|
44
43
|
if (HttpResponse.isInstance(response)) {
|
|
45
|
-
const { headers = {} } = response;
|
|
44
|
+
const { headers = {}, statusCode } = response;
|
|
46
45
|
const headerEntries = Object.entries(headers);
|
|
47
46
|
error.$metadata = {
|
|
48
|
-
httpStatusCode:
|
|
47
|
+
httpStatusCode: statusCode,
|
|
49
48
|
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
50
49
|
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
51
50
|
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getSmithyContext } from "@smithy/core/
|
|
2
|
-
import { toEndpointV1 } from "@smithy/core/endpoints";
|
|
1
|
+
import { getSmithyContext, toEndpointV1 } from "@smithy/core/transport";
|
|
3
2
|
import { operation } from "../schemas/operation";
|
|
4
3
|
export const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
|
|
5
4
|
const { operationSchema } = getSmithyContext(context);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { getSmithyContext } from "./getSmithyContext";
|
|
2
|
+
export { HttpRequest } from "./httpRequest";
|
|
3
|
+
export { HttpResponse } from "./httpResponse";
|
|
4
|
+
export { isValidHostLabel } from "./isValidHostLabel";
|
|
5
|
+
export { isValidHostname } from "./isValidHostname";
|
|
6
|
+
export { normalizeProvider } from "./normalizeProvider";
|
|
7
|
+
export { parseQueryString } from "./parseQueryString";
|
|
8
|
+
export { parseUrl } from "./parseUrl";
|
|
9
|
+
export { toEndpointV1 } from "./toEndpointV1";
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./middleware-http-auth-scheme";
|
|
3
|
-
export * from "./middleware-http-signing";
|
|
1
|
+
export { getSmithyContext } from "@smithy/core/transport";
|
|
2
|
+
export * from "./legacy-root-exports/middleware-http-auth-scheme";
|
|
3
|
+
export * from "./legacy-root-exports/middleware-http-signing";
|
|
4
4
|
export * from "./normalizeProvider";
|
|
5
|
-
export { createPaginator } from "./pagination/createPaginator";
|
|
6
|
-
|
|
5
|
+
export { createPaginator } from "./legacy-root-exports/pagination/createPaginator";
|
|
6
|
+
/**
|
|
7
|
+
* Backwards compatibility re-export.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export { requestBuilder } from "@smithy/core/protocols";
|
|
7
11
|
export * from "./setFeature";
|
|
8
|
-
export * from "./util-identity-and-auth";
|
|
12
|
+
export * from "./legacy-root-exports/util-identity-and-auth";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { constructStack } from "./middleware-stack/MiddlewareStack";
|
|
2
|
-
export { getSmithyContext } from "
|
|
3
|
-
export { normalizeProvider } from "
|
|
2
|
+
export { getSmithyContext } from "@smithy/core/transport";
|
|
3
|
+
export { normalizeProvider } from "@smithy/core/transport";
|
|
4
4
|
export { invalidFunction } from "./invalid-dependency/invalidFunction";
|
|
5
5
|
export { invalidProvider } from "./invalid-dependency/invalidProvider";
|
|
6
6
|
export { createWaiter } from "./util-waiter/createWaiter";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { toEndpointV1 } from "@smithy/core/transport";
|
|
2
2
|
export { BinaryDecisionDiagram } from "./util-endpoints/bdd/BinaryDecisionDiagram";
|
|
3
3
|
export { EndpointCache } from "./util-endpoints/cache/EndpointCache";
|
|
4
4
|
export { decideEndpoint } from "./util-endpoints/decideEndpoint";
|
|
5
5
|
export { isIpAddress } from "./util-endpoints/lib/isIpAddress";
|
|
6
|
-
export { isValidHostLabel } from "
|
|
6
|
+
export { isValidHostLabel } from "@smithy/core/transport";
|
|
7
7
|
export { customEndpointFunctions } from "./util-endpoints/utils/customEndpointFunctions";
|
|
8
8
|
export { resolveEndpoint } from "./util-endpoints/resolveEndpoint";
|
|
9
9
|
export * from "./util-endpoints/types";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { toEndpointV1 } from "@smithy/core/transport";
|
|
2
2
|
export { BinaryDecisionDiagram } from "./util-endpoints/bdd/BinaryDecisionDiagram";
|
|
3
3
|
export { EndpointCache } from "./util-endpoints/cache/EndpointCache";
|
|
4
4
|
export { decideEndpoint } from "./util-endpoints/decideEndpoint";
|
|
5
5
|
export { isIpAddress } from "./util-endpoints/lib/isIpAddress";
|
|
6
|
-
export { isValidHostLabel } from "
|
|
6
|
+
export { isValidHostLabel } from "@smithy/core/transport";
|
|
7
7
|
export { customEndpointFunctions } from "./util-endpoints/utils/customEndpointFunctions";
|
|
8
8
|
export { resolveEndpoint } from "./util-endpoints/resolveEndpoint";
|
|
9
9
|
export * from "./util-endpoints/types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @deprecated Use `toEndpointV1` from `@smithy/core/
|
|
2
|
+
* @deprecated Use `toEndpointV1` from `@smithy/core/transport` instead.
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export { toEndpointV1 } from "
|
|
5
|
+
export { toEndpointV1 } from "@smithy/core/transport";
|
|
@@ -2,7 +2,7 @@ export * from "./booleanEquals";
|
|
|
2
2
|
export * from "./coalesce";
|
|
3
3
|
export * from "./getAttr";
|
|
4
4
|
export * from "./isSet";
|
|
5
|
-
export
|
|
5
|
+
export { isValidHostLabel } from "@smithy/core/transport";
|
|
6
6
|
export * from "./ite";
|
|
7
7
|
export * from "./not";
|
|
8
8
|
export * from "./parseURL";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NormalizedSchema, type TypeRegistry } from "@smithy/core/schema";
|
|
2
|
+
import { HttpRequest } from "@smithy/core/transport";
|
|
2
3
|
import type { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, Schema, SerdeFunctions } from "@smithy/types";
|
|
3
4
|
import { HttpProtocol } from "./HttpProtocol";
|
|
4
|
-
import { HttpRequest } from "./protocol-http/httpRequest";
|
|
5
5
|
/**
|
|
6
6
|
* Base for HTTP-binding protocols. Downstream examples
|
|
7
7
|
* include AWS REST JSON and AWS REST XML.
|
|
@@ -14,14 +14,14 @@ export * from "./SerdeContext";
|
|
|
14
14
|
export { Field } from "./protocol-http/Field";
|
|
15
15
|
export { Fields, type FieldsOptions } from "./protocol-http/Fields";
|
|
16
16
|
export { type HttpHandler, type HttpHandlerUserInput } from "./protocol-http/httpHandler";
|
|
17
|
-
export { HttpRequest, type IHttpRequest } from "
|
|
18
|
-
export { HttpResponse } from "
|
|
19
|
-
export { isValidHostname } from "
|
|
17
|
+
export { HttpRequest, type IHttpRequest } from "@smithy/core/transport";
|
|
18
|
+
export { HttpResponse } from "@smithy/core/transport";
|
|
19
|
+
export { isValidHostname } from "@smithy/core/transport";
|
|
20
20
|
export { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig, type HttpHandlerExtensionConfiguration, type HttpHandlerExtensionConfigType, } from "./protocol-http/extensions/httpExtensionConfiguration";
|
|
21
21
|
export { type FieldOptions, type FieldPosition, type HeaderBag, type HttpMessage, type HttpHandlerOptions, } from "./protocol-http/types";
|
|
22
22
|
export { contentLengthMiddleware, contentLengthMiddlewareOptions, getContentLengthPlugin, } from "./middleware-content-length/contentLengthMiddleware";
|
|
23
23
|
export { escapeUri } from "./util-uri-escape/escape-uri";
|
|
24
24
|
export { escapeUriPath } from "./util-uri-escape/escape-uri-path";
|
|
25
25
|
export { buildQueryString } from "./querystring-builder/buildQueryString";
|
|
26
|
-
export { parseQueryString } from "
|
|
27
|
-
export { parseUrl } from "
|
|
26
|
+
export { parseQueryString } from "@smithy/core/transport";
|
|
27
|
+
export { parseUrl } from "@smithy/core/transport";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import type { HttpRequest, HttpResponse } from "@smithy/core/transport";
|
|
1
2
|
import type { FetchHttpHandlerOptions, HttpHandlerOptions, NodeHttpHandlerOptions, RequestHandler } from "@smithy/types";
|
|
2
|
-
import type { HttpRequest } from "./httpRequest";
|
|
3
|
-
import type { HttpResponse } from "./httpResponse";
|
|
4
3
|
/**
|
|
5
4
|
* @internal
|
|
6
5
|
*/
|
|
@@ -53,7 +53,10 @@ export interface RetryResolvedConfig {
|
|
|
53
53
|
/**
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
56
|
-
export declare const resolveRetryConfig: <T>(input: T & PreviouslyResolved & RetryInputConfig
|
|
56
|
+
export declare const resolveRetryConfig: <T>(input: T & PreviouslyResolved & RetryInputConfig, defaults?: {
|
|
57
|
+
defaultMaxAttempts?: number;
|
|
58
|
+
defaultBaseDelay?: number;
|
|
59
|
+
}) => T & RetryResolvedConfig;
|
|
57
60
|
/**
|
|
58
61
|
* @internal
|
|
59
62
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Provider, RetryBackoffStrategy,
|
|
1
|
+
import type { Provider, RetryBackoffStrategy, RetryStrategyV2 } from "@smithy/types";
|
|
2
2
|
import { StandardRetryStrategy } from "./StandardRetryStrategy";
|
|
3
3
|
/**
|
|
4
4
|
* This extension of the StandardRetryStrategy allows customizing the
|
|
@@ -28,5 +28,4 @@ export declare class ConfiguredRetryStrategy extends StandardRetryStrategy imple
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
constructor(maxAttempts: number | Provider<number>, computeNextBackoffDelay?: number | RetryBackoffStrategy["computeNextBackoffDelay"]);
|
|
31
|
-
refreshRetryTokenForRetry(tokenToRenew: StandardRetryToken, errorInfo: RetryErrorInfo): Promise<StandardRetryToken>;
|
|
32
31
|
}
|
|
@@ -7,6 +7,9 @@ export declare class DefaultRetryToken implements StandardRetryToken {
|
|
|
7
7
|
private readonly count;
|
|
8
8
|
private readonly cost;
|
|
9
9
|
private readonly longPoll;
|
|
10
|
+
$retryLog: {
|
|
11
|
+
acquisitionDelay: number;
|
|
12
|
+
};
|
|
10
13
|
constructor(delay: number, count: number, cost: number | undefined, longPoll: boolean);
|
|
11
14
|
getRetryCount(): number;
|
|
12
15
|
getRetryDelay(): number;
|
|
@@ -21,8 +21,8 @@ export type StandardRetryStrategyOptions = {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare class StandardRetryStrategy implements RetryStrategyV2 {
|
|
23
23
|
readonly mode: string;
|
|
24
|
+
protected readonly retryBackoffStrategy: StandardRetryBackoffStrategy;
|
|
24
25
|
private capacity;
|
|
25
|
-
private readonly retryBackoffStrategy;
|
|
26
26
|
private readonly maxAttemptsProvider;
|
|
27
27
|
private readonly baseDelay;
|
|
28
28
|
constructor(maxAttempts: number);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { getSmithyContext } from "./getSmithyContext";
|
|
2
|
+
export { HttpRequest, IHttpRequest } from "./httpRequest";
|
|
3
|
+
export { HttpResponse } from "./httpResponse";
|
|
4
|
+
export { isValidHostLabel } from "./isValidHostLabel";
|
|
5
|
+
export { isValidHostname } from "./isValidHostname";
|
|
6
|
+
export { normalizeProvider } from "./normalizeProvider";
|
|
7
|
+
export { parseQueryString } from "./parseQueryString";
|
|
8
|
+
export { parseUrl } from "./parseUrl";
|
|
9
|
+
export { toEndpointV1 } from "./toEndpointV1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/core",
|
|
3
|
-
"version": "3.24.
|
|
3
|
+
"version": "3.24.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
6
6
|
"build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline core",
|
|
@@ -151,6 +151,13 @@
|
|
|
151
151
|
"node": "./dist-cjs/submodules/retry/index.js",
|
|
152
152
|
"import": "./dist-es/submodules/retry/index.js",
|
|
153
153
|
"require": "./dist-cjs/submodules/retry/index.js"
|
|
154
|
+
},
|
|
155
|
+
"./transport": {
|
|
156
|
+
"types": "./dist-types/submodules/transport/index.d.ts",
|
|
157
|
+
"module": "./dist-es/submodules/transport/index.js",
|
|
158
|
+
"node": "./dist-cjs/submodules/transport/index.js",
|
|
159
|
+
"import": "./dist-es/submodules/transport/index.js",
|
|
160
|
+
"require": "./dist-cjs/submodules/transport/index.js"
|
|
154
161
|
}
|
|
155
162
|
},
|
|
156
163
|
"author": {
|
|
@@ -162,7 +169,7 @@
|
|
|
162
169
|
"sideEffects": false,
|
|
163
170
|
"dependencies": {
|
|
164
171
|
"@aws-crypto/crc32": "5.2.0",
|
|
165
|
-
"@smithy/types": "^4.14.
|
|
172
|
+
"@smithy/types": "^4.14.3",
|
|
166
173
|
"tslib": "^2.6.2"
|
|
167
174
|
},
|
|
168
175
|
"engines": {
|
|
@@ -178,25 +185,27 @@
|
|
|
178
185
|
"files": [
|
|
179
186
|
"./cbor.d.ts",
|
|
180
187
|
"./cbor.js",
|
|
188
|
+
"./checksum.d.ts",
|
|
189
|
+
"./checksum.js",
|
|
190
|
+
"./client.d.ts",
|
|
191
|
+
"./client.js",
|
|
192
|
+
"./config.d.ts",
|
|
193
|
+
"./config.js",
|
|
181
194
|
"./endpoints.d.ts",
|
|
182
195
|
"./endpoints.js",
|
|
183
196
|
"./event-streams.d.ts",
|
|
184
197
|
"./event-streams.js",
|
|
185
198
|
"./protocols.d.ts",
|
|
186
199
|
"./protocols.js",
|
|
200
|
+
"./retry.d.ts",
|
|
201
|
+
"./retry.js",
|
|
187
202
|
"./schema.d.ts",
|
|
188
203
|
"./schema.js",
|
|
189
204
|
"./serde.d.ts",
|
|
190
205
|
"./serde.js",
|
|
191
|
-
"
|
|
192
|
-
"./
|
|
193
|
-
"
|
|
194
|
-
"./config.d.ts",
|
|
195
|
-
"./config.js",
|
|
196
|
-
"./checksum.d.ts",
|
|
197
|
-
"./checksum.js",
|
|
198
|
-
"./retry.d.ts",
|
|
199
|
-
"./retry.js"
|
|
206
|
+
"./transport.d.ts",
|
|
207
|
+
"./transport.js",
|
|
208
|
+
"dist-*/**"
|
|
200
209
|
],
|
|
201
210
|
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
|
|
202
211
|
"repository": {
|
package/transport.d.ts
ADDED
package/transport.js
ADDED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSmithyContext = void 0;
|
|
4
|
-
const types_1 = require("@smithy/types");
|
|
5
|
-
const getSmithyContext = (context) => context[types_1.SMITHY_CONTEXT_KEY] || (context[types_1.SMITHY_CONTEXT_KEY] = {});
|
|
6
|
-
exports.getSmithyContext = getSmithyContext;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHttpAuthSchemeEndpointRuleSetPlugin = exports.httpAuthSchemeEndpointRuleSetMiddlewareOptions = void 0;
|
|
4
|
-
const httpAuthSchemeMiddleware_1 = require("./httpAuthSchemeMiddleware");
|
|
5
|
-
exports.httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
|
|
6
|
-
step: "serialize",
|
|
7
|
-
tags: ["HTTP_AUTH_SCHEME"],
|
|
8
|
-
name: "httpAuthSchemeMiddleware",
|
|
9
|
-
override: true,
|
|
10
|
-
relation: "before",
|
|
11
|
-
toMiddleware: "endpointV2Middleware",
|
|
12
|
-
};
|
|
13
|
-
const getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }) => ({
|
|
14
|
-
applyToStack: (clientStack) => {
|
|
15
|
-
clientStack.addRelativeTo((0, httpAuthSchemeMiddleware_1.httpAuthSchemeMiddleware)(config, {
|
|
16
|
-
httpAuthSchemeParametersProvider,
|
|
17
|
-
identityProviderConfigProvider,
|
|
18
|
-
}), exports.httpAuthSchemeEndpointRuleSetMiddlewareOptions);
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
exports.getHttpAuthSchemeEndpointRuleSetPlugin = getHttpAuthSchemeEndpointRuleSetPlugin;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHttpAuthSchemePlugin = exports.httpAuthSchemeMiddlewareOptions = void 0;
|
|
4
|
-
const httpAuthSchemeMiddleware_1 = require("./httpAuthSchemeMiddleware");
|
|
5
|
-
exports.httpAuthSchemeMiddlewareOptions = {
|
|
6
|
-
step: "serialize",
|
|
7
|
-
tags: ["HTTP_AUTH_SCHEME"],
|
|
8
|
-
name: "httpAuthSchemeMiddleware",
|
|
9
|
-
override: true,
|
|
10
|
-
relation: "before",
|
|
11
|
-
toMiddleware: "serializerMiddleware",
|
|
12
|
-
};
|
|
13
|
-
const getHttpAuthSchemePlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }) => ({
|
|
14
|
-
applyToStack: (clientStack) => {
|
|
15
|
-
clientStack.addRelativeTo((0, httpAuthSchemeMiddleware_1.httpAuthSchemeMiddleware)(config, {
|
|
16
|
-
httpAuthSchemeParametersProvider,
|
|
17
|
-
identityProviderConfigProvider,
|
|
18
|
-
}), exports.httpAuthSchemeMiddlewareOptions);
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
exports.getHttpAuthSchemePlugin = getHttpAuthSchemePlugin;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpAuthSchemeMiddleware = void 0;
|
|
4
|
-
const client_1 = require("@smithy/core/client");
|
|
5
|
-
const resolveAuthOptions_1 = require("./resolveAuthOptions");
|
|
6
|
-
function convertHttpAuthSchemesToMap(httpAuthSchemes) {
|
|
7
|
-
const map = new Map();
|
|
8
|
-
for (const scheme of httpAuthSchemes) {
|
|
9
|
-
map.set(scheme.schemeId, scheme);
|
|
10
|
-
}
|
|
11
|
-
return map;
|
|
12
|
-
}
|
|
13
|
-
const httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
|
|
14
|
-
const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
|
|
15
|
-
const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
|
|
16
|
-
const resolvedOptions = (0, resolveAuthOptions_1.resolveAuthOptions)(options, authSchemePreference);
|
|
17
|
-
const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
|
|
18
|
-
const smithyContext = (0, client_1.getSmithyContext)(context);
|
|
19
|
-
const failureReasons = [];
|
|
20
|
-
for (const option of resolvedOptions) {
|
|
21
|
-
const scheme = authSchemes.get(option.schemeId);
|
|
22
|
-
if (!scheme) {
|
|
23
|
-
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
|
|
27
|
-
if (!identityProvider) {
|
|
28
|
-
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
|
|
32
|
-
option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
|
|
33
|
-
option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
|
|
34
|
-
smithyContext.selectedHttpAuthScheme = {
|
|
35
|
-
httpAuthOption: option,
|
|
36
|
-
identity: await identityProvider(option.identityProperties),
|
|
37
|
-
signer: scheme.signer,
|
|
38
|
-
};
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
if (!smithyContext.selectedHttpAuthScheme) {
|
|
42
|
-
throw new Error(failureReasons.join("\n"));
|
|
43
|
-
}
|
|
44
|
-
return next(args);
|
|
45
|
-
};
|
|
46
|
-
exports.httpAuthSchemeMiddleware = httpAuthSchemeMiddleware;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./httpAuthSchemeMiddleware"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./getHttpAuthSchemeEndpointRuleSetPlugin"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./getHttpAuthSchemePlugin"), exports);
|