import { Builder } from "@dawntech/dwntbots-models"; import { CanonicalPosition } from "./position"; export declare type BuilderData = { flow: Builder.Flow; globalActions: Builder.GlobalActions; configuration: Builder.Configuration; }; export declare enum OpLogType { CREATE = "CREATE", UPDATE = "UPDATE", DELETE = "DELETE" } export declare enum OpLogTarget { CONFIG = "CONFIG", BLOCK = "BLOCK", DEFAULT_OUTPUT = "DEFAULT_OUTPUT", CONDITIONS_OUTPUT = "CONDITIONS_OUTPUT", ENTERING_ACTIONS = "ENTERING_ACTIONS", LEAVING_ACTIONS = "LEAVING_ACTIONS", CONTENT_ACTIONS = "CONTENT_ACTIONS", TAGS = "TAGS", POSITION = "POSITION" } export interface OpLog { name: string; type: OpLogType; target: OpLogTarget; source: string; message: string; } export interface OperationLogs { name: string; logs: Array; } export interface FeatureLog { name: string; operations: Array; } export declare abstract class Operation { protected name: string; protected force: boolean; protected logs: Array; constructor(name: string, force?: boolean, logs?: Array); abstract run(): void; abstract addLog(type: OpLogType, target: OpLogTarget, message: string): void; execute(): OperationLogs; } export declare type Ref = { ref: string; version: number; }; export declare type TagBuilder = Omit & Ref; export declare type CustomActionBuilder = Omit & Ref; export declare type ConditionOutputBuilder = Omit & Ref; export declare abstract class BlockOperation extends Operation { protected block: Builder.Block; static ONBOARDING_BLOCK_ID: string; static FALLBACK_BLOCK_ID: string; static WELCOME_BLOCK_ID: string; static ERROR_BLOCK_ID: string; private created; constructor(name: string, block: Builder.Block, force?: boolean); create(): void; static getElement(elements: Array, idOrRef: string): T | undefined; static insertElement(elements: Array, element: T, at?: "BEFORE" | "AFTER", anchor_id?: string | null): number; static createAction(actionBuilder: CustomActionBuilder): Builder.CustomAction; static createConditionalOuput(ConditionOutputBuilder: ConditionOutputBuilder): Builder.ConditionOutput; static createTag(tagBuilder: TagBuilder): Builder.Tag; static conditionalToMessage(conditional: Builder.ConditionOutput): string; addLog(type: OpLogType, target: OpLogTarget, message: string): void; protected isNewBlock(): boolean; protected hasTag(id: string): boolean; protected computePosition(anchor: Builder.BlockPosition, displacement: CanonicalPosition): Builder.BlockPosition; } export declare abstract class ConfigOperation extends Operation { protected key: string; protected configuration: Builder.Configuration; constructor(key: string, configuration: Builder.Configuration, force?: boolean); addLog(type: OpLogType, message: string): void; protected hasConfig(key: string): boolean; protected getConfig(key: string, defaultValue: T): T; protected checkConfig(key: string, keys?: Array): void; protected setConfig(key: string, value: T): Builder.Configuration; } export declare abstract class Feature { protected name: string; protected builder: BuilderData; protected force: boolean; protected depends: Array; static NEW_ENTITY: string; private operations; constructor(name: string, builder: BuilderData, force?: boolean, depends?: Array); abstract run(): void; static computePosition(anchor: Builder.BlockPosition, displacement: CanonicalPosition): Builder.BlockPosition; static hasTag(block: Builder.Block, idOrRef: string | Ref): boolean; protected getConfigValue(key: string, defaultValue: T): T; protected createBlock(idOrRef: string | Ref): Builder.Block; protected getBlock(idOrRef: string | Ref): Builder.Block; protected getOrCreateBlock(idOrRef: string | Ref): Builder.Block; protected addTraversalOperations(fn: (block: Builder.Block) => Operation | null, excludes?: Array): void; protected addOperation(op: Operation): void; execute(): FeatureLog; }