Documentation - v1.2.0-alpha.3
    Preparing search index...

    Context object passed in to a WaterfallStep.

    Type Parameters

    • O extends object = {}

      (Optional) type of options passed to the steps waterfall dialog in the call to DialogContext.beginDialog().

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    context: TurnContext

    Gets the context object for the turn.

    dialogs: DialogSet

    Gets the dialogs that can be called directly from this context.

    The parent dialog context for this dialog context, or undefined if this context doesn't have a parent.

    When it attempts to start a dialog, the dialog context searches for the Dialog.id in its DialogContext.dialogs. If the dialog to start is not found in this dialog context, it searches in its parent dialog context, and so on.

    services: TurnContextStateCollection = ...

    Gets the services collection which is contextual to this dialog context.

    stack: DialogInstance<any>[]

    Gets the current dialog stack.

    Gets the DialogStateManager which manages view of all memory scopes.

    Accessors

    Methods

    • Starts a dialog instance and pushes it onto the dialog stack. Creates a new instance of the dialog and pushes it onto the stack.

      Parameters

      • dialogId: string

        ID of the dialog to start.

      • Optionaloptions: object

        Optional. Arguments to pass into the dialog when it starts.

      Returns Promise<DialogTurnResult<any>>

      a promise resolving to the dialog turn result.

      If there's already an active dialog on the stack, that dialog will be paused until it is again the top dialog on the stack.

      The DialogTurnResult.status of returned object describes the status of the dialog stack after this method completes.

      This method throws an exception if the requested dialog can't be found in this dialog context or any of its ancestors.

    • Cancels all dialogs on the dialog stack, and clears stack.

      Parameters

      • cancelParents: boolean = false

        Optional. If true all parent dialogs will be cancelled as well.

      • OptionaleventName: string

        Optional. Name of a custom event to raise as dialogs are cancelled. This defaults to DialogEvents.cancelDialog.

      • OptionaleventValue: any

        Optional. Value to pass along with custom cancellation event.

      Returns Promise<DialogTurnResult<any>>

      a promise resolving to the dialog turn result.

      This calls each dialog's endDialog method before removing the dialog from the stack.

      If there were any dialogs on the stack initially, the DialogTurnResult.status of the return value is DialogTurnStatus.cancelled; otherwise, it's DialogTurnStatus.empty.

    • Searches for a dialog with a given ID.

      Parameters

      • name: string

        Name of the event to raise.

      • Optionalvalue: any

        Optional. Value to send along with the event.

      • bubble: boolean = true

        Optional. Flag to control whether the event should be bubbled to its parent if not handled locally. Defaults to a value of true.

      • fromLeaf: boolean = false

        Optional. Whether the event is emitted from a leaf node.

      Returns Promise<boolean>

      true if the event was handled.

      Emits a named event for the current dialog, or someone who started it, to handle.

    • Ends a dialog and pops it off the stack. Returns an optional result to the dialog's parent.

      Parameters

      • Optionalresult: any

        Optional. A result to pass to the parent logic. This might be the next dialog on the stack, or if this was the last dialog on the stack, a parent dialog context or the agent's turn handler.

      Returns Promise<DialogTurnResult<any>>

      a promise resolving to the dialog turn result.

      The parent dialog is the next dialog on the dialog stack, if there is one. This method calls the parent's Dialog.resumeDialog method, passing the result returned by the ending dialog. If there is no parent dialog, the turn ends and the result is available to the agent through the returned object's DialogTurnResult.result property.

      The DialogTurnResult.status of returned object describes the status of the dialog stack after this method completes.

      Typically, you would call this from within the logic for a specific dialog to signal back to the dialog context that the dialog has completed, the dialog should be removed from the stack, and the parent dialog should resume.

    • Ends the active dialog and starts a new dialog in its place.

      Parameters

      • dialogId: string

        ID of the dialog to start.

      • Optionaloptions: object

        Optional. Arguments to pass into the new dialog when it starts.

      Returns Promise<DialogTurnResult<any>>

      a promise resolving to the dialog turn result.

      This is particularly useful for creating a loop or redirecting to another dialog.

      The DialogTurnResult.status of returned object describes the status of the dialog stack after this method completes.

      This method is similar to ending the current dialog and immediately beginning the new one. However, the parent dialog is neither resumed nor otherwise notified.