Comparing version 0.3.0 to 0.4.0
11
index.js
@@ -5,3 +5,2 @@ 'use strict'; | ||
var os = require('os'); | ||
var libxml = require('libxmljs'); | ||
var fs = require('fs'); | ||
@@ -183,12 +182,2 @@ | ||
function validateAudit(auditXml) { | ||
var xsd = fs.readFileSync(__dirname + '/rfc-3881.xsd').toString(); | ||
var xsdDoc = libxml.parseXml(xsd); | ||
var xml = libxml.parseXml(auditXml); | ||
if (!xml.validate(xsdDoc)) { | ||
throw new Error('XML audit not valid according to XSD:\n' + xml.validationErrors); | ||
} | ||
} | ||
exports.validateAudit = validateAudit; | ||
function wrapInSyslog(msg) { | ||
@@ -195,0 +184,0 @@ return '<85>1 ' + new Date().toISOString() + ' ' + os.hostname() + ' atna-audit.js ' + process.pid + ' IHE+RFC-3881 - ' + msg; |
{ | ||
"name": "atna-audit", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Assists in the creation of ATNA audit trail messages for IHE profiles.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
16
test.js
'use strict'; | ||
var fs = require('fs'); | ||
var libxml = require('libxmljs'); | ||
var atna = require('./index'); | ||
function validateAudit(auditXml) { | ||
var xsd = fs.readFileSync(__dirname + '/rfc-3881.xsd').toString(); | ||
var xsdDoc = libxml.parseXml(xsd); | ||
var xml = libxml.parseXml(auditXml); | ||
if (!xml.validate(xsdDoc)) { | ||
throw new Error('XML audit not valid according to XSD:\n' + xml.validationErrors); | ||
} | ||
} | ||
exports.validateAudit = validateAudit; | ||
var syslog = atna.wrapInSyslog('test'); | ||
@@ -9,7 +21,7 @@ console.log(syslog); | ||
var audit = atna.userLoginAudit(atna.OUTCOME_SUCCESS, 'openhim', 'openhim.org', 'testUser', 'testRole', '123'); | ||
atna.validateAudit(audit); | ||
validateAudit(audit); | ||
console.log(audit); | ||
audit = atna.appActivityAudit(true, 'openhim', 'openhim.org'); | ||
atna.validateAudit(audit); | ||
validateAudit(audit); | ||
console.log(audit); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31918
224
2