UNPKG

@iyio/convo-lang

Version:

A conversational language.

47 lines (46 loc) 2.13 kB
import { Observable } from "rxjs"; import { ConversationOptions } from "./Conversation"; import { ConvoEdge, ConvoEdgePattern, ConvoGraphMonitorEvent, ConvoGraphStore, ConvoNodeExeState, ConvoTraverser, ConvoTraverserGroup, StartConvoTraversalOptions } from "./convo-graph-types"; export interface ConvoGraphCtrlOptions { store?: ConvoGraphStore; convoOptions?: ConversationOptions; } export declare class ConvoGraphCtrl { readonly store: ConvoGraphStore; private readonly _onMonitorEvent; get onMonitorEvent(): Observable<ConvoGraphMonitorEvent>; private get hasListeners(); private triggerEvent; private readonly defaultConvoOptions; private getConvoOptionsAsync; constructor({ store, convoOptions }: ConvoGraphCtrlOptions); private readonly disposables; private _isDisposed; get isDisposed(): boolean; dispose(): void; startRunAsync(options: StartConvoTraversalOptions): Promise<ConvoTraverserGroup>; startTraversalAsync({ createTvOptions, edge, edgePattern, payload, state, saveToStore, cancel, }: StartConvoTraversalOptions): Promise<ConvoTraverserGroup>; private createTvAsync; /** * Moves the traverser to the "to" side of the edge and updates the traversers execution state. * If the target node of the edge can not be found the traverser's execution state will be * set to failed. */ private traverseEdgeAsync; runGroupAsync(group: ConvoTraverserGroup): Promise<void>; runAsync(tv: ConvoTraverser, group?: ConvoTraverserGroup): Promise<ConvoNodeExeState>; /** * Executes the current node the traverser in on then traverses to the next node or stops if * no matching edges are found. */ nextAsync(tv: ConvoTraverser, group?: ConvoTraverserGroup): Promise<ConvoNodeExeState>; private _nextAsync; /** * Returns all edges that match the given pattern */ getEdgesAsync({ from, fromType, fromFn, input }: ConvoEdgePattern): Promise<ConvoEdge[]>; private getSharedSourceAsync; private transformInputAsync; private executeStepAsync; private callTargetAsync; }