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

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
@@ -502,8 +502,9 @@ function serializeBasicTypes(typeName, objectName, value) {
502
502
  !(value instanceof ArrayBuffer) &&
503
503
  !ArrayBuffer.isView(value) &&
504
504
  // File objects count as a type of Blob, so we want to use instanceof explicitly
505
- !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob)) {
506
- throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, or NodeJS.ReadableStream.`);
505
+ !((typeof Blob === "function" || typeof Blob === "object") && value instanceof Blob) &&
506
+ objectType !== "function") {
507
+ throw new Error(`${objectName} must be a string, Blob, ArrayBuffer, ArrayBufferView, NodeJS.ReadableStream, or () => NodeJS.ReadableStream.`);
507
508
  }
508
509
  }
509
510
  }
@@ -806,7 +807,8 @@ function isSpecialXmlProperty(propertyName, options) {
806
807
  return [XML_ATTRKEY, options.xml.xmlCharKey].includes(propertyName);
807
808
  }
808
809
  function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
809
- var _a;
810
+ var _a, _b;
811
+ const xmlCharKey = (_a = options.xml.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
810
812
  if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
811
813
  mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
812
814
  }
@@ -837,6 +839,16 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
837
839
  if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
838
840
  instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
839
841
  }
842
+ else if (propertyMapper.xmlIsMsText) {
843
+ if (responseBody[xmlCharKey] !== undefined) {
844
+ instance[key] = responseBody[xmlCharKey];
845
+ }
846
+ else if (typeof responseBody === "string") {
847
+ // The special case where xml parser parses "<Name>content</Name>" into JSON of
848
+ // `{ name: "content"}` instead of `{ name: { "_": "content" }}`
849
+ instance[key] = responseBody;
850
+ }
851
+ }
840
852
  else {
841
853
  const propertyName = xmlElementName || xmlName || serializedName;
842
854
  if (propertyMapper.xmlIsWrapped) {
@@ -855,12 +867,14 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
855
867
  xmlName is "Cors" and xmlElementName is"CorsRule".
856
868
  */
857
869
  const wrapped = responseBody[xmlName];
858
- const elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : [];
870
+ const elementList = (_b = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _b !== void 0 ? _b : [];
859
871
  instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
872
+ handledPropertyNames.push(xmlName);
860
873
  }
861
874
  else {
862
875
  const property = responseBody[propertyName];
863
876
  instance[key] = serializer.deserialize(propertyMapper, property, propertyObjectName, options);
877
+ handledPropertyNames.push(propertyName);
864
878
  }
865
879
  }
866
880
  }