UNPKG

@farris/bef-vue

Version:
66 lines (65 loc) 2.14 kB
import { HttpHeaders, HttpClient, Injector } from '@farris/devkit-vue'; import { FrameworkSessionService } from '../../framework-session.service'; import { SessionStorageStrategy } from '../storage-strategies/index'; import { RuntimeContext } from '../../types'; /** * 会话处理策略类 */ declare abstract class SessionHandlingStrategy { /** * 存储策略 */ protected storageStrategy: SessionStorageStrategy; /** * 框架Session服务 */ protected frameworkSessionService: FrameworkSessionService; /** * Http客户端 */ protected httpClient: HttpClient; /** * 创建Session的的EAPI地址 */ protected baseUrl: string; /** * 创建Session接口地址 */ protected createSessionUrl: string; /** * 关闭Session接口地址 */ protected closeSessionUrl: string; /** * 上次使用的会话id */ protected lastTimeUsedSessionId: string; /** * injector */ protected injector: Injector; /** * 构造函数 */ constructor(storageStrategy: SessionStorageStrategy, frameworkSessionService: FrameworkSessionService, httpClient: HttpClient, baseUrl: string, injector: Injector); abstract getSessionId(runtimeContext?: RuntimeContext): Promise<string>; abstract setSessionId(sessionId: string, runtimeContext?: RuntimeContext): void; abstract clearSessionId(runtimeContext?: RuntimeContext): void; abstract handleRequestHeaders(headers: HttpHeaders, runtimeContext?: RuntimeContext): HttpHeaders; abstract handleReponseHeaders(headers: HttpHeaders): void; protected abstract getSessionStorageKey(runtimeContext?: RuntimeContext): string; /** * 获取框架SessionId * TODO: 暂不支持runtimeContext */ getFrameworkSessionId(): string; /** * 从缓存中获取BeSession */ protected getSessionIdFromStorage(runtimeContext?: RuntimeContext): string; /** * 框架SessionId(用户的或者功能菜单的) */ protected get frameworkSessionId(): string; } export { SessionHandlingStrategy };