UNPKG

3.23 kBTypeScriptView Raw
1/**
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License.
4 */
5import * as BB from 'botbuilder';
6import { CLMemory } from '../CLMemory';
7import { AppBase } from '@conversationlearner/models';
8import { QueuedInput } from './InputQueue';
9import { SessionStartFlags } from '../CLRunner';
10export interface ConversationSession {
11 sessionId: string | null;
12 conversationId: string | null;
13}
14export interface SessionInfo {
15 userName: string;
16 userId: string;
17 logDialogId: string;
18}
19export interface ActiveApps {
20 [appId: string]: string;
21}
22export declare enum UIMode {
23 TEACH = "TEACH",
24 EDIT = "EDIT",
25 NONE = "NONE"
26}
27export declare enum BotStateType {
28 APP = "APP",
29 CONVERSATION_ID = "CONVERSATION_ID",
30 CONVERSATION_REFERENCE = "CONVERSATION_REFERENCE",
31 EDITING_PACKAGE = "EDITING_PACKAGE",
32 UI_MODE = "UI_MODE",
33 LAST_ACTIVE = "LAST_ACTIVE",
34 LOG_DIALOG_ID = "LOG_DIALOG_ID",
35 MESSAGE_MUTEX = "MESSAGE_MUTEX",
36 NEED_SESSIONEND_CALL = "ON_ENDSESSION_CALLED",
37 SESSION_ID = "SESSION_ID"
38}
39export declare class BotState {
40 private static _instance;
41 memory: CLMemory | undefined;
42 private constructor();
43 static Get(clMemory: CLMemory): BotState;
44 private GetStateAsync;
45 private SetStateAsync;
46 _SetAppAsync(app: AppBase | null): Promise<void>;
47 GetApp(): Promise<AppBase | null>;
48 SetApp(app: AppBase | null): Promise<void>;
49 GetConversationId(): Promise<string | BB.ConversationReference | null>;
50 SetConversationId(conversationId: string | BB.ConversationReference | null): Promise<void>;
51 GetEditingPackages(): Promise<ActiveApps>;
52 SetEditingPackage(appId: string, packageId: string): Promise<{
53 [appId: string]: string;
54 }>;
55 GetEditingPackageForApp(appId: string): Promise<string>;
56 ClearEditingPackageAsync(): Promise<void>;
57 GetNeedSessionEndCall(): Promise<boolean>;
58 SetNeedSessionEndCall(needed: boolean): Promise<void>;
59 GetLastActive(): Promise<number>;
60 SetLastActive(lastActive: number): Promise<void>;
61 GetSessionIdAndSetConversationId(conversationId: string): Promise<string | null>;
62 GetSessionIdAsync(): Promise<string | null>;
63 SetSessionId(sessionId: string | null): Promise<void>;
64 InitSessionAsync(sessionId: string | null, logDialogId: string | null, conversationId: string | BB.ConversationReference | null, sessionStartFlags: SessionStartFlags): Promise<void>;
65 EndSessionAsync(): Promise<void>;
66 getUIMode(): Promise<UIMode>;
67 SetUIMode(uiMode: UIMode): Promise<void>;
68 SetConversationReference(conversationReference: Partial<BB.ConversationReference> | null): Promise<void>;
69 GetConversationReverence(): Promise<Partial<BB.ConversationReference> | null>;
70 CreateConversationReference(userName: string, userId: string, conversationId: string): Promise<void>;
71 GetLogDialogId(): Promise<string | null>;
72 SetLogDialogId(logDialogId: string | null): Promise<void>;
73 GetMessageProcessing(): Promise<QueuedInput | null>;
74 MessageProcessingPopAsync(): Promise<QueuedInput | null>;
75 SetMessageProcessing(queuedInput: QueuedInput | null): Promise<void>;
76 SessionInfoAsync(): Promise<SessionInfo>;
77}