forked from thinkjs/thinkjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
76 lines (66 loc) · 1.71 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import * as _Koa from 'koa';
import * as Helper from 'think-helper';
import * as ThinkCluster from 'think-cluster';
import * as ThinkLogger from 'think-logger3';
declare namespace ThinkJs {
export var think: Think;
export interface Koa extends _Koa {
think: Think;
}
class Controller {
constructor(ctx: Koa);
ctx: Koa;
assign?(name: string, value: any): any;
render?(file: string, config: object): Promise<string>;
render?(config: object): Promise<string>;
display?(file: string, config: object): Promise<any>;
display?(): Promise<any>;
/**
* get session
* @memberOf Controller
*/
session?(name: string): Promise<string>;
/**
* set session
* @memberOf Controller
*/
session?(name: string, value: string): Promise<string>;
session?(name: null): Promise<string>;
}
class Logic extends Controller {
validate(rules: Object, msgs?: Object ): Object;
validateErrors?: Object;
}
class Service { }
class Model {}
export interface Think extends Helper.Think {
app: Koa;
isCli: boolean;
/**
* Get thisnk.app.env.
*/
env: string;
version: string;
messenger: ThinkCluster.Messenger;
Controller: typeof Controller;
Logic: typeof Logic;
Service: typeof Service;
Model: typeof Model;
ROOT_PATH: string;
APP_PATH: string;
logger: ThinkLogger.Logger;
service(name: string, m: any, ...args: any[]): any;
beforeStartServer(fn: Function): Promise<any>;
}
export class Application {
constructor(options: {
ROOT_PATH: string,
APP_PATH?: string,
watch?: any,
transpiler?: any,
notifier?: Function,
env?: string
})
}
}
export = ThinkJs;