Skip to main content
Version: v0.0.2

Function: convertOutcome()

convertOutcome(findings): object

Decide the conversion outcome from the library's value-free findings: whether any is error-severity (which drives a non-zero exit: the load-bearing "a conversion error is never exit 0" rule) and the value-free human report. The severity classification is the library's: @cosyte/transform fixes each issue's severity; the CLI only reads it. Exported so the exit-verdict and report logic is unit-testable with synthetic findings, independent of which HL7 message happens to produce an error.

Parameters

findings

readonly Finding[]

The value-free Findings the conversion produced.

Returns

object

hasError (true iff any finding is error/fatal severity) and the rendered value-free report (one line per finding + a summary line).

hasError

readonly hasError: boolean

report

readonly report: string

Example

import { convertOutcome } from "@cosyte/cli";

convertOutcome([{ code: "TRANSFORM_RESOURCE_INVALID", severity: "error", location: "PID" }])
.hasError; // => true
convertOutcome([{ code: "TRANSFORM_ELEMENT_DROPPED", severity: "information", location: "PID.13" }])
.hasError; // => false