import Knex = require('knex'); import Koa = require('koa'); import Bluebird = require('bluebird'); import Logger = require('jinghuan-logger'); type Upload = { pathname: string, filename: string } declare function PropApi(): Function; declare function PropRpc(): Function; declare function PropAction(props: { auth: boolean, login: boolean }): Function; declare function PropSocket(props: { auth: boolean, login: boolean }): Function; interface JinghuanDb extends Knex.QueryBuilder { sql(sql: string): JinghuanDb logger(logger: Logger): JinghuanDb } interface JinghuanContext extends Koa.Context { readonly module: string; readonly controller: string; readonly action: string; readonly userAgent: string; readonly isGet: boolean; readonly isPost: boolean; readonly body: any; readonly logger: Logger referer(onlyHost: boolean): string; referrer(onlyHost: boolean): string; isMethod(method: string): boolean; isAjax(method: string): boolean; expires(time: any): any param(): object; param(name: string): object; post(): object; post(value: object): this; file(): object; file(data: object): this; file(name: string): any; file(name: string, value: any): this; download(filepath: string, filename?: string): void; db(table: string): JinghuanDb; db(type: symbol, table: string): JinghuanDb; db(transactionScope: (trx: Knex.Transaction) => Promise | Bluebird | void): Bluebird; sql(name: string): JinghuanDb; sql(type: symbol, name: string): JinghuanDb; upload(file: string, dir: string, filename: string, filter?: Array): Upload } class JinghuanController { readonly ctx: JinghuanContext; readonly userAgent: string; readonly isGet: boolean; readonly isPost: boolean; body: any; referer(onlyHost: boolean): string; referrer(onlyHost: boolean): string; isMethod(method: string): boolean; isAjax(method: string): boolean; expires(time: any): any param(): object; param(name: string): object; post(): object; post(value: object): this; file(): object; file(data: object): this; file(name: string): any; file(name: string, value: any): this; download(filepath: string, filename?: string): void; db(table: string): JinghuanDb; db(type: symbol, table: string): JinghuanDb; db(transactionScope: (trx: Knex.Transaction) => Promise | Bluebird | void): Promise; sql(name: string): JinghuanDb; sql(type: symbol, name: string): JinghuanDb; upload(file: string, dir: string, filename: string, filter?: Array): Upload session(name: string, value: string): Promise } declare namespace "jinghuan" { const JH_ROOT: string; const APP_PATH: string; const ROOT_PATH: string; const modules: string[]; const modulePaths: object; const mode: string; const source: string; const env: string; const workers: string; const PORT: string; const HOST: string; const paths: string[]; const process_id: number; const watcher: boolean; const version: string; interface Controller extends JinghuanController { } const app: Koa; const logger: { log(...args: any[]): void; debug(...args: any[]): void; info(...args: any[]): void; debug(...args: any[]): void; warn(...args: any[]): void; } } declare namespace jinghuanjs { const JH_ROOT: string; const APP_PATH: string; const ROOT_PATH: string; const modules: string[]; const modulePaths: object; const mode: string; const source: string; const env: string; const workers: string; const PORT: string; const HOST: string; const paths: string[]; const process_id: number; const watcher: boolean; const version: string; interface Controller extends JinghuanController { } const app: Koa; const logger: { log(...args: any[]): void; debug(...args: any[]): void; info(...args: any[]): void; debug(...args: any[]): void; warn(...args: any[]): void; error(...args: any[]): void; } }