UNPKG

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