import type { Key, IContest, IHandle, IUser, ResolvedCPanyOption, DiffLog } from '@cpany/types'; import { Logger, LogLevel } from './logger'; import { CPanyPlugin } from './plugin'; export interface CreateOptions { plugins?: Array; logger?: Logger; logLevel?: LogLevel; } export interface CPanyInstance extends FSOperations { logger: Logger; platforms: string[]; fetchAll: (option: ResolvedCPanyOption) => Promise; loadAll: (option: ResolvedCPanyOption) => Promise<{ handles: Array>; contests: Array>; users: IUser[]; }>; cache: () => Promise; fetch: (platform: string, name: string) => Promise; query: (platform: string, name: string, payload: string | number) => Promise; diff: (option: ResolvedCPanyOption) => Promise; } export interface FSOperations { on: (event: T, fn: FSEventType[T]) => void; } /** * Paths are relative under the data root directory. */ export interface FSEventType { read: (...paths: string[]) => Promise; list: (platform: string, ...paths: string[]) => Promise; write: (content: string, ...paths: string[]) => Promise; remove: (...paths: string[]) => Promise; }