UNPKG

@mdf.js/openc2-core

Version:

MMS - API Core - OpenC2

51 lines 2.2 kB
/** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ import { Health, Layer } from '@mdf.js/core'; import { EventEmitter } from 'events'; export declare class HealthWrapper extends EventEmitter implements Layer.App.Resource { readonly name: string; private readonly components; /** Component identification */ readonly componentId: string; /** Flag to indicate that an unhealthy status has been emitted recently */ private lastStatusEmitted?; /** * Regular OpenC2 consumer implementation. This class allows the management of incoming command * and the underlayer Adapter. The main task of this class is to filter incoming commands that are * not related with the instance or are not supported * @param name - Component name used as node identifier for OpenC2 * @param components - Health components to be monitored */ constructor(name: string, components: Layer.App.Resource[]); /** * Add a new component to health wrapper * @param component - component to be added to the health wrapper */ add(component: Layer.App.Resource): void; /** * Return the status of the Consumer in a standard format * @returns _check object_ as defined in the draft standard * https://datatracker.ietf.org/doc/html/draft-inadarei-api-health-check-05 */ get checks(): Health.Checks; /** Emit the status if it's different from the last emitted status */ private readonly emitStatus; /** * Manage the error in the producer interface * @param error - error to be processed */ private readonly onErrorHandler; /** Overall component status */ get status(): Health.Status; /** Fake start method used to implement the Resource interface */ start(): Promise<void>; /** Fake stop method used to implement the Resource interface */ stop(): Promise<void>; /** Fake close method used to implement the Resource interface */ close(): Promise<void>; } //# sourceMappingURL=HealthWrapper.d.ts.map