@adguard/agtree
Version:
Tool set for working with adblock filter lists
49 lines (48 loc) • 2.04 kB
TypeScript
/**
* @file Base class for converters.
*
* TS doesn't support abstract static methods, so we should use
* a workaround and extend this class instead of implementing it.
*/
import { type ConversionResult } from './conversion-result.js';
/**
* Basic class for rule converters.
*/
export declare class BaseConverter {
/**
* Converts some data to AdGuard format.
*
* @param data Data to convert.
*
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
* If the node was not converted, the result will contain the original node with the same object reference.
*
* @throws If the data is invalid or incompatible.
*/
static convertToAdg(data: unknown): ConversionResult<unknown>;
/**
* Converts some data to Adblock Plus format.
*
* @param data Data to convert.
*
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
* If the node was not converted, the result will contain the original node with the same object reference.
*
* @throws If the data is invalid or incompatible.
*/
static convertToAbp(data: unknown): ConversionResult<unknown>;
/**
* Converts some data to uBlock Origin format.
*
* @param data Data to convert.
*
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
* If the node was not converted, the result will contain the original node with the same object reference.
*
* @throws If the data is invalid or incompatible.
*/
static convertToUbo(data: unknown): ConversionResult<unknown>;
}