@aws-sdk/core 3.936.0 → 3.943.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.
- package/dist-cjs/index.js +161 -91
- package/dist-cjs/submodules/protocols/index.js +161 -91
- package/dist-es/submodules/protocols/json/AwsJson1_0Protocol.js +2 -1
- package/dist-es/submodules/protocols/json/AwsJson1_1Protocol.js +2 -1
- package/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +10 -8
- package/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +31 -26
- package/dist-es/submodules/protocols/json/JsonShapeSerializer.js +76 -53
- package/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +2 -1
- package/dist-es/submodules/protocols/query/QueryShapeSerializer.js +2 -1
- package/dist-es/submodules/protocols/structIterator.js +40 -0
- package/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +2 -1
- package/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +3 -1
- package/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +3 -1
- package/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -1
- package/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +12 -3
- package/dist-types/submodules/protocols/structIterator.d.ts +27 -0
- package/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +3 -0
- package/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +3 -0
- package/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -0
- package/dist-types/ts3.4/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/dist-types/ts3.4/submodules/protocols/json/JsonShapeSerializer.d.ts +9 -3
- package/dist-types/ts3.4/submodules/protocols/structIterator.d.ts +12 -0
- package/package.json +1 -1
|
@@ -3,10 +3,12 @@ import { NormalizedSchema } from "@smithy/core/schema";
|
|
|
3
3
|
import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue } from "@smithy/core/serde";
|
|
4
4
|
import { toBase64 } from "@smithy/util-base64";
|
|
5
5
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
6
|
+
import { serializingStructIterator } from "../structIterator";
|
|
6
7
|
import { JsonReplacer } from "./jsonReplacer";
|
|
7
8
|
export class JsonShapeSerializer extends SerdeContextConfig {
|
|
8
9
|
settings;
|
|
9
10
|
buffer;
|
|
11
|
+
useReplacer = false;
|
|
10
12
|
rootSchema;
|
|
11
13
|
constructor(settings) {
|
|
12
14
|
super();
|
|
@@ -23,9 +25,13 @@ export class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
flush() {
|
|
26
|
-
const { rootSchema } = this;
|
|
28
|
+
const { rootSchema, useReplacer } = this;
|
|
27
29
|
this.rootSchema = undefined;
|
|
30
|
+
this.useReplacer = false;
|
|
28
31
|
if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
|
|
32
|
+
if (!useReplacer) {
|
|
33
|
+
return JSON.stringify(this.buffer);
|
|
34
|
+
}
|
|
29
35
|
const replacer = new JsonReplacer();
|
|
30
36
|
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
31
37
|
}
|
|
@@ -34,68 +40,68 @@ export class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
34
40
|
_write(schema, value, container) {
|
|
35
41
|
const isObject = value !== null && typeof value === "object";
|
|
36
42
|
const ns = NormalizedSchema.of(schema);
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
if (isObject) {
|
|
44
|
+
if (ns.isStructSchema()) {
|
|
45
|
+
const out = {};
|
|
46
|
+
for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
|
|
47
|
+
const serializableValue = this._write(memberSchema, value[memberName], ns);
|
|
48
|
+
if (serializableValue !== undefined) {
|
|
49
|
+
const jsonName = memberSchema.getMergedTraits().jsonName;
|
|
50
|
+
const targetKey = this.settings.jsonName ? jsonName ?? memberName : memberName;
|
|
51
|
+
out[targetKey] = serializableValue;
|
|
52
|
+
}
|
|
44
53
|
}
|
|
54
|
+
return out;
|
|
45
55
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
out[_k] = this._write(mapMember, _v);
|
|
56
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
57
|
+
const listMember = ns.getValueSchema();
|
|
58
|
+
const out = [];
|
|
59
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
60
|
+
for (const item of value) {
|
|
61
|
+
if (sparse || item != null) {
|
|
62
|
+
out.push(this._write(listMember, item));
|
|
63
|
+
}
|
|
55
64
|
}
|
|
65
|
+
return out;
|
|
56
66
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
out[targetKey] = serializableValue;
|
|
67
|
+
if (ns.isMapSchema()) {
|
|
68
|
+
const mapMember = ns.getValueSchema();
|
|
69
|
+
const out = {};
|
|
70
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
71
|
+
for (const [_k, _v] of Object.entries(value)) {
|
|
72
|
+
if (sparse || _v != null) {
|
|
73
|
+
out[_k] = this._write(mapMember, _v);
|
|
74
|
+
}
|
|
66
75
|
}
|
|
76
|
+
return out;
|
|
67
77
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if ((ns.isBlobSchema() && (value instanceof Uint8Array || typeof value === "string")) ||
|
|
74
|
-
(ns.isDocumentSchema() && value instanceof Uint8Array)) {
|
|
75
|
-
if (ns === this.rootSchema) {
|
|
76
|
-
return value;
|
|
78
|
+
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
79
|
+
if (ns === this.rootSchema) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
77
83
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return value.getTime() / 1000;
|
|
84
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
85
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
86
|
+
switch (format) {
|
|
87
|
+
case 5:
|
|
88
|
+
return value.toISOString().replace(".000Z", "Z");
|
|
89
|
+
case 6:
|
|
90
|
+
return dateToUtcString(value);
|
|
91
|
+
case 7:
|
|
92
|
+
return value.getTime() / 1000;
|
|
93
|
+
default:
|
|
94
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
95
|
+
return value.getTime() / 1000;
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
96
|
-
return String(value);
|
|
98
|
+
if (value instanceof NumericValue) {
|
|
99
|
+
this.useReplacer = true;
|
|
97
100
|
}
|
|
98
101
|
}
|
|
102
|
+
if (value === null && container?.isStructSchema()) {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
99
105
|
if (ns.isStringSchema()) {
|
|
100
106
|
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
101
107
|
return generateIdempotencyToken();
|
|
@@ -107,12 +113,29 @@ export class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
107
113
|
return LazyJsonString.from(value);
|
|
108
114
|
}
|
|
109
115
|
}
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
if (typeof value === "number" && ns.isNumericSchema()) {
|
|
119
|
+
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
120
|
+
return String(value);
|
|
121
|
+
}
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
125
|
+
if (ns === this.rootSchema) {
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
129
|
+
}
|
|
130
|
+
if (typeof value === "bigint") {
|
|
131
|
+
this.useReplacer = true;
|
|
110
132
|
}
|
|
111
133
|
if (ns.isDocumentSchema()) {
|
|
112
134
|
if (isObject) {
|
|
113
135
|
const out = Array.isArray(value) ? [] : {};
|
|
114
136
|
for (const [k, v] of Object.entries(value)) {
|
|
115
137
|
if (v instanceof NumericValue) {
|
|
138
|
+
this.useReplacer = true;
|
|
116
139
|
out[k] = v;
|
|
117
140
|
}
|
|
118
141
|
else {
|
|
@@ -3,6 +3,7 @@ import { NormalizedSchema } from "@smithy/core/schema";
|
|
|
3
3
|
import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue } from "@smithy/core/serde";
|
|
4
4
|
import { toBase64 } from "@smithy/util-base64";
|
|
5
5
|
import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
|
|
6
|
+
import { serializingStructIterator } from "../../structIterator";
|
|
6
7
|
export class SinglePassJsonShapeSerializer extends SerdeContextConfig {
|
|
7
8
|
settings;
|
|
8
9
|
buffer;
|
|
@@ -44,7 +45,7 @@ export class SinglePassJsonShapeSerializer extends SerdeContextConfig {
|
|
|
44
45
|
}
|
|
45
46
|
else if (ns.isStructSchema()) {
|
|
46
47
|
b += "{";
|
|
47
|
-
for (const [name, member] of ns
|
|
48
|
+
for (const [name, member] of serializingStructIterator(ns, value)) {
|
|
48
49
|
const item = value[name];
|
|
49
50
|
const targetKey = this.settings.jsonName ? member.getMergedTraits().jsonName ?? name : name;
|
|
50
51
|
const serializableValue = this.writeValue(member, item);
|
|
@@ -4,6 +4,7 @@ import { generateIdempotencyToken, NumericValue } from "@smithy/core/serde";
|
|
|
4
4
|
import { dateToUtcString } from "@smithy/smithy-client";
|
|
5
5
|
import { toBase64 } from "@smithy/util-base64";
|
|
6
6
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
7
|
+
import { serializingStructIterator } from "../structIterator";
|
|
7
8
|
export class QueryShapeSerializer extends SerdeContextConfig {
|
|
8
9
|
settings;
|
|
9
10
|
buffer;
|
|
@@ -113,7 +114,7 @@ export class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
113
114
|
}
|
|
114
115
|
else if (ns.isStructSchema()) {
|
|
115
116
|
if (value && typeof value === "object") {
|
|
116
|
-
for (const [memberName, member] of ns
|
|
117
|
+
for (const [memberName, member] of serializingStructIterator(ns, value)) {
|
|
117
118
|
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
118
119
|
continue;
|
|
119
120
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
|
+
export function* serializingStructIterator(ns, sourceObject) {
|
|
3
|
+
if (ns.isUnitSchema()) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const struct = ns.getSchema();
|
|
7
|
+
for (let i = 0; i < struct[4].length; ++i) {
|
|
8
|
+
const key = struct[4][i];
|
|
9
|
+
const memberSchema = struct[5][i];
|
|
10
|
+
const memberNs = new NormalizedSchema([memberSchema, 0], key);
|
|
11
|
+
if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
yield [key, memberNs];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function* deserializingStructIterator(ns, sourceObject, nameTrait) {
|
|
18
|
+
if (ns.isUnitSchema()) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const struct = ns.getSchema();
|
|
22
|
+
let keysRemaining = Object.keys(sourceObject).filter((k) => k !== "__type").length;
|
|
23
|
+
for (let i = 0; i < struct[4].length; ++i) {
|
|
24
|
+
if (keysRemaining === 0) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
const key = struct[4][i];
|
|
28
|
+
const memberSchema = struct[5][i];
|
|
29
|
+
const memberNs = new NormalizedSchema([memberSchema, 0], key);
|
|
30
|
+
let serializationKey = key;
|
|
31
|
+
if (nameTrait) {
|
|
32
|
+
serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
|
|
33
|
+
}
|
|
34
|
+
if (!(serializationKey in sourceObject)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
yield [key, memberNs];
|
|
38
|
+
keysRemaining -= 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -5,6 +5,7 @@ import { generateIdempotencyToken, NumericValue } from "@smithy/core/serde";
|
|
|
5
5
|
import { dateToUtcString } from "@smithy/smithy-client";
|
|
6
6
|
import { fromBase64, toBase64 } from "@smithy/util-base64";
|
|
7
7
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
8
|
+
import { serializingStructIterator } from "../structIterator";
|
|
8
9
|
export class XmlShapeSerializer extends SerdeContextConfig {
|
|
9
10
|
settings;
|
|
10
11
|
stringBuffer;
|
|
@@ -63,7 +64,7 @@ export class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
63
64
|
}
|
|
64
65
|
const structXmlNode = XmlNode.of(name);
|
|
65
66
|
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
|
|
66
|
-
for (const [memberName, memberSchema] of ns
|
|
67
|
+
for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
|
|
67
68
|
const val = value[memberName];
|
|
68
69
|
if (val != null || memberSchema.isIdempotencyToken()) {
|
|
69
70
|
if (memberSchema.getMergedTraits().xmlAttribute) {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
2
|
+
import type { JsonCodec } from "./JsonCodec";
|
|
2
3
|
/**
|
|
3
4
|
* @public
|
|
4
5
|
* @see https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#differences-between-awsjson1-0-and-awsjson1-1
|
|
5
6
|
*/
|
|
6
7
|
export declare class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
7
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }: {
|
|
8
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }: {
|
|
8
9
|
defaultNamespace: string;
|
|
9
10
|
serviceTarget: string;
|
|
10
11
|
awsQueryCompatible?: boolean;
|
|
12
|
+
jsonCodec?: JsonCodec;
|
|
11
13
|
});
|
|
12
14
|
getShapeId(): string;
|
|
13
15
|
protected getJsonRpcVersion(): "1.0";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
2
|
+
import type { JsonCodec } from "./JsonCodec";
|
|
2
3
|
/**
|
|
3
4
|
* @public
|
|
4
5
|
* @see https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#differences-between-awsjson1-0-and-awsjson1-1
|
|
5
6
|
*/
|
|
6
7
|
export declare class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
7
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }: {
|
|
8
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }: {
|
|
8
9
|
defaultNamespace: string;
|
|
9
10
|
serviceTarget: string;
|
|
10
11
|
awsQueryCompatible?: boolean;
|
|
12
|
+
jsonCodec?: JsonCodec;
|
|
11
13
|
});
|
|
12
14
|
getShapeId(): string;
|
|
13
15
|
protected getJsonRpcVersion(): "1.1";
|
|
@@ -11,10 +11,11 @@ export declare abstract class AwsJsonRpcProtocol extends RpcProtocol {
|
|
|
11
11
|
private readonly codec;
|
|
12
12
|
private readonly mixin;
|
|
13
13
|
private readonly awsQueryCompatible;
|
|
14
|
-
protected constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }: {
|
|
14
|
+
protected constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }: {
|
|
15
15
|
defaultNamespace: string;
|
|
16
16
|
serviceTarget: string;
|
|
17
17
|
awsQueryCompatible?: boolean;
|
|
18
|
+
jsonCodec?: JsonCodec;
|
|
18
19
|
});
|
|
19
20
|
serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<HttpRequest>;
|
|
20
21
|
getPayloadCodec(): JsonCodec;
|
|
@@ -9,5 +9,5 @@ export declare class JsonShapeDeserializer extends SerdeContextConfig implements
|
|
|
9
9
|
constructor(settings: JsonSettings);
|
|
10
10
|
read(schema: Schema, data: string | Uint8Array | unknown): Promise<any>;
|
|
11
11
|
readObject(schema: Schema, data: DocumentType): any;
|
|
12
|
-
|
|
12
|
+
protected _read(schema: Schema, value: unknown): any;
|
|
13
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
1
2
|
import type { Schema, ShapeSerializer } from "@smithy/types";
|
|
2
3
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
3
4
|
import type { JsonSettings } from "./JsonCodec";
|
|
@@ -6,8 +7,13 @@ import type { JsonSettings } from "./JsonCodec";
|
|
|
6
7
|
*/
|
|
7
8
|
export declare class JsonShapeSerializer extends SerdeContextConfig implements ShapeSerializer<string> {
|
|
8
9
|
readonly settings: JsonSettings;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Write buffer. Reused per value serialization pass.
|
|
12
|
+
* In the initial implementation, this is not an incremental buffer.
|
|
13
|
+
*/
|
|
14
|
+
protected buffer: any;
|
|
15
|
+
protected useReplacer: boolean;
|
|
16
|
+
protected rootSchema: NormalizedSchema | undefined;
|
|
11
17
|
constructor(settings: JsonSettings);
|
|
12
18
|
write(schema: Schema, value: unknown): void;
|
|
13
19
|
/**
|
|
@@ -15,5 +21,8 @@ export declare class JsonShapeSerializer extends SerdeContextConfig implements S
|
|
|
15
21
|
*/
|
|
16
22
|
writeDiscriminatedDocument(schema: Schema, value: unknown): void;
|
|
17
23
|
flush(): string;
|
|
18
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Order if-statements by order of likelihood.
|
|
26
|
+
*/
|
|
27
|
+
protected _write(schema: Schema, value: unknown, container?: NormalizedSchema): any;
|
|
19
28
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
type SourceObject = Record<string, any>;
|
|
6
|
+
/**
|
|
7
|
+
* For serialization use only.
|
|
8
|
+
* @internal
|
|
9
|
+
*
|
|
10
|
+
* @param ns - normalized schema object.
|
|
11
|
+
* @param sourceObject - source object from serialization.
|
|
12
|
+
*/
|
|
13
|
+
export declare function serializingStructIterator(ns: NormalizedSchema, sourceObject: SourceObject): Generator<any[], void, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* For deserialization use only.
|
|
16
|
+
* Yields a subset of NormalizedSchema::structIterator matched to the source object keys.
|
|
17
|
+
* This is a performance optimization to avoid creation of NormalizedSchema member
|
|
18
|
+
* objects for members that are undefined in the source data object but may be numerous
|
|
19
|
+
* in the schema/model.
|
|
20
|
+
* @internal
|
|
21
|
+
*
|
|
22
|
+
* @param ns - normalized schema object.
|
|
23
|
+
* @param sourceObject - source object from deserialization.
|
|
24
|
+
* @param nameTrait - xmlName or jsonName trait to look for.
|
|
25
|
+
*/
|
|
26
|
+
export declare function deserializingStructIterator(ns: NormalizedSchema, sourceObject: SourceObject, nameTrait?: "xmlName" | "jsonName" | false): Generator<any[], void, unknown>;
|
|
27
|
+
export {};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
2
|
+
import { JsonCodec } from "./JsonCodec";
|
|
2
3
|
export declare class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
3
4
|
constructor({
|
|
4
5
|
defaultNamespace,
|
|
5
6
|
serviceTarget,
|
|
6
7
|
awsQueryCompatible,
|
|
8
|
+
jsonCodec,
|
|
7
9
|
}: {
|
|
8
10
|
defaultNamespace: string;
|
|
9
11
|
serviceTarget: string;
|
|
10
12
|
awsQueryCompatible?: boolean;
|
|
13
|
+
jsonCodec?: JsonCodec;
|
|
11
14
|
});
|
|
12
15
|
getShapeId(): string;
|
|
13
16
|
protected getJsonRpcVersion(): "1.0";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
2
|
+
import { JsonCodec } from "./JsonCodec";
|
|
2
3
|
export declare class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
3
4
|
constructor({
|
|
4
5
|
defaultNamespace,
|
|
5
6
|
serviceTarget,
|
|
6
7
|
awsQueryCompatible,
|
|
8
|
+
jsonCodec,
|
|
7
9
|
}: {
|
|
8
10
|
defaultNamespace: string;
|
|
9
11
|
serviceTarget: string;
|
|
10
12
|
awsQueryCompatible?: boolean;
|
|
13
|
+
jsonCodec?: JsonCodec;
|
|
11
14
|
});
|
|
12
15
|
getShapeId(): string;
|
|
13
16
|
protected getJsonRpcVersion(): "1.1";
|
|
@@ -22,10 +22,12 @@ export declare abstract class AwsJsonRpcProtocol extends RpcProtocol {
|
|
|
22
22
|
defaultNamespace,
|
|
23
23
|
serviceTarget,
|
|
24
24
|
awsQueryCompatible,
|
|
25
|
+
jsonCodec,
|
|
25
26
|
}: {
|
|
26
27
|
defaultNamespace: string;
|
|
27
28
|
serviceTarget: string;
|
|
28
29
|
awsQueryCompatible?: boolean;
|
|
30
|
+
jsonCodec?: JsonCodec;
|
|
29
31
|
});
|
|
30
32
|
serializeRequest<Input extends object>(
|
|
31
33
|
operationSchema: OperationSchema,
|
|
@@ -9,5 +9,5 @@ export declare class JsonShapeDeserializer
|
|
|
9
9
|
constructor(settings: JsonSettings);
|
|
10
10
|
read(schema: Schema, data: string | Uint8Array | unknown): Promise<any>;
|
|
11
11
|
readObject(schema: Schema, data: DocumentType): any;
|
|
12
|
-
|
|
12
|
+
protected _read(schema: Schema, value: unknown): any;
|
|
13
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
1
2
|
import { Schema, ShapeSerializer } from "@smithy/types";
|
|
2
3
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
3
4
|
import { JsonSettings } from "./JsonCodec";
|
|
@@ -6,11 +7,16 @@ export declare class JsonShapeSerializer
|
|
|
6
7
|
implements ShapeSerializer<string>
|
|
7
8
|
{
|
|
8
9
|
readonly settings: JsonSettings;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
protected buffer: any;
|
|
11
|
+
protected useReplacer: boolean;
|
|
12
|
+
protected rootSchema: NormalizedSchema | undefined;
|
|
11
13
|
constructor(settings: JsonSettings);
|
|
12
14
|
write(schema: Schema, value: unknown): void;
|
|
13
15
|
writeDiscriminatedDocument(schema: Schema, value: unknown): void;
|
|
14
16
|
flush(): string;
|
|
15
|
-
|
|
17
|
+
protected _write(
|
|
18
|
+
schema: Schema,
|
|
19
|
+
value: unknown,
|
|
20
|
+
container?: NormalizedSchema
|
|
21
|
+
): any;
|
|
16
22
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
|
+
type SourceObject = Record<string, any>;
|
|
3
|
+
export declare function serializingStructIterator(
|
|
4
|
+
ns: NormalizedSchema,
|
|
5
|
+
sourceObject: SourceObject
|
|
6
|
+
): Generator<any[], void, unknown>;
|
|
7
|
+
export declare function deserializingStructIterator(
|
|
8
|
+
ns: NormalizedSchema,
|
|
9
|
+
sourceObject: SourceObject,
|
|
10
|
+
nameTrait?: "xmlName" | "jsonName" | false
|
|
11
|
+
): Generator<any[], void, unknown>;
|
|
12
|
+
export {};
|
package/package.json
CHANGED