diff --git a/clients/client-auto-scaling/package.json b/clients/client-auto-scaling/package.json index a17c056e3260e..5550ef0e294be 100644 --- a/clients/client-auto-scaling/package.json +++ b/clients/client-auto-scaling/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-auto-scaling/src/protocols/Aws_query.ts b/clients/client-auto-scaling/src/protocols/Aws_query.ts index 3cf69b61772e5..6b313c072b867 100644 --- a/clients/client-auto-scaling/src/protocols/Aws_query.ts +++ b/clients/client-auto-scaling/src/protocols/Aws_query.ts @@ -20,8 +20,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AttachInstancesCommandInput, AttachInstancesCommandOutput } from "../commands/AttachInstancesCommand"; import { @@ -9838,13 +9837,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 977c5c4de84fe..851ebf11e9605 100644 --- a/clients/client-cloudformation/package.json +++ b/clients/client-cloudformation/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "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 b558162d81a92..0d51f7c1d6892 100644 --- a/clients/client-cloudformation/src/protocols/Aws_query.ts +++ b/clients/client-cloudformation/src/protocols/Aws_query.ts @@ -18,8 +18,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; import { ActivateTypeCommandInput, ActivateTypeCommandOutput } from "../commands/ActivateTypeCommand"; @@ -10248,13 +10247,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 e8c8ac555caee..99fb731dfb03d 100644 --- a/clients/client-cloudfront/package.json +++ b/clients/client-cloudfront/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-cloudfront/src/protocols/Aws_restXml.ts b/clients/client-cloudfront/src/protocols/Aws_restXml.ts index 64d8c430bafec..81f0fcdcc3b9d 100644 --- a/clients/client-cloudfront/src/protocols/Aws_restXml.ts +++ b/clients/client-cloudfront/src/protocols/Aws_restXml.ts @@ -23,8 +23,7 @@ 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 { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AssociateAliasCommandInput, AssociateAliasCommandOutput } from "../commands/AssociateAliasCommand"; import { CreateCachePolicyCommandInput, CreateCachePolicyCommandOutput } from "../commands/CreateCachePolicyCommand"; @@ -17270,13 +17269,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 2c583312af6c1..3e55e28f2c6de 100644 --- a/clients/client-cloudsearch/package.json +++ b/clients/client-cloudsearch/package.json @@ -50,8 +50,7 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-cloudsearch/src/protocols/Aws_query.ts b/clients/client-cloudsearch/src/protocols/Aws_query.ts index c5743ec0e1c97..9aa870f77bb4a 100644 --- a/clients/client-cloudsearch/src/protocols/Aws_query.ts +++ b/clients/client-cloudsearch/src/protocols/Aws_query.ts @@ -21,8 +21,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { BuildSuggestersCommandInput, BuildSuggestersCommandOutput } from "../commands/BuildSuggestersCommand"; import { CreateDomainCommandInput, CreateDomainCommandOutput } from "../commands/CreateDomainCommand"; @@ -4186,13 +4185,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 c4e5376c1163b..d7d7bc81d0bb6 100644 --- a/clients/client-cloudwatch/package.json +++ b/clients/client-cloudwatch/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-cloudwatch/src/protocols/Aws_query.ts b/clients/client-cloudwatch/src/protocols/Aws_query.ts index 8e3b3c815b737..32b95a1ec7639 100644 --- a/clients/client-cloudwatch/src/protocols/Aws_query.ts +++ b/clients/client-cloudwatch/src/protocols/Aws_query.ts @@ -21,8 +21,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { DeleteAlarmsCommandInput, DeleteAlarmsCommandOutput } from "../commands/DeleteAlarmsCommand"; import { @@ -6189,13 +6188,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 96fdb409040c7..391530bfac7d3 100644 --- a/clients/client-docdb/package.json +++ b/clients/client-docdb/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-docdb/src/protocols/Aws_query.ts b/clients/client-docdb/src/protocols/Aws_query.ts index 9725e6327a0cd..498338786cad9 100644 --- a/clients/client-docdb/src/protocols/Aws_query.ts +++ b/clients/client-docdb/src/protocols/Aws_query.ts @@ -18,8 +18,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddSourceIdentifierToSubscriptionCommandInput, @@ -9082,13 +9081,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 bb290ec97f069..779e74edd237f 100644 --- a/clients/client-ec2/package.json +++ b/clients/client-ec2/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "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 0044d388503d0..d52c8ce8a7b0a 100644 --- a/clients/client-ec2/src/protocols/Aws_ec2.ts +++ b/clients/client-ec2/src/protocols/Aws_ec2.ts @@ -20,8 +20,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; import { @@ -80353,13 +80352,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 e94dfb598ebcf..16bf6729b51ee 100644 --- a/clients/client-elastic-beanstalk/package.json +++ b/clients/client-elastic-beanstalk/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts b/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts index d4e36fc323fa6..61bc88412d787 100644 --- a/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts +++ b/clients/client-elastic-beanstalk/src/protocols/Aws_query.ts @@ -20,8 +20,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AbortEnvironmentUpdateCommandInput, @@ -7279,13 +7278,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 d3e9c4b8c5539..a789933266f62 100644 --- a/clients/client-elastic-load-balancing-v2/package.json +++ b/clients/client-elastic-load-balancing-v2/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { 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 d8d0c6e5f3923..7859b3d8ce310 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,8 +19,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddListenerCertificatesCommandInput, @@ -6703,13 +6702,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 02117c6557203..409b4ffe4a1a3 100644 --- a/clients/client-elastic-load-balancing/package.json +++ b/clients/client-elastic-load-balancing/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { 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 48ba1a36a6133..5607470d55878 100644 --- a/clients/client-elastic-load-balancing/src/protocols/Aws_query.ts +++ b/clients/client-elastic-load-balancing/src/protocols/Aws_query.ts @@ -19,8 +19,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddTagsCommandInput, AddTagsCommandOutput } from "../commands/AddTagsCommand"; import { @@ -4657,13 +4656,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 4d78208990d06..d288a8c63f13d 100644 --- a/clients/client-elasticache/package.json +++ b/clients/client-elasticache/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-elasticache/src/protocols/Aws_query.ts b/clients/client-elasticache/src/protocols/Aws_query.ts index da1e8e76b9704..1c5f55e382388 100644 --- a/clients/client-elasticache/src/protocols/Aws_query.ts +++ b/clients/client-elasticache/src/protocols/Aws_query.ts @@ -19,8 +19,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddTagsToResourceCommandInput, AddTagsToResourceCommandOutput } from "../commands/AddTagsToResourceCommand"; import { @@ -12498,13 +12497,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 f90a9391a9fb3..c3ab507c5f4dc 100644 --- a/clients/client-iam/package.json +++ b/clients/client-iam/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-iam/src/protocols/Aws_query.ts b/clients/client-iam/src/protocols/Aws_query.ts index 7e0d48eebea64..b61a735fb2a25 100644 --- a/clients/client-iam/src/protocols/Aws_query.ts +++ b/clients/client-iam/src/protocols/Aws_query.ts @@ -18,8 +18,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddClientIDToOpenIDConnectProviderCommandInput, @@ -17375,13 +17374,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 f8e56ba33f1ab..a842101ab8cac 100644 --- a/clients/client-neptune/package.json +++ b/clients/client-neptune/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-neptune/src/protocols/Aws_query.ts b/clients/client-neptune/src/protocols/Aws_query.ts index 63b6213b26446..fe11b938366b3 100644 --- a/clients/client-neptune/src/protocols/Aws_query.ts +++ b/clients/client-neptune/src/protocols/Aws_query.ts @@ -19,8 +19,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddRoleToDBClusterCommandInput, AddRoleToDBClusterCommandOutput } from "../commands/AddRoleToDBClusterCommand"; import { @@ -12051,13 +12050,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 64882ede5de30..19593f9a4f3dc 100644 --- a/clients/client-rds/package.json +++ b/clients/client-rds/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-rds/src/protocols/Aws_query.ts b/clients/client-rds/src/protocols/Aws_query.ts index 2deca6ce15047..42a041d223e4e 100644 --- a/clients/client-rds/src/protocols/Aws_query.ts +++ b/clients/client-rds/src/protocols/Aws_query.ts @@ -21,8 +21,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddRoleToDBClusterCommandInput, AddRoleToDBClusterCommandOutput } from "../commands/AddRoleToDBClusterCommand"; import { @@ -24102,13 +24101,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 138adca20c494..62b0527248344 100644 --- a/clients/client-redshift/package.json +++ b/clients/client-redshift/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-redshift/src/protocols/Aws_query.ts b/clients/client-redshift/src/protocols/Aws_query.ts index 00160b77b47ba..2da8cc580aa29 100644 --- a/clients/client-redshift/src/protocols/Aws_query.ts +++ b/clients/client-redshift/src/protocols/Aws_query.ts @@ -20,8 +20,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AcceptReservedNodeExchangeCommandInput, @@ -19395,13 +19394,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 7db2c1ad6a091..5e69a376e121b 100644 --- a/clients/client-route-53/package.json +++ b/clients/client-route-53/package.json @@ -53,8 +53,7 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-route-53/src/protocols/Aws_restXml.ts b/clients/client-route-53/src/protocols/Aws_restXml.ts index af63eff7339bc..50f937a72a160 100644 --- a/clients/client-route-53/src/protocols/Aws_restXml.ts +++ b/clients/client-route-53/src/protocols/Aws_restXml.ts @@ -23,8 +23,7 @@ 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 { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { ActivateKeySigningKeyCommandInput, @@ -8950,13 +8949,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 ab4c3d4fa03b6..679a77a36f155 100644 --- a/clients/client-s3-control/package.json +++ b/clients/client-s3-control/package.json @@ -58,8 +58,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "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 a069c6d63cfe0..b13b8cf6647af 100644 --- a/clients/client-s3-control/src/protocols/Aws_restXml.ts +++ b/clients/client-s3-control/src/protocols/Aws_restXml.ts @@ -28,8 +28,7 @@ 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 { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; import { CreateAccessPointCommandInput, CreateAccessPointCommandOutput } from "../commands/CreateAccessPointCommand"; @@ -8593,13 +8592,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 f932ab3cc5eb6..9867a918cc626 100644 --- a/clients/client-s3/package.json +++ b/clients/client-s3/package.json @@ -71,8 +71,7 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", "@aws-sdk/xml-builder": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-s3/src/protocols/Aws_restXml.ts b/clients/client-s3/src/protocols/Aws_restXml.ts index dc2aed35affea..09433891c607f 100644 --- a/clients/client-s3/src/protocols/Aws_restXml.ts +++ b/clients/client-s3/src/protocols/Aws_restXml.ts @@ -30,8 +30,7 @@ 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 { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AbortMultipartUploadCommandInput, @@ -12043,13 +12042,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 850a751236cad..8ee6611ed9b06 100644 --- a/clients/client-ses/package.json +++ b/clients/client-ses/package.json @@ -51,8 +51,7 @@ "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", "@aws-sdk/util-waiter": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-ses/src/protocols/Aws_query.ts b/clients/client-ses/src/protocols/Aws_query.ts index 9a4ebbde26645..31123465bc3b6 100644 --- a/clients/client-ses/src/protocols/Aws_query.ts +++ b/clients/client-ses/src/protocols/Aws_query.ts @@ -19,8 +19,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { CloneReceiptRuleSetCommandInput, @@ -8998,13 +8997,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 ce16caa0cbb66..a6dc80d2208dd 100644 --- a/clients/client-sns/package.json +++ b/clients/client-sns/package.json @@ -50,8 +50,7 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-sns/src/protocols/Aws_query.ts b/clients/client-sns/src/protocols/Aws_query.ts index ac8214f8be050..cda76a8f5486c 100644 --- a/clients/client-sns/src/protocols/Aws_query.ts +++ b/clients/client-sns/src/protocols/Aws_query.ts @@ -17,8 +17,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddPermissionCommandInput, AddPermissionCommandOutput } from "../commands/AddPermissionCommand"; import { @@ -5575,13 +5574,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 01b952394b6f8..3ba5c2ee098f3 100644 --- a/clients/client-sqs/package.json +++ b/clients/client-sqs/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-sqs/src/protocols/Aws_query.ts b/clients/client-sqs/src/protocols/Aws_query.ts index f87f713080bed..7150bf07decd8 100644 --- a/clients/client-sqs/src/protocols/Aws_query.ts +++ b/clients/client-sqs/src/protocols/Aws_query.ts @@ -15,8 +15,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AddPermissionCommandInput, AddPermissionCommandOutput } from "../commands/AddPermissionCommand"; import { @@ -2741,13 +2740,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 5a71c78484348..c40edef1622d1 100644 --- a/clients/client-sts/package.json +++ b/clients/client-sts/package.json @@ -52,8 +52,7 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1" }, "devDependencies": { diff --git a/clients/client-sts/src/protocols/Aws_query.ts b/clients/client-sts/src/protocols/Aws_query.ts index 6f7ed732500a4..66fe4aa2ab972 100644 --- a/clients/client-sts/src/protocols/Aws_query.ts +++ b/clients/client-sts/src/protocols/Aws_query.ts @@ -16,8 +16,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { AssumeRoleCommandInput, AssumeRoleCommandOutput } from "../commands/AssumeRoleCommand"; import { AssumeRoleWithSAMLCommandInput, AssumeRoleWithSAMLCommandOutput } from "../commands/AssumeRoleWithSAMLCommand"; @@ -1286,13 +1285,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java index 697d1efb23e71..ac1cdb4300bfb 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java @@ -56,8 +56,7 @@ public enum AwsDependency implements SymbolDependencyContainer { BODY_CHECKSUM_GENERATOR_BROWSER(NORMAL_DEPENDENCY, "@aws-sdk/body-checksum-browser"), BODY_CHECKSUM_GENERATOR_NODE(NORMAL_DEPENDENCY, "@aws-sdk/body-checksum-node"), XML_BUILDER(NORMAL_DEPENDENCY, "@aws-sdk/xml-builder"), - XML_PARSER(NORMAL_DEPENDENCY, "fast-xml-parser", "3.19.0"), - HTML_ENTITIES(NORMAL_DEPENDENCY, "entities", "2.2.0"), + XML_PARSER(NORMAL_DEPENDENCY, "fast-xml-parser", "4.0.11"), UUID_GENERATOR(NORMAL_DEPENDENCY, "uuid", "^8.3.2"), UUID_GENERATOR_TYPES(DEV_DEPENDENCY, "@types/uuid", "^8.3.0"), MIDDLEWARE_EVENTSTREAM(NORMAL_DEPENDENCY, "@aws-sdk/middleware-eventstream"), diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java index 39a4a345a2cf5..ca6846c7107c8 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java @@ -159,16 +159,19 @@ static void generateXmlParseBody(GenerationContext context) { writer.addImport("SerdeContext", "__SerdeContext", "@aws-sdk/types"); writer.addImport("getValueFromTextNode", "__getValueFromTextNode", "@aws-sdk/smithy-client"); writer.addDependency(AwsDependency.XML_PARSER); - writer.addDependency(AwsDependency.HTML_ENTITIES); - writer.addImport("parse", "xmlParse", "fast-xml-parser"); - writer.addImport("decodeHTML", "decodeHTML", "entities"); + writer.addImport("XMLParser", null, "fast-xml-parser"); writer.openBlock("const parseBody = (streamBody: any, context: __SerdeContext): " + "any => collectBodyString(streamBody, context).then(encoded => {", "});", () -> { writer.openBlock("if (encoded.length) {", "}", () -> { - writer.write("const parsedObj = xmlParse(encoded, { attributeNamePrefix: '', " - + "ignoreAttributes: false, parseNodeValue: false, trimValues: false, " - + "tagValueProcessor: (val) => (val.trim() === '' && val.includes('\\n'))" - + " ? '': decodeHTML(val) });"); + // Temporararily creating parser inside the function. + // Parser would be moved to runtime config in https://github.com/aws/aws-sdk-js-v3/issues/3979 + writer.write("const parser = new XMLParser({ attributeNamePrefix: '', htmlEntities: true, " + + "ignoreAttributes: false, ignoreDeclaration: true, parseTagValue: false, " + + "trimValues: false, tagValueProcessor: (_, val) => " + + "(val.trim() === '' && val.includes('\\n')) ? '': undefined });"); + writer.write("parser.addEntity('#xD', '\\r');"); + writer.write("parser.addEntity('#10', '\\n');"); + writer.write("const parsedObj = parser.parse(encoded);"); writer.write("const textNodeName = '#text';"); writer.write("const key = Object.keys(parsedObj)[0];"); writer.write("const parsedObjToReturn = parsedObj[key];"); diff --git a/private/aws-protocoltests-ec2/package.json b/private/aws-protocoltests-ec2/package.json index 412b69425734f..7ca210ccedada 100644 --- a/private/aws-protocoltests-ec2/package.json +++ b/private/aws-protocoltests-ec2/package.json @@ -48,8 +48,7 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "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 b964314ca4937..fc09862ed3ca8 100644 --- a/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts +++ b/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts @@ -29,8 +29,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; import { @@ -1943,13 +1942,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 2e3a9fe6d5dbe..c351b140a4e1d 100644 --- a/private/aws-protocoltests-query/package.json +++ b/private/aws-protocoltests-query/package.json @@ -48,8 +48,7 @@ "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", "@aws-sdk/util-utf8-node": "*", - "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "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 806e53ea5b2ed..5eb2b27c90921 100644 --- a/private/aws-protocoltests-query/src/protocols/Aws_query.ts +++ b/private/aws-protocoltests-query/src/protocols/Aws_query.ts @@ -29,8 +29,7 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; -import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; import { @@ -2679,13 +2678,18 @@ const buildHttpRpcRequest = async ( const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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/package.json b/private/aws-protocoltests-restxml/package.json index a969a629b3e7a..433b949ba1fee 100644 --- a/private/aws-protocoltests-restxml/package.json +++ b/private/aws-protocoltests-restxml/package.json @@ -51,7 +51,7 @@ "@aws-sdk/util-utf8-node": "*", "@aws-sdk/xml-builder": "*", "entities": "2.2.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.0.11", "tslib": "^2.3.1", "uuid": "^8.3.2" }, diff --git a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts index 03b70745db18d..aaa30c26ab50b 100644 --- a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts +++ b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts @@ -36,8 +36,7 @@ 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 { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { v4 as generateIdempotencyToken } from "uuid"; import { @@ -5282,13 +5281,18 @@ const isSerializableHeaderValue = (value: any): boolean => const parseBody = (streamBody: any, context: __SerdeContext): any => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - const parsedObj = xmlParse(encoded, { + const parser = new XMLParser({ attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: false, + ignoreDeclaration: true, + parseTagValue: false, trimValues: false, - tagValueProcessor: (val) => (val.trim() === "" && val.includes("\n") ? "" : decodeHTML(val)), + 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 c2de3e10f4041..d5a76fa3ffce1 100644 --- a/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts +++ b/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts @@ -4,7 +4,7 @@ import { buildQueryString } from "@aws-sdk/querystring-builder"; import { Encoder as __Encoder } from "@aws-sdk/types"; import { HeaderBag, HttpHandlerOptions } from "@aws-sdk/types"; import { decodeHTML } from "entities"; -import { parse as xmlParse } from "fast-xml-parser"; +import { XMLParser } from "fast-xml-parser"; import { Readable } from "stream"; import { AllQueryStringTypesCommand } from "../../src/commands/AllQueryStringTypesCommand"; @@ -6753,14 +6753,19 @@ const compareEquivalentUnknownTypeBodies = ( const compareEquivalentXmlBodies = (expectedBody: string, generatedBody: string): Object => { const parseConfig = { attributeNamePrefix: "", + htmlEntities: true, ignoreAttributes: false, - parseNodeValue: 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 = xmlParse(body, parseConfig); + 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]; diff --git a/yarn.lock b/yarn.lock index 7befaa8ed7c52..a6372e9e872d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -122,8 +122,7 @@ "@aws-sdk/util-user-agent-node" "*" "@aws-sdk/util-utf8-browser" "*" "@aws-sdk/util-utf8-node" "*" - entities "2.2.0" - fast-xml-parser "3.19.0" + fast-xml-parser "4.0.11" tslib "^2.3.1" "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13": @@ -5560,10 +5559,12 @@ fast-safe-stringify@2.1.1, fast-safe-stringify@^2.0.8: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== -fast-xml-parser@3.19.0: - version "3.19.0" - resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-3.19.0.tgz#cb637ec3f3999f51406dd8ff0e6fc4d83e520d01" - integrity sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg== +fast-xml-parser@4.0.11: + version "4.0.11" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.0.11.tgz#42332a9aca544520631c8919e6ea871c0185a985" + integrity sha512-4aUg3aNRR/WjQAcpceODG1C3x3lFANXRo8+1biqfieHmg9pyMt7qB4lQV/Ta6sJCTbA5vfD8fnA8S54JATiFUA== + dependencies: + strnum "^1.0.5" fastest-levenshtein@^1.0.12: version "1.0.12" @@ -10815,6 +10816,11 @@ strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1. resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strnum@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" + integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== + strong-log-transformer@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10"