fhir-validator-wrapper 1.2.1 → 1.2.2

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 CHANGED
@@ -25,6 +25,7 @@ class FhirValidator {
25
25
  // Version tracking file sits alongside the JAR
26
26
  this.versionFilePath = validatorJarPath + '.version';
27
27
  this.version = undefined;
28
+ this.lastStderr = '';
28
29
  }
29
30
 
30
31
  /**
@@ -377,6 +378,10 @@ class FhirValidator {
377
378
 
378
379
  this.process.on('exit', (code, signal) => {
379
380
  this.log('info', `Validator process exited with code ${code} and signal ${signal}`);
381
+ });
382
+
383
+ this.process.on('close', (code, signal) => {
384
+ this.log('info', `Validator process closed`);
380
385
  this.cleanup();
381
386
  });
382
387
 
@@ -397,8 +402,26 @@ class FhirValidator {
397
402
  this.log('error', `Validator-err: ${data}`);
398
403
  });
399
404
 
405
+ this.lastStderr = '';
406
+
407
+ this.process.stderr.on('data', (data) => {
408
+ const text = data.toString();
409
+ this.lastStderr += text;
410
+ this.log('error', `Validator-err: ${text}`);
411
+ });
412
+
400
413
  // Wait for the service to be ready
401
- await this.waitForReady(timeout);
414
+ await Promise.race([
415
+ this.waitForReady(timeout),
416
+ new Promise((_, reject) => {
417
+ this.process.on('close', (code) => {
418
+ if (code !== 0) {
419
+ reject(new Error(`Validator exited with code ${code}:\n${this.lastStderr.slice(-2000)}`));
420
+ }
421
+ });
422
+ })
423
+ ]);
424
+
402
425
  this.log('info', 'FHIR validator service is ready');
403
426
  }
404
427
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-validator-wrapper",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Node.js wrapper for the HL7 FHIR Validator CLI",
5
5
  "main": "fhir-validator.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -538,4 +538,16 @@ validator.setLogger(logger);
538
538
  ## Support
539
539
 
540
540
  For issues with this wrapper, please file a GitHub issue.
541
- For FHIR validator issues, see the [official FHIR validator documentation](https://confluence.hl7.org/spaces/FHIR/pages/35718580/Using+the+FHIR+Validator).
541
+ For FHIR validator issues, see the [official FHIR validator documentation](https://confluence.hl7.org/spaces/FHIR/pages/35718580/Using+the+FHIR+Validator).
542
+
543
+ ## Release Process
544
+
545
+ Check that there's an entry in CHANGELOG.md, and then:
546
+
547
+ ```
548
+ npm login
549
+ npm version patch ## or minor
550
+ git push && git push --tags
551
+
552
+ ```
553
+