UNPKG

@eclipse-emfcloud/modelserver-client

Version:

Typescript rest client to interact with an EMF.cloud modelserver

91 lines 3.86 kB
/** The bit mask value for okay severity */ export declare const OK = 0; /** The bit mask value for informational message severity */ export declare const INFO = 1; /** The bit mask value for warning message severity */ export declare const WARNING = 2; /** The bit mask value for error message severity */ export declare const ERROR = 4; /** The bit mask value for canceled diagnosis severity */ export declare const CANCEL = 8; /** * Information about the result of a model validation. * @see org.eclipse.emf.common.util.Diagnostic */ export interface Diagnostic { /** indicator of the severity of the problem */ severity: number; /** message describing the situation */ message: string; /** unique identifier of the source */ source: string; /** source-specific identity code */ code: number; /** the relevant low-level exception */ exception?: Error | any; /** * The arbitrary associated list of data. * The first element is typically the object that is the primary source of the problem; * the second element is typically some object describing the problematic feature or aspect of the primary source, * and the remaining elements are additional objects associated with or describing the problem. */ data: any[]; /** list of child Diagnostic */ children: Diagnostic[]; /** The id or URI fragment of the validated model element */ id: string; } export declare namespace Diagnostic { /** * Typeguard function to check wether the given object is of type {@link Diagnostic}. * @param object the object to check * @returns the given object as {@link Diagnostic} or `false` */ function is(object: unknown): object is Diagnostic; /** * Recompute the severity of a composed diagnostic by looking at its children. * Contrary to the org.eclipse.emf.common.util.BasicDiagnostic.recomputeSeverity() implementation, * we combine the severity values and do not just keep the highest number value. * This means the severity number will keep trace of all non-OK severities found in children. * If you need a simple severity value, just use getSeverityLabel method afterward. * @param diagnostic diagnostic to analyze * @returns the updated severity value */ function recomputeSeverity(diagnostic: Diagnostic): number; /** * Get the label severity value of the diagnostic using masks. * @param diagnostic diagnostic to analyze * @returns severity label which the mask matches the severity number */ function getSeverityLabel(diagnostic: Diagnostic): 'OK' | 'INFO' | 'WARNING' | 'ERROR' | 'CANCEL'; /** * Collect leaf diagnostics, which are children diagnostics without children. * An OK diagnostic without children is not returned. * @param diagnostic diagnostic to analyze * @returns diagnostics without children (eventually including this one or empty) */ function collectLeaves(diagnostic: Diagnostic): Diagnostic[]; /** * Get an OK diagnostic. * * @returns an OK diagnostic */ function ok(): Diagnostic; /** * Merge any number of `diagnostics` (even zero) into a single result. * Any OK diagnostics are elided and the result may itself just be OK. * * @param diagnostics diagnostics to merge * @returns the merged diagnostic */ function merge(...diagnostics: Diagnostic[]): Diagnostic; /** * Find the worst severity in a list of `diagnostics`. * * @param diagnostics an array of diagnostics, possibly empty * @returns the first diagnostic of the great severity amongst the `diagnostics` * or else an OK diagnostic if none */ function worstOf(diagnostics: Diagnostic[]): Diagnostic; } //# sourceMappingURL=diagnostic.d.ts.map