UNPKG

@mdf.js/openc2-core

Version:

MMS - API Core - OpenC2

43 lines 1.56 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 EventEmitter from 'events'; import express from 'express'; import { Registry } from '../modules'; import { Control } from '../types'; import { CommandResponseHandler } from './oc2.service'; export declare interface Router { /** Event emitted when a command is received */ on(event: 'command', listener: (message: Control.CommandMessage, done: CommandResponseHandler) => void): this; } /** Router class */ export declare class Router extends EventEmitter { readonly router: express.Router; /** Model class instance */ private readonly model; /** Service class instance */ private readonly service; /** Controller class instance */ private readonly controller; /** * Create a new instance of the Router class * @param register - Register used by this component * @param path - prefix path for all the routes */ constructor(register: Registry, path?: string); /** * Event handler for the command event * @param message - message to be processed * @param done - callback to be called when the command is processed */ private readonly onCommand; /** * Perform the instantiation of the routes in an express router * @param path - prefix path for all the routers */ private buildRoutes; } //# sourceMappingURL=oc2.router.d.ts.map