Skip to content

Commit 61b70fe

Browse files
committed
chore: codegen to populate contents from #text in parsedObj
1 parent 0e8510d commit 61b70fe

File tree

25 files changed

+6296
-24534
lines changed

25 files changed

+6296
-24534
lines changed

clients/client-auto-scaling/protocols/Aws_query.ts

Lines changed: 180 additions & 692 deletions
Large diffs are not rendered by default.

clients/client-cloudformation/protocols/Aws_query.ts

Lines changed: 294 additions & 1129 deletions
Large diffs are not rendered by default.

clients/client-cloudfront/protocols/Aws_restXml.ts

Lines changed: 300 additions & 1203 deletions
Large diffs are not rendered by default.

clients/client-cloudsearch/protocols/Aws_query.ts

Lines changed: 126 additions & 479 deletions
Large diffs are not rendered by default.

clients/client-cloudwatch/protocols/Aws_query.ts

Lines changed: 122 additions & 473 deletions
Large diffs are not rendered by default.

clients/client-docdb/protocols/Aws_query.ts

Lines changed: 209 additions & 808 deletions
Large diffs are not rendered by default.

clients/client-ec2/protocols/Aws_ec2.ts

Lines changed: 1653 additions & 6616 deletions
Large diffs are not rendered by default.

clients/client-elastic-beanstalk/protocols/Aws_query.ts

Lines changed: 227 additions & 905 deletions
Large diffs are not rendered by default.

clients/client-elastic-load-balancing-v2/protocols/Aws_query.ts

Lines changed: 158 additions & 605 deletions
Large diffs are not rendered by default.

clients/client-elastic-load-balancing/protocols/Aws_query.ts

Lines changed: 95 additions & 356 deletions
Large diffs are not rendered by default.

clients/client-elasticache/protocols/Aws_query.ts

Lines changed: 274 additions & 1062 deletions
Large diffs are not rendered by default.

clients/client-iam/protocols/Aws_query.ts

Lines changed: 296 additions & 1144 deletions
Large diffs are not rendered by default.

clients/client-neptune/protocols/Aws_query.ts

Lines changed: 305 additions & 1189 deletions
Large diffs are not rendered by default.

clients/client-rds/protocols/Aws_query.ts

Lines changed: 633 additions & 2506 deletions
Large diffs are not rendered by default.

clients/client-redshift/protocols/Aws_query.ts

Lines changed: 408 additions & 1586 deletions
Large diffs are not rendered by default.

clients/client-route-53/protocols/Aws_restXml.ts

Lines changed: 233 additions & 911 deletions
Large diffs are not rendered by default.

clients/client-s3-control/protocols/Aws_restXml.ts

Lines changed: 102 additions & 384 deletions
Large diffs are not rendered by default.

clients/client-s3/protocols/Aws_restXml.ts

Lines changed: 216 additions & 843 deletions
Large diffs are not rendered by default.

clients/client-ses/protocols/Aws_query.ts

Lines changed: 175 additions & 666 deletions
Large diffs are not rendered by default.

clients/client-sns/protocols/Aws_query.ts

Lines changed: 61 additions & 214 deletions
Large diffs are not rendered by default.

clients/client-sqs/protocols/Aws_query.ts

Lines changed: 44 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ import {
145145
import {
146146
SmithyException as __SmithyException,
147147
extendedEncodeURIComponent as __extendedEncodeURIComponent,
148-
getArrayIfSingleItem as __getArrayIfSingleItem
148+
getArrayIfSingleItem as __getArrayIfSingleItem,
149+
getValueFromTextNode as __getValueFromTextNode
149150
} from "@aws-sdk/smithy-client";
150151
import {
151152
Endpoint as __Endpoint,
@@ -2869,28 +2870,16 @@ const deserializeAws_queryBatchResultErrorEntry = (
28692870
SenderFault: undefined
28702871
};
28712872
if (output["Code"] !== undefined) {
2872-
contents.Code =
2873-
output["Code"]["#text"] !== undefined
2874-
? output["Code"]["#text"]
2875-
: output["Code"];
2873+
contents.Code = output["Code"];
28762874
}
28772875
if (output["Id"] !== undefined) {
2878-
contents.Id =
2879-
output["Id"]["#text"] !== undefined
2880-
? output["Id"]["#text"]
2881-
: output["Id"];
2876+
contents.Id = output["Id"];
28822877
}
28832878
if (output["Message"] !== undefined) {
2884-
contents.Message =
2885-
output["Message"]["#text"] !== undefined
2886-
? output["Message"]["#text"]
2887-
: output["Message"];
2879+
contents.Message = output["Message"];
28882880
}
28892881
if (output["SenderFault"] !== undefined) {
2890-
contents.SenderFault =
2891-
(output["SenderFault"]["#text"] !== undefined
2892-
? output["SenderFault"]["#text"]
2893-
: output["SenderFault"]) == "true";
2882+
contents.SenderFault = output["SenderFault"] == "true";
28942883
}
28952884
return contents;
28962885
};
@@ -2908,9 +2897,7 @@ const deserializeAws_queryBinaryList = (
29082897
output: any,
29092898
context: __SerdeContext
29102899
): Uint8Array[] => {
2911-
return (output || []).map((entry: any) =>
2912-
context.base64Decoder(entry["#text"] !== undefined ? entry["#text"] : entry)
2913-
);
2900+
return (output || []).map((entry: any) => context.base64Decoder(entry));
29142901
};
29152902

29162903
const deserializeAws_queryChangeMessageVisibilityBatchResult = (
@@ -2952,10 +2939,7 @@ const deserializeAws_queryChangeMessageVisibilityBatchResultEntry = (
29522939
Id: undefined
29532940
};
29542941
if (output["Id"] !== undefined) {
2955-
contents.Id =
2956-
output["Id"]["#text"] !== undefined
2957-
? output["Id"]["#text"]
2958-
: output["Id"];
2942+
contents.Id = output["Id"];
29592943
}
29602944
return contents;
29612945
};
@@ -2978,10 +2962,7 @@ const deserializeAws_queryCreateQueueResult = (
29782962
QueueUrl: undefined
29792963
};
29802964
if (output["QueueUrl"] !== undefined) {
2981-
contents.QueueUrl =
2982-
output["QueueUrl"]["#text"] !== undefined
2983-
? output["QueueUrl"]["#text"]
2984-
: output["QueueUrl"];
2965+
contents.QueueUrl = output["QueueUrl"];
29852966
}
29862967
return contents;
29872968
};
@@ -3025,10 +3006,7 @@ const deserializeAws_queryDeleteMessageBatchResultEntry = (
30253006
Id: undefined
30263007
};
30273008
if (output["Id"] !== undefined) {
3028-
contents.Id =
3029-
output["Id"]["#text"] !== undefined
3030-
? output["Id"]["#text"]
3031-
: output["Id"];
3009+
contents.Id = output["Id"];
30323010
}
30333011
return contents;
30343012
};
@@ -3081,10 +3059,7 @@ const deserializeAws_queryGetQueueUrlResult = (
30813059
QueueUrl: undefined
30823060
};
30833061
if (output["QueueUrl"] !== undefined) {
3084-
contents.QueueUrl =
3085-
output["QueueUrl"]["#text"] !== undefined
3086-
? output["QueueUrl"]["#text"]
3087-
: output["QueueUrl"];
3062+
contents.QueueUrl = output["QueueUrl"];
30883063
}
30893064
return contents;
30903065
};
@@ -3213,22 +3188,13 @@ const deserializeAws_queryMessage = (
32133188
);
32143189
}
32153190
if (output["Body"] !== undefined) {
3216-
contents.Body =
3217-
output["Body"]["#text"] !== undefined
3218-
? output["Body"]["#text"]
3219-
: output["Body"];
3191+
contents.Body = output["Body"];
32203192
}
32213193
if (output["MD5OfBody"] !== undefined) {
3222-
contents.MD5OfBody =
3223-
output["MD5OfBody"]["#text"] !== undefined
3224-
? output["MD5OfBody"]["#text"]
3225-
: output["MD5OfBody"];
3194+
contents.MD5OfBody = output["MD5OfBody"];
32263195
}
32273196
if (output["MD5OfMessageAttributes"] !== undefined) {
3228-
contents.MD5OfMessageAttributes =
3229-
output["MD5OfMessageAttributes"]["#text"] !== undefined
3230-
? output["MD5OfMessageAttributes"]["#text"]
3231-
: output["MD5OfMessageAttributes"];
3197+
contents.MD5OfMessageAttributes = output["MD5OfMessageAttributes"];
32323198
}
32333199
if (output.MessageAttribute === "") {
32343200
contents.MessageAttributes = {};
@@ -3240,16 +3206,10 @@ const deserializeAws_queryMessage = (
32403206
);
32413207
}
32423208
if (output["MessageId"] !== undefined) {
3243-
contents.MessageId =
3244-
output["MessageId"]["#text"] !== undefined
3245-
? output["MessageId"]["#text"]
3246-
: output["MessageId"];
3209+
contents.MessageId = output["MessageId"];
32473210
}
32483211
if (output["ReceiptHandle"] !== undefined) {
3249-
contents.ReceiptHandle =
3250-
output["ReceiptHandle"]["#text"] !== undefined
3251-
? output["ReceiptHandle"]["#text"]
3252-
: output["ReceiptHandle"];
3212+
contents.ReceiptHandle = output["ReceiptHandle"];
32533213
}
32543214
return contents;
32553215
};
@@ -3276,17 +3236,10 @@ const deserializeAws_queryMessageAttributeValue = (
32763236
);
32773237
}
32783238
if (output["BinaryValue"] !== undefined) {
3279-
contents.BinaryValue = context.base64Decoder(
3280-
output["BinaryValue"]["#text"] !== undefined
3281-
? output["BinaryValue"]["#text"]
3282-
: output["BinaryValue"]
3283-
);
3239+
contents.BinaryValue = context.base64Decoder(output["BinaryValue"]);
32843240
}
32853241
if (output["DataType"] !== undefined) {
3286-
contents.DataType =
3287-
output["DataType"]["#text"] !== undefined
3288-
? output["DataType"]["#text"]
3289-
: output["DataType"];
3242+
contents.DataType = output["DataType"];
32903243
}
32913244
if (output.StringListValue === "") {
32923245
contents.StringListValues = [];
@@ -3298,10 +3251,7 @@ const deserializeAws_queryMessageAttributeValue = (
32983251
);
32993252
}
33003253
if (output["StringValue"] !== undefined) {
3301-
contents.StringValue =
3302-
output["StringValue"]["#text"] !== undefined
3303-
? output["StringValue"]["#text"]
3304-
: output["StringValue"];
3254+
contents.StringValue = output["StringValue"];
33053255
}
33063256
return contents;
33073257
};
@@ -3343,10 +3293,7 @@ const deserializeAws_queryMessageSystemAttributeMap = (
33433293
context: __SerdeContext
33443294
): { [key: string]: string } => {
33453295
return output.reduce((acc: any, pair: any) => {
3346-
acc[pair["Name"]] =
3347-
pair["Value"]["#text"] !== undefined
3348-
? pair["Value"]["#text"]
3349-
: pair["Value"];
3296+
acc[pair["Name"]] = pair["Value"];
33503297
return acc;
33513298
}, {});
33523299
};
@@ -3376,10 +3323,7 @@ const deserializeAws_queryQueueAttributeMap = (
33763323
context: __SerdeContext
33773324
): { [key: string]: string } => {
33783325
return output.reduce((acc: any, pair: any) => {
3379-
acc[pair["Name"]] =
3380-
pair["Value"]["#text"] !== undefined
3381-
? pair["Value"]["#text"]
3382-
: pair["Value"];
3326+
acc[pair["Name"]] = pair["Value"];
33833327
return acc;
33843328
}, {});
33853329
};
@@ -3418,9 +3362,7 @@ const deserializeAws_queryQueueUrlList = (
34183362
output: any,
34193363
context: __SerdeContext
34203364
): string[] => {
3421-
return (output || []).map((entry: any) =>
3422-
entry["#text"] !== undefined ? entry["#text"] : entry
3423-
);
3365+
return (output || []).map((entry: any) => entry);
34243366
};
34253367

34263368
const deserializeAws_queryReceiptHandleIsInvalid = (
@@ -3497,40 +3439,23 @@ const deserializeAws_querySendMessageBatchResultEntry = (
34973439
SequenceNumber: undefined
34983440
};
34993441
if (output["Id"] !== undefined) {
3500-
contents.Id =
3501-
output["Id"]["#text"] !== undefined
3502-
? output["Id"]["#text"]
3503-
: output["Id"];
3442+
contents.Id = output["Id"];
35043443
}
35053444
if (output["MD5OfMessageAttributes"] !== undefined) {
3506-
contents.MD5OfMessageAttributes =
3507-
output["MD5OfMessageAttributes"]["#text"] !== undefined
3508-
? output["MD5OfMessageAttributes"]["#text"]
3509-
: output["MD5OfMessageAttributes"];
3445+
contents.MD5OfMessageAttributes = output["MD5OfMessageAttributes"];
35103446
}
35113447
if (output["MD5OfMessageBody"] !== undefined) {
3512-
contents.MD5OfMessageBody =
3513-
output["MD5OfMessageBody"]["#text"] !== undefined
3514-
? output["MD5OfMessageBody"]["#text"]
3515-
: output["MD5OfMessageBody"];
3448+
contents.MD5OfMessageBody = output["MD5OfMessageBody"];
35163449
}
35173450
if (output["MD5OfMessageSystemAttributes"] !== undefined) {
35183451
contents.MD5OfMessageSystemAttributes =
3519-
output["MD5OfMessageSystemAttributes"]["#text"] !== undefined
3520-
? output["MD5OfMessageSystemAttributes"]["#text"]
3521-
: output["MD5OfMessageSystemAttributes"];
3452+
output["MD5OfMessageSystemAttributes"];
35223453
}
35233454
if (output["MessageId"] !== undefined) {
3524-
contents.MessageId =
3525-
output["MessageId"]["#text"] !== undefined
3526-
? output["MessageId"]["#text"]
3527-
: output["MessageId"];
3455+
contents.MessageId = output["MessageId"];
35283456
}
35293457
if (output["SequenceNumber"] !== undefined) {
3530-
contents.SequenceNumber =
3531-
output["SequenceNumber"]["#text"] !== undefined
3532-
? output["SequenceNumber"]["#text"]
3533-
: output["SequenceNumber"];
3458+
contents.SequenceNumber = output["SequenceNumber"];
35343459
}
35353460
return contents;
35363461
};
@@ -3557,34 +3482,20 @@ const deserializeAws_querySendMessageResult = (
35573482
SequenceNumber: undefined
35583483
};
35593484
if (output["MD5OfMessageAttributes"] !== undefined) {
3560-
contents.MD5OfMessageAttributes =
3561-
output["MD5OfMessageAttributes"]["#text"] !== undefined
3562-
? output["MD5OfMessageAttributes"]["#text"]
3563-
: output["MD5OfMessageAttributes"];
3485+
contents.MD5OfMessageAttributes = output["MD5OfMessageAttributes"];
35643486
}
35653487
if (output["MD5OfMessageBody"] !== undefined) {
3566-
contents.MD5OfMessageBody =
3567-
output["MD5OfMessageBody"]["#text"] !== undefined
3568-
? output["MD5OfMessageBody"]["#text"]
3569-
: output["MD5OfMessageBody"];
3488+
contents.MD5OfMessageBody = output["MD5OfMessageBody"];
35703489
}
35713490
if (output["MD5OfMessageSystemAttributes"] !== undefined) {
35723491
contents.MD5OfMessageSystemAttributes =
3573-
output["MD5OfMessageSystemAttributes"]["#text"] !== undefined
3574-
? output["MD5OfMessageSystemAttributes"]["#text"]
3575-
: output["MD5OfMessageSystemAttributes"];
3492+
output["MD5OfMessageSystemAttributes"];
35763493
}
35773494
if (output["MessageId"] !== undefined) {
3578-
contents.MessageId =
3579-
output["MessageId"]["#text"] !== undefined
3580-
? output["MessageId"]["#text"]
3581-
: output["MessageId"];
3495+
contents.MessageId = output["MessageId"];
35823496
}
35833497
if (output["SequenceNumber"] !== undefined) {
3584-
contents.SequenceNumber =
3585-
output["SequenceNumber"]["#text"] !== undefined
3586-
? output["SequenceNumber"]["#text"]
3587-
: output["SequenceNumber"];
3498+
contents.SequenceNumber = output["SequenceNumber"];
35883499
}
35893500
return contents;
35903501
};
@@ -3593,20 +3504,15 @@ const deserializeAws_queryStringList = (
35933504
output: any,
35943505
context: __SerdeContext
35953506
): string[] => {
3596-
return (output || []).map((entry: any) =>
3597-
entry["#text"] !== undefined ? entry["#text"] : entry
3598-
);
3507+
return (output || []).map((entry: any) => entry);
35993508
};
36003509

36013510
const deserializeAws_queryTagMap = (
36023511
output: any,
36033512
context: __SerdeContext
36043513
): { [key: string]: string } => {
36053514
return output.reduce((acc: any, pair: any) => {
3606-
acc[pair["Key"]] =
3607-
pair["Value"]["#text"] !== undefined
3608-
? pair["Value"]["#text"]
3609-
: pair["Value"];
3515+
acc[pair["Key"]] = pair["Value"];
36103516
return acc;
36113517
}, {});
36123518
};
@@ -3693,20 +3599,15 @@ const decodeEscapedXML = (str: string) =>
36933599
const parseBody = (streamBody: any, context: __SerdeContext): any =>
36943600
collectBodyString(streamBody, context).then(encoded => {
36953601
if (encoded.length) {
3696-
const parsedObj = xmlParse(encoded, {
3697-
attributeNamePrefix: "",
3698-
ignoreAttributes: false,
3699-
parseNodeValue: false,
3700-
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
3701-
});
3702-
const textNodeName = "#text";
3703-
const key = Object.keys(parsedObj)[0];
3704-
const parsedObjToReturn = parsedObj[key];
3705-
if (parsedObjToReturn[textNodeName]) {
3706-
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
3707-
delete parsedObjToReturn[textNodeName];
3708-
}
3709-
return parsedObjToReturn;
3602+
const parsedObj = __getValueFromTextNode(
3603+
xmlParse(encoded, {
3604+
attributeNamePrefix: "",
3605+
ignoreAttributes: false,
3606+
parseNodeValue: false,
3607+
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
3608+
})
3609+
);
3610+
return parsedObj[Object.keys(parsedObj)[0]];
37103611
}
37113612
return {};
37123613
});

0 commit comments

Comments
 (0)