@aws-sdk/core 3.975.3 → 3.977.0

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.
Files changed (61) hide show
  1. package/dist-cjs/submodules/httpAuthSchemes/index.js +66 -28
  2. package/dist-cjs/submodules/protocols/index.js +111 -12
  3. package/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js +7 -2
  4. package/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +28 -14
  5. package/dist-es/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.js +1 -0
  6. package/dist-es/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.js +3 -0
  7. package/dist-es/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.js +8 -0
  8. package/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js +1 -1
  9. package/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +3 -3
  10. package/dist-es/submodules/httpAuthSchemes/index.browser.js +9 -0
  11. package/dist-es/submodules/httpAuthSchemes/index.js +5 -1
  12. package/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js +1 -0
  13. package/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +12 -6
  14. package/dist-es/submodules/httpAuthSchemes/utils/index.js +2 -1
  15. package/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js +1 -1
  16. package/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +10 -1
  17. package/dist-es/submodules/protocols/json/JsonShapeSerializer.js +10 -0
  18. package/dist-es/submodules/protocols/json/detectBufferParsing.js +18 -0
  19. package/dist-es/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.js +180 -0
  20. package/dist-es/submodules/protocols/json/experimental/ByteJsonShapeSerializer.js +483 -0
  21. package/dist-es/submodules/protocols/json/needsReviver.js +41 -0
  22. package/dist-es/submodules/protocols/json/parseJsonBody.js +33 -13
  23. package/dist-es/submodules/protocols/writeKey.js +3 -0
  24. package/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js +4 -0
  25. package/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +2 -1
  26. package/dist-types/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.d.ts +6 -0
  27. package/dist-types/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.d.ts +7 -0
  28. package/dist-types/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.d.ts +13 -0
  29. package/dist-types/submodules/httpAuthSchemes/aws_sdk/index.d.ts +1 -1
  30. package/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +22 -6
  31. package/dist-types/submodules/httpAuthSchemes/index.browser.d.ts +11 -0
  32. package/dist-types/submodules/httpAuthSchemes/index.d.ts +7 -1
  33. package/dist-types/submodules/httpAuthSchemes/utils/getDateHeader.d.ts +4 -0
  34. package/dist-types/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +22 -6
  35. package/dist-types/submodules/httpAuthSchemes/utils/index.d.ts +2 -1
  36. package/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +1 -0
  37. package/dist-types/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +29 -0
  38. package/dist-types/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +57 -0
  39. package/dist-types/submodules/protocols/json/needsReviver.d.ts +11 -0
  40. package/dist-types/submodules/protocols/json/parseJsonBody.d.ts +7 -2
  41. package/dist-types/submodules/protocols/writeKey.d.ts +4 -0
  42. package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +2 -0
  43. package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.d.ts +1 -0
  44. package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.d.ts +1 -0
  45. package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.d.ts +4 -0
  46. package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/index.d.ts +1 -1
  47. package/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +7 -6
  48. package/dist-types/ts3.4/submodules/httpAuthSchemes/index.browser.d.ts +32 -0
  49. package/dist-types/ts3.4/submodules/httpAuthSchemes/index.d.ts +10 -2
  50. package/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getDateHeader.d.ts +1 -0
  51. package/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +2 -0
  52. package/dist-types/ts3.4/submodules/httpAuthSchemes/utils/index.d.ts +2 -1
  53. package/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -0
  54. package/dist-types/ts3.4/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +14 -0
  55. package/dist-types/ts3.4/submodules/protocols/json/experimental/{SinglePassJsonShapeSerializer.d.ts → ByteJsonShapeSerializer.d.ts} +16 -5
  56. package/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +2 -0
  57. package/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +7 -2
  58. package/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +1 -0
  59. package/package.json +11 -6
  60. package/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +0 -135
  61. package/dist-types/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.d.ts +0 -27
@@ -1,20 +1,40 @@
1
+ import { collectBody } from "@smithy/core/protocols";
1
2
  import { collectBodyString } from "../common";
2
- export const parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
3
- if (encoded.length) {
4
- try {
5
- return JSON.parse(encoded);
6
- }
7
- catch (e) {
8
- if (e?.name === "SyntaxError") {
9
- Object.defineProperty(e, "$responseBodyText", {
10
- value: encoded,
11
- });
3
+ import { detectBufferParsing } from "./detectBufferParsing";
4
+ import { jsonReviver } from "./jsonReviver";
5
+ import { needsReviver } from "./needsReviver";
6
+ export async function parseJsonBody(streamBody, context, schema) {
7
+ let parsingInput;
8
+ if (detectBufferParsing() && typeof streamBody?.[Symbol.asyncIterator] === "function") {
9
+ const buffer = await collectBody(streamBody, context);
10
+ if (typeof Buffer === "function") {
11
+ if (Buffer.isBuffer(buffer)) {
12
+ parsingInput = buffer;
13
+ }
14
+ else {
15
+ parsingInput = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
12
16
  }
13
- throw e;
14
17
  }
15
18
  }
16
- return {};
17
- });
19
+ if (!parsingInput) {
20
+ parsingInput = await collectBodyString(streamBody, context);
21
+ }
22
+ if (parsingInput.length === 0) {
23
+ return {};
24
+ }
25
+ const reviver = schema && needsReviver(schema) ? jsonReviver : undefined;
26
+ try {
27
+ return JSON.parse(parsingInput, reviver);
28
+ }
29
+ catch (e) {
30
+ if (e?.name === "SyntaxError") {
31
+ Object.defineProperty(e, "$responseBodyText", {
32
+ value: typeof parsingInput === "string" ? parsingInput : parsingInput.toString("utf8"),
33
+ });
34
+ }
35
+ throw e;
36
+ }
37
+ }
18
38
  export const parseJsonErrorBody = async (errorBody, context) => {
19
39
  const value = await parseJsonBody(errorBody, context);
20
40
  value.message = value.message ?? value.Message;
@@ -0,0 +1,3 @@
1
+ export function writeKey(obj) {
2
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
3
+ }
@@ -5,6 +5,7 @@ import { NormalizedSchema } from "@smithy/core/schema";
5
5
  import { toUtf8 } from "@smithy/core/serde";
6
6
  import { SerdeContextConfig } from "../ConfigurableSerdeContext";
7
7
  import { UnionSerde } from "../UnionSerde";
8
+ import { writeKey } from "../writeKey";
8
9
  export class XmlShapeDeserializer extends SerdeContextConfig {
9
10
  settings;
10
11
  stringDeserializer;
@@ -85,6 +86,9 @@ export class XmlShapeDeserializer extends SerdeContextConfig {
85
86
  for (const entry of entries) {
86
87
  const key = entry[keyProperty];
87
88
  const value = entry[valueProperty];
89
+ if (key === "__proto__") {
90
+ writeKey(buffer);
91
+ }
88
92
  buffer[key] = this.readSchema(memberNs, value);
89
93
  }
90
94
  return buffer;
@@ -1,4 +1,4 @@
1
- import type { AuthScheme, AwsCredentialIdentity, HttpRequest as IHttpRequest, HttpResponse, HttpSigner, RequestSigner } from "@smithy/types";
1
+ import type { AuthScheme, AwsCredentialIdentity, HttpRequest as IHttpRequest, HttpResponse, HttpSigner, Provider, RequestSigner } from "@smithy/types";
2
2
  import type { AwsSdkSigV4AAuthResolvedConfig } from "./resolveAwsSdkSigV4AConfig";
3
3
  /**
4
4
  * @internal
@@ -6,6 +6,7 @@ import type { AwsSdkSigV4AAuthResolvedConfig } from "./resolveAwsSdkSigV4AConfig
6
6
  interface AwsSdkSigV4Config extends AwsSdkSigV4AAuthResolvedConfig {
7
7
  systemClockOffset: number;
8
8
  signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
9
+ disableClockSkewCorrection?: Provider<boolean>;
9
10
  }
10
11
  /**
11
12
  * @internal
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Browser default: clock skew correction enabled.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = false;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Node.js default: lazily reads from env var / shared config file.
3
+ * Browser counterpart (via index binding) exports `false`.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION: import("@smithy/types").Provider<boolean>;
@@ -0,0 +1,13 @@
1
+ import { type LoadedConfigSelectors } from "@smithy/core/config";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION";
6
+ /**
7
+ * @internal
8
+ */
9
+ export declare const CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction";
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare const NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
@@ -3,5 +3,5 @@ export { AwsSdkSigV4ASigner } from "./AwsSdkSigV4ASigner";
3
3
  export { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS } from "./NODE_AUTH_SCHEME_PREFERENCE_OPTIONS";
4
4
  export { resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS } from "./resolveAwsSdkSigV4AConfig";
5
5
  export type { AwsSdkSigV4AAuthInputConfig, AwsSdkSigV4APreviouslyResolved, AwsSdkSigV4AAuthResolvedConfig, } from "./resolveAwsSdkSigV4AConfig";
6
- export { resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config } from "./resolveAwsSdkSigV4Config";
6
+ export { bindResolveAwsSdkSigV4Config } from "./resolveAwsSdkSigV4Config";
7
7
  export type { AwsSdkSigV4AuthInputConfig, AwsSdkSigV4Memoized, AwsSdkSigV4PreviouslyResolved, AwsSdkSigV4AuthResolvedConfig, AWSSDKSigV4AuthInputConfig, AWSSDKSigV4PreviouslyResolved, AWSSDKSigV4AuthResolvedConfig, } from "./resolveAwsSdkSigV4Config";
@@ -33,6 +33,14 @@ export interface AwsSdkSigV4AuthInputConfig {
33
33
  * @internal
34
34
  */
35
35
  signerConstructor?: new (options: SignatureV4Init & SignatureV4CryptoInit) => RequestSigner;
36
+ /**
37
+ * Whether to disable clock skew correction. When true, the SDK will not adjust
38
+ * the signing timestamp, will not update the client clock offset from response
39
+ * headers, and will not retry clock skew errors.
40
+ *
41
+ * Defaults to false (correction enabled).
42
+ */
43
+ disableClockSkewCorrection?: boolean | Provider<boolean>;
36
44
  }
37
45
  /**
38
46
  * Used to indicate whether a credential provider function was memoized by this resolver.
@@ -87,11 +95,23 @@ export interface AwsSdkSigV4AuthResolvedConfig {
87
95
  * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.systemClockOffset}
88
96
  */
89
97
  systemClockOffset: number;
98
+ /**
99
+ * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.disableClockSkewCorrection}
100
+ */
101
+ disableClockSkewCorrection: Provider<boolean>;
90
102
  }
91
103
  /**
104
+ * Combined input config type used internally by the resolver and helper functions.
92
105
  * @internal
93
106
  */
94
- export declare const resolveAwsSdkSigV4Config: <T>(config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved) => T & AwsSdkSigV4AuthResolvedConfig;
107
+ type AwsSdkSigV4ConfigInput = AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved;
108
+ /**
109
+ * Accepts a platform-specific default for disableClockSkewCorrection and
110
+ * returns the resolver function. Called from the index (node vs browser).
111
+ *
112
+ * @internal
113
+ */
114
+ export declare const bindResolveAwsSdkSigV4Config: (defaultDisableClockSkewCorrection: boolean | Provider<boolean>) => <T>(config: T & AwsSdkSigV4ConfigInput) => T & AwsSdkSigV4AuthResolvedConfig;
95
115
  /**
96
116
  * @internal
97
117
  * @deprecated renamed to {@link AwsSdkSigV4AuthInputConfig}
@@ -110,8 +130,4 @@ export interface AWSSDKSigV4PreviouslyResolved extends AwsSdkSigV4PreviouslyReso
110
130
  */
111
131
  export interface AWSSDKSigV4AuthResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {
112
132
  }
113
- /**
114
- * @internal
115
- * @deprecated renamed to {@link resolveAwsSdkSigV4Config}
116
- */
117
- export declare const resolveAWSSDKSigV4Config: <T>(config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved) => T & AwsSdkSigV4AuthResolvedConfig;
133
+ export {};
@@ -0,0 +1,11 @@
1
+ export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, resolveAwsSdkSigV4AConfig, } from "./aws_sdk";
2
+ export type { AwsSdkSigV4AAuthInputConfig, AwsSdkSigV4APreviouslyResolved, AwsSdkSigV4AAuthResolvedConfig, AwsSdkSigV4AuthInputConfig, AwsSdkSigV4Memoized, AwsSdkSigV4PreviouslyResolved, AwsSdkSigV4AuthResolvedConfig, AWSSDKSigV4AuthInputConfig, AWSSDKSigV4PreviouslyResolved, AWSSDKSigV4AuthResolvedConfig, } from "./aws_sdk";
3
+ export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey";
4
+ export declare const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS: symbol;
5
+ export declare const NODE_SIGV4A_CONFIG_OPTIONS: symbol;
6
+ export declare const resolveAwsSdkSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
7
+ /**
8
+ * @internal
9
+ * @deprecated renamed to {@link resolveAwsSdkSigV4Config}
10
+ */
11
+ export declare const resolveAWSSDKSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
@@ -1,3 +1,9 @@
1
- export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS, resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config, } from "./aws_sdk";
1
+ export { AwsSdkSigV4Signer, AWSSDKSigV4Signer, validateSigningProperties, AwsSdkSigV4ASigner, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS, } from "./aws_sdk";
2
2
  export type { AwsSdkSigV4AAuthInputConfig, AwsSdkSigV4APreviouslyResolved, AwsSdkSigV4AAuthResolvedConfig, AwsSdkSigV4AuthInputConfig, AwsSdkSigV4Memoized, AwsSdkSigV4PreviouslyResolved, AwsSdkSigV4AuthResolvedConfig, AWSSDKSigV4AuthInputConfig, AWSSDKSigV4PreviouslyResolved, AWSSDKSigV4AuthResolvedConfig, } from "./aws_sdk";
3
3
  export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey";
4
+ export declare const resolveAwsSdkSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
5
+ /**
6
+ * @internal
7
+ * @deprecated renamed to {@link resolveAwsSdkSigV4Config}
8
+ */
9
+ export declare const resolveAWSSDKSigV4Config: <T>(config: T & (import("./aws_sdk").AwsSdkSigV4AuthInputConfig & import("./aws_sdk").AwsSdkSigV4PreviouslyResolved)) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
@@ -2,3 +2,7 @@
2
2
  * @internal
3
3
  */
4
4
  export declare const getDateHeader: (response: unknown) => string | undefined;
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare const getAgeHeader: (response: unknown) => string | undefined;
@@ -1,10 +1,26 @@
1
1
  /**
2
- * @internal
2
+ * Computes an updated system clock offset from a server Date header.
3
+ *
4
+ * When `timeRequestSent` is provided, uses the midpoint formula:
5
+ * elapsed = timeResponseReceived - timeRequestSent
6
+ * midpoint = (timeRequestSent + timeResponseReceived) / 2
7
+ * candidateSkew = serverTime - midpoint
8
+ *
9
+ * When `timeRequestSent` is absent (legacy callers), falls back to:
10
+ * candidateSkew = serverTime - timeResponseReceived
3
11
  *
4
- * If clock is skewed, it returns the difference between serverTime and current time.
5
- * If clock is not skewed, it returns currentSystemClockOffset.
12
+ * The candidate is discarded if:
13
+ * - An Age header is present
14
+ * - elapsed > 15 minutes
6
15
  *
7
- * @param clockTime The string value of the server time.
8
- * @param currentSystemClockOffset The current system clock offset.
16
+ * The candidate is recorded unconditionally when not
17
+ * discarded. The detection threshold (4 min) is only used for retry decisions,
18
+ * not for whether to update the offset.
19
+ *
20
+ * @internal
21
+ * @param clockTime The string value of the Date response header.
22
+ * @param currentSystemClockOffset The current system clock offset in milliseconds.
23
+ * @param timeRequestSent The raw client time (ms) at which the request was sent.
24
+ * @param ageHeader The value of the Age response header, if present.
9
25
  */
10
- export declare const getUpdatedSystemClockOffset: (clockTime: string, currentSystemClockOffset: number) => number;
26
+ export declare const getUpdatedSystemClockOffset: (clockTime: string, currentSystemClockOffset: number, timeRequestSent?: number, ageHeader?: string) => number;
@@ -1,3 +1,4 @@
1
- export { getDateHeader } from "./getDateHeader";
1
+ export { getAgeHeader, getDateHeader } from "./getDateHeader";
2
2
  export { getSkewCorrectedDate } from "./getSkewCorrectedDate";
3
3
  export { getUpdatedSystemClockOffset } from "./getUpdatedSystemClockOffset";
4
+ export { isClockSkewed } from "./isClockSkewed";
@@ -0,0 +1 @@
1
+ export declare function detectBufferParsing(): boolean;
@@ -0,0 +1,29 @@
1
+ import type { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
+ import type { JsonSettings } from "../JsonCodec";
4
+ /**
5
+ * Performance-optimized JSON deserializer.
6
+ *
7
+ * Skips UTF-8 decoding when the runtime supports JSON.parse(Buffer) (Node 22+).
8
+ *
9
+ * After JSON.parse, lists, maps, and document containers are mutated in place
10
+ * (element values are overwritten with their deserialized form) rather than
11
+ * copied into new arrays/objects. Structs allocate a fresh object because
12
+ * jsonName traits require key renaming, and building the output object
13
+ * incrementally lets V8 assign a stable hidden class rather than
14
+ * deoptimizing from repeated property deletion/addition on an existing shape.
15
+ *
16
+ * In-place mutation is safe here because the parsed tree is locally owned
17
+ * after JSON.parse with no external references, so rewriting values avoids
18
+ * redundant allocation and GC pressure.
19
+ *
20
+ * @internal
21
+ */
22
+ export declare class BufferJsonShapeDeserializer extends SerdeContextConfig implements ShapeDeserializer<string> {
23
+ readonly settings: JsonSettings;
24
+ constructor(settings: JsonSettings);
25
+ read(schema: Schema, data: string | Uint8Array | unknown): Promise<any>;
26
+ readObject(schema: Schema, data: DocumentType): any;
27
+ protected _read(schema: Schema, value: unknown): any;
28
+ private _readStruct;
29
+ }
@@ -0,0 +1,57 @@
1
+ import type { Schema, ShapeSerializer } from "@smithy/types";
2
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
+ import type { JsonSettings } from "../JsonCodec";
4
+ /**
5
+ * Experimental single-pass JSON serializer that writes directly to a Uint8Array buffer.
6
+ * Fewer intermediate states as when compared to the initial multi-pass implementation.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare class ByteJsonShapeSerializer extends SerdeContextConfig implements ShapeSerializer<Uint8Array> {
11
+ readonly settings: JsonSettings;
12
+ private json;
13
+ private i;
14
+ private rootSchema;
15
+ constructor(settings: JsonSettings);
16
+ write(schema: Schema, value: unknown): void;
17
+ /**
18
+ * @internal
19
+ */
20
+ writeDiscriminatedDocument(schema: Schema, value: unknown): void;
21
+ /**
22
+ * Returns the serialized JSON as a Uint8Array (UTF-8 bytes).
23
+ * This is the primary output — pass directly to request.body.
24
+ */
25
+ flush(): Uint8Array;
26
+ private ensure;
27
+ /**
28
+ * Write a raw ASCII string (no JSON escaping). Used for pre-validated content
29
+ * like numeric literals and pre-encoded base64.
30
+ */
31
+ private writeAscii;
32
+ /**
33
+ * Write a quoted ASCII string with no escape checking.
34
+ * Used for struct member keys (jsonName or model names) which are
35
+ * guaranteed to be safe ASCII identifiers. No control chars, quotes,
36
+ * backslashes, or non-ASCII.
37
+ * Ensures extra room for surrounding structural chars (comma, colon).
38
+ */
39
+ private writeAsciiQuoted;
40
+ /**
41
+ * Write a JSON-escaped string including the surrounding quotes.
42
+ * Fast-path for ASCII, falls back to TextEncoder for multi-byte.
43
+ */
44
+ private writeJsonString;
45
+ private writeUnicodeEscape;
46
+ private static readonly B64;
47
+ /**
48
+ * Write a Uint8Array as a quoted base64 string directly into the buffer.
49
+ * No intermediate JS string, no escape checking (base64 alphabet is safe ASCII).
50
+ */
51
+ private writeBase64;
52
+ private writeValue;
53
+ private writeStruct;
54
+ private writeList;
55
+ private writeMap;
56
+ private writeTimestamp;
57
+ }
@@ -0,0 +1,11 @@
1
+ import type { Schema } from "@smithy/types";
2
+ /**
3
+ * Determines whether a schema tree contains BigInteger or BigDecimal members,
4
+ * which require a JSON.parse reviver to preserve numeric precision.
5
+ *
6
+ * The result is cached on the root static schema array (struct schemas) via a Symbol key,
7
+ * so subsequent calls for the same schema are O(1).
8
+ *
9
+ * @internal
10
+ */
11
+ export declare function needsReviver(schema: Schema): boolean;
@@ -1,8 +1,13 @@
1
- import type { HttpResponse, SerdeFunctions } from "@smithy/types";
1
+ import type { HttpResponse, Schema, SerdeFunctions } from "@smithy/types";
2
2
  /**
3
+ * @deprecated new calls to parseJsonBody must pass schema.
3
4
  * @internal
4
5
  */
5
- export declare const parseJsonBody: (streamBody: any, context: SerdeFunctions) => any;
6
+ export declare function parseJsonBody(streamBody: any, context: SerdeFunctions): Promise<any>;
7
+ /**
8
+ * @internal
9
+ */
10
+ export declare function parseJsonBody(streamBody: any, context: SerdeFunctions, schema: Schema): Promise<any>;
6
11
  /**
7
12
  * @internal
8
13
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Makes __proto__ writable on a given object.
3
+ */
4
+ export declare function writeKey(obj: object | Record<string, unknown> | any): void;
@@ -4,12 +4,14 @@ import {
4
4
  HttpRequest as IHttpRequest,
5
5
  HttpResponse,
6
6
  HttpSigner,
7
+ Provider,
7
8
  RequestSigner,
8
9
  } from "@smithy/types";
9
10
  import { AwsSdkSigV4AAuthResolvedConfig } from "./resolveAwsSdkSigV4AConfig";
10
11
  interface AwsSdkSigV4Config extends AwsSdkSigV4AAuthResolvedConfig {
11
12
  systemClockOffset: number;
12
13
  signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
14
+ disableClockSkewCorrection?: Provider<boolean>;
13
15
  }
14
16
  interface AwsSdkSigV4AuthSigningProperties {
15
17
  config: AwsSdkSigV4Config;
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION = false;
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_DISABLE_CLOCK_SKEW_CORRECTION: import("@smithy/types").Provider<boolean>;
@@ -0,0 +1,4 @@
1
+ import { LoadedConfigSelectors } from "@smithy/core/config";
2
+ export declare const ENV_DISABLE_CLOCK_SKEW_CORRECTION = "AWS_DISABLE_CLOCK_SKEW_CORRECTION";
3
+ export declare const CONFIG_DISABLE_CLOCK_SKEW_CORRECTION = "disable_clock_skew_correction";
4
+ export declare const NODE_DISABLE_CLOCK_SKEW_CORRECTION_CONFIG_OPTIONS: LoadedConfigSelectors<boolean>;
@@ -11,7 +11,7 @@ export {
11
11
  AwsSdkSigV4APreviouslyResolved,
12
12
  AwsSdkSigV4AAuthResolvedConfig,
13
13
  } from "./resolveAwsSdkSigV4AConfig";
14
- export { resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config } from "./resolveAwsSdkSigV4Config";
14
+ export { bindResolveAwsSdkSigV4Config } from "./resolveAwsSdkSigV4Config";
15
15
  export {
16
16
  AwsSdkSigV4AuthInputConfig,
17
17
  AwsSdkSigV4Memoized,
@@ -18,6 +18,7 @@ export interface AwsSdkSigV4AuthInputConfig {
18
18
  systemClockOffset?: number;
19
19
  signingRegion?: string;
20
20
  signerConstructor?: new (options: SignatureV4Init & SignatureV4CryptoInit) => RequestSigner;
21
+ disableClockSkewCorrection?: boolean | Provider<boolean>;
21
22
  }
22
23
  export type AwsSdkSigV4Memoized = {
23
24
  memoized?: boolean;
@@ -44,13 +45,13 @@ export interface AwsSdkSigV4AuthResolvedConfig {
44
45
  signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
45
46
  signingEscapePath: boolean;
46
47
  systemClockOffset: number;
48
+ disableClockSkewCorrection: Provider<boolean>;
47
49
  }
48
- export declare const resolveAwsSdkSigV4Config: <T>(
49
- config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved,
50
- ) => T & AwsSdkSigV4AuthResolvedConfig;
50
+ type AwsSdkSigV4ConfigInput = AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved;
51
+ export declare const bindResolveAwsSdkSigV4Config: (
52
+ defaultDisableClockSkewCorrection: boolean | Provider<boolean>,
53
+ ) => <T>(config: T & AwsSdkSigV4ConfigInput) => T & AwsSdkSigV4AuthResolvedConfig;
51
54
  export interface AWSSDKSigV4AuthInputConfig extends AwsSdkSigV4AuthInputConfig {}
52
55
  export interface AWSSDKSigV4PreviouslyResolved extends AwsSdkSigV4PreviouslyResolved {}
53
56
  export interface AWSSDKSigV4AuthResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {}
54
- export declare const resolveAWSSDKSigV4Config: <T>(
55
- config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved,
56
- ) => T & AwsSdkSigV4AuthResolvedConfig;
57
+ export {};
@@ -0,0 +1,32 @@
1
+ export {
2
+ AwsSdkSigV4Signer,
3
+ AWSSDKSigV4Signer,
4
+ validateSigningProperties,
5
+ AwsSdkSigV4ASigner,
6
+ resolveAwsSdkSigV4AConfig,
7
+ } from "./aws_sdk";
8
+ export {
9
+ AwsSdkSigV4AAuthInputConfig,
10
+ AwsSdkSigV4APreviouslyResolved,
11
+ AwsSdkSigV4AAuthResolvedConfig,
12
+ AwsSdkSigV4AuthInputConfig,
13
+ AwsSdkSigV4Memoized,
14
+ AwsSdkSigV4PreviouslyResolved,
15
+ AwsSdkSigV4AuthResolvedConfig,
16
+ AWSSDKSigV4AuthInputConfig,
17
+ AWSSDKSigV4PreviouslyResolved,
18
+ AWSSDKSigV4AuthResolvedConfig,
19
+ } from "./aws_sdk";
20
+ export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey";
21
+ export declare const NODE_AUTH_SCHEME_PREFERENCE_OPTIONS: symbol;
22
+ export declare const NODE_SIGV4A_CONFIG_OPTIONS: symbol;
23
+ export declare const resolveAwsSdkSigV4Config: <T>(
24
+ config: T &
25
+ (import("./aws_sdk").AwsSdkSigV4AuthInputConfig &
26
+ import("./aws_sdk").AwsSdkSigV4PreviouslyResolved),
27
+ ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
28
+ export declare const resolveAWSSDKSigV4Config: <T>(
29
+ config: T &
30
+ (import("./aws_sdk").AwsSdkSigV4AuthInputConfig &
31
+ import("./aws_sdk").AwsSdkSigV4PreviouslyResolved),
32
+ ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
@@ -6,8 +6,6 @@ export {
6
6
  NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,
7
7
  resolveAwsSdkSigV4AConfig,
8
8
  NODE_SIGV4A_CONFIG_OPTIONS,
9
- resolveAwsSdkSigV4Config,
10
- resolveAWSSDKSigV4Config,
11
9
  } from "./aws_sdk";
12
10
  export {
13
11
  AwsSdkSigV4AAuthInputConfig,
@@ -22,3 +20,13 @@ export {
22
20
  AWSSDKSigV4AuthResolvedConfig,
23
21
  } from "./aws_sdk";
24
22
  export { getBearerTokenEnvKey } from "./utils/getBearerTokenEnvKey";
23
+ export declare const resolveAwsSdkSigV4Config: <T>(
24
+ config: T &
25
+ (import("./aws_sdk").AwsSdkSigV4AuthInputConfig &
26
+ import("./aws_sdk").AwsSdkSigV4PreviouslyResolved),
27
+ ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
28
+ export declare const resolveAWSSDKSigV4Config: <T>(
29
+ config: T &
30
+ (import("./aws_sdk").AwsSdkSigV4AuthInputConfig &
31
+ import("./aws_sdk").AwsSdkSigV4PreviouslyResolved),
32
+ ) => T & import("./aws_sdk").AwsSdkSigV4AuthResolvedConfig;
@@ -1 +1,2 @@
1
1
  export declare const getDateHeader: (response: unknown) => string | undefined;
2
+ export declare const getAgeHeader: (response: unknown) => string | undefined;
@@ -1,4 +1,6 @@
1
1
  export declare const getUpdatedSystemClockOffset: (
2
2
  clockTime: string,
3
3
  currentSystemClockOffset: number,
4
+ timeRequestSent?: number,
5
+ ageHeader?: string,
4
6
  ) => number;
@@ -1,3 +1,4 @@
1
- export { getDateHeader } from "./getDateHeader";
1
+ export { getAgeHeader, getDateHeader } from "./getDateHeader";
2
2
  export { getSkewCorrectedDate } from "./getSkewCorrectedDate";
3
3
  export { getUpdatedSystemClockOffset } from "./getUpdatedSystemClockOffset";
4
+ export { isClockSkewed } from "./isClockSkewed";
@@ -0,0 +1 @@
1
+ export declare function detectBufferParsing(): boolean;
@@ -0,0 +1,14 @@
1
+ import { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
+ import { JsonSettings } from "../JsonCodec";
4
+ export declare class BufferJsonShapeDeserializer
5
+ extends SerdeContextConfig
6
+ implements ShapeDeserializer<string>
7
+ {
8
+ readonly settings: JsonSettings;
9
+ constructor(settings: JsonSettings);
10
+ read(schema: Schema, data: string | Uint8Array | unknown): Promise<any>;
11
+ readObject(schema: Schema, data: DocumentType): any;
12
+ protected _read(schema: Schema, value: unknown): any;
13
+ private _readStruct;
14
+ }
@@ -1,17 +1,28 @@
1
1
  import { Schema, ShapeSerializer } from "@smithy/types";
2
2
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
3
  import { JsonSettings } from "../JsonCodec";
4
- export declare class SinglePassJsonShapeSerializer
4
+ export declare class ByteJsonShapeSerializer
5
5
  extends SerdeContextConfig
6
- implements ShapeSerializer<string>
6
+ implements ShapeSerializer<Uint8Array>
7
7
  {
8
8
  readonly settings: JsonSettings;
9
- private buffer;
9
+ private json;
10
+ private i;
10
11
  private rootSchema;
11
12
  constructor(settings: JsonSettings);
12
13
  write(schema: Schema, value: unknown): void;
13
14
  writeDiscriminatedDocument(schema: Schema, value: unknown): void;
14
- flush(): string;
15
- private writeObject;
15
+ flush(): Uint8Array;
16
+ private ensure;
17
+ private writeAscii;
18
+ private writeAsciiQuoted;
19
+ private writeJsonString;
20
+ private writeUnicodeEscape;
21
+ private static readonly B64;
22
+ private writeBase64;
16
23
  private writeValue;
24
+ private writeStruct;
25
+ private writeList;
26
+ private writeMap;
27
+ private writeTimestamp;
17
28
  }
@@ -0,0 +1,2 @@
1
+ import { Schema } from "@smithy/types";
2
+ export declare function needsReviver(schema: Schema): boolean;
@@ -1,5 +1,10 @@
1
- import { HttpResponse, SerdeFunctions } from "@smithy/types";
2
- export declare const parseJsonBody: (streamBody: any, context: SerdeFunctions) => any;
1
+ import { HttpResponse, Schema, SerdeFunctions } from "@smithy/types";
2
+ export declare function parseJsonBody(streamBody: any, context: SerdeFunctions): Promise<any>;
3
+ export declare function parseJsonBody(
4
+ streamBody: any,
5
+ context: SerdeFunctions,
6
+ schema: Schema,
7
+ ): Promise<any>;
3
8
  export declare const parseJsonErrorBody: (errorBody: any, context: SerdeFunctions) => Promise<any>;
4
9
  export declare const loadRestJsonErrorCode: (output: HttpResponse, data: any) => string | undefined;
5
10
  export declare const loadJsonRpcErrorCode: (
@@ -0,0 +1 @@
1
+ export declare function writeKey(obj: object | Record<string, unknown> | any): void;