@mdf.js/openc2-core
Version:
MMS - API Core - OpenC2
113 lines • 4.83 kB
TypeScript
/**
* 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 { ConsumerOptions, Control } from '../types';
export declare class Checkers {
/**
* Check if the message is a valid message.
* @param message - message to be check
* @param uuid - traceability identifier
* @returns Validated message.
* @throws In case of invalid message, throw a validation error.
*/
static isValidMessageSync(message: Control.Message, uuid: string): Control.Message;
/**
* Check if the message is a valid message.
* @param message - message to be check
* @param uuid - traceability identifier
* @returns Promise with the validated message.
*/
static isValidMessage(message: Control.Message, uuid: string): Promise<Control.Message>;
/**
* Check if the command is a valid command message.
* @param command - command to be check
* @param uuid - traceability identifier
* @returns Validated command message.
* @throws In case of invalid command, throw a validation error.
*/
static isValidCommandSync(command: Control.Message, uuid: string): Control.CommandMessage;
/**
* Check if the command is a valid command message.
* @param command - command to be check
* @param uuid - traceability identifier
* @returns Promise with the validated command message.
*/
static isValidCommand(command: Control.Message, uuid: string): Promise<Control.CommandMessage>;
/**
* Check if the response is a valid response message
* @param response - response to be checked
* @param uuid - traceability identifier
* @returns Validated response message.
* @throws In case of invalid response, throw a validation error.
*/
static isValidResponseSync(response: Control.Message, uuid: string): Control.ResponseMessage;
/**
* Check if the response is a valid response message
* @param response - response to be checked
* @param uuid - traceability identifier
* @returns Promise with the validated response message.
*/
static isValidResponse(response: Control.Message, uuid: string): Promise<Control.ResponseMessage>;
/**
* Checks if the command should be response with a default response
* @param command - message to be checked
* @param options - Consumer options
* @returns Default response for the command or undefined if the command has no default response
*/
static hasDefaultResponse(command: Control.CommandMessage, options: ConsumerOptions): Control.ResponseMessage | undefined;
/**
* Check if the message is a command the instance indicated or for all the instances
* @param message - message to be checked
* @param id - instance identification
* @returns true if the message is for this instance or for all the instances
*/
static isCommandToInstance(message: Control.Message, id: string): boolean;
/**
* Check if the message is a response for our command
* @param message - message to be checked
* @param from - from field of the original command
* @param requestId - request_id field of the original command
* @returns
*/
static isResponseToInstance(message: Control.Message, from: string, requestId: string): boolean;
/**
* Check if the command has arguments based on execution time and if we are on time
* @param command - message to be checked
* @returns
*/
static isOnTime(command: Control.CommandMessage): boolean;
/**
* Check if the command is supported
* @param command - message to be checked
* @param pairs - action-target pairs supported by the consumer
* @returns
*/
static isSupportedAction(command: Control.CommandMessage, pairs: Control.ActionTargetPairs): boolean;
/**
* Check if the command only request an ack as response
* @param command - message to be checked
* @returns
*/
static isAckOnlyRequested(command: Control.CommandMessage): boolean;
/**
* Check if the command is a featured request
* @param command - message to be checked
* @returns
*/
static isQueryFeaturesRequest(command: Control.CommandMessage): boolean;
/**
* Check if the command is a valid featured request
* @param command - message to be checked
* @returns
*/
static isValidQueryFeaturesRequest(command: Control.CommandMessage): boolean;
/**
* Return the delay allowed from command
* @param command - message to be processed
*/
static isDelayDefinedOnCommand(command: Control.Command): boolean;
}
//# sourceMappingURL=Checkers.d.ts.map