@azure/core-client 1.6.2-alpha.20221107.4 → 1.6.2-alpha.20221129.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -806,7 +806,8 @@ function isSpecialXmlProperty(propertyName, options) {
806
806
  return [XML_ATTRKEY, options.xml.xmlCharKey].includes(propertyName);
807
807
  }
808
808
  function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
809
- var _a;
809
+ var _a, _b;
810
+ const xmlCharKey = (_a = options.xml.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
810
811
  if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
811
812
  mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
812
813
  }
@@ -837,6 +838,16 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
837
838
  if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
838
839
  instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
839
840
  }
841
+ else if (propertyMapper.xmlIsMsText) {
842
+ if (responseBody[xmlCharKey] !== undefined) {
843
+ instance[key] = responseBody[xmlCharKey];
844
+ }
845
+ else if (typeof responseBody === "string") {
846
+ // The special case where xml parser parses "<Name>content</Name>" into JSON of
847
+ // `{ name: "content"}` instead of `{ name: { "_": "content" }}`
848
+ instance[key] = responseBody;
849
+ }
850
+ }
840
851
  else {
841
852
  const propertyName = xmlElementName || xmlName || serializedName;
842
853
  if (propertyMapper.xmlIsWrapped) {
@@ -855,12 +866,14 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
855
866
  xmlName is "Cors" and xmlElementName is"CorsRule".
856
867
  */
857
868
  const wrapped = responseBody[xmlName];
858
- const elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : [];
869
+ const elementList = (_b = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _b !== void 0 ? _b : [];
859
870
  instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
871
+ handledPropertyNames.push(xmlName);
860
872
  }
861
873
  else {
862
874
  const property = responseBody[propertyName];
863
875
  instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options);
876
+ handledPropertyNames.push(propertyName);
864
877
  }
865
878
  }
866
879
  }