@aws-sdk/core 3.977.2 → 3.977.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/submodules/protocols/index.js +741 -57
- package/dist-es/submodules/protocols/index.js +6 -3
- package/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -1
- package/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -1
- package/dist-es/submodules/protocols/json/JsonSettings.js +1 -0
- package/dist-es/submodules/protocols/json/{JsonCodec.js → codec-v1/JsonCodec.js} +3 -3
- package/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +1 -0
- package/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +20 -0
- package/dist-es/submodules/protocols/json/codec-v2/{BufferJsonShapeDeserializer.js → JsonShapeDeserializer2.js} +1 -1
- package/dist-es/submodules/protocols/json/codec-v2/{ByteJsonShapeSerializer.js → JsonShapeSerializer2.js} +28 -32
- package/dist-types/submodules/protocols/index.d.ts +7 -4
- package/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -1
- package/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -1
- package/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +1 -1
- package/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +1 -1
- package/dist-types/submodules/protocols/json/JsonSettings.d.ts +7 -0
- package/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -0
- package/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +7 -0
- package/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +2 -1
- package/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +2 -1
- package/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +12 -0
- package/dist-types/submodules/protocols/json/codec-v2/{BufferJsonShapeDeserializer.d.ts → JsonShapeDeserializer2.d.ts} +3 -3
- package/dist-types/submodules/protocols/json/codec-v2/{ByteJsonShapeSerializer.d.ts → JsonShapeSerializer2.d.ts} +19 -31
- package/dist-types/ts3.4/submodules/protocols/index.d.ts +7 -4
- package/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +4 -0
- package/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +11 -0
- package/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +4 -0
- package/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +9 -0
- package/dist-types/ts3.4/submodules/protocols/json/codec-v2/{BufferJsonShapeDeserializer.d.ts → JsonShapeDeserializer2.d.ts} +2 -2
- package/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +39 -0
- package/package.json +3 -3
- package/dist-types/submodules/protocols/json/JsonCodec.d.ts +0 -19
- package/dist-types/ts3.4/submodules/protocols/json/JsonCodec.d.ts +0 -13
- package/dist-types/ts3.4/submodules/protocols/json/codec-v2/ByteJsonShapeSerializer.d.ts +0 -39
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { AwsSmithyRpcV2CborProtocol } from "./cbor/AwsSmithyRpcV2CborProtocol";
|
|
2
|
-
export { _toStr, _toBool, _toNum } from "./coercing-serializers";
|
|
3
2
|
export { AwsJson1_0Protocol } from "./json/AwsJson1_0Protocol";
|
|
4
3
|
export { AwsJson1_1Protocol } from "./json/AwsJson1_1Protocol";
|
|
5
4
|
export { AwsJsonRpcProtocol } from "./json/AwsJsonRpcProtocol";
|
|
6
5
|
export { AwsRestJsonProtocol } from "./json/AwsRestJsonProtocol";
|
|
7
|
-
export { JsonCodec } from "./json/JsonCodec";
|
|
6
|
+
export { JsonCodec } from "./json/codec-v1/JsonCodec";
|
|
8
7
|
export { JsonShapeDeserializer } from "./json/codec-v1/JsonShapeDeserializer";
|
|
9
8
|
export { JsonShapeSerializer } from "./json/codec-v1/JsonShapeSerializer";
|
|
10
|
-
export {
|
|
9
|
+
export { JsonCodec2 } from "./json/codec-v2/JsonCodec2";
|
|
10
|
+
export { JsonShapeDeserializer2 } from "./json/codec-v2/JsonShapeDeserializer2";
|
|
11
|
+
export { JsonShapeSerializer2 } from "./json/codec-v2/JsonShapeSerializer2";
|
|
11
12
|
export { parseJsonBody, parseJsonErrorBody, loadRestJsonErrorCode, loadJsonRpcErrorCode } from "./json/parseJsonBody";
|
|
12
13
|
export { AwsEc2QueryProtocol } from "./query/AwsEc2QueryProtocol";
|
|
13
14
|
export { AwsQueryProtocol } from "./query/AwsQueryProtocol";
|
|
@@ -17,3 +18,5 @@ export { XmlCodec } from "./xml/XmlCodec";
|
|
|
17
18
|
export { XmlShapeDeserializer } from "./xml/XmlShapeDeserializer";
|
|
18
19
|
export { XmlShapeSerializer } from "./xml/XmlShapeSerializer";
|
|
19
20
|
export { parseXmlBody, parseXmlErrorBody, loadRestXmlErrorCode } from "./xml/parseXmlBody";
|
|
21
|
+
export { awsExpectUnion } from "./json/awsExpectUnion";
|
|
22
|
+
export { _toStr, _toBool, _toNum } from "./coercing-serializers";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RpcProtocol } from "@smithy/core/protocols";
|
|
2
2
|
import { deref, NormalizedSchema } from "@smithy/core/schema";
|
|
3
3
|
import { ProtocolLib } from "../ProtocolLib";
|
|
4
|
-
import { JsonCodec } from "./JsonCodec";
|
|
4
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
5
5
|
import { loadJsonRpcErrorCode } from "./parseJsonBody";
|
|
6
6
|
export class AwsJsonRpcProtocol extends RpcProtocol {
|
|
7
7
|
serializer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HttpBindingProtocol, HttpInterceptingShapeDeserializer, HttpInterceptingShapeSerializer, } from "@smithy/core/protocols";
|
|
2
2
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
3
|
import { ProtocolLib } from "../ProtocolLib";
|
|
4
|
-
import { JsonCodec } from "./JsonCodec";
|
|
4
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
5
5
|
import { loadRestJsonErrorCode } from "./parseJsonBody";
|
|
6
6
|
export class AwsRestJsonProtocol extends HttpBindingProtocol {
|
|
7
7
|
serializer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SerdeContextConfig } from "
|
|
2
|
-
import { JsonShapeDeserializer } from "./
|
|
3
|
-
import { JsonShapeSerializer } from "./
|
|
1
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
2
|
+
import { JsonShapeDeserializer } from "./JsonShapeDeserializer";
|
|
3
|
+
import { JsonShapeSerializer } from "./JsonShapeSerializer";
|
|
4
4
|
export class JsonCodec extends SerdeContextConfig {
|
|
5
5
|
settings;
|
|
6
6
|
constructor(settings) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
2
|
+
import { JsonShapeDeserializer2 } from "./JsonShapeDeserializer2";
|
|
3
|
+
import { JsonShapeSerializer2 } from "./JsonShapeSerializer2";
|
|
4
|
+
export class JsonCodec2 extends SerdeContextConfig {
|
|
5
|
+
settings;
|
|
6
|
+
constructor(settings) {
|
|
7
|
+
super();
|
|
8
|
+
this.settings = settings;
|
|
9
|
+
}
|
|
10
|
+
createSerializer() {
|
|
11
|
+
const serializer = new JsonShapeSerializer2(this.settings);
|
|
12
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
13
|
+
return serializer;
|
|
14
|
+
}
|
|
15
|
+
createDeserializer() {
|
|
16
|
+
const deserializer = new JsonShapeDeserializer2(this.settings);
|
|
17
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
18
|
+
return deserializer;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -9,7 +9,7 @@ import { jsonReviver } from "../jsonReviver";
|
|
|
9
9
|
import { needsReviver } from "../needsReviver";
|
|
10
10
|
import { parseJsonBody } from "../parseJsonBody";
|
|
11
11
|
import { writeKey } from "../../writeKey";
|
|
12
|
-
export class
|
|
12
|
+
export class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
13
13
|
settings;
|
|
14
14
|
constructor(settings) {
|
|
15
15
|
super();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { determineTimestampFormat } from "@smithy/core/protocols";
|
|
2
2
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
|
-
import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue, toBase64
|
|
3
|
+
import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue, toBase64 } from "@smithy/core/serde";
|
|
4
4
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
5
5
|
import { writeKey } from "../../writeKey";
|
|
6
6
|
const encoder = new TextEncoder();
|
|
@@ -32,11 +32,13 @@ const INITIAL_BUFFER_SIZE = 2048;
|
|
|
32
32
|
function alloc(size) {
|
|
33
33
|
return typeof Buffer !== "undefined" ? Buffer.allocUnsafe(size) : new Uint8Array(size);
|
|
34
34
|
}
|
|
35
|
-
export class
|
|
35
|
+
export class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
36
36
|
settings;
|
|
37
37
|
json;
|
|
38
38
|
i = 0;
|
|
39
39
|
rootSchema;
|
|
40
|
+
rawValue;
|
|
41
|
+
passthrough = false;
|
|
40
42
|
constructor(settings) {
|
|
41
43
|
super();
|
|
42
44
|
this.settings = settings;
|
|
@@ -44,8 +46,15 @@ export class ByteJsonShapeSerializer extends SerdeContextConfig {
|
|
|
44
46
|
}
|
|
45
47
|
write(schema, value) {
|
|
46
48
|
this.i = 0;
|
|
49
|
+
this.rawValue = value;
|
|
47
50
|
this.rootSchema = NormalizedSchema.of(schema);
|
|
48
|
-
this.
|
|
51
|
+
this.passthrough =
|
|
52
|
+
!this.rootSchema.isStructSchema() &&
|
|
53
|
+
!this.rootSchema.isDocumentSchema() &&
|
|
54
|
+
(this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema());
|
|
55
|
+
if (!this.passthrough) {
|
|
56
|
+
this.writeValue(this.rootSchema, value, undefined);
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
59
|
writeDiscriminatedDocument(schema, value) {
|
|
51
60
|
this.i = 0;
|
|
@@ -85,6 +94,11 @@ export class ByteJsonShapeSerializer extends SerdeContextConfig {
|
|
|
85
94
|
this.rootSchema = undefined;
|
|
86
95
|
const finalPosition = this.i;
|
|
87
96
|
this.i = 0;
|
|
97
|
+
const raw = this.rawValue;
|
|
98
|
+
this.rawValue = undefined;
|
|
99
|
+
if (finalPosition === 0) {
|
|
100
|
+
return raw;
|
|
101
|
+
}
|
|
88
102
|
const result = this.json.subarray(0, finalPosition);
|
|
89
103
|
this.json = alloc(INITIAL_BUFFER_SIZE);
|
|
90
104
|
return result;
|
|
@@ -198,7 +212,7 @@ export class ByteJsonShapeSerializer extends SerdeContextConfig {
|
|
|
198
212
|
const b64Len = Math.ceil(data.length / 3) * 4;
|
|
199
213
|
this.ensure(b64Len + 2);
|
|
200
214
|
const json = this.json;
|
|
201
|
-
const B64 =
|
|
215
|
+
const B64 = JsonShapeSerializer2.B64;
|
|
202
216
|
let i = this.i;
|
|
203
217
|
json[i++] = QUOTE;
|
|
204
218
|
const len = data.length;
|
|
@@ -250,6 +264,16 @@ export class ByteJsonShapeSerializer extends SerdeContextConfig {
|
|
|
250
264
|
}
|
|
251
265
|
const ns = NormalizedSchema.of(schema);
|
|
252
266
|
const isObject = typeof value === "object";
|
|
267
|
+
if (ns.isStringSchema()) {
|
|
268
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
269
|
+
if (mediaType) {
|
|
270
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
271
|
+
if (isJson) {
|
|
272
|
+
this.writeJsonString(LazyJsonString.from(value).toString());
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
253
277
|
if (isObject) {
|
|
254
278
|
if (ns.isStructSchema()) {
|
|
255
279
|
this.writeStruct(ns, value);
|
|
@@ -289,16 +313,6 @@ export class ByteJsonShapeSerializer extends SerdeContextConfig {
|
|
|
289
313
|
return;
|
|
290
314
|
}
|
|
291
315
|
if (typeof value === "string") {
|
|
292
|
-
if (ns.isStringSchema()) {
|
|
293
|
-
const mediaType = ns.getMergedTraits().mediaType;
|
|
294
|
-
if (mediaType) {
|
|
295
|
-
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
296
|
-
if (isJson) {
|
|
297
|
-
this.writeJsonString(LazyJsonString.from(value).toString());
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
316
|
if (ns.isBlobSchema()) {
|
|
303
317
|
const b64 = (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
304
318
|
this.writeAsciiQuoted(b64);
|
|
@@ -481,21 +495,3 @@ export class ByteJsonShapeSerializer extends SerdeContextConfig {
|
|
|
481
495
|
}
|
|
482
496
|
}
|
|
483
497
|
}
|
|
484
|
-
export class StringJsonShapeSerializer extends SerdeContextConfig {
|
|
485
|
-
settings;
|
|
486
|
-
byteSerializer;
|
|
487
|
-
constructor(settings) {
|
|
488
|
-
super();
|
|
489
|
-
this.settings = settings;
|
|
490
|
-
this.byteSerializer = new ByteJsonShapeSerializer(settings);
|
|
491
|
-
}
|
|
492
|
-
write(schema, value) {
|
|
493
|
-
this.byteSerializer.write(schema, value);
|
|
494
|
-
}
|
|
495
|
-
writeDiscriminatedDocument(schema, value) {
|
|
496
|
-
this.byteSerializer.writeDiscriminatedDocument(schema, value);
|
|
497
|
-
}
|
|
498
|
-
flush() {
|
|
499
|
-
return (this.serdeContext?.utf8Encoder ?? toUtf8)(this.byteSerializer.flush());
|
|
500
|
-
}
|
|
501
|
-
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export { AwsSmithyRpcV2CborProtocol } from "./cbor/AwsSmithyRpcV2CborProtocol";
|
|
2
|
-
export { _toStr, _toBool, _toNum } from "./coercing-serializers";
|
|
3
2
|
export { AwsJson1_0Protocol } from "./json/AwsJson1_0Protocol";
|
|
4
3
|
export { AwsJson1_1Protocol } from "./json/AwsJson1_1Protocol";
|
|
5
4
|
export { AwsJsonRpcProtocol } from "./json/AwsJsonRpcProtocol";
|
|
6
5
|
export { AwsRestJsonProtocol } from "./json/AwsRestJsonProtocol";
|
|
7
|
-
export { JsonCodec } from "./json/JsonCodec";
|
|
8
|
-
export type { JsonSettings } from "./json/
|
|
6
|
+
export { JsonCodec } from "./json/codec-v1/JsonCodec";
|
|
7
|
+
export type { JsonSettings } from "./json/JsonSettings";
|
|
9
8
|
export { JsonShapeDeserializer } from "./json/codec-v1/JsonShapeDeserializer";
|
|
10
9
|
export { JsonShapeSerializer } from "./json/codec-v1/JsonShapeSerializer";
|
|
11
|
-
export {
|
|
10
|
+
export { JsonCodec2 } from "./json/codec-v2/JsonCodec2";
|
|
11
|
+
export { JsonShapeDeserializer2 } from "./json/codec-v2/JsonShapeDeserializer2";
|
|
12
|
+
export { JsonShapeSerializer2 } from "./json/codec-v2/JsonShapeSerializer2";
|
|
12
13
|
export { parseJsonBody, parseJsonErrorBody, loadRestJsonErrorCode, loadJsonRpcErrorCode } from "./json/parseJsonBody";
|
|
13
14
|
export { AwsEc2QueryProtocol } from "./query/AwsEc2QueryProtocol";
|
|
14
15
|
export { AwsQueryProtocol } from "./query/AwsQueryProtocol";
|
|
@@ -20,3 +21,5 @@ export type { XmlSettings } from "./xml/XmlCodec";
|
|
|
20
21
|
export { XmlShapeDeserializer } from "./xml/XmlShapeDeserializer";
|
|
21
22
|
export { XmlShapeSerializer } from "./xml/XmlShapeSerializer";
|
|
22
23
|
export { parseXmlBody, parseXmlErrorBody, loadRestXmlErrorCode } from "./xml/parseXmlBody";
|
|
24
|
+
export { awsExpectUnion } from "./json/awsExpectUnion";
|
|
25
|
+
export { _toStr, _toBool, _toNum } from "./coercing-serializers";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TypeRegistry } from "@smithy/core/schema";
|
|
2
2
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
3
|
-
import type { JsonCodec } from "./JsonCodec";
|
|
3
|
+
import type { JsonCodec } from "./codec-v1/JsonCodec";
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
6
|
* @see https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#differences-between-awsjson1-0-and-awsjson1-1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TypeRegistry } from "@smithy/core/schema";
|
|
2
2
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
3
|
-
import type { JsonCodec } from "./JsonCodec";
|
|
3
|
+
import type { JsonCodec } from "./codec-v1/JsonCodec";
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
6
|
* @see https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#differences-between-awsjson1-0-and-awsjson1-1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RpcProtocol } from "@smithy/core/protocols";
|
|
2
2
|
import type { TypeRegistry } from "@smithy/core/schema";
|
|
3
3
|
import type { EndpointBearer, HandlerExecutionContext, HttpRequest, HttpResponse, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
4
|
-
import { JsonCodec } from "./JsonCodec";
|
|
4
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HttpBindingProtocol } from "@smithy/core/protocols";
|
|
2
2
|
import type { TypeRegistry } from "@smithy/core/schema";
|
|
3
3
|
import type { EndpointBearer, HandlerExecutionContext, HttpRequest, HttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
4
|
-
import { JsonCodec } from "./JsonCodec";
|
|
4
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Codec } from "@smithy/types";
|
|
2
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
+
import { JsonShapeDeserializer } from "./JsonShapeDeserializer";
|
|
4
|
+
import { JsonShapeSerializer } from "./JsonShapeSerializer";
|
|
5
|
+
import type { JsonSettings } from "./JsonSettings";
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use JsonCodec2.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class JsonCodec extends SerdeContextConfig implements Codec<string, string> {
|
|
11
|
+
readonly settings: JsonSettings;
|
|
12
|
+
constructor(settings: JsonSettings);
|
|
13
|
+
createSerializer(): JsonShapeSerializer;
|
|
14
|
+
createDeserializer(): JsonShapeDeserializer;
|
|
15
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
|
|
2
2
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
-
import type { JsonSettings } from "
|
|
3
|
+
import type { JsonSettings } from "./JsonSettings";
|
|
4
4
|
/**
|
|
5
|
+
* @deprecated prefer JsonShapeDeserializer in codec-v2.
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
8
|
export declare class JsonShapeDeserializer extends SerdeContextConfig implements ShapeDeserializer<string> {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
2
|
import type { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
3
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
4
|
-
import type { JsonSettings } from "
|
|
4
|
+
import type { JsonSettings } from "./JsonSettings";
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated prefer byte-targeting JsonShapeSerializer or its string adapter StringJsonShapeSerializer in codec-v2.
|
|
6
7
|
* @public
|
|
7
8
|
*/
|
|
8
9
|
export declare class JsonShapeSerializer extends SerdeContextConfig implements ShapeSerializer<string> {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { $ShapeSerializer, $Codec, $ShapeDeserializer } from "@smithy/types";
|
|
2
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
+
import type { JsonSettings } from "../JsonSettings";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class JsonCodec2 extends SerdeContextConfig implements $Codec<Uint8Array, string> {
|
|
8
|
+
readonly settings: JsonSettings;
|
|
9
|
+
constructor(settings: JsonSettings);
|
|
10
|
+
createSerializer(): $ShapeSerializer<Uint8Array>;
|
|
11
|
+
createDeserializer(): $ShapeDeserializer<string>;
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
|
|
2
2
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
-
import type { JsonSettings } from "../
|
|
3
|
+
import type { JsonSettings } from "../JsonSettings";
|
|
4
4
|
/**
|
|
5
5
|
* Performance-optimized JSON deserializer.
|
|
6
6
|
*
|
|
@@ -17,9 +17,9 @@ import type { JsonSettings } from "../JsonCodec";
|
|
|
17
17
|
* after JSON.parse with no external references, so rewriting values avoids
|
|
18
18
|
* redundant allocation and GC pressure.
|
|
19
19
|
*
|
|
20
|
-
* @
|
|
20
|
+
* @public
|
|
21
21
|
*/
|
|
22
|
-
export declare class
|
|
22
|
+
export declare class JsonShapeDeserializer2 extends SerdeContextConfig implements ShapeDeserializer<string> {
|
|
23
23
|
readonly settings: JsonSettings;
|
|
24
24
|
constructor(settings: JsonSettings);
|
|
25
25
|
read(schema: Schema, data: string | Uint8Array | unknown): Promise<any>;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
1
2
|
import type { Schema, ShapeSerializer } from "@smithy/types";
|
|
2
3
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
-
import type { JsonSettings } from "../
|
|
4
|
+
import type { JsonSettings } from "../JsonSettings";
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Single-pass JSON serializer that writes directly to a Uint8Array buffer.
|
|
6
7
|
* Fewer intermediate states as when compared to the initial multi-pass implementation.
|
|
7
8
|
*
|
|
8
|
-
* @
|
|
9
|
+
* @public
|
|
9
10
|
*/
|
|
10
|
-
export declare class
|
|
11
|
+
export declare class JsonShapeSerializer2 extends SerdeContextConfig implements ShapeSerializer<Uint8Array> {
|
|
11
12
|
readonly settings: JsonSettings;
|
|
12
13
|
private json;
|
|
13
14
|
private i;
|
|
14
15
|
private rootSchema;
|
|
16
|
+
private rawValue;
|
|
17
|
+
private passthrough;
|
|
15
18
|
constructor(settings: JsonSettings);
|
|
16
19
|
write(schema: Schema, value: unknown): void;
|
|
17
20
|
/**
|
|
@@ -23,12 +26,12 @@ export declare class ByteJsonShapeSerializer extends SerdeContextConfig implemen
|
|
|
23
26
|
* This is the primary output — pass directly to request.body.
|
|
24
27
|
*/
|
|
25
28
|
flush(): Uint8Array;
|
|
26
|
-
|
|
29
|
+
protected ensure(byteCount: number): void;
|
|
27
30
|
/**
|
|
28
31
|
* Write a raw ASCII string (no JSON escaping). Used for pre-validated content
|
|
29
32
|
* like numeric literals and pre-encoded base64.
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
protected writeAscii(s: string): void;
|
|
32
35
|
/**
|
|
33
36
|
* Write a quoted ASCII string with no escape checking.
|
|
34
37
|
* Used for struct member keys (jsonName or model names) which are
|
|
@@ -36,37 +39,22 @@ export declare class ByteJsonShapeSerializer extends SerdeContextConfig implemen
|
|
|
36
39
|
* backslashes, or non-ASCII.
|
|
37
40
|
* Ensures extra room for surrounding structural chars (comma, colon).
|
|
38
41
|
*/
|
|
39
|
-
|
|
42
|
+
protected writeAsciiQuoted(s: string): void;
|
|
40
43
|
/**
|
|
41
44
|
* Write a JSON-escaped string including the surrounding quotes.
|
|
42
45
|
* Fast-path for ASCII, falls back to TextEncoder for multi-byte.
|
|
43
46
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
protected writeJsonString(s: string): void;
|
|
48
|
+
protected writeUnicodeEscape(code: number): void;
|
|
49
|
+
protected static readonly B64: Uint8Array;
|
|
47
50
|
/**
|
|
48
51
|
* Write a Uint8Array as a quoted base64 string directly into the buffer.
|
|
49
52
|
* No intermediate JS string, no escape checking (base64 alphabet is safe ASCII).
|
|
50
53
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* A string adapter for the byte serializer, for backwards compatibility.
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export declare class StringJsonShapeSerializer extends SerdeContextConfig implements ShapeSerializer<string> {
|
|
63
|
-
readonly settings: JsonSettings;
|
|
64
|
-
private byteSerializer;
|
|
65
|
-
constructor(settings: JsonSettings);
|
|
66
|
-
write(schema: Schema, value: unknown): void;
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
writeDiscriminatedDocument(schema: Schema, value: unknown): void;
|
|
71
|
-
flush(): string;
|
|
54
|
+
protected writeBase64(data: Uint8Array): void;
|
|
55
|
+
protected writeValue(schema: Schema, value: unknown, container: NormalizedSchema | undefined): void;
|
|
56
|
+
protected writeStruct(ns: NormalizedSchema, value: Record<string, unknown>): void;
|
|
57
|
+
protected writeList(ns: NormalizedSchema, value: unknown[], isDocument?: boolean): void;
|
|
58
|
+
protected writeMap(ns: NormalizedSchema, value: Record<string, unknown>, isDocument?: boolean): void;
|
|
59
|
+
protected writeTimestamp(ns: NormalizedSchema, value: Date): void;
|
|
72
60
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export { AwsSmithyRpcV2CborProtocol } from "./cbor/AwsSmithyRpcV2CborProtocol";
|
|
2
|
-
export { _toStr, _toBool, _toNum } from "./coercing-serializers";
|
|
3
2
|
export { AwsJson1_0Protocol } from "./json/AwsJson1_0Protocol";
|
|
4
3
|
export { AwsJson1_1Protocol } from "./json/AwsJson1_1Protocol";
|
|
5
4
|
export { AwsJsonRpcProtocol } from "./json/AwsJsonRpcProtocol";
|
|
6
5
|
export { AwsRestJsonProtocol } from "./json/AwsRestJsonProtocol";
|
|
7
|
-
export { JsonCodec } from "./json/JsonCodec";
|
|
8
|
-
export { JsonSettings } from "./json/
|
|
6
|
+
export { JsonCodec } from "./json/codec-v1/JsonCodec";
|
|
7
|
+
export { JsonSettings } from "./json/JsonSettings";
|
|
9
8
|
export { JsonShapeDeserializer } from "./json/codec-v1/JsonShapeDeserializer";
|
|
10
9
|
export { JsonShapeSerializer } from "./json/codec-v1/JsonShapeSerializer";
|
|
11
|
-
export {
|
|
10
|
+
export { JsonCodec2 } from "./json/codec-v2/JsonCodec2";
|
|
11
|
+
export { JsonShapeDeserializer2 } from "./json/codec-v2/JsonShapeDeserializer2";
|
|
12
|
+
export { JsonShapeSerializer2 } from "./json/codec-v2/JsonShapeSerializer2";
|
|
12
13
|
export {
|
|
13
14
|
parseJsonBody,
|
|
14
15
|
parseJsonErrorBody,
|
|
@@ -25,3 +26,5 @@ export { XmlSettings } from "./xml/XmlCodec";
|
|
|
25
26
|
export { XmlShapeDeserializer } from "./xml/XmlShapeDeserializer";
|
|
26
27
|
export { XmlShapeSerializer } from "./xml/XmlShapeSerializer";
|
|
27
28
|
export { parseXmlBody, parseXmlErrorBody, loadRestXmlErrorCode } from "./xml/parseXmlBody";
|
|
29
|
+
export { awsExpectUnion } from "./json/awsExpectUnion";
|
|
30
|
+
export { _toStr, _toBool, _toNum } from "./coercing-serializers";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeRegistry } from "@smithy/core/schema";
|
|
2
2
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
3
|
-
import { JsonCodec } from "./JsonCodec";
|
|
3
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
4
4
|
export declare class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
5
5
|
constructor({
|
|
6
6
|
defaultNamespace,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeRegistry } from "@smithy/core/schema";
|
|
2
2
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
3
|
-
import { JsonCodec } from "./JsonCodec";
|
|
3
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
4
4
|
export declare class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
5
5
|
constructor({
|
|
6
6
|
defaultNamespace,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ShapeDeserializer,
|
|
12
12
|
ShapeSerializer,
|
|
13
13
|
} from "@smithy/types";
|
|
14
|
-
import { JsonCodec } from "./JsonCodec";
|
|
14
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
15
15
|
export declare abstract class AwsJsonRpcProtocol extends RpcProtocol {
|
|
16
16
|
protected serializer: ShapeSerializer<string | Uint8Array>;
|
|
17
17
|
protected deserializer: ShapeDeserializer<string | Uint8Array>;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ShapeDeserializer,
|
|
13
13
|
ShapeSerializer,
|
|
14
14
|
} from "@smithy/types";
|
|
15
|
-
import { JsonCodec } from "./JsonCodec";
|
|
15
|
+
import { JsonCodec } from "./codec-v1/JsonCodec";
|
|
16
16
|
export declare class AwsRestJsonProtocol extends HttpBindingProtocol {
|
|
17
17
|
protected serializer: ShapeSerializer<string | Uint8Array>;
|
|
18
18
|
protected deserializer: ShapeDeserializer<string | Uint8Array>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Codec } from "@smithy/types";
|
|
2
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
+
import { JsonShapeDeserializer } from "./JsonShapeDeserializer";
|
|
4
|
+
import { JsonShapeSerializer } from "./JsonShapeSerializer";
|
|
5
|
+
import { JsonSettings } from "./JsonSettings";
|
|
6
|
+
export declare class JsonCodec extends SerdeContextConfig implements Codec<string, string> {
|
|
7
|
+
readonly settings: JsonSettings;
|
|
8
|
+
constructor(settings: JsonSettings);
|
|
9
|
+
createSerializer(): JsonShapeSerializer;
|
|
10
|
+
createDeserializer(): JsonShapeDeserializer;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
|
|
2
2
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
-
import { JsonSettings } from "
|
|
3
|
+
import { JsonSettings } from "./JsonSettings";
|
|
4
4
|
export declare class JsonShapeDeserializer
|
|
5
5
|
extends SerdeContextConfig
|
|
6
6
|
implements ShapeDeserializer<string>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
2
|
import { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
3
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
4
|
-
import { JsonSettings } from "
|
|
4
|
+
import { JsonSettings } from "./JsonSettings";
|
|
5
5
|
export declare class JsonShapeSerializer
|
|
6
6
|
extends SerdeContextConfig
|
|
7
7
|
implements ShapeSerializer<string>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { $ShapeSerializer, $Codec, $ShapeDeserializer } from "@smithy/types";
|
|
2
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
+
import { JsonSettings } from "../JsonSettings";
|
|
4
|
+
export declare class JsonCodec2 extends SerdeContextConfig implements $Codec<Uint8Array, string> {
|
|
5
|
+
readonly settings: JsonSettings;
|
|
6
|
+
constructor(settings: JsonSettings);
|
|
7
|
+
createSerializer(): $ShapeSerializer<Uint8Array>;
|
|
8
|
+
createDeserializer(): $ShapeDeserializer<string>;
|
|
9
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentType, Schema, ShapeDeserializer } from "@smithy/types";
|
|
2
2
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
3
|
-
import { JsonSettings } from "../
|
|
4
|
-
export declare class
|
|
3
|
+
import { JsonSettings } from "../JsonSettings";
|
|
4
|
+
export declare class JsonShapeDeserializer2
|
|
5
5
|
extends SerdeContextConfig
|
|
6
6
|
implements ShapeDeserializer<string>
|
|
7
7
|
{
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
|
+
import { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
|
+
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
4
|
+
import { JsonSettings } from "../JsonSettings";
|
|
5
|
+
export declare class JsonShapeSerializer2
|
|
6
|
+
extends SerdeContextConfig
|
|
7
|
+
implements ShapeSerializer<Uint8Array>
|
|
8
|
+
{
|
|
9
|
+
readonly settings: JsonSettings;
|
|
10
|
+
private json;
|
|
11
|
+
private i;
|
|
12
|
+
private rootSchema;
|
|
13
|
+
private rawValue;
|
|
14
|
+
private passthrough;
|
|
15
|
+
constructor(settings: JsonSettings);
|
|
16
|
+
write(schema: Schema, value: unknown): void;
|
|
17
|
+
writeDiscriminatedDocument(schema: Schema, value: unknown): void;
|
|
18
|
+
flush(): Uint8Array;
|
|
19
|
+
protected ensure(byteCount: number): void;
|
|
20
|
+
protected writeAscii(s: string): void;
|
|
21
|
+
protected writeAsciiQuoted(s: string): void;
|
|
22
|
+
protected writeJsonString(s: string): void;
|
|
23
|
+
protected writeUnicodeEscape(code: number): void;
|
|
24
|
+
protected static readonly B64: Uint8Array;
|
|
25
|
+
protected writeBase64(data: Uint8Array): void;
|
|
26
|
+
protected writeValue(
|
|
27
|
+
schema: Schema,
|
|
28
|
+
value: unknown,
|
|
29
|
+
container: NormalizedSchema | undefined,
|
|
30
|
+
): void;
|
|
31
|
+
protected writeStruct(ns: NormalizedSchema, value: Record<string, unknown>): void;
|
|
32
|
+
protected writeList(ns: NormalizedSchema, value: unknown[], isDocument?: boolean): void;
|
|
33
|
+
protected writeMap(
|
|
34
|
+
ns: NormalizedSchema,
|
|
35
|
+
value: Record<string, unknown>,
|
|
36
|
+
isDocument?: boolean,
|
|
37
|
+
): void;
|
|
38
|
+
protected writeTimestamp(ns: NormalizedSchema, value: Date): void;
|
|
39
|
+
}
|