UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

142 lines 7.82 kB
import { Converter, ConverterFactory, Dialog, DialogConfiguration, DialogContext, DialogDependencies, DialogReason, DialogTurnResult } from 'botbuilder-dialogs'; export declare enum ActionScopeCommands { GotoAction = "goto", BreakLoop = "break", ContinueLoop = "continue" } export interface ActionScopeResult { actionScopeCommand: string; actionId?: string; } export interface ActionScopeConfiguration extends DialogConfiguration { actions?: string[] | Dialog[]; } /** * `ActionScope` manages execution of a block of actions, and supports Goto, Continue and Break semantics. */ export declare class ActionScope<O extends object = {}> extends Dialog<O> implements DialogDependencies, ActionScopeConfiguration { /** * Creates a new `ActionScope` instance. * * @param actions The actions for the scope. */ constructor(actions?: Dialog[]); /** * The actions to execute. */ actions: Dialog[]; /** * @param property The key of the conditional selector configuration. * @returns The converter for the selector configuration. */ getConverter(property: keyof ActionScopeConfiguration): Converter | ConverterFactory; /** * Gets a unique `string` which represents the version of this dialog. If the version * changes between turns the dialog system will emit a DialogChanged event. * * @returns Unique `string` which should only change when dialog has changed in a * way that should restart the dialog. */ getVersion(): string; /** * Gets the child [Dialog](xref:botbuilder-dialogs.Dialog) dependencies so they can be added to the containers [Dialog](xref:botbuilder-dialogs.Dialog) set. * * @returns The child [Dialog](xref:botbuilder-dialogs.Dialog) dependencies. */ getDependencies(): Dialog[]; /** * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) is started and pushed onto the dialog stack. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param _options Optional. Initial information to pass to the dialog. * @returns A `Promise` representing the asynchronous operation. */ beginDialog(dc: DialogContext, _options?: O): Promise<DialogTurnResult>; /** * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) is _continued_, where it is the active dialog and the * user replies with a new activity. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @returns A `Promise` representing the asynchronous operation. */ continueDialog(dc: DialogContext): Promise<DialogTurnResult>; /** * Called when a child [Dialog](xref:botbuilder-dialogs.Dialog) completed its turn, returning control to this dialog. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param _reason [DialogReason](xref:botbuilder-dialogs.DialogReason), reason why the dialog resumed. * @param result Optional. Value returned from the dialog that was called. The type * of the value returned is dependent on the child dialog. * @returns A `Promise` representing the asynchronous operation. */ resumeDialog(dc: DialogContext, _reason: DialogReason, result?: any): Promise<DialogTurnResult>; /** * @protected * Called when returning control to this [Dialog](xref:botbuilder-dialogs.Dialog) with an [ActionScopeResult](xref:botbuilder-dialogs-adaptive.ActionScopeResult) * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param actionScopeResult The [ActionScopeResult](xref:botbuilder-dialogs-adaptive.ActionScopeResult). * @returns A `Promise` representing the asynchronous operation. */ protected onActionScopeResult(dc: DialogContext, actionScopeResult: ActionScopeResult): Promise<DialogTurnResult>; /** * @protected * Called when returning control to this [Dialog](xref:botbuilder-dialogs.Dialog) with an [ActionScopeResult](xref:botbuilder-dialogs-adaptive.ActionScopeResult) * with the property `ActionCommand` set to `GoToAction`. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param actionScopeResult The [ActionScopeResult](xref:botbuilder-dialogs-adaptive.ActionScopeResult). * @returns A `Promise` representing the asynchronous operation. */ protected onGotoAction(dc: DialogContext, actionScopeResult: ActionScopeResult): Promise<DialogTurnResult>; /** * @protected * Called when returning control to this [Dialog](xref:botbuilder-dialogs.Dialog) with an [ActionScopeResult](xref:botbuilder-dialogs-adaptive.ActionScopeResult) * with the property `ActionCommand` set to `BreakLoop`. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param actionScopeResult Contains the actions scope result. * @returns A `Promise` representing the asynchronous operation. */ protected onBreakLoop(dc: DialogContext, actionScopeResult: ActionScopeResult): Promise<DialogTurnResult>; /** * @protected * Called when returning control to this [Dialog](xref:botbuilder-dialogs.Dialog) with an [ActionScopeResult](xref:botbuilder-dialogs-adaptive.ActionScopeResult) * with the property `ActionCommand` set to `ContinueLoop`. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param actionScopeResult Contains the actions scope result. * @returns A `Promise` representing the asynchronous operation. */ protected onContinueLoop(dc: DialogContext, actionScopeResult: ActionScopeResult): Promise<DialogTurnResult>; /** * @protected * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) continues to the next action. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param result Optional. Value returned from the dialog that was called. The type * of the value returned is dependent on the child dialog. * @returns A `Promise` representing the asynchronous operation. */ protected onNextAction(dc: DialogContext, result?: any): Promise<DialogTurnResult>; /** * @protected * Called when the [Dialog](xref:botbuilder-dialogs.Dialog)'s action ends. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param result Optional. Value returned from the dialog that was called. The type * of the value returned is dependent on the child dialog. * @returns A `Promise` representing the asynchronous operation. */ protected onEndOfActions(dc: DialogContext, result?: any): Promise<DialogTurnResult>; /** * @protected * Starts a new [Dialog](xref:botbuilder-dialogs.Dialog) and pushes it onto the dialog stack. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param offset Optional, value returned from the dialog that was called. The type * of the value returned is dependent on the child dialog. * @returns A `Promise` representing the asynchronous operation. */ protected beginAction(dc: DialogContext, offset: number): Promise<DialogTurnResult>; /** * @protected * Builds the compute Id for the dialog. * @returns A `string` representing the compute Id. */ protected onComputeId(): string; } //# sourceMappingURL=actionScope.d.ts.map