deserialize(mapper, responseBody, objectName, options = { xml: {} }) {
        var _a, _b, _c;
        const updatedOptions = {
            xml: {
                rootName: (_a = options.xml.rootName) !== null && _a !== void 0 ? _a : "",
                includeRoot: (_b = options.xml.includeRoot) !== null && _b !== void 0 ? _b : false,
                xmlCharKey: (_c = options.xml.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
            }
        };
        if (responseBody === undefined || responseBody === null) {
            if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) {
                // Edge case for empty XML non-wrapped lists. xml2js can't distinguish
                // between the list being empty versus being missing,
                // so let's do the more user-friendly thing and return an empty list.
                responseBody = [];
            }
            // specifically check for undefined as default value can be a falsey value `0, "", false, null`
            if (mapper.defaultValue !== undefined) {
                responseBody = mapper.defaultValue;
            }
            return responseBody;
        }
        let payload;
        const mapperType = mapper.type.name;
        if (!objectName) {
            objectName = mapper.serializedName;
        }
        if (mapperType.match(/^Composite$/i) !== null) {
            payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions);
        }
        else {
            if (this.isXML) {
                const xmlCharKey = updatedOptions.xml.xmlCharKey;
                /**
                 * If the mapper specifies this as a non-composite type value but the responseBody contains
                 * both header ("$" i.e., XML_ATTRKEY) and body ("#" i.e., XML_CHARKEY) properties,
                 * then just reduce the responseBody value to the body ("#" i.e., XML_CHARKEY) property.
                 */
                if (responseBody[XML_ATTRKEY] !== undefined && responseBody[xmlCharKey] !== undefined) {
                    responseBody = responseBody[xmlCharKey];
                }
            }
            if (mapperType.match(/^Number$/i) !== null) {
                payload = parseFloat(responseBody);
                if (isNaN(payload)) {
                    payload = responseBody;
                }
            }
            else if (mapperType.match(/^Boolean$/i) !== null) {
                if (responseBody === "true") {
                    payload = true;
                }
                else if (responseBody === "false") {
                    payload = false;
                }
                else {
                    payload = responseBody;
                }
            }
            else if (mapperType.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i) !== null) {
                payload = responseBody;
            }
            else if (mapperType.match(/^(Date|DateTime|DateTimeRfc1123)$/i) !== null) {
                payload = new Date(responseBody);
            }
            else if (mapperType.match(/^UnixTime$/i) !== null) {
                payload = unixTimeToDate(responseBody);
            }
            else if (mapperType.match(/^ByteArray$/i) !== null) {
                payload = base64.decodeString(responseBody);
            }
            else if (mapperType.match(/^Base64Url$/i) !== null) {
                payload = base64UrlToByteArray(responseBody);
            }
            else if (mapperType.match(/^Sequence$/i) !== null) {
                payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions);
            }
            else if (mapperType.match(/^Dictionary$/i) !== null) {
                payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions);
            }
        }
        if (mapper.isConstant) {
            payload = mapper.defaultValue;
        }
        return payload;
    }
/**
     * Deserialize the given object based on its metadata defined in the mapper
     *
     * @param mapper - The mapper which defines the metadata of the serializable object
     *
     * @param responseBody - A valid Javascript entity to be deserialized
     *
     * @param objectName - Name of the deserialized object
     *
     * @param options - Controls behavior of XML parser and builder.
     *
     * @returns A valid deserialized Javascript object
     */
Deserialize the given object based on its metadata defined in the mapper
@param mapper - The mapper which defines the metadata of the serializable object

@param responseBody - A valid Javascript entity to be deserialized

@param objectName - Name of the deserialized object

@param options - Controls behavior of XML parser and builder.

@returns A valid deserialized Javascript object
Deserialize the given object based on its metadata defined in the mapper @param mapper - The mapper which defines the metadata of the serializable object @param responseBody - A valid Javascript entity to be deserialized @param objectName - Name of the deserialized object @param options - Controls behavior of XML parser and builder . @returns A valid deserialized Javascript object
deserialize(mapper, responseBody, objectName, options = { xml: {} }) {
        var _a, _b, _c;
        const updatedOptions = {
            xml: {
                rootName: (_a = options.xml.rootName) !== null && _a !== void 0 ? _a : "",
                includeRoot: (_b = options.xml.includeRoot) !== null && _b !== void 0 ? _b : false,
                xmlCharKey: (_c = options.xml.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY
            }
        };
        if (responseBody === undefined || responseBody === null) {
            if (this.isXML && mapper.type.name === "Sequence" && !mapper.xmlIsWrapped) {
                responseBody = [];
            }
            if (mapper.defaultValue !== undefined) {
                responseBody = mapper.defaultValue;
            }
            return responseBody;
        }
        let payload;
        const mapperType = mapper.type.name;
        if (!objectName) {
            objectName = mapper.serializedName;
        }
        if (mapperType.match(/^Composite$/i) !== null) {
            payload = deserializeCompositeType(this, mapper, responseBody, objectName, updatedOptions);
        }
        else {
            if (this.isXML) {
                const xmlCharKey = updatedOptions.xml.xmlCharKey;
                if (responseBody[XML_ATTRKEY] !== undefined && responseBody[xmlCharKey] !== undefined) {
                    responseBody = responseBody[xmlCharKey];
                }
            }
            if (mapperType.match(/^Number$/i) !== null) {
                payload = parseFloat(responseBody);
                if (isNaN(payload)) {
                    payload = responseBody;
                }
            }
            else if (mapperType.match(/^Boolean$/i) !== null) {
                if (responseBody === "true") {
                    payload = true;
                }
                else if (responseBody === "false") {
                    payload = false;
                }
                else {
                    payload = responseBody;
                }
            }
            else if (mapperType.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i) !== null) {
                payload = responseBody;
            }
            else if (mapperType.match(/^(Date|DateTime|DateTimeRfc1123)$/i) !== null) {
                payload = new Date(responseBody);
            }
            else if (mapperType.match(/^UnixTime$/i) !== null) {
                payload = unixTimeToDate(responseBody);
            }
            else if (mapperType.match(/^ByteArray$/i) !== null) {
                payload = base64.decodeString(responseBody);
            }
            else if (mapperType.match(/^Base64Url$/i) !== null) {
                payload = base64UrlToByteArray(responseBody);
            }
            else if (mapperType.match(/^Sequence$/i) !== null) {
                payload = deserializeSequenceType(this, mapper, responseBody, objectName, updatedOptions);
            }
            else if (mapperType.match(/^Dictionary$/i) !== null) {
                payload = deserializeDictionaryType(this, mapper, responseBody, objectName, updatedOptions);
            }
        }
        if (mapper.isConstant) {
            payload = mapper.defaultValue;
        }
        return payload;
    }
deserialize ( mapper , responseBody , objectName , options = { xml : { } } ) { var _a , _b , _c ; const updatedOptions = { xml : { rootName : ( _a = options . xml . rootName ) !== null && _a !== void 0 ? _a : "" , includeRoot : ( _b = options . xml . includeRoot ) !== null && _b !== void 0 ? _b : false , xmlCharKey : ( _c = options . xml . xmlCharKey ) !== null && _c !== void 0 ? _c : XML_CHARKEY } } ; if ( responseBody === undefined || responseBody === null ) { if ( this . isXML && mapper . type . name === "Sequence" && ! mapper . xmlIsWrapped ) { responseBody = [ ] ; } if ( mapper . defaultValue !== undefined ) { responseBody = mapper . defaultValue ; } return responseBody ; } let payload ; const mapperType = mapper . type . name ; if ( ! objectName ) { objectName = mapper . serializedName ; } if ( mapperType . match ( / ^Composite$ / i ) !== null ) { payload = deserializeCompositeType ( this , mapper , responseBody , objectName , updatedOptions ) ; } else { if ( this . isXML ) { const xmlCharKey = updatedOptions . xml . xmlCharKey ; if ( responseBody [ XML_ATTRKEY ] !== undefined && responseBody [ xmlCharKey ] !== undefined ) { responseBody = responseBody [ xmlCharKey ] ; } } if ( mapperType . match ( / ^Number$ / i ) !== null ) { payload = parseFloat ( responseBody ) ; if ( isNaN ( payload ) ) { payload = responseBody ; } } else if ( mapperType . match ( / ^Boolean$ / i ) !== null ) { if ( responseBody === "true" ) { payload = true ; } else if ( responseBody === "false" ) { payload = false ; } else { payload = responseBody ; } } else if ( mapperType . match ( / ^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$ / i ) !== null ) { payload = responseBody ; } else if ( mapperType . match ( / ^(Date|DateTime|DateTimeRfc1123)$ / i ) !== null ) { payload = new Date ( responseBody ) ; } else if ( mapperType . match ( / ^UnixTime$ / i ) !== null ) { payload = unixTimeToDate ( responseBody ) ; } else if ( mapperType . match ( / ^ByteArray$ / i ) !== null ) { payload = base64 . decodeString ( responseBody ) ; } else if ( mapperType . match ( / ^Base64Url$ / i ) !== null ) { payload = base64UrlToByteArray ( responseBody ) ; } else if ( mapperType . match ( / ^Sequence$ / i ) !== null ) { payload = deserializeSequenceType ( this , mapper , responseBody , objectName , updatedOptions ) ; } else if ( mapperType . match ( / ^Dictionary$ / i ) !== null ) { payload = deserializeDictionaryType ( this , mapper , responseBody , objectName , updatedOptions ) ; } } if ( mapper . isConstant ) { payload = mapper . defaultValue ; } return payload ; }
Deserialize the given object based on its metadata defined in the mapper
 @param mapper - The mapper which defines the metadata of the serializable object
Deserialize the given object based on its metadata defined in the mapper @param mapper - The mapper which defines the metadata of the serializable object
// Edge case for empty XML non-wrapped lists. xml2js can't distinguish // between the list being empty versus being missing, // so let's do the more user-friendly thing and return an empty list. // specifically check for undefined as default value can be a falsey value `0, "", false, null` /**
                 * If the mapper specifies this as a non-composite type value but the responseBody contains
                 * both header ("$" i.e., XML_ATTRKEY) and body ("#" i.e., XML_CHARKEY) properties,
                 * then just reduce the responseBody value to the body ("#" i.e., XML_CHARKEY) property.
                 */