@aws-sdk/core
Advanced tools
| export const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = false; |
| import { loadConfig } from "@smithy/core/config"; | ||
| import { NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS } from "./clock-skew-node-config"; | ||
| export const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = loadConfig(NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS); |
| import { booleanSelector, SelectorType } from "@smithy/core/config"; | ||
| export const ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION"; | ||
| export const CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction"; | ||
| export const NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS = { | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_DISABLE_CLOCK_SKEW_CORRECTION, SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_DISABLE_CLOCK_SKEW_CORRECTION, SelectorType.CONFIG), | ||
| default: false, | ||
| }; |
| const no = Symbol.for("node-only"); | ||
| export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, resolveAwsSdkSigV4AConfig, } from "./aws_sdk"; | ||
| export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey"; | ||
| export const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = no; | ||
| export const NODE_SIGV4A_CONFIG_OPTIONS = no; | ||
| import { bindResolveAwsSdkSigV4Config } from "./aws_sdk"; | ||
| import { DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION } from "./aws_sdk/clock-skew-defaults.browser"; | ||
| export const resolveAwsSdkSigV4Config = bindResolveAwsSdkSigV4Config(DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION); | ||
| export const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; |
| let canParseBuffer; | ||
| export function detectBufferParsing() { | ||
| if (canParseBuffer === undefined) { | ||
| try { | ||
| if (typeof Buffer !== "function") { | ||
| canParseBuffer = false; | ||
| } | ||
| else { | ||
| const result = JSON.parse(Buffer.from([0x7b, 0x7d])); | ||
| canParseBuffer = result !== null && typeof result === "object"; | ||
| } | ||
| } | ||
| catch { | ||
| canParseBuffer = false; | ||
| } | ||
| } | ||
| return canParseBuffer; | ||
| } |
| import { NormalizedSchema } from "@smithy/core/schema"; | ||
| const REVIVER_SYMBOL = Symbol.for("@aws-sdk/reviver"); | ||
| export function needsReviver(schema) { | ||
| const ns = NormalizedSchema.of(schema); | ||
| const raw = ns.getSchema(); | ||
| if (Array.isArray(raw) && ns.isStructSchema()) { | ||
| if (REVIVER_SYMBOL in raw) { | ||
| return raw[REVIVER_SYMBOL]; | ||
| } | ||
| const result = _check(ns, new Set()); | ||
| raw[REVIVER_SYMBOL] = result; | ||
| return result; | ||
| } | ||
| return _check(ns, new Set()); | ||
| } | ||
| function _check(ns, seen) { | ||
| const raw = ns.getSchema(); | ||
| if (seen.has(raw)) { | ||
| return false; | ||
| } | ||
| seen.add(raw); | ||
| if (ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) { | ||
| return true; | ||
| } | ||
| if (ns.isStructSchema()) { | ||
| for (const [, memberSchema] of ns.structIterator()) { | ||
| if (_check(memberSchema, seen)) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| else if (ns.isListSchema() || ns.isMapSchema()) { | ||
| if (_check(ns.getValueSchema(), seen)) { | ||
| return true; | ||
| } | ||
| } | ||
| else if (ns.isDocumentSchema()) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } |
| export function writeKey(obj) { | ||
| Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true }); | ||
| } |
| /** | ||
| * Browser default: clock skew correction enabled. | ||
| * | ||
| * @internal | ||
| */ | ||
| export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = false; |
| /** | ||
| * Node.js default: lazily reads from env var / shared config file. | ||
| * Browser counterpart (via index binding) exports `false`. | ||
| * | ||
| * @internal | ||
| */ | ||
| export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION: import("@smithy/types").Provider<boolean>; |
| import { type LoadedConfigSelectors } from "@smithy/core/config"; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION"; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction"; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>; |
| export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, resolveAwsSdkSigV4AConfig, } from "./aws_sdk"; | ||
| export type { AwsSdkSigV4AAuthInputConfig, AwsSdkSigV4APreviouslyResolved, AwsSdkSigV4AAuthResolvedConfig, AwsSdkSigV4AuthInputConfig, AwsSdkSigV4Memoized, AwsSdkSigV4PreviouslyResolved, AwsSdkSigV4AuthResolvedConfig, AWSSDKSigV4AuthInputConfig, AWSSDKSigV4PreviouslyResolved, AWSSDKSigV4AuthResolvedConfig, } from "./aws_sdk"; | ||
| export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey"; | ||
| export declare const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS: symbol; | ||
| export declare const NODE_SIGV4A_CONFIG_OPTIONS: symbol; | ||
| export declare const resolveAwsSdkSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; | ||
| /** | ||
| * @internal | ||
| * @deprecated renamed to {@link resolveAwsSdkSigV4Config} | ||
| */ | ||
| export declare const resolveAWSSDKSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; |
| export declare function detectBufferParsing(): boolean; |
| import type { Schema } from "@smithy/types"; | ||
| /** | ||
| * Determines whether a schema tree contains BigInteger or BigDecimal members, | ||
| * which require a JSON.parse reviver to preserve numeric precision. | ||
| * | ||
| * The result is cached on the root static schema array (struct schemas) via a Symbol key, | ||
| * so subsequent calls for the same schema are O(1). | ||
| * | ||
| * @internal | ||
| */ | ||
| export declare function needsReviver(schema: Schema): boolean; |
| /** | ||
| * Makes __proto__ writable on a given object. | ||
| */ | ||
| export declare function writeKey(obj: object | Record<string, unknown> | any): void; |
| export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = false; |
| export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION: import("@smithy/types").Provider<boolean>; |
| import { LoadedConfigSelectors } from "@smithy/core/config"; | ||
| export declare const ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION"; | ||
| export declare const CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction"; | ||
| export declare const NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>; |
| export { | ||
| AwsSdkSigV4Signer, | ||
| AWSSDKSigV4Signer, | ||
| validateSigningProperties, | ||
| AwsSdkSigV4ASigner, | ||
| resolveAwsSdkSigV4AConfig, | ||
| } from "./aws_sdk"; | ||
| export { | ||
| AwsSdkSigV4AAuthInputConfig, | ||
| AwsSdkSigV4APreviouslyResolved, | ||
| AwsSdkSigV4AAuthResolvedConfig, | ||
| AwsSdkSigV4AuthInputConfig, | ||
| AwsSdkSigV4Memoized, | ||
| AwsSdkSigV4PreviouslyResolved, | ||
| AwsSdkSigV4AuthResolvedConfig, | ||
| AWSSDKSigV4AuthInputConfig, | ||
| AWSSDKSigV4PreviouslyResolved, | ||
| AWSSDKSigV4AuthResolvedConfig, | ||
| } from "./aws_sdk"; | ||
| export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey"; | ||
| export declare const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS: symbol; | ||
| export declare const NODE_SIGV4A_CONFIG_OPTIONS: symbol; | ||
| export declare const resolveAwsSdkSigV4Config: <T>( | ||
| config: T & | ||
| (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & | ||
| import("./aws_sdk").AwsSdkSigV4PreviouslyResolved), | ||
| ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; | ||
| export declare const resolveAWSSDKSigV4Config: <T>( | ||
| config: T & | ||
| (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & | ||
| import("./aws_sdk").AwsSdkSigV4PreviouslyResolved), | ||
| ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; |
| export declare function detectBufferParsing(): boolean; |
| import { Schema } from "@smithy/types"; | ||
| export declare function needsReviver(schema: Schema): boolean; |
| export declare function writeKey(obj: object | Record<string, unknown> | any): void; |
@@ -1,19 +0,25 @@ | ||
| const { HttpResponse, HttpRequest } = require("@smithy/core/protocols"); | ||
| const { ProviderError, booleanSelector, SelectorType, loadConfig } = require("@smithy/core/config"); | ||
| const { setCredentialFeature } = require("@aws-sdk/core/client"); | ||
| const { normalizeProvider, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require("@smithy/core"); | ||
| const { ProviderError } = require("@smithy/core/config"); | ||
| const { setCredentialFeature } = require("@aws-sdk/core/client"); | ||
| const { SignatureV4 } = require("@smithy/signature-v4"); | ||
| const { HttpResponse, HttpRequest } = require("@smithy/core/protocols"); | ||
| const getDateHeader = (response) => HttpResponse.isInstance(response) ? (response.headers?.date ?? response.headers?.Date) : undefined; | ||
| const getAgeHeader = (response) => HttpResponse.isInstance(response) ? (response.headers?.age ?? response.headers?.Age) : undefined; | ||
| const getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset); | ||
| const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000; | ||
| const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { | ||
| const clockTimeInMs = Date.parse(clockTime); | ||
| if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) { | ||
| return clockTimeInMs - Date.now(); | ||
| const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset, timeRequestSent, ageHeader) => { | ||
| if (ageHeader !== undefined) { | ||
| return currentSystemClockOffset; | ||
| } | ||
| return currentSystemClockOffset; | ||
| const serverTime = Date.parse(clockTime); | ||
| const timeResponseReceived = Date.now(); | ||
| if (timeRequestSent !== undefined && timeResponseReceived - timeRequestSent > 900_000) { | ||
| return currentSystemClockOffset; | ||
| } | ||
| const candidateSkew = timeRequestSent !== undefined | ||
| ? serverTime - (timeRequestSent + timeResponseReceived) / 2 | ||
| : serverTime - timeResponseReceived; | ||
| return candidateSkew; | ||
| }; | ||
@@ -60,5 +66,10 @@ | ||
| } | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| const noSkewCorrection = (await config.disableClockSkewCorrection?.()) === true; | ||
| signingProperties._disableClockSkewCorrection = noSkewCorrection; | ||
| if (!noSkewCorrection) { | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| signingProperties._requestSentAt = Date.now(); | ||
| } | ||
| const signedRequest = await signer.sign(httpRequest, { | ||
| signingDate: getSkewCorrectedDate(config.systemClockOffset), | ||
| signingDate: noSkewCorrection ? new Date() : getSkewCorrectedDate(config.systemClockOffset), | ||
| signingRegion: signingRegion, | ||
@@ -72,13 +83,17 @@ signingService: signingName, | ||
| const errorException = error; | ||
| const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response); | ||
| if (serverTime) { | ||
| const config = throwSigningPropertyError("config", signingProperties.config); | ||
| const preRequestOffset = signingProperties._preRequestSystemClockOffset; | ||
| const newOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset); | ||
| const isLocalCorrection = newOffset !== config.systemClockOffset; | ||
| const isConcurrentCorrection = preRequestOffset !== undefined && preRequestOffset !== newOffset; | ||
| const clockSkewCorrected = isLocalCorrection || isConcurrentCorrection; | ||
| if (clockSkewCorrected && errorException.$metadata) { | ||
| if (!signingProperties._disableClockSkewCorrection) { | ||
| const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response); | ||
| if (serverTime) { | ||
| const config = throwSigningPropertyError("config", signingProperties.config); | ||
| const preRequestOffset = signingProperties._preRequestSystemClockOffset; | ||
| const timeRequestSent = signingProperties._requestSentAt; | ||
| const ageHeader = getAgeHeader(errorException.$response); | ||
| const newOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset, timeRequestSent, ageHeader); | ||
| config.systemClockOffset = newOffset; | ||
| errorException.$metadata.clockSkewCorrected = true; | ||
| const skewExceedsThreshold = Math.abs(newOffset) >= 240_000; | ||
| const isLocalCorrection = newOffset !== preRequestOffset; | ||
| const isConcurrentCorrection = preRequestOffset !== undefined && preRequestOffset !== newOffset; | ||
| if (skewExceedsThreshold && (isLocalCorrection || isConcurrentCorrection) && errorException.$metadata) { | ||
| errorException.$metadata.clockSkewCorrected = true; | ||
| } | ||
| } | ||
@@ -90,6 +105,11 @@ } | ||
| successHandler(httpResponse, signingProperties) { | ||
| if (signingProperties._disableClockSkewCorrection) { | ||
| return; | ||
| } | ||
| const dateHeader = getDateHeader(httpResponse); | ||
| if (dateHeader) { | ||
| const config = throwSigningPropertyError("config", signingProperties.config); | ||
| config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset); | ||
| const timeRequestSent = signingProperties._requestSentAt; | ||
| const ageHeader = getAgeHeader(httpResponse); | ||
| config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset, timeRequestSent, ageHeader); | ||
| } | ||
@@ -109,5 +129,10 @@ } | ||
| signingRegionSet ?? [signingRegion]).join(","); | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| const noSkewCorrection = (await config.disableClockSkewCorrection?.()) === true; | ||
| signingProperties._disableClockSkewCorrection = noSkewCorrection; | ||
| if (!noSkewCorrection) { | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| signingProperties._requestSentAt = Date.now(); | ||
| } | ||
| const signedRequest = await signer.sign(httpRequest, { | ||
| signingDate: getSkewCorrectedDate(config.systemClockOffset), | ||
| signingDate: noSkewCorrection ? new Date() : getSkewCorrectedDate(config.systemClockOffset), | ||
| signingRegion: multiRegionOverride, | ||
@@ -169,3 +194,3 @@ signingService: signingName, | ||
| const resolveAwsSdkSigV4Config = (config) => { | ||
| const bindResolveAwsSdkSigV4Config = (defaultDisableClockSkewCorrection) => (config) => { | ||
| let inputCredentials = config.credentials; | ||
@@ -268,7 +293,7 @@ let isUserSupplied = !!config.credentials; | ||
| signer, | ||
| disableClockSkewCorrection: normalizeProvider(config.disableClockSkewCorrection ?? defaultDisableClockSkewCorrection), | ||
| }); | ||
| return resolvedConfig; | ||
| }; | ||
| const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; | ||
| function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider, }) { | ||
| function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider }) { | ||
| let credentialsProvider; | ||
@@ -308,2 +333,15 @@ if (credentials) { | ||
| const ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION"; | ||
| const CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction"; | ||
| const NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS = { | ||
| environmentVariableSelector: (env) => booleanSelector(env, ENV_DISABLE_CLOCK_SKEW_CORRECTION, SelectorType.ENV), | ||
| configFileSelector: (profile) => booleanSelector(profile, CONFIG_DISABLE_CLOCK_SKEW_CORRECTION, SelectorType.CONFIG), | ||
| default: false, | ||
| }; | ||
| const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = loadConfig(NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS); | ||
| const resolveAwsSdkSigV4Config = bindResolveAwsSdkSigV4Config(DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION); | ||
| const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; | ||
| exports.AWSSDKSigV4Signer = AWSSDKSigV4Signer; | ||
@@ -310,0 +348,0 @@ exports.AwsSdkSigV4ASigner = AwsSdkSigV4ASigner; |
@@ -13,5 +13,10 @@ import { HttpRequest } from "@smithy/core/protocols"; | ||
| signingRegionSet ?? [signingRegion]).join(","); | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| const noSkewCorrection = (await config.disableClockSkewCorrection?.()) === true; | ||
| signingProperties._disableClockSkewCorrection = noSkewCorrection; | ||
| if (!noSkewCorrection) { | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| signingProperties._requestSentAt = Date.now(); | ||
| } | ||
| const signedRequest = await signer.sign(httpRequest, { | ||
| signingDate: getSkewCorrectedDate(config.systemClockOffset), | ||
| signingDate: noSkewCorrection ? new Date() : getSkewCorrectedDate(config.systemClockOffset), | ||
| signingRegion: multiRegionOverride, | ||
@@ -18,0 +23,0 @@ signingService: signingName, |
| import { HttpRequest } from "@smithy/core/protocols"; | ||
| import { getDateHeader, getSkewCorrectedDate, getUpdatedSystemClockOffset } from "../utils"; | ||
| import { getAgeHeader, getDateHeader, getSkewCorrectedDate, getUpdatedSystemClockOffset } from "../utils"; | ||
| const throwSigningPropertyError = (name, property) => { | ||
@@ -42,5 +42,10 @@ if (!property) { | ||
| } | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| const noSkewCorrection = (await config.disableClockSkewCorrection?.()) === true; | ||
| signingProperties._disableClockSkewCorrection = noSkewCorrection; | ||
| if (!noSkewCorrection) { | ||
| signingProperties._preRequestSystemClockOffset = config.systemClockOffset; | ||
| signingProperties._requestSentAt = Date.now(); | ||
| } | ||
| const signedRequest = await signer.sign(httpRequest, { | ||
| signingDate: getSkewCorrectedDate(config.systemClockOffset), | ||
| signingDate: noSkewCorrection ? new Date() : getSkewCorrectedDate(config.systemClockOffset), | ||
| signingRegion: signingRegion, | ||
@@ -54,13 +59,17 @@ signingService: signingName, | ||
| const errorException = error; | ||
| const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response); | ||
| if (serverTime) { | ||
| const config = throwSigningPropertyError("config", signingProperties.config); | ||
| const preRequestOffset = signingProperties._preRequestSystemClockOffset; | ||
| const newOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset); | ||
| const isLocalCorrection = newOffset !== config.systemClockOffset; | ||
| const isConcurrentCorrection = preRequestOffset !== undefined && preRequestOffset !== newOffset; | ||
| const clockSkewCorrected = isLocalCorrection || isConcurrentCorrection; | ||
| if (clockSkewCorrected && errorException.$metadata) { | ||
| if (!signingProperties._disableClockSkewCorrection) { | ||
| const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response); | ||
| if (serverTime) { | ||
| const config = throwSigningPropertyError("config", signingProperties.config); | ||
| const preRequestOffset = signingProperties._preRequestSystemClockOffset; | ||
| const timeRequestSent = signingProperties._requestSentAt; | ||
| const ageHeader = getAgeHeader(errorException.$response); | ||
| const newOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset, timeRequestSent, ageHeader); | ||
| config.systemClockOffset = newOffset; | ||
| errorException.$metadata.clockSkewCorrected = true; | ||
| const skewExceedsThreshold = Math.abs(newOffset) >= 240_000; | ||
| const isLocalCorrection = newOffset !== preRequestOffset; | ||
| const isConcurrentCorrection = preRequestOffset !== undefined && preRequestOffset !== newOffset; | ||
| if (skewExceedsThreshold && (isLocalCorrection || isConcurrentCorrection) && errorException.$metadata) { | ||
| errorException.$metadata.clockSkewCorrected = true; | ||
| } | ||
| } | ||
@@ -72,6 +81,11 @@ } | ||
| successHandler(httpResponse, signingProperties) { | ||
| if (signingProperties._disableClockSkewCorrection) { | ||
| return; | ||
| } | ||
| const dateHeader = getDateHeader(httpResponse); | ||
| if (dateHeader) { | ||
| const config = throwSigningPropertyError("config", signingProperties.config); | ||
| config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset); | ||
| const timeRequestSent = signingProperties._requestSentAt; | ||
| const ageHeader = getAgeHeader(httpResponse); | ||
| config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset, timeRequestSent, ageHeader); | ||
| } | ||
@@ -78,0 +92,0 @@ } |
@@ -5,2 +5,2 @@ export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties } from "./AwsSdkSigV4Signer"; | ||
| export { resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS } from "./resolveAwsSdkSigV4AConfig"; | ||
| export { resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config } from "./resolveAwsSdkSigV4Config"; | ||
| export { bindResolveAwsSdkSigV4Config } from "./resolveAwsSdkSigV4Config"; |
| import { setCredentialFeature } from "@aws-sdk/core/client"; | ||
| import { doesIdentityRequireRefresh, isIdentityExpired, memoizeIdentityProvider, normalizeProvider, } from "@smithy/core"; | ||
| import { SignatureV4 } from "@smithy/signature-v4"; | ||
| export const resolveAwsSdkSigV4Config = (config) => { | ||
| export const bindResolveAwsSdkSigV4Config = (defaultDisableClockSkewCorrection) => (config) => { | ||
| let inputCredentials = config.credentials; | ||
@@ -102,7 +102,7 @@ let isUserSupplied = !!config.credentials; | ||
| signer, | ||
| disableClockSkewCorrection: normalizeProvider(config.disableClockSkewCorrection ?? defaultDisableClockSkewCorrection), | ||
| }); | ||
| return resolvedConfig; | ||
| }; | ||
| export const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; | ||
| function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider, }) { | ||
| function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider }) { | ||
| let credentialsProvider; | ||
@@ -109,0 +109,0 @@ if (credentials) { |
@@ -1,2 +0,6 @@ | ||
| export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS, resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config, } from "./aws_sdk"; | ||
| export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS, } from "./aws_sdk"; | ||
| export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey"; | ||
| import { bindResolveAwsSdkSigV4Config } from "./aws_sdk"; | ||
| import { DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION } from "./aws_sdk/clock-skew-defaults"; | ||
| export const resolveAwsSdkSigV4Config = bindResolveAwsSdkSigV4Config(DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION); | ||
| export const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; |
| import { HttpResponse } from "@smithy/core/protocols"; | ||
| export const getDateHeader = (response) => HttpResponse.isInstance(response) ? (response.headers?.date ?? response.headers?.Date) : undefined; | ||
| export const getAgeHeader = (response) => HttpResponse.isInstance(response) ? (response.headers?.age ?? response.headers?.Age) : undefined; |
@@ -1,8 +0,14 @@ | ||
| import { isClockSkewed } from "./isClockSkewed"; | ||
| export const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { | ||
| const clockTimeInMs = Date.parse(clockTime); | ||
| if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) { | ||
| return clockTimeInMs - Date.now(); | ||
| export const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset, timeRequestSent, ageHeader) => { | ||
| if (ageHeader !== undefined) { | ||
| return currentSystemClockOffset; | ||
| } | ||
| return currentSystemClockOffset; | ||
| const serverTime = Date.parse(clockTime); | ||
| const timeResponseReceived = Date.now(); | ||
| if (timeRequestSent !== undefined && timeResponseReceived - timeRequestSent > 900_000) { | ||
| return currentSystemClockOffset; | ||
| } | ||
| const candidateSkew = timeRequestSent !== undefined | ||
| ? serverTime - (timeRequestSent + timeResponseReceived) / 2 | ||
| : serverTime - timeResponseReceived; | ||
| return candidateSkew; | ||
| }; |
@@ -1,3 +0,4 @@ | ||
| export { getDateHeader } from "./getDateHeader"; | ||
| export { getAgeHeader, getDateHeader } from "./getDateHeader"; | ||
| export { getSkewCorrectedDate } from "./getSkewCorrectedDate"; | ||
| export { getUpdatedSystemClockOffset } from "./getUpdatedSystemClockOffset"; | ||
| export { isClockSkewed } from "./isClockSkewed"; |
| import { getSkewCorrectedDate } from "./getSkewCorrectedDate"; | ||
| export const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000; | ||
| export const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 240000; |
@@ -7,17 +7,7 @@ import { determineTimestampFormat } from "@smithy/core/protocols"; | ||
| import { UnionSerde } from "../../UnionSerde"; | ||
| import { detectBufferParsing } from "../detectBufferParsing"; | ||
| import { jsonReviver } from "../jsonReviver"; | ||
| import { needsReviver } from "../needsReviver"; | ||
| import { parseJsonBody } from "../parseJsonBody"; | ||
| let canParseBuffer; | ||
| function detectBufferParsing() { | ||
| if (canParseBuffer === undefined) { | ||
| try { | ||
| const result = JSON.parse(new Uint8Array([0x7b, 0x7d])); | ||
| canParseBuffer = result !== null && typeof result === "object"; | ||
| } | ||
| catch { | ||
| canParseBuffer = false; | ||
| } | ||
| } | ||
| return canParseBuffer; | ||
| } | ||
| import { writeKey } from "../../writeKey"; | ||
| export class BufferJsonShapeDeserializer extends SerdeContextConfig { | ||
@@ -30,8 +20,10 @@ settings; | ||
| async read(schema, data) { | ||
| const reviver = needsReviver(schema) ? jsonReviver : undefined; | ||
| let parsed; | ||
| if (typeof data === "string") { | ||
| parsed = JSON.parse(data, jsonReviver); | ||
| parsed = JSON.parse(data, reviver); | ||
| } | ||
| else if (data instanceof Uint8Array && detectBufferParsing()) { | ||
| parsed = JSON.parse(data, jsonReviver); | ||
| const buf = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength); | ||
| parsed = JSON.parse(buf, reviver); | ||
| } | ||
@@ -64,2 +56,5 @@ else { | ||
| for (const k in map) { | ||
| if (k === "__proto__") { | ||
| writeKey(map); | ||
| } | ||
| map[k] = this._read(mapMember, map[k]); | ||
@@ -132,2 +127,5 @@ } | ||
| for (const k in doc) { | ||
| if (k === "__proto__") { | ||
| writeKey(doc); | ||
| } | ||
| const v = doc[k]; | ||
@@ -134,0 +132,0 @@ if (!(v instanceof NumericValue)) { |
@@ -5,2 +5,3 @@ import { determineTimestampFormat } from "@smithy/core/protocols"; | ||
| import { SerdeContextConfig } from "../../ConfigurableSerdeContext"; | ||
| import { writeKey } from "../../writeKey"; | ||
| const encoder = new TextEncoder(); | ||
@@ -40,4 +41,2 @@ const OPEN_BRACE = 0x7b; | ||
| rootSchema; | ||
| sizeHistory = new Uint32Array(20); | ||
| sizeHistoryIndex = 0; | ||
| constructor(settings) { | ||
@@ -91,13 +90,5 @@ super(); | ||
| this.i = 0; | ||
| this.sizeHistory[this.sizeHistoryIndex] = finalPosition; | ||
| this.sizeHistoryIndex = (this.sizeHistoryIndex + 1) % 20; | ||
| let max = INITIAL_BUFFER_SIZE; | ||
| for (let i = 0; i < 20; i++) { | ||
| if (this.sizeHistory[i] > max) | ||
| max = this.sizeHistory[i]; | ||
| } | ||
| if (this.json.byteLength < max) { | ||
| this.json = alloc(max); | ||
| } | ||
| return this.json.slice(0, finalPosition); | ||
| const result = this.json.subarray(0, finalPosition); | ||
| this.json = alloc(INITIAL_BUFFER_SIZE); | ||
| return result; | ||
| } | ||
@@ -151,4 +142,4 @@ ensure(byteCount) { | ||
| this.json[this.i++] = BACKSLASH; | ||
| for (let j = 0; j < esc.length; j++) { | ||
| this.json[this.i++] = esc.charCodeAt(j); | ||
| for (let k = 0; k < esc.length; k++) { | ||
| this.json[this.i++] = esc.charCodeAt(k); | ||
| } | ||
@@ -430,6 +421,25 @@ } | ||
| writeMap(ns, value, isDocument) { | ||
| const sparse = !!ns.getMergedTraits().sparse; | ||
| const valueSchema = ns.getValueSchema(); | ||
| if (!isDocument) { | ||
| if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) { | ||
| let input = value; | ||
| if (sparse) { | ||
| input = {}; | ||
| for (const k in value) { | ||
| if (k === "__proto__") { | ||
| writeKey(input); | ||
| } | ||
| input[k] = value[k] ?? null; | ||
| } | ||
| } | ||
| const json = JSON.stringify(input); | ||
| this.ensure(json.length * 3); | ||
| const { written } = encoder.encodeInto(json, this.json.subarray(this.i)); | ||
| this.i += written; | ||
| return; | ||
| } | ||
| } | ||
| this.ensure(2); | ||
| this.json[this.i++] = OPEN_BRACE; | ||
| const sparse = !!ns.getMergedTraits().sparse; | ||
| const valueSchema = ns.getValueSchema(); | ||
| let first = true; | ||
@@ -436,0 +446,0 @@ for (const k in value) { |
@@ -8,3 +8,5 @@ import { determineTimestampFormat } from "@smithy/core/protocols"; | ||
| import { jsonReviver } from "./jsonReviver"; | ||
| import { needsReviver } from "./needsReviver"; | ||
| import { parseJsonBody } from "./parseJsonBody"; | ||
| import { writeKey } from "../writeKey"; | ||
| export class JsonShapeDeserializer extends SerdeContextConfig { | ||
@@ -17,3 +19,4 @@ settings; | ||
| async read(schema, data) { | ||
| return this._read(schema, typeof data === "string" ? JSON.parse(data, jsonReviver) : await parseJsonBody(data, this.serdeContext)); | ||
| const reviver = needsReviver(schema) ? jsonReviver : undefined; | ||
| return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema)); | ||
| } | ||
@@ -79,2 +82,5 @@ readObject(schema, data) { | ||
| for (const _k in value) { | ||
| if (_k === "__proto__") { | ||
| writeKey(out); | ||
| } | ||
| out[_k] = this._read(mapMember, value[_k]); | ||
@@ -138,2 +144,5 @@ } | ||
| for (const k in value) { | ||
| if (k === "__proto__") { | ||
| writeKey(out); | ||
| } | ||
| const v = value[k]; | ||
@@ -140,0 +149,0 @@ if (v instanceof NumericValue) { |
@@ -6,2 +6,3 @@ import { determineTimestampFormat } from "@smithy/core/protocols"; | ||
| import { JsonReplacer } from "./jsonReplacer"; | ||
| import { writeKey } from "../writeKey"; | ||
| export class JsonShapeSerializer extends SerdeContextConfig { | ||
@@ -68,2 +69,5 @@ settings; | ||
| const [k, v] = $unknown; | ||
| if (k === "__proto__") { | ||
| writeKey(out); | ||
| } | ||
| out[k] = this._write(15, v); | ||
@@ -101,2 +105,5 @@ } | ||
| if (sparse || _v != null) { | ||
| if (_k === "__proto__") { | ||
| writeKey(out); | ||
| } | ||
| out[_k] = this._write(mapMember, _v); | ||
@@ -167,2 +174,5 @@ } | ||
| const v = value[k]; | ||
| if (k === "__proto__") { | ||
| writeKey(out); | ||
| } | ||
| if (v instanceof NumericValue) { | ||
@@ -169,0 +179,0 @@ this.useReplacer = true; |
@@ -0,18 +1,38 @@ | ||
| import { collectBody } from "@smithy/core/protocols"; | ||
| import { collectBodyString } from "../common"; | ||
| export const parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { | ||
| if (encoded.length) { | ||
| try { | ||
| return JSON.parse(encoded); | ||
| } | ||
| catch (e) { | ||
| if (e?.name === "SyntaxError") { | ||
| Object.defineProperty(e, "$responseBodyText", { | ||
| value: encoded, | ||
| }); | ||
| import { detectBufferParsing } from "./detectBufferParsing"; | ||
| import { jsonReviver } from "./jsonReviver"; | ||
| import { needsReviver } from "./needsReviver"; | ||
| export async function parseJsonBody(streamBody, context, schema) { | ||
| let parsingInput; | ||
| if (detectBufferParsing() && typeof streamBody?.[Symbol.asyncIterator] === "function") { | ||
| const buffer = await collectBody(streamBody, context); | ||
| if (typeof Buffer === "function") { | ||
| if (Buffer.isBuffer(buffer)) { | ||
| parsingInput = buffer; | ||
| } | ||
| throw e; | ||
| else { | ||
| parsingInput = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength); | ||
| } | ||
| } | ||
| } | ||
| return {}; | ||
| }); | ||
| if (!parsingInput) { | ||
| parsingInput = await collectBodyString(streamBody, context); | ||
| } | ||
| if (parsingInput.length === 0) { | ||
| return {}; | ||
| } | ||
| const reviver = schema && needsReviver(schema) ? jsonReviver : undefined; | ||
| try { | ||
| return JSON.parse(parsingInput, reviver); | ||
| } | ||
| catch (e) { | ||
| if (e?.name === "SyntaxError") { | ||
| Object.defineProperty(e, "$responseBodyText", { | ||
| value: typeof parsingInput === "string" ? parsingInput : parsingInput.toString("utf8"), | ||
| }); | ||
| } | ||
| throw e; | ||
| } | ||
| } | ||
| export const parseJsonErrorBody = async (errorBody, context) => { | ||
@@ -19,0 +39,0 @@ const value = await parseJsonBody(errorBody, context); |
@@ -8,2 +8,3 @@ import { parseXML } from "@aws-sdk/xml-builder"; | ||
| import { UnionSerde } from "../UnionSerde"; | ||
| import { writeKey } from "../writeKey"; | ||
| export class XmlShapeDeserializer extends SerdeContextConfig { | ||
@@ -89,2 +90,5 @@ settings; | ||
| const value = entry[valueProperty]; | ||
| if (key === "__proto__") { | ||
| writeKey(buffer); | ||
| } | ||
| buffer[key] = this.readSchema(memberNs, value); | ||
@@ -91,0 +95,0 @@ } |
@@ -1,2 +0,2 @@ | ||
| import type { AuthScheme, AwsCredentialIdentity, HttpRequest as IHttpRequest, HttpResponse, HttpSigner, RequestSigner } from "@smithy/types"; | ||
| import type { AuthScheme, AwsCredentialIdentity, HttpRequest as IHttpRequest, HttpResponse, HttpSigner, Provider, RequestSigner } from "@smithy/types"; | ||
| import type { AwsSdkSigV4AAuthResolvedConfig } from "./resolveAwsSdkSigV4AConfig"; | ||
@@ -9,2 +9,3 @@ /** | ||
| signer: (authScheme?: AuthScheme) => Promise<RequestSigner>; | ||
| disableClockSkewCorrection?: Provider<boolean>; | ||
| } | ||
@@ -11,0 +12,0 @@ /** |
@@ -6,3 +6,3 @@ export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties } from "./AwsSdkSigV4Signer"; | ||
| export type { AwsSdkSigV4AAuthInputConfig, AwsSdkSigV4APreviouslyResolved, AwsSdkSigV4AAuthResolvedConfig, } from "./resolveAwsSdkSigV4AConfig"; | ||
| export { resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config } from "./resolveAwsSdkSigV4Config"; | ||
| export { bindResolveAwsSdkSigV4Config } from "./resolveAwsSdkSigV4Config"; | ||
| export type { AwsSdkSigV4AuthInputConfig, AwsSdkSigV4Memoized, AwsSdkSigV4PreviouslyResolved, AwsSdkSigV4AuthResolvedConfig, AWSSDKSigV4AuthInputConfig, AWSSDKSigV4PreviouslyResolved, AWSSDKSigV4AuthResolvedConfig, } from "./resolveAwsSdkSigV4Config"; |
@@ -36,2 +36,10 @@ import type { MergeFunctions } from "@aws-sdk/types"; | ||
| signerConstructor?: new (options: SignatureV4Init & SignatureV4CryptoInit) => RequestSigner; | ||
| /** | ||
| * Whether to disable clock skew correction. When true, the SDK will not adjust | ||
| * the signing timestamp, will not update the client clock offset from response | ||
| * headers, and will not retry clock skew errors. | ||
| * | ||
| * Defaults to false (correction enabled). | ||
| */ | ||
| disableClockSkewCorrection?: boolean | Provider<boolean>; | ||
| } | ||
@@ -91,9 +99,21 @@ /** | ||
| systemClockOffset: number; | ||
| /** | ||
| * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.disableClockSkewCorrection} | ||
| */ | ||
| disableClockSkewCorrection: Provider<boolean>; | ||
| } | ||
| /** | ||
| * Combined input config type used internally by the resolver and helper functions. | ||
| * @internal | ||
| */ | ||
| export declare const resolveAwsSdkSigV4Config: <T>(config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved) => T & AwsSdkSigV4AuthResolvedConfig; | ||
| type AwsSdkSigV4ConfigInput = AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved; | ||
| /** | ||
| * Accepts a platform-specific default for disableClockSkewCorrection and | ||
| * returns the resolver function. Called from the index (node vs browser). | ||
| * | ||
| * @internal | ||
| */ | ||
| export declare const bindResolveAwsSdkSigV4Config: (defaultDisableClockSkewCorrection: boolean | Provider<boolean>) => <T>(config: T & AwsSdkSigV4ConfigInput) => T & AwsSdkSigV4AuthResolvedConfig; | ||
| /** | ||
| * @internal | ||
| * @deprecated renamed to {@link AwsSdkSigV4AuthInputConfig} | ||
@@ -115,6 +135,2 @@ */ | ||
| } | ||
| /** | ||
| * @internal | ||
| * @deprecated renamed to {@link resolveAwsSdkSigV4Config} | ||
| */ | ||
| export declare const resolveAWSSDKSigV4Config: <T>(config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved) => T & AwsSdkSigV4AuthResolvedConfig; | ||
| export {}; |
@@ -1,3 +0,9 @@ | ||
| export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS, resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config, } from "./aws_sdk"; | ||
| export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS, } from "./aws_sdk"; | ||
| export type { AwsSdkSigV4AAuthInputConfig, AwsSdkSigV4APreviouslyResolved, AwsSdkSigV4AAuthResolvedConfig, AwsSdkSigV4AuthInputConfig, AwsSdkSigV4Memoized, AwsSdkSigV4PreviouslyResolved, AwsSdkSigV4AuthResolvedConfig, AWSSDKSigV4AuthInputConfig, AWSSDKSigV4PreviouslyResolved, AWSSDKSigV4AuthResolvedConfig, } from "./aws_sdk"; | ||
| export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey"; | ||
| export declare const resolveAwsSdkSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; | ||
| /** | ||
| * @internal | ||
| * @deprecated renamed to {@link resolveAwsSdkSigV4Config} | ||
| */ | ||
| export declare const resolveAWSSDKSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; |
@@ -5,1 +5,5 @@ /** | ||
| export declare const getDateHeader: (response: unknown) => string | undefined; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const getAgeHeader: (response: unknown) => string | undefined; |
| /** | ||
| * @internal | ||
| * Computes an updated system clock offset from a server Date header. | ||
| * | ||
| * If clock is skewed, it returns the difference between serverTime and current time. | ||
| * If clock is not skewed, it returns currentSystemClockOffset. | ||
| * When `timeRequestSent` is provided, uses the midpoint formula: | ||
| * elapsed = timeResponseReceived - timeRequestSent | ||
| * midpoint = (timeRequestSent + timeResponseReceived) / 2 | ||
| * candidateSkew = serverTime - midpoint | ||
| * | ||
| * @param clockTime The string value of the server time. | ||
| * @param currentSystemClockOffset The current system clock offset. | ||
| * When `timeRequestSent` is absent (legacy callers), falls back to: | ||
| * candidateSkew = serverTime - timeResponseReceived | ||
| * | ||
| * The candidate is discarded if: | ||
| * - An Age header is present | ||
| * - elapsed > 15 minutes | ||
| * | ||
| * The candidate is recorded unconditionally when not | ||
| * discarded. The detection threshold (4 min) is only used for retry decisions, | ||
| * not for whether to update the offset. | ||
| * | ||
| * @internal | ||
| * @param clockTime The string value of the Date response header. | ||
| * @param currentSystemClockOffset The current system clock offset in milliseconds. | ||
| * @param timeRequestSent The raw client time (ms) at which the request was sent. | ||
| * @param ageHeader The value of the Age response header, if present. | ||
| */ | ||
| export declare const getUpdatedSystemClockOffset: (clockTime: string, currentSystemClockOffset: number) => number; | ||
| export declare const getUpdatedSystemClockOffset: (clockTime: string, currentSystemClockOffset: number, timeRequestSent?: number, ageHeader?: string) => number; |
@@ -1,3 +0,4 @@ | ||
| export { getDateHeader } from "./getDateHeader"; | ||
| export { getAgeHeader, getDateHeader } from "./getDateHeader"; | ||
| export { getSkewCorrectedDate } from "./getSkewCorrectedDate"; | ||
| export { getUpdatedSystemClockOffset } from "./getUpdatedSystemClockOffset"; | ||
| export { isClockSkewed } from "./isClockSkewed"; |
@@ -15,4 +15,2 @@ import type { Schema, ShapeSerializer } from "@smithy/types"; | ||
| private rootSchema; | ||
| private readonly sizeHistory; | ||
| private sizeHistoryIndex; | ||
| constructor(settings: JsonSettings); | ||
@@ -19,0 +17,0 @@ write(schema: Schema, value: unknown): void; |
@@ -1,9 +0,14 @@ | ||
| import type { HttpResponse, SerdeFunctions } from "@smithy/types"; | ||
| import type { HttpResponse, Schema, SerdeFunctions } from "@smithy/types"; | ||
| /** | ||
| * @deprecated new calls to parseJsonBody must pass schema. | ||
| * @internal | ||
| */ | ||
| export declare const parseJsonBody: (streamBody: any, context: SerdeFunctions) => any; | ||
| export declare function parseJsonBody(streamBody: any, context: SerdeFunctions): Promise<any>; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare function parseJsonBody(streamBody: any, context: SerdeFunctions, schema: Schema): Promise<any>; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const parseJsonErrorBody: (errorBody: any, context: SerdeFunctions) => Promise<any>; | ||
@@ -10,0 +15,0 @@ /** |
@@ -7,2 +7,3 @@ import { | ||
| HttpSigner, | ||
| Provider, | ||
| RequestSigner, | ||
@@ -14,2 +15,3 @@ } from "@smithy/types"; | ||
| signer: (authScheme?: AuthScheme) => Promise<RequestSigner>; | ||
| disableClockSkewCorrection?: Provider<boolean>; | ||
| } | ||
@@ -16,0 +18,0 @@ interface AwsSdkSigV4AuthSigningProperties { |
@@ -14,3 +14,3 @@ export { | ||
| } from "./resolveAwsSdkSigV4AConfig"; | ||
| export { resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config } from "./resolveAwsSdkSigV4Config"; | ||
| export { bindResolveAwsSdkSigV4Config } from "./resolveAwsSdkSigV4Config"; | ||
| export { | ||
@@ -17,0 +17,0 @@ AwsSdkSigV4AuthInputConfig, |
@@ -21,2 +21,3 @@ import { MergeFunctions } from "@aws-sdk/types"; | ||
| signerConstructor?: new (options: SignatureV4Init & SignatureV4CryptoInit) => RequestSigner; | ||
| disableClockSkewCorrection?: boolean | Provider<boolean>; | ||
| } | ||
@@ -48,11 +49,11 @@ export type AwsSdkSigV4Memoized = { | ||
| systemClockOffset: number; | ||
| disableClockSkewCorrection: Provider<boolean>; | ||
| } | ||
| export declare const resolveAwsSdkSigV4Config: <T>( | ||
| config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved, | ||
| ) => T & AwsSdkSigV4AuthResolvedConfig; | ||
| type AwsSdkSigV4ConfigInput = AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved; | ||
| export declare const bindResolveAwsSdkSigV4Config: ( | ||
| defaultDisableClockSkewCorrection: boolean | Provider<boolean>, | ||
| ) => <T>(config: T & AwsSdkSigV4ConfigInput) => T & AwsSdkSigV4AuthResolvedConfig; | ||
| export interface AWSSDKSigV4AuthInputConfig extends AwsSdkSigV4AuthInputConfig {} | ||
| export interface AWSSDKSigV4PreviouslyResolved extends AwsSdkSigV4PreviouslyResolved {} | ||
| export interface AWSSDKSigV4AuthResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {} | ||
| export declare const resolveAWSSDKSigV4Config: <T>( | ||
| config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved, | ||
| ) => T & AwsSdkSigV4AuthResolvedConfig; | ||
| export {}; |
@@ -9,4 +9,2 @@ export { | ||
| NODE_SIGV4A_CONFIG_OPTIONS, | ||
| resolveAwsSdkSigV4Config, | ||
| resolveAWSSDKSigV4Config, | ||
| } from "./aws_sdk"; | ||
@@ -26,1 +24,11 @@ export { | ||
| export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey"; | ||
| export declare const resolveAwsSdkSigV4Config: <T>( | ||
| config: T & | ||
| (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & | ||
| import("./aws_sdk").AwsSdkSigV4PreviouslyResolved), | ||
| ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; | ||
| export declare const resolveAWSSDKSigV4Config: <T>( | ||
| config: T & | ||
| (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & | ||
| import("./aws_sdk").AwsSdkSigV4PreviouslyResolved), | ||
| ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig; |
| export declare const getDateHeader: (response: unknown) => string | undefined; | ||
| export declare const getAgeHeader: (response: unknown) => string | undefined; |
| export declare const getUpdatedSystemClockOffset: ( | ||
| clockTime: string, | ||
| currentSystemClockOffset: number, | ||
| timeRequestSent?: number, | ||
| ageHeader?: string, | ||
| ) => number; |
@@ -1,3 +0,4 @@ | ||
| export { getDateHeader } from "./getDateHeader"; | ||
| export { getAgeHeader, getDateHeader } from "./getDateHeader"; | ||
| export { getSkewCorrectedDate } from "./getSkewCorrectedDate"; | ||
| export { getUpdatedSystemClockOffset } from "./getUpdatedSystemClockOffset"; | ||
| export { isClockSkewed } from "./isClockSkewed"; |
@@ -12,4 +12,2 @@ import { Schema, ShapeSerializer } from "@smithy/types"; | ||
| private rootSchema; | ||
| private readonly sizeHistory; | ||
| private sizeHistoryIndex; | ||
| constructor(settings: JsonSettings); | ||
@@ -16,0 +14,0 @@ write(schema: Schema, value: unknown): void; |
@@ -1,3 +0,8 @@ | ||
| import { HttpResponse, SerdeFunctions } from "@smithy/types"; | ||
| export declare const parseJsonBody: (streamBody: any, context: SerdeFunctions) => any; | ||
| import { HttpResponse, Schema, SerdeFunctions } from "@smithy/types"; | ||
| export declare function parseJsonBody(streamBody: any, context: SerdeFunctions): Promise<any>; | ||
| export declare function parseJsonBody( | ||
| streamBody: any, | ||
| context: SerdeFunctions, | ||
| schema: Schema, | ||
| ): Promise<any>; | ||
| export declare const parseJsonErrorBody: (errorBody: any, context: SerdeFunctions) => Promise<any>; | ||
@@ -4,0 +9,0 @@ export declare const loadRestJsonErrorCode: (output: HttpResponse, data: any) => string | undefined; |
+10
-6
| { | ||
| "name": "@aws-sdk/core", | ||
| "version": "3.976.0", | ||
| "version": "3.977.0", | ||
| "description": "Core functions & classes shared by multiple AWS SDK clients.", | ||
@@ -36,3 +36,4 @@ "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/core", | ||
| "browser": { | ||
| "./dist-es/submodules/client/index.js": "./dist-es/submodules/client/index.browser.js" | ||
| "./dist-es/submodules/client/index.js": "./dist-es/submodules/client/index.browser.js", | ||
| "./dist-es/submodules/httpAuthSchemes/index.js": "./dist-es/submodules/httpAuthSchemes/index.browser.js" | ||
| }, | ||
@@ -51,3 +52,4 @@ "types": "./dist-types/index.d.ts", | ||
| "react-native": { | ||
| "./dist-es/submodules/client/index.js": "./dist-es/submodules/client/index.native.js" | ||
| "./dist-es/submodules/client/index.js": "./dist-es/submodules/client/index.native.js", | ||
| "./dist-es/submodules/httpAuthSchemes/index.js": "./dist-es/submodules/httpAuthSchemes/index.browser.js" | ||
| }, | ||
@@ -79,2 +81,4 @@ "exports": { | ||
| "types": "./dist-types/submodules/httpAuthSchemes/index.d.ts", | ||
| "react-native": "./dist-es/submodules/httpAuthSchemes/index.browser.js", | ||
| "browser": "./dist-es/submodules/httpAuthSchemes/index.browser.js", | ||
| "module": "./dist-es/submodules/httpAuthSchemes/index.js", | ||
@@ -127,6 +131,6 @@ "node": "./dist-cjs/submodules/httpAuthSchemes/index.js", | ||
| "@aws-sdk/types": "^3.974.2", | ||
| "@aws-sdk/xml-builder": "^3.972.36", | ||
| "@aws-sdk/xml-builder": "^3.972.37", | ||
| "@aws/lambda-invoke-store": "^0.3.0", | ||
| "@smithy/core": "^3.29.4", | ||
| "@smithy/signature-v4": "^5.6.5", | ||
| "@smithy/core": "^3.29.8", | ||
| "@smithy/signature-v4": "^5.6.9", | ||
| "@smithy/types": "^4.16.1", | ||
@@ -133,0 +137,0 @@ "bowser": "^2.11.0", |
Sorry, the diff of this file is too big to display
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
522778
4.27%348
6.42%12534
3.79%1
Infinity%Updated
Updated