From 0a893fba5e4bc42a0d1336b712ac0cf0a8eedeaa Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Tue, 11 Oct 2022 11:42:30 -0700 Subject: [PATCH] chore(deps-dev): bump fast-xml-parser to 4.0.11 (#4001) Co-authored-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> --- clients/client-auto-scaling/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-cloudformation/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-cloudfront/package.json | 3 +-- .../src/protocols/Aws_restXml.ts | 14 +++++++++----- clients/client-cloudsearch/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-cloudwatch/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-docdb/package.json | 3 +-- .../client-docdb/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-ec2/package.json | 3 +-- clients/client-ec2/src/protocols/Aws_ec2.ts | 14 +++++++++----- clients/client-elastic-beanstalk/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- .../package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- .../client-elastic-load-balancing/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-elasticache/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-iam/package.json | 3 +-- clients/client-iam/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-neptune/package.json | 3 +-- .../client-neptune/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-rds/package.json | 3 +-- clients/client-rds/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-redshift/package.json | 3 +-- .../client-redshift/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-route-53/package.json | 3 +-- .../src/protocols/Aws_restXml.ts | 14 +++++++++----- clients/client-s3-control/package.json | 3 +-- .../src/protocols/Aws_restXml.ts | 14 +++++++++----- clients/client-s3/package.json | 3 +-- clients/client-s3/src/protocols/Aws_restXml.ts | 14 +++++++++----- clients/client-ses/package.json | 3 +-- clients/client-ses/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-sns/package.json | 3 +-- clients/client-sns/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-sqs/package.json | 3 +-- clients/client-sqs/src/protocols/Aws_query.ts | 14 +++++++++----- clients/client-sts/package.json | 3 +-- clients/client-sts/src/protocols/Aws_query.ts | 14 +++++++++----- .../aws/typescript/codegen/AwsDependency.java | 3 +-- .../typescript/codegen/AwsProtocolUtils.java | 17 ++++++++++------- private/aws-protocoltests-ec2/package.json | 3 +-- .../src/protocols/Aws_ec2.ts | 14 +++++++++----- private/aws-protocoltests-query/package.json | 3 +-- .../src/protocols/Aws_query.ts | 14 +++++++++----- private/aws-protocoltests-restxml/package.json | 2 +- .../src/protocols/Aws_restXml.ts | 14 +++++++++----- .../test/functional/restxml.spec.ts | 13 +++++++++---- yarn.lock | 18 ++++++++++++------ 54 files changed, 282 insertions(+), 193 deletions(-) diff --git a/clients/client-auto-scaling/package.json b/clients/client-auto-scaling/package.json index 300bd61390bab..17471d72a7228 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 343ff4c729c7f..c3e6a08ad03f8 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 2c93727b49619..0c12cb3560a9c 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 8c7b43dd144e6..0645d5831ac91 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 369dbc759930a..0d0e5c1b8715e 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 cf468015a9a4c..07f5259b3ed44 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 46a2e3ab6146a..6632734c99686 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 cbbb8fa8e842f..69d77810b2c5d 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 8c49832b28cc4..ef23d4df1aca0 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 b20b0ee07d253..0ae4862cbdc92 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 7758c82d5590b..fa6afc325d8da 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 efbd6a202cae0..f783807c759dd 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 7c3ea6205746e..fc66321255ce6 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 7d78a39924e20..48db93f90dbc9 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 c4db97786df7b..4e7ac5fc9df11 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 a1224a3ab3178..e741768144c4e 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 588662a19ffd6..5c888c63ea63b 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 5eb7deec12297..60a915080bf2b 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 64d4f1706ea78..242bfb1d1c675 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 bb8a0eeac6948..a65ac3c81718c 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 cd0affc23c39e..837044521bbe0 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 26aec47127670..b94bb187793ff 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 ae0f263e7c203..2bdd37b11a99f 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 f63a896b905c8..22ab0b7a6362a 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 8d4bcc5931b4b..9f7c761a33cc6 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 3d22a109b4ef4..87e42e891c21c 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"