UNPKG

@foxpage/foxpage-types

Version:

foxpage sdk types

92 lines (91 loc) 2.73 kB
import { TypedEventEmitter } from '../common'; import { ContentDetail } from '../content'; import { AppEvents, BlockManager, ConditionManager, FileManager, FunctionManager, MockManager, PackageManager, PageManager, PluginManager, RelationInfo, Router, SecurityManager, TagManager, TemplateManager, VariableManager } from '../manager'; import { ResourceUpdateInfo } from '../ws'; import { AppConfig, AppResource } from './config'; import { ApplicationResource } from './resource'; export * from './config'; export * from './resource'; export * from './route'; export * from './security'; export interface ApplicationHooks { sourceUpdateHook?: (data: unknown) => void; } export interface AppScheduleDataType { appId?: string; contents: ResourceUpdateInfo; timestamp?: number; } /** * @deprecated */ export interface ApplicationResourceItem { name: string; host?: string; downloadHost?: string; } export interface ApplicationOption { plugins?: string[]; pluginDir?: string; hooks?: ApplicationHooks; /** * from foxpage.config.js */ configs?: AppConfig; /** * application resource */ resources?: AppResource[]; resourceMap?: Map<string, AppResource>; } export interface UserRequest { /** * pageId * * @type {string} */ pageId: string; } export interface Application extends TypedEventEmitter<AppEvents> { readonly appId: string; readonly slug: string; readonly fileManager: FileManager; readonly tagManager: TagManager; readonly pageManager: PageManager; readonly packageManager: PackageManager; readonly pluginManager: PluginManager; readonly variableManager: VariableManager; readonly conditionManager: ConditionManager; readonly templateManager: TemplateManager; readonly functionManager: FunctionManager; readonly routeManager: Router; readonly mockManager: MockManager; readonly blockManager: BlockManager; readonly securityManager: SecurityManager; configs: AppConfig; hooks: ApplicationOption['hooks']; /** * * @deprecated */ resources?: AppResource[]; resourceMap?: Map<string, AppResource>; enableSchedule(): boolean; onScheduled(): void; refresh(updateInfos: AppScheduleDataType): void; getContentRelationInfo(content: ContentDetail, opt?: GetContentRelationInfoOpt): Promise<RelationInfo>; destroy(): void; } export interface GetContentRelationInfoOpt { isBase?: boolean; } export interface FPApplicationSetting { } export interface FPApplication { id: string; name: string; settings: ApplicationOption; slug: string; intro: string; resources?: ApplicationResource[]; }