@aws-sdk/core 3.977.3 → 3.977.5

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 (21) hide show
  1. package/dist-cjs/submodules/protocols/index.js +939 -790
  2. package/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
  3. package/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +3 -3
  4. package/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +5 -2
  5. package/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +103 -0
  6. package/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +37 -17
  7. package/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +84 -62
  8. package/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +2 -1
  9. package/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +2 -1
  10. package/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +4 -3
  11. package/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +5 -3
  12. package/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  13. package/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +1 -0
  14. package/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +1 -0
  15. package/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +2 -1
  16. package/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +2 -1
  17. package/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +3 -2
  18. package/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +4 -1
  19. package/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +27 -0
  20. package/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +1 -0
  21. package/package.json +1 -1
@@ -0,0 +1,51 @@
1
+ /**
2
+ * A Uint8Array subclass holding serialized JSON bytes that provides
3
+ * string method compatibility for customer middleware.
4
+ *
5
+ * Middleware historically observed `request.body` as a string for JSON
6
+ * protocol services. This class preserves that contract: string methods
7
+ * and coercion (template literals, `+` operator) lazily decode the bytes
8
+ * to a cached string. The HTTP transport layer still sees a Uint8Array
9
+ * and sends raw bytes without conversion.
10
+ *
11
+ * @internal
12
+ * @deprecated this adapter will be removed in a future version.
13
+ */
14
+ export declare class JsonBytesStringAdapter extends Uint8Array {
15
+ private string;
16
+ static allocUnsafe(bytes: number): JsonBytesStringAdapter;
17
+ /**
18
+ * Enables string coercion via template literals and `+` operator.
19
+ */
20
+ toString(): string;
21
+ /**
22
+ * Enables string coercion in comparison and arithmetic contexts.
23
+ * @returns a string. The signature is set to avoid incompatibility with extending Uint8Array.
24
+ */
25
+ valueOf(): any;
26
+ includes(searchString: string | number, position?: number): boolean;
27
+ indexOf(searchString: string | number, position?: number): number;
28
+ lastIndexOf(searchString: string | number, position?: number): number;
29
+ startsWith(searchString: string, position?: number): boolean;
30
+ endsWith(searchString: string, endPosition?: number): boolean;
31
+ match(regexp: string | RegExp): RegExpMatchArray | null;
32
+ replace(searchValue: string | RegExp, replaceValue: string): string;
33
+ search(regexp: string | RegExp): number;
34
+ split(separator: string | RegExp, limit?: number): string[];
35
+ substring(start: number, end?: number): string;
36
+ trim(): string;
37
+ trimStart(): string;
38
+ trimEnd(): string;
39
+ charAt(pos: number): string;
40
+ charCodeAt(index: number): number;
41
+ padStart(maxLength: number, fillString?: string): string;
42
+ padEnd(maxLength: number, fillString?: string): string;
43
+ repeat(count: number): string;
44
+ toUpperCase(): string;
45
+ toLowerCase(): string;
46
+ /**
47
+ * Decodes the bytes to a UTF-8 string on first access, then caches.
48
+ * Subsequent calls return the cached string with zero cost.
49
+ */
50
+ private s;
51
+ }
@@ -2,6 +2,7 @@ import type { $ShapeSerializer, $Codec, $ShapeDeserializer } from "@smithy/types
2
2
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
3
3
  import type { JsonSettings } from "../JsonSettings";
4
4
  /**
5
+ * Codec grouping the v2 serializer and deserializer.
5
6
  * @public
6
7
  */
7
8
  export declare class JsonCodec2 extends SerdeContextConfig implements $Codec<Uint8Array, string> {
@@ -26,4 +26,5 @@ export declare class JsonShapeDeserializer2 extends SerdeContextConfig implement
26
26
  readObject(schema: Schema, data: DocumentType): any;
27
27
  protected _read(schema: Schema, value: unknown): any;
28
28
  private _readStruct;
29
+ private needsTransform;
29
30
  }
@@ -1,6 +1,7 @@
1
1
  import { TypeRegistry } from "@smithy/core/schema";
2
2
  import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
3
3
  import { JsonCodec } from "./codec-v1/JsonCodec";
4
+ import { JsonCodec2 } from "./codec-v2/JsonCodec2";
4
5
  export declare class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
5
6
  constructor({
6
7
  defaultNamespace,
@@ -13,7 +14,7 @@ export declare class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
13
14
  errorTypeRegistries?: TypeRegistry[];
14
15
  serviceTarget: string;
15
16
  awsQueryCompatible?: boolean;
16
- jsonCodec?: JsonCodec;
17
+ jsonCodec?: JsonCodec | JsonCodec2;
17
18
  });
18
19
  getShapeId(): string;
19
20
  protected getJsonRpcVersion(): "1.0";
@@ -1,6 +1,7 @@
1
1
  import { TypeRegistry } from "@smithy/core/schema";
2
2
  import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
3
3
  import { JsonCodec } from "./codec-v1/JsonCodec";
4
+ import { JsonCodec2 } from "./codec-v2/JsonCodec2";
4
5
  export declare class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
5
6
  constructor({
6
7
  defaultNamespace,
@@ -13,7 +14,7 @@ export declare class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
13
14
  errorTypeRegistries?: TypeRegistry[];
14
15
  serviceTarget: string;
15
16
  awsQueryCompatible?: boolean;
16
- jsonCodec?: JsonCodec;
17
+ jsonCodec?: JsonCodec | JsonCodec2;
17
18
  });
18
19
  getShapeId(): string;
19
20
  protected getJsonRpcVersion(): "1.1";
@@ -12,6 +12,7 @@ import {
12
12
  ShapeSerializer,
13
13
  } from "@smithy/types";
14
14
  import { JsonCodec } from "./codec-v1/JsonCodec";
15
+ import { JsonCodec2 } from "./codec-v2/JsonCodec2";
15
16
  export declare abstract class AwsJsonRpcProtocol extends RpcProtocol {
16
17
  protected serializer: ShapeSerializer<string | Uint8Array>;
17
18
  protected deserializer: ShapeDeserializer<string | Uint8Array>;
@@ -30,14 +31,14 @@ export declare abstract class AwsJsonRpcProtocol extends RpcProtocol {
30
31
  errorTypeRegistries?: TypeRegistry[];
31
32
  serviceTarget: string;
32
33
  awsQueryCompatible?: boolean;
33
- jsonCodec?: JsonCodec;
34
+ jsonCodec?: JsonCodec | JsonCodec2;
34
35
  });
35
36
  serializeRequest<Input extends object>(
36
37
  operationSchema: OperationSchema,
37
38
  input: Input,
38
39
  context: HandlerExecutionContext & SerdeFunctions & EndpointBearer,
39
40
  ): Promise<HttpRequest>;
40
- getPayloadCodec(): JsonCodec;
41
+ getPayloadCodec(): JsonCodec | JsonCodec2;
41
42
  protected abstract getJsonRpcVersion(): "1.1" | "1.0";
42
43
  protected handleError(
43
44
  operationSchema: OperationSchema,
@@ -13,6 +13,7 @@ import {
13
13
  ShapeSerializer,
14
14
  } from "@smithy/types";
15
15
  import { JsonCodec } from "./codec-v1/JsonCodec";
16
+ import { JsonCodec2 } from "./codec-v2/JsonCodec2";
16
17
  export declare class AwsRestJsonProtocol extends HttpBindingProtocol {
17
18
  protected serializer: ShapeSerializer<string | Uint8Array>;
18
19
  protected deserializer: ShapeDeserializer<string | Uint8Array>;
@@ -21,12 +22,14 @@ export declare class AwsRestJsonProtocol extends HttpBindingProtocol {
21
22
  constructor({
22
23
  defaultNamespace,
23
24
  errorTypeRegistries,
25
+ jsonCodec,
24
26
  }: {
25
27
  defaultNamespace: string;
26
28
  errorTypeRegistries?: TypeRegistry[];
29
+ jsonCodec?: JsonCodec | JsonCodec2;
27
30
  });
28
31
  getShapeId(): string;
29
- getPayloadCodec(): JsonCodec;
32
+ getPayloadCodec(): JsonCodec | JsonCodec2;
30
33
  setSerdeContext(serdeContext: SerdeFunctions): void;
31
34
  serializeRequest<Input extends object>(
32
35
  operationSchema: OperationSchema,
@@ -0,0 +1,27 @@
1
+ export declare class JsonBytesStringAdapter extends Uint8Array {
2
+ private string;
3
+ static allocUnsafe(bytes: number): JsonBytesStringAdapter;
4
+ toString(): string;
5
+ valueOf(): any;
6
+ includes(searchString: string | number, position?: number): boolean;
7
+ indexOf(searchString: string | number, position?: number): number;
8
+ lastIndexOf(searchString: string | number, position?: number): number;
9
+ startsWith(searchString: string, position?: number): boolean;
10
+ endsWith(searchString: string, endPosition?: number): boolean;
11
+ match(regexp: string | RegExp): RegExpMatchArray | null;
12
+ replace(searchValue: string | RegExp, replaceValue: string): string;
13
+ search(regexp: string | RegExp): number;
14
+ split(separator: string | RegExp, limit?: number): string[];
15
+ substring(start: number, end?: number): string;
16
+ trim(): string;
17
+ trimStart(): string;
18
+ trimEnd(): string;
19
+ charAt(pos: number): string;
20
+ charCodeAt(index: number): number;
21
+ padStart(maxLength: number, fillString?: string): string;
22
+ padEnd(maxLength: number, fillString?: string): string;
23
+ repeat(count: number): string;
24
+ toUpperCase(): string;
25
+ toLowerCase(): string;
26
+ private s;
27
+ }
@@ -11,4 +11,5 @@ export declare class JsonShapeDeserializer2
11
11
  readObject(schema: Schema, data: DocumentType): any;
12
12
  protected _read(schema: Schema, value: unknown): any;
13
13
  private _readStruct;
14
+ private needsTransform;
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/core",
3
- "version": "3.977.3",
3
+ "version": "3.977.5",
4
4
  "description": "Core functions & classes shared by multiple AWS SDK clients.",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/core",
6
6
  "license": "Apache-2.0",