@@ -145,7 +145,8 @@ import {
145
145
import {
146
146
SmithyException as __SmithyException ,
147
147
extendedEncodeURIComponent as __extendedEncodeURIComponent ,
148
- getArrayIfSingleItem as __getArrayIfSingleItem
148
+ getArrayIfSingleItem as __getArrayIfSingleItem ,
149
+ getValueFromTextNode as __getValueFromTextNode
149
150
} from "@aws-sdk/smithy-client" ;
150
151
import {
151
152
Endpoint as __Endpoint ,
@@ -2869,28 +2870,16 @@ const deserializeAws_queryBatchResultErrorEntry = (
2869
2870
SenderFault : undefined
2870
2871
} ;
2871
2872
if ( output [ "Code" ] !== undefined ) {
2872
- contents . Code =
2873
- output [ "Code" ] [ "#text" ] !== undefined
2874
- ? output [ "Code" ] [ "#text" ]
2875
- : output [ "Code" ] ;
2873
+ contents . Code = output [ "Code" ] ;
2876
2874
}
2877
2875
if ( output [ "Id" ] !== undefined ) {
2878
- contents . Id =
2879
- output [ "Id" ] [ "#text" ] !== undefined
2880
- ? output [ "Id" ] [ "#text" ]
2881
- : output [ "Id" ] ;
2876
+ contents . Id = output [ "Id" ] ;
2882
2877
}
2883
2878
if ( output [ "Message" ] !== undefined ) {
2884
- contents . Message =
2885
- output [ "Message" ] [ "#text" ] !== undefined
2886
- ? output [ "Message" ] [ "#text" ]
2887
- : output [ "Message" ] ;
2879
+ contents . Message = output [ "Message" ] ;
2888
2880
}
2889
2881
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" ;
2894
2883
}
2895
2884
return contents ;
2896
2885
} ;
@@ -2908,9 +2897,7 @@ const deserializeAws_queryBinaryList = (
2908
2897
output : any ,
2909
2898
context : __SerdeContext
2910
2899
) : 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 ) ) ;
2914
2901
} ;
2915
2902
2916
2903
const deserializeAws_queryChangeMessageVisibilityBatchResult = (
@@ -2952,10 +2939,7 @@ const deserializeAws_queryChangeMessageVisibilityBatchResultEntry = (
2952
2939
Id : undefined
2953
2940
} ;
2954
2941
if ( output [ "Id" ] !== undefined ) {
2955
- contents . Id =
2956
- output [ "Id" ] [ "#text" ] !== undefined
2957
- ? output [ "Id" ] [ "#text" ]
2958
- : output [ "Id" ] ;
2942
+ contents . Id = output [ "Id" ] ;
2959
2943
}
2960
2944
return contents ;
2961
2945
} ;
@@ -2978,10 +2962,7 @@ const deserializeAws_queryCreateQueueResult = (
2978
2962
QueueUrl : undefined
2979
2963
} ;
2980
2964
if ( output [ "QueueUrl" ] !== undefined ) {
2981
- contents . QueueUrl =
2982
- output [ "QueueUrl" ] [ "#text" ] !== undefined
2983
- ? output [ "QueueUrl" ] [ "#text" ]
2984
- : output [ "QueueUrl" ] ;
2965
+ contents . QueueUrl = output [ "QueueUrl" ] ;
2985
2966
}
2986
2967
return contents ;
2987
2968
} ;
@@ -3025,10 +3006,7 @@ const deserializeAws_queryDeleteMessageBatchResultEntry = (
3025
3006
Id : undefined
3026
3007
} ;
3027
3008
if ( output [ "Id" ] !== undefined ) {
3028
- contents . Id =
3029
- output [ "Id" ] [ "#text" ] !== undefined
3030
- ? output [ "Id" ] [ "#text" ]
3031
- : output [ "Id" ] ;
3009
+ contents . Id = output [ "Id" ] ;
3032
3010
}
3033
3011
return contents ;
3034
3012
} ;
@@ -3081,10 +3059,7 @@ const deserializeAws_queryGetQueueUrlResult = (
3081
3059
QueueUrl : undefined
3082
3060
} ;
3083
3061
if ( output [ "QueueUrl" ] !== undefined ) {
3084
- contents . QueueUrl =
3085
- output [ "QueueUrl" ] [ "#text" ] !== undefined
3086
- ? output [ "QueueUrl" ] [ "#text" ]
3087
- : output [ "QueueUrl" ] ;
3062
+ contents . QueueUrl = output [ "QueueUrl" ] ;
3088
3063
}
3089
3064
return contents ;
3090
3065
} ;
@@ -3213,22 +3188,13 @@ const deserializeAws_queryMessage = (
3213
3188
) ;
3214
3189
}
3215
3190
if ( output [ "Body" ] !== undefined ) {
3216
- contents . Body =
3217
- output [ "Body" ] [ "#text" ] !== undefined
3218
- ? output [ "Body" ] [ "#text" ]
3219
- : output [ "Body" ] ;
3191
+ contents . Body = output [ "Body" ] ;
3220
3192
}
3221
3193
if ( output [ "MD5OfBody" ] !== undefined ) {
3222
- contents . MD5OfBody =
3223
- output [ "MD5OfBody" ] [ "#text" ] !== undefined
3224
- ? output [ "MD5OfBody" ] [ "#text" ]
3225
- : output [ "MD5OfBody" ] ;
3194
+ contents . MD5OfBody = output [ "MD5OfBody" ] ;
3226
3195
}
3227
3196
if ( output [ "MD5OfMessageAttributes" ] !== undefined ) {
3228
- contents . MD5OfMessageAttributes =
3229
- output [ "MD5OfMessageAttributes" ] [ "#text" ] !== undefined
3230
- ? output [ "MD5OfMessageAttributes" ] [ "#text" ]
3231
- : output [ "MD5OfMessageAttributes" ] ;
3197
+ contents . MD5OfMessageAttributes = output [ "MD5OfMessageAttributes" ] ;
3232
3198
}
3233
3199
if ( output . MessageAttribute === "" ) {
3234
3200
contents . MessageAttributes = { } ;
@@ -3240,16 +3206,10 @@ const deserializeAws_queryMessage = (
3240
3206
) ;
3241
3207
}
3242
3208
if ( output [ "MessageId" ] !== undefined ) {
3243
- contents . MessageId =
3244
- output [ "MessageId" ] [ "#text" ] !== undefined
3245
- ? output [ "MessageId" ] [ "#text" ]
3246
- : output [ "MessageId" ] ;
3209
+ contents . MessageId = output [ "MessageId" ] ;
3247
3210
}
3248
3211
if ( output [ "ReceiptHandle" ] !== undefined ) {
3249
- contents . ReceiptHandle =
3250
- output [ "ReceiptHandle" ] [ "#text" ] !== undefined
3251
- ? output [ "ReceiptHandle" ] [ "#text" ]
3252
- : output [ "ReceiptHandle" ] ;
3212
+ contents . ReceiptHandle = output [ "ReceiptHandle" ] ;
3253
3213
}
3254
3214
return contents ;
3255
3215
} ;
@@ -3276,17 +3236,10 @@ const deserializeAws_queryMessageAttributeValue = (
3276
3236
) ;
3277
3237
}
3278
3238
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" ] ) ;
3284
3240
}
3285
3241
if ( output [ "DataType" ] !== undefined ) {
3286
- contents . DataType =
3287
- output [ "DataType" ] [ "#text" ] !== undefined
3288
- ? output [ "DataType" ] [ "#text" ]
3289
- : output [ "DataType" ] ;
3242
+ contents . DataType = output [ "DataType" ] ;
3290
3243
}
3291
3244
if ( output . StringListValue === "" ) {
3292
3245
contents . StringListValues = [ ] ;
@@ -3298,10 +3251,7 @@ const deserializeAws_queryMessageAttributeValue = (
3298
3251
) ;
3299
3252
}
3300
3253
if ( output [ "StringValue" ] !== undefined ) {
3301
- contents . StringValue =
3302
- output [ "StringValue" ] [ "#text" ] !== undefined
3303
- ? output [ "StringValue" ] [ "#text" ]
3304
- : output [ "StringValue" ] ;
3254
+ contents . StringValue = output [ "StringValue" ] ;
3305
3255
}
3306
3256
return contents ;
3307
3257
} ;
@@ -3343,10 +3293,7 @@ const deserializeAws_queryMessageSystemAttributeMap = (
3343
3293
context : __SerdeContext
3344
3294
) : { [ key : string ] : string } => {
3345
3295
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" ] ;
3350
3297
return acc ;
3351
3298
} , { } ) ;
3352
3299
} ;
@@ -3376,10 +3323,7 @@ const deserializeAws_queryQueueAttributeMap = (
3376
3323
context : __SerdeContext
3377
3324
) : { [ key : string ] : string } => {
3378
3325
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" ] ;
3383
3327
return acc ;
3384
3328
} , { } ) ;
3385
3329
} ;
@@ -3418,9 +3362,7 @@ const deserializeAws_queryQueueUrlList = (
3418
3362
output : any ,
3419
3363
context : __SerdeContext
3420
3364
) : string [ ] => {
3421
- return ( output || [ ] ) . map ( ( entry : any ) =>
3422
- entry [ "#text" ] !== undefined ? entry [ "#text" ] : entry
3423
- ) ;
3365
+ return ( output || [ ] ) . map ( ( entry : any ) => entry ) ;
3424
3366
} ;
3425
3367
3426
3368
const deserializeAws_queryReceiptHandleIsInvalid = (
@@ -3497,40 +3439,23 @@ const deserializeAws_querySendMessageBatchResultEntry = (
3497
3439
SequenceNumber : undefined
3498
3440
} ;
3499
3441
if ( output [ "Id" ] !== undefined ) {
3500
- contents . Id =
3501
- output [ "Id" ] [ "#text" ] !== undefined
3502
- ? output [ "Id" ] [ "#text" ]
3503
- : output [ "Id" ] ;
3442
+ contents . Id = output [ "Id" ] ;
3504
3443
}
3505
3444
if ( output [ "MD5OfMessageAttributes" ] !== undefined ) {
3506
- contents . MD5OfMessageAttributes =
3507
- output [ "MD5OfMessageAttributes" ] [ "#text" ] !== undefined
3508
- ? output [ "MD5OfMessageAttributes" ] [ "#text" ]
3509
- : output [ "MD5OfMessageAttributes" ] ;
3445
+ contents . MD5OfMessageAttributes = output [ "MD5OfMessageAttributes" ] ;
3510
3446
}
3511
3447
if ( output [ "MD5OfMessageBody" ] !== undefined ) {
3512
- contents . MD5OfMessageBody =
3513
- output [ "MD5OfMessageBody" ] [ "#text" ] !== undefined
3514
- ? output [ "MD5OfMessageBody" ] [ "#text" ]
3515
- : output [ "MD5OfMessageBody" ] ;
3448
+ contents . MD5OfMessageBody = output [ "MD5OfMessageBody" ] ;
3516
3449
}
3517
3450
if ( output [ "MD5OfMessageSystemAttributes" ] !== undefined ) {
3518
3451
contents . MD5OfMessageSystemAttributes =
3519
- output [ "MD5OfMessageSystemAttributes" ] [ "#text" ] !== undefined
3520
- ? output [ "MD5OfMessageSystemAttributes" ] [ "#text" ]
3521
- : output [ "MD5OfMessageSystemAttributes" ] ;
3452
+ output [ "MD5OfMessageSystemAttributes" ] ;
3522
3453
}
3523
3454
if ( output [ "MessageId" ] !== undefined ) {
3524
- contents . MessageId =
3525
- output [ "MessageId" ] [ "#text" ] !== undefined
3526
- ? output [ "MessageId" ] [ "#text" ]
3527
- : output [ "MessageId" ] ;
3455
+ contents . MessageId = output [ "MessageId" ] ;
3528
3456
}
3529
3457
if ( output [ "SequenceNumber" ] !== undefined ) {
3530
- contents . SequenceNumber =
3531
- output [ "SequenceNumber" ] [ "#text" ] !== undefined
3532
- ? output [ "SequenceNumber" ] [ "#text" ]
3533
- : output [ "SequenceNumber" ] ;
3458
+ contents . SequenceNumber = output [ "SequenceNumber" ] ;
3534
3459
}
3535
3460
return contents ;
3536
3461
} ;
@@ -3557,34 +3482,20 @@ const deserializeAws_querySendMessageResult = (
3557
3482
SequenceNumber : undefined
3558
3483
} ;
3559
3484
if ( output [ "MD5OfMessageAttributes" ] !== undefined ) {
3560
- contents . MD5OfMessageAttributes =
3561
- output [ "MD5OfMessageAttributes" ] [ "#text" ] !== undefined
3562
- ? output [ "MD5OfMessageAttributes" ] [ "#text" ]
3563
- : output [ "MD5OfMessageAttributes" ] ;
3485
+ contents . MD5OfMessageAttributes = output [ "MD5OfMessageAttributes" ] ;
3564
3486
}
3565
3487
if ( output [ "MD5OfMessageBody" ] !== undefined ) {
3566
- contents . MD5OfMessageBody =
3567
- output [ "MD5OfMessageBody" ] [ "#text" ] !== undefined
3568
- ? output [ "MD5OfMessageBody" ] [ "#text" ]
3569
- : output [ "MD5OfMessageBody" ] ;
3488
+ contents . MD5OfMessageBody = output [ "MD5OfMessageBody" ] ;
3570
3489
}
3571
3490
if ( output [ "MD5OfMessageSystemAttributes" ] !== undefined ) {
3572
3491
contents . MD5OfMessageSystemAttributes =
3573
- output [ "MD5OfMessageSystemAttributes" ] [ "#text" ] !== undefined
3574
- ? output [ "MD5OfMessageSystemAttributes" ] [ "#text" ]
3575
- : output [ "MD5OfMessageSystemAttributes" ] ;
3492
+ output [ "MD5OfMessageSystemAttributes" ] ;
3576
3493
}
3577
3494
if ( output [ "MessageId" ] !== undefined ) {
3578
- contents . MessageId =
3579
- output [ "MessageId" ] [ "#text" ] !== undefined
3580
- ? output [ "MessageId" ] [ "#text" ]
3581
- : output [ "MessageId" ] ;
3495
+ contents . MessageId = output [ "MessageId" ] ;
3582
3496
}
3583
3497
if ( output [ "SequenceNumber" ] !== undefined ) {
3584
- contents . SequenceNumber =
3585
- output [ "SequenceNumber" ] [ "#text" ] !== undefined
3586
- ? output [ "SequenceNumber" ] [ "#text" ]
3587
- : output [ "SequenceNumber" ] ;
3498
+ contents . SequenceNumber = output [ "SequenceNumber" ] ;
3588
3499
}
3589
3500
return contents ;
3590
3501
} ;
@@ -3593,20 +3504,15 @@ const deserializeAws_queryStringList = (
3593
3504
output : any ,
3594
3505
context : __SerdeContext
3595
3506
) : string [ ] => {
3596
- return ( output || [ ] ) . map ( ( entry : any ) =>
3597
- entry [ "#text" ] !== undefined ? entry [ "#text" ] : entry
3598
- ) ;
3507
+ return ( output || [ ] ) . map ( ( entry : any ) => entry ) ;
3599
3508
} ;
3600
3509
3601
3510
const deserializeAws_queryTagMap = (
3602
3511
output : any ,
3603
3512
context : __SerdeContext
3604
3513
) : { [ key : string ] : string } => {
3605
3514
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" ] ;
3610
3516
return acc ;
3611
3517
} , { } ) ;
3612
3518
} ;
@@ -3693,20 +3599,15 @@ const decodeEscapedXML = (str: string) =>
3693
3599
const parseBody = ( streamBody : any , context : __SerdeContext ) : any =>
3694
3600
collectBodyString ( streamBody , context ) . then ( encoded => {
3695
3601
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 ] ] ;
3710
3611
}
3711
3612
return { } ;
3712
3613
} ) ;
0 commit comments