@interoperability/atna-audit-messages
Version:
The ATNA Audit Messages Generator is a JavaScript library that provides a set of reusable static methods for generating Audit Trail and Node Authentication (ATNA) compliant audit messages. This library is particularly useful in healthcare systems and othe
48 lines (44 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ATNAComplexType = void 0;
var _XMLElement = require("../helpers/xml/XMLElement.js");
var _xmlJs = _interopRequireDefault(require("xml-js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Represents a complex type for ATNA (Audit Trail and Node Authentication) data.
*/
class ATNAComplexType {
/**
* Initializes a new instance of the ATNAComplexType class.
*/
constructor() {
this.xml = {};
}
/**
* Abstract method to prepare XML data specific to each subclass.
* @abstract
*/
prepareXML() {
// Implementation specific to each subclass.
}
/**
* Converts the complex type to XML format.
* @returns {XMLElement} - The XML representation of the complex type.
*/
toXML() {
return _xmlJs.default.json2xml(JSON.stringify(new _XMLElement.XMLElement().addChild(this.prepareXML())), {
compact: false,
spaces: 4
});
}
/**
* Converts the complex type to JSON format.
* @returns {Object} - The JSON representation of the complex type.
*/
toJSON() {
return this.prepareXML();
}
}
exports.ATNAComplexType = ATNAComplexType;