fhir-validator-wrapper 1.2.0 → 1.2.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/fhir-validator.js +18 -0
- package/package.json +1 -1
package/fhir-validator.js
CHANGED
|
@@ -24,6 +24,14 @@ class FhirValidator {
|
|
|
24
24
|
|
|
25
25
|
// Version tracking file sits alongside the JAR
|
|
26
26
|
this.versionFilePath = validatorJarPath + '.version';
|
|
27
|
+
this.version = undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @returns what version the validator jar reports that it is
|
|
32
|
+
*/
|
|
33
|
+
jarVersion() {
|
|
34
|
+
return this.version;
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
/**
|
|
@@ -379,6 +387,7 @@ class FhirValidator {
|
|
|
379
387
|
// Remove ANSI escape sequences (color codes, etc.)
|
|
380
388
|
const cleanLine = line.replace(/\u001b\[[0-9;]*m/g, '').trim();
|
|
381
389
|
if (cleanLine.length > 1) {
|
|
390
|
+
this.checkForVersion(cleanLine);
|
|
382
391
|
this.log('info', `Validator: ${cleanLine}`);
|
|
383
392
|
}
|
|
384
393
|
});
|
|
@@ -805,6 +814,15 @@ class FhirValidator {
|
|
|
805
814
|
isRunning() {
|
|
806
815
|
return this.process !== null && this.isReady;
|
|
807
816
|
}
|
|
817
|
+
|
|
818
|
+
checkForVersion(cleanLine) {
|
|
819
|
+
if (!this.version) {
|
|
820
|
+
if (cleanLine.startsWith('FHIR Validation tool Version')) {
|
|
821
|
+
let parts = cleanLine.split(' ');
|
|
822
|
+
this.version = parts[4];
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
808
826
|
}
|
|
809
827
|
|
|
810
828
|
module.exports = FhirValidator;
|