UNPKG

4.21 kBTypeScriptView Raw
1import { MicrosoftAppCredentials } from 'botframework-connector';
2import { Activity, Middleware, TurnContext, BotState, UserState, ConversationState, Storage } from 'botbuilder-core';
3/** @private */
4declare abstract class InterceptionMiddleware implements Middleware {
5 /** Implement middleware signature
6 * @param context {TurnContext} An incoming TurnContext object.
7 * @param next {function} The next delegate function.
8 */
9 onTurn(turnContext: TurnContext, next: () => Promise<void>): Promise<void>;
10 protected abstract inbound(turnContext: TurnContext, traceActivity: Partial<Activity>): Promise<any>;
11 protected abstract outbound(turnContext: TurnContext, traceActivities: Partial<Activity>[]): Promise<any>;
12 protected abstract traceState(turnContext: TurnContext): Promise<any>;
13 private invokeInbound;
14 private invokeOutbound;
15 private invokeTraceState;
16}
17/**
18 * InspectionMiddleware for emulator inspection of runtime Activities and BotState.
19 *
20 * @remarks
21 * InspectionMiddleware for emulator inspection of runtime Activities and BotState.
22 *
23 */
24export declare class InspectionMiddleware extends InterceptionMiddleware {
25 private static readonly command;
26 private readonly inspectionState;
27 private readonly inspectionStateAccessor;
28 private readonly userState;
29 private readonly conversationState;
30 private readonly credentials;
31 /**
32 * Create the Inspection middleware for sending trace activities out to an emulator session
33 */
34 constructor(inspectionState: InspectionState, userState?: UserState, conversationState?: ConversationState, credentials?: Partial<MicrosoftAppCredentials>);
35 /**
36 * Indentifies open and attach commands and calls the appropriate method.
37 * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
38 * @returns True if the command is open or attached, otherwise false.
39 */
40 processCommand(turnContext: TurnContext): Promise<any>;
41 /**
42 * Processes inbound activities.
43 * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
44 * @param traceActivity The trace activity.
45 */
46 protected inbound(turnContext: TurnContext, traceActivity: Partial<Activity>): Promise<any>;
47 /**
48 * Processes outbound activities.
49 * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
50 * @param traceActivities A collection of trace activities.
51 */
52 protected outbound(turnContext: TurnContext, traceActivities: Partial<Activity>[]): Promise<any>;
53 /**
54 * Processes the state management object.
55 * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
56 */
57 protected traceState(turnContext: TurnContext): Promise<any>;
58 /**
59 * @private
60 */
61 private processOpenCommand;
62 /**
63 * @private
64 */
65 private processAttachCommand;
66 /**
67 * @private
68 */
69 private openCommand;
70 /**
71 * @private
72 */
73 private attachCommand;
74 /**
75 * @private
76 */
77 private findSession;
78 /**
79 * @private
80 */
81 private invokeSend;
82 /**
83 * @private
84 */
85 private cleanUpSession;
86 /**
87 * @private
88 */
89 private getAttachId;
90}
91/**
92 * InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState.
93 *
94 * @remarks
95 * InspectionState for use by the InspectionMiddleware for emulator inspection of runtime Activities and BotState.
96 *
97 */
98export declare class InspectionState extends BotState {
99 /**
100 * Creates a new instance of the [InspectionState](xref:botbuilder.InspectionState) class.
101 * @param storage The [Storage](xref:botbuilder-core.Storage) layer this state management object will use to store and retrieve state.
102 */
103 constructor(storage: Storage);
104 /**
105 * Gets the key to use when reading and writing state to and from storage.
106 * @param turnContext The [TurnContext](xref:botbuilder-core.TurnContext) for this turn.
107 */
108 protected getStorageKey(turnContext: TurnContext): string;
109}
110export {};
111//# sourceMappingURL=inspectionMiddleware.d.ts.map
\No newline at end of file