From 1e6bb7e28cc2d51cba1bc326f6dfaf411fbe291b Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Thu, 29 Sep 2022 17:25:59 +0000 Subject: [PATCH] feat(codegen): upgrade fast-xml-parser to 4.0.10 --- clients/client-auto-scaling/package.json | 1 - .../client-auto-scaling/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-cloudformation/package.json | 1 - .../client-cloudformation/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-cloudfront/package.json | 1 - .../client-cloudfront/src/protocols/Aws_restXml.ts | 12 ++++++++---- clients/client-cloudsearch/package.json | 1 - .../client-cloudsearch/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-cloudwatch/package.json | 1 - clients/client-cloudwatch/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-docdb/package.json | 1 - clients/client-docdb/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-ec2/package.json | 1 - clients/client-ec2/src/protocols/Aws_ec2.ts | 12 ++++++++---- clients/client-elastic-beanstalk/package.json | 1 - .../src/protocols/Aws_query.ts | 12 ++++++++---- .../client-elastic-load-balancing-v2/package.json | 1 - .../src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-elastic-load-balancing/package.json | 1 - .../src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-elasticache/package.json | 1 - .../client-elasticache/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-iam/package.json | 1 - clients/client-iam/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-neptune/package.json | 1 - clients/client-neptune/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-rds/package.json | 1 - clients/client-rds/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-redshift/package.json | 1 - clients/client-redshift/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-route-53/package.json | 1 - clients/client-route-53/src/protocols/Aws_restXml.ts | 12 ++++++++---- clients/client-s3-control/package.json | 1 - .../client-s3-control/src/protocols/Aws_restXml.ts | 12 ++++++++---- clients/client-s3/package.json | 1 - clients/client-s3/src/protocols/Aws_restXml.ts | 12 ++++++++---- clients/client-ses/package.json | 1 - clients/client-ses/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-sns/package.json | 1 - clients/client-sns/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-sqs/package.json | 1 - clients/client-sqs/src/protocols/Aws_query.ts | 12 ++++++++---- clients/client-sts/package.json | 1 - clients/client-sts/src/protocols/Aws_query.ts | 12 ++++++++---- private/aws-protocoltests-ec2/package.json | 1 - .../aws-protocoltests-ec2/src/protocols/Aws_ec2.ts | 12 ++++++++---- private/aws-protocoltests-query/package.json | 1 - .../src/protocols/Aws_query.ts | 12 ++++++++---- .../src/protocols/Aws_restXml.ts | 12 ++++++++---- .../test/functional/restxml.spec.ts | 9 +++++++-- 50 files changed, 207 insertions(+), 126 deletions(-) diff --git a/clients/client-auto-scaling/package.json b/clients/client-auto-scaling/package.json index 66ac3e5f7720b..f8551abe4031e 100644 --- a/clients/client-auto-scaling/package.json +++ b/clients/client-auto-scaling/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-auto-scaling/src/protocols/Aws_query.ts b/clients/client-auto-scaling/src/protocols/Aws_query.ts index efe2bc9917930..de3a49ae9c958 100644 --- a/clients/client-auto-scaling/src/protocols/Aws_query.ts +++ b/clients/client-auto-scaling/src/protocols/Aws_query.ts @@ -20,7 +20,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AttachInstancesCommandInput, AttachInstancesCommandOutput } from "../commands/AttachInstancesCommand"; @@ -9837,13 +9836,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-cloudformation/package.json b/clients/client-cloudformation/package.json index e3d6b87a498d7..4acb185e27541 100644 --- a/clients/client-cloudformation/package.json +++ b/clients/client-cloudformation/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1", "uuid": "^8.3.2" diff --git a/clients/client-cloudformation/src/protocols/Aws_query.ts b/clients/client-cloudformation/src/protocols/Aws_query.ts index 97d22037d90d4..eb84772307cd1 100644 --- a/clients/client-cloudformation/src/protocols/Aws_query.ts +++ b/clients/client-cloudformation/src/protocols/Aws_query.ts @@ -18,7 +18,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -10247,13 +10246,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-cloudfront/package.json b/clients/client-cloudfront/package.json index 01bccc863b78c..6643624e61b53 100644 --- a/clients/client-cloudfront/package.json +++ b/clients/client-cloudfront/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-cloudfront/src/protocols/Aws_restXml.ts b/clients/client-cloudfront/src/protocols/Aws_restXml.ts index ce65ec2c742ef..6121bd38a82bc 100644 --- a/clients/client-cloudfront/src/protocols/Aws_restXml.ts +++ b/clients/client-cloudfront/src/protocols/Aws_restXml.ts @@ -23,7 +23,6 @@ import { SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AssociateAliasCommandInput, AssociateAliasCommandOutput } from "../commands/AssociateAliasCommand"; @@ -17269,13 +17268,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-cloudsearch/package.json b/clients/client-cloudsearch/package.json index ed43a887c3f78..5280ce8fbcd5a 100644 --- a/clients/client-cloudsearch/package.json +++ b/clients/client-cloudsearch/package.json @@ -50,7 +50,6 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-cloudsearch/src/protocols/Aws_query.ts b/clients/client-cloudsearch/src/protocols/Aws_query.ts index 354044e1bc694..a0ab673a7f886 100644 --- a/clients/client-cloudsearch/src/protocols/Aws_query.ts +++ b/clients/client-cloudsearch/src/protocols/Aws_query.ts @@ -21,7 +21,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { BuildSuggestersCommandInput, BuildSuggestersCommandOutput } from "../commands/BuildSuggestersCommand"; @@ -4185,13 +4184,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-cloudwatch/package.json b/clients/client-cloudwatch/package.json index 6d9a5fb0c8890..5f1c97827e087 100644 --- a/clients/client-cloudwatch/package.json +++ b/clients/client-cloudwatch/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-cloudwatch/src/protocols/Aws_query.ts b/clients/client-cloudwatch/src/protocols/Aws_query.ts index de9d780d158ba..2849e235c98b8 100644 --- a/clients/client-cloudwatch/src/protocols/Aws_query.ts +++ b/clients/client-cloudwatch/src/protocols/Aws_query.ts @@ -21,7 +21,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { DeleteAlarmsCommandInput, DeleteAlarmsCommandOutput } from "../commands/DeleteAlarmsCommand"; @@ -6188,13 +6187,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-docdb/package.json b/clients/client-docdb/package.json index 61fb998818a54..2dd0450a256db 100644 --- a/clients/client-docdb/package.json +++ b/clients/client-docdb/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-docdb/src/protocols/Aws_query.ts b/clients/client-docdb/src/protocols/Aws_query.ts index c346a2dd81dbb..d57917c815ff7 100644 --- a/clients/client-docdb/src/protocols/Aws_query.ts +++ b/clients/client-docdb/src/protocols/Aws_query.ts @@ -18,7 +18,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -9081,13 +9080,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-ec2/package.json b/clients/client-ec2/package.json index adb1c8f1af639..aaaeaf47db243 100644 --- a/clients/client-ec2/package.json +++ b/clients/client-ec2/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1", "uuid": "^8.3.2" diff --git a/clients/client-ec2/src/protocols/Aws_ec2.ts b/clients/client-ec2/src/protocols/Aws_ec2.ts index ca2d2f7e34773..67efd805b57b6 100644 --- a/clients/client-ec2/src/protocols/Aws_ec2.ts +++ b/clients/client-ec2/src/protocols/Aws_ec2.ts @@ -20,7 +20,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -80327,13 +80326,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-elastic-beanstalk/package.json b/clients/client-elastic-beanstalk/package.json index 3791f6bf8170a..57bd6c6adecbf 100644 --- a/clients/client-elastic-beanstalk/package.json +++ b/clients/client-elastic-beanstalk/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts b/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts index 5c208d6ebf662..b7372f02fb39f 100644 --- a/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts +++ b/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts @@ -20,7 +20,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -7278,13 +7277,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-elastic-load-balancing-v2/package.json b/clients/client-elastic-load-balancing-v2/package.json index ef966a1644df7..c7bb67cc9838b 100644 --- a/clients/client-elastic-load-balancing-v2/package.json +++ b/clients/client-elastic-load-balancing-v2/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-elastic-load-balancing-v2/src/protocols/Aws_query.ts b/clients/client-elastic-load-balancing-v2/src/protocols/Aws_query.ts index a30bbe853b156..31df6739ba2c1 100644 --- a/clients/client-elastic-load-balancing-v2/src/protocols/Aws_query.ts +++ b/clients/client-elastic-load-balancing-v2/src/protocols/Aws_query.ts @@ -19,7 +19,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -6702,13 +6701,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-elastic-load-balancing/package.json b/clients/client-elastic-load-balancing/package.json index c24755eb2be41..a6143874f3409 100644 --- a/clients/client-elastic-load-balancing/package.json +++ b/clients/client-elastic-load-balancing/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-elastic-load-balancing/src/protocols/Aws_query.ts b/clients/client-elastic-load-balancing/src/protocols/Aws_query.ts index a89ff081c6bf0..c5ebcffebeca6 100644 --- a/clients/client-elastic-load-balancing/src/protocols/Aws_query.ts +++ b/clients/client-elastic-load-balancing/src/protocols/Aws_query.ts @@ -19,7 +19,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AddTagsCommandInput, AddTagsCommandOutput } from "../commands/AddTagsCommand"; @@ -4656,13 +4655,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-elasticache/package.json b/clients/client-elasticache/package.json index 37119101c21dd..d62603da295a2 100644 --- a/clients/client-elasticache/package.json +++ b/clients/client-elasticache/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-elasticache/src/protocols/Aws_query.ts b/clients/client-elasticache/src/protocols/Aws_query.ts index 40b4544bcc373..f060560040ee2 100644 --- a/clients/client-elasticache/src/protocols/Aws_query.ts +++ b/clients/client-elasticache/src/protocols/Aws_query.ts @@ -19,7 +19,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AddTagsToResourceCommandInput, AddTagsToResourceCommandOutput } from "../commands/AddTagsToResourceCommand"; @@ -12497,13 +12496,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-iam/package.json b/clients/client-iam/package.json index 5f71c6fc4d648..c4f96592d76ff 100644 --- a/clients/client-iam/package.json +++ b/clients/client-iam/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-iam/src/protocols/Aws_query.ts b/clients/client-iam/src/protocols/Aws_query.ts index b978ff7043c2a..1964609326ad7 100644 --- a/clients/client-iam/src/protocols/Aws_query.ts +++ b/clients/client-iam/src/protocols/Aws_query.ts @@ -18,7 +18,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -17374,13 +17373,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-neptune/package.json b/clients/client-neptune/package.json index 8a8299dd215af..df8962aba568c 100644 --- a/clients/client-neptune/package.json +++ b/clients/client-neptune/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-neptune/src/protocols/Aws_query.ts b/clients/client-neptune/src/protocols/Aws_query.ts index 98f9bfabfa8e9..f7276eb50dc6b 100644 --- a/clients/client-neptune/src/protocols/Aws_query.ts +++ b/clients/client-neptune/src/protocols/Aws_query.ts @@ -19,7 +19,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AddRoleToDBClusterCommandInput, AddRoleToDBClusterCommandOutput } from "../commands/AddRoleToDBClusterCommand"; @@ -12050,13 +12049,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-rds/package.json b/clients/client-rds/package.json index fced35770249c..fa7e9f1daaa66 100644 --- a/clients/client-rds/package.json +++ b/clients/client-rds/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-rds/src/protocols/Aws_query.ts b/clients/client-rds/src/protocols/Aws_query.ts index 0ba5ac7fe6e9c..3b30ab3a18075 100644 --- a/clients/client-rds/src/protocols/Aws_query.ts +++ b/clients/client-rds/src/protocols/Aws_query.ts @@ -21,7 +21,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AddRoleToDBClusterCommandInput, AddRoleToDBClusterCommandOutput } from "../commands/AddRoleToDBClusterCommand"; @@ -24101,13 +24100,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-redshift/package.json b/clients/client-redshift/package.json index 8d0af79af6821..bdeb8317d4969 100644 --- a/clients/client-redshift/package.json +++ b/clients/client-redshift/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-redshift/src/protocols/Aws_query.ts b/clients/client-redshift/src/protocols/Aws_query.ts index d2c934327cc55..8040e573660a5 100644 --- a/clients/client-redshift/src/protocols/Aws_query.ts +++ b/clients/client-redshift/src/protocols/Aws_query.ts @@ -20,7 +20,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -19394,13 +19393,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-route-53/package.json b/clients/client-route-53/package.json index 5db35dc6fc814..a61599a9409b5 100644 --- a/clients/client-route-53/package.json +++ b/clients/client-route-53/package.json @@ -53,7 +53,6 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-route-53/src/protocols/Aws_restXml.ts b/clients/client-route-53/src/protocols/Aws_restXml.ts index 23bbd6239c6c0..b7533fe0d17f7 100644 --- a/clients/client-route-53/src/protocols/Aws_restXml.ts +++ b/clients/client-route-53/src/protocols/Aws_restXml.ts @@ -23,7 +23,6 @@ import { SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -8949,13 +8948,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-s3-control/package.json b/clients/client-s3-control/package.json index 1b7288e3718f9..8a7214e697536 100644 --- a/clients/client-s3-control/package.json +++ b/clients/client-s3-control/package.json @@ -58,7 +58,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1", "uuid": "^8.3.2" diff --git a/clients/client-s3-control/src/protocols/Aws_restXml.ts b/clients/client-s3-control/src/protocols/Aws_restXml.ts index 7d95dd1ad8fd7..d65ac3477c1fc 100644 --- a/clients/client-s3-control/src/protocols/Aws_restXml.ts +++ b/clients/client-s3-control/src/protocols/Aws_restXml.ts @@ -28,7 +28,6 @@ import { SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -8592,13 +8591,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-s3/package.json b/clients/client-s3/package.json index eb0c2840b5ff5..2ed0ae7832979 100644 --- a/clients/client-s3/package.json +++ b/clients/client-s3/package.json @@ -71,7 +71,6 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-s3/src/protocols/Aws_restXml.ts b/clients/client-s3/src/protocols/Aws_restXml.ts index d508e269d70e7..83f08703b73e7 100644 --- a/clients/client-s3/src/protocols/Aws_restXml.ts +++ b/clients/client-s3/src/protocols/Aws_restXml.ts @@ -30,7 +30,6 @@ import { SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -12042,13 +12041,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-ses/package.json b/clients/client-ses/package.json index 7727395be3d62..dbecd92570999 100644 --- a/clients/client-ses/package.json +++ b/clients/client-ses/package.json @@ -51,7 +51,6 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-ses/src/protocols/Aws_query.ts b/clients/client-ses/src/protocols/Aws_query.ts index 7f00e2580ea56..5655aa111f03e 100644 --- a/clients/client-ses/src/protocols/Aws_query.ts +++ b/clients/client-ses/src/protocols/Aws_query.ts @@ -19,7 +19,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { @@ -8997,13 +8996,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-sns/package.json b/clients/client-sns/package.json index 68ac010cbca8e..bada6c34ed86d 100644 --- a/clients/client-sns/package.json +++ b/clients/client-sns/package.json @@ -50,7 +50,6 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-sns/src/protocols/Aws_query.ts b/clients/client-sns/src/protocols/Aws_query.ts index 37d7a6bfada49..c412e5e4d068b 100644 --- a/clients/client-sns/src/protocols/Aws_query.ts +++ b/clients/client-sns/src/protocols/Aws_query.ts @@ -17,7 +17,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AddPermissionCommandInput, AddPermissionCommandOutput } from "../commands/AddPermissionCommand"; @@ -5574,13 +5573,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-sqs/package.json b/clients/client-sqs/package.json index 87a8bc9256073..fdd743e89ead4 100644 --- a/clients/client-sqs/package.json +++ b/clients/client-sqs/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-sqs/src/protocols/Aws_query.ts b/clients/client-sqs/src/protocols/Aws_query.ts index f196d932a2671..0820e629898a2 100644 --- a/clients/client-sqs/src/protocols/Aws_query.ts +++ b/clients/client-sqs/src/protocols/Aws_query.ts @@ -15,7 +15,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AddPermissionCommandInput, AddPermissionCommandOutput } from "../commands/AddPermissionCommand"; @@ -2740,13 +2739,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/clients/client-sts/package.json b/clients/client-sts/package.json index 871a82193dfe7..bfbcabfddde16 100644 --- a/clients/client-sts/package.json +++ b/clients/client-sts/package.json @@ -52,7 +52,6 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1" }, diff --git a/clients/client-sts/src/protocols/Aws_query.ts b/clients/client-sts/src/protocols/Aws_query.ts index f5e81cd78b506..d6d06485bf1c2 100644 --- a/clients/client-sts/src/protocols/Aws_query.ts +++ b/clients/client-sts/src/protocols/Aws_query.ts @@ -16,7 +16,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { AssumeRoleCommandInput, AssumeRoleCommandOutput } from "../commands/AssumeRoleCommand"; @@ -1285,13 +1284,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/private/aws-protocoltests-ec2/package.json b/private/aws-protocoltests-ec2/package.json index 0242543e6517d..2086f94d8820c 100644 --- a/private/aws-protocoltests-ec2/package.json +++ b/private/aws-protocoltests-ec2/package.json @@ -48,7 +48,6 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1", "uuid": "^8.3.2" diff --git a/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts b/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts index a4c33d781cca7..0e024c2dd0873 100644 --- a/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts +++ b/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts @@ -29,7 +29,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -1942,13 +1941,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/private/aws-protocoltests-query/package.json b/private/aws-protocoltests-query/package.json index cc4b8227fbe50..6fd33b7210e18 100644 --- a/private/aws-protocoltests-query/package.json +++ b/private/aws-protocoltests-query/package.json @@ -48,7 +48,6 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", "fast-xml-parser": "4.0.10", "tslib": "^2.3.1", "uuid": "^8.3.2" diff --git a/private/aws-protocoltests-query/src/protocols/Aws_query.ts b/private/aws-protocoltests-query/src/protocols/Aws_query.ts index 6414cc1050e17..840b2c0a8e08b 100644 --- a/private/aws-protocoltests-query/src/protocols/Aws_query.ts +++ b/private/aws-protocoltests-query/src/protocols/Aws_query.ts @@ -29,7 +29,6 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -2678,13 +2677,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts index 86e94ceb944a1..8351f93f4a8d8 100644 --- a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts +++ b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts @@ -36,7 +36,6 @@ import { SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; -import { decodeHTML } from "entities"; import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -5281,13 +5280,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = new XMLParser({ + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), - }).parse(encoded); + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(encoded); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key]; diff --git a/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts b/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts index 6814ed8f83143..d5a76fa3ffce1 100644 --- a/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts +++ b/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts @@ -6753,14 +6753,19 @@ const compareEquivalentUnknownTypeBodies = ( const compareEquivalentXmlBodies = (expectedBody: string, generatedBody: string): Object => { const parseConfig = { attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, + ignoreDeclaration: true, parseTagValue: false, trimValues: false, - tagValueProcessor: (val: any, tagName: any) => (val.trim() === "" ? "" : decodeHTML(val)), + tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined), }; const parseXmlBody = (body: string) => { - const parsedObj = new XMLParser(parseConfig).parse(body); + const parser = new XMLParser(parseConfig); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + const parsedObj = parser.parse(body); const textNodeName = "#text"; const key = Object.keys(parsedObj)[0]; const parsedObjToReturn = parsedObj[key];