47 lines
2.6 KiB
TypeScript
47 lines
2.6 KiB
TypeScript
import { RuntimeContext } from './RuntimeContext';
|
||
import { EntityDict } from '../oak-app-domain';
|
||
import { SerializedData } from './FrontendRuntimeContext';
|
||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||
import { OakException } from 'oak-domain/lib/types/Exception';
|
||
import { BackendRuntimeContext as BRC } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
|
||
/**
|
||
* general数据结构要求的后台上下文
|
||
*/
|
||
export declare abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends BRC<ED> implements RuntimeContext {
|
||
protected application?: Partial<ED['application']['Schema']>;
|
||
protected token?: Partial<ED['token']['Schema']>;
|
||
protected amIRoot?: boolean;
|
||
protected amIReallyRoot?: boolean;
|
||
protected rootMode?: boolean;
|
||
private userId?;
|
||
protected platformManager?: boolean;
|
||
protected appVersion?: string;
|
||
protected applicationProjection: EntityDict['user']['Projection'];
|
||
refineOpRecords(): Promise<void>;
|
||
setPlatformManager(tokenValue?: string, userId?: string): Promise<void>;
|
||
setTokenValue(tokenValue?: string, userId?: string): Promise<void>;
|
||
setApplication(appId: string): Promise<void>;
|
||
initialize(data?: SerializedData, later?: boolean): Promise<void>;
|
||
getApplicationId<P extends true | undefined>(allowNull?: P): P extends undefined ? (string | undefined) : string;
|
||
getSystemId<P extends true | undefined>(allowNull?: P): P extends undefined ? (string | undefined) : string;
|
||
getApplication<P extends true | undefined>(allowNull?: P): P extends undefined ? (Partial<ED['application']['Schema']> | undefined) : Partial<ED['application']['Schema']>;
|
||
openRootMode(): () => void;
|
||
getTokenValue(allowUnloggedIn?: boolean): "oak-root-token" | ED["token"]["Schema"]["value"] | undefined;
|
||
getToken(allowUnloggedIn?: boolean): Partial<ED["token"]["Schema"]> | undefined;
|
||
getCurrentUserId(allowUnloggedIn?: boolean): string;
|
||
setCurrentUserId(userId: string | undefined): void;
|
||
protected getSerializedData(): Promise<SerializedData>;
|
||
isRoot(): boolean;
|
||
isReallyRoot(): boolean;
|
||
sendMessage(data: ED['message']['CreateOperationData']): Promise<import("oak-domain/lib/types").OperationResult<ED>>;
|
||
allowUserUpdate(): boolean;
|
||
protected sortDomains(domains: ED['domain']['Schema'][]): ED['domain']['Schema'][];
|
||
/**
|
||
* 获得当前系统的访问路径,根据application/system/domain之间的关联
|
||
* http://www.xxx.com/oak-api
|
||
*/
|
||
composeAccessPath(): string;
|
||
tryDeduceException(err: Error): Promise<OakException<any> | void>;
|
||
}
|
||
export default BackendRuntimeContext;
|