@atlasrender/render-plugin
Version:
Atlas Render Farm Manager plugin system.
96 lines (95 loc) • 2.59 kB
TypeScript
import ValidationError from "../errors/ValidationError";
import WebJsonable from "../interfaces/WebJsonable";
/**
* PluginSetting - base class for plugin settings.
* @class
* @author Danil Andreev
*/
export default class PluginSetting implements WebJsonable {
/**
* types - available setting types.
*/
static readonly types: string[];
/**
* nameRegExp - regular expression for setting name correctness checks.
*/
static readonly nameRegExp: RegExp;
/**
* type - the type of a filed.
*/
private type;
/**
* name - key value of the field.
*/
readonly name: string;
/**
* label - label of the field. Will be displayed in the UI.
*/
readonly label: string;
/**
* id - custom id for user needs.
*/
readonly id?: string | number;
/**
* nullable - if true, target value can be not filled.
*/
readonly nullable: boolean;
/**
* validation - validation error object. Contains validation map.
* @protected
*/
protected validation: ValidationError;
/**
* validateName - function, designed to validate setting name.
* @method
* @param input - Input data. Is should be correct string to get true.
* @author Danil Andreev
*/
static validateName(input: any): boolean;
/**
* Creates an instance of PluginSetting
* @constructor
* @param type - Type of the plugin setting.
* @param setting - Setting object.
* @throws ValidationError
* @throws TypeError
* @author Danil Andreev
*/
constructor(type: string, setting: any);
/**
* setType - sets the type of the field.
* @method
* @author Danil Andreev
*/
protected setType(type: string): void;
/**
* getType - returns a type of the field.
* @method
* @author Danil Andreev
*/
getType(): string;
/**
* isValid - if validation has no errors will return true, else - false.
* @method
* @author Danil Andreev
*/
isValid(): boolean;
/**
* getValidation - returns validation error object.
* @method
* @author Danil Andreev
*/
getValidation(): ValidationError;
/**
* validatePayload - validates payload.
* If it is OK - function will return payload.
* If not - throw a Validation Error.
* @method
* @param payload - Any payload.
* @throws ReferenceError
* @throws ValidationError
* @author Danil Andreev
*/
validatePayload(payload: any): any;
getJSON(): object;
}