-
Notifications
You must be signed in to change notification settings - Fork 0
/
bases.d.ts
104 lines (73 loc) · 3.29 KB
/
bases.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import KoaCompress from 'koa-compress';
import KoaCORS from '@koa/cors';
import KoaHelmet from 'koa-helmet';
import { LoggerOption } from '@nuogz/utility/types/src/inject-base-logger.pure.js';
/** Desire constructor options */
export type ConstructorOption = {
/** Name for server. Used to log */
name?: string | undefined;
/** Server listen host */
host?: string | undefined;
/** Server listen port */
port?: number | undefined;
/** Options passed to modules used by Desire */
module?: ModulesOption | undefined;
/** Harbour options */
harbour?: Object | undefined;
/** the interface and folder mapping initializer, called `Harbour`, which is used to apply options to the `koajs` instance, and is invoked by passing an instance of `koajs`. pass string `'default'`, `''` or undefined will use module `@nuogz/desire-harbour`; pass a `string` will try to import a module with the same name as the option;pass a `class` will be created and then call its `init()` method; pass a `function` will be called directly */
Harbour?: string | Function | undefined;
/** Base logger options */
logger?: LoggerOption | undefined;
};
/** Options passed to modules used by `Desire` */
export type ModulesOption = {
/** Node module HTTP options */
http?: import("http").ServerOptions<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | undefined;
/** Node module HTTP2 options */
http2?: (import("http2").SecureServerOptions & ModuleOptionExtend) | undefined;
/** Module `koa` options */
koa?: KoaConstructorOption | undefined;
/** Module `koa-compress` options */
compress?: (KoaCompress.CompressOptions & ModuleOptionExtend) | undefined;
/** Module `@koa/cors` options */
cors?: (KoaCORS.Options & ModuleOptionExtend) | undefined;
/** Module `koa-helmet` contentSecurityPolicy options */
csp?: (KoaHelmet.KoaHelmetContentSecurityPolicyConfiguration & ModuleOptionExtend) | undefined;
/** Module `koa-favicon` options or favicon path */
favicon?: string | (KoaFaviconOption & ModuleOptionExtend) | undefined;
};
/** Options that will affect how `Desire` uses these modules are passed along with the modules options */
export type ModuleOptionExtend = {
/**
* - `undefined`, enable this module (default)
* - `false`, enable this module
* - `true`, disable this module
*/
disable?: boolean | undefined;
};
/** Should equivalent to the first argument of `new Koa(option)` */
export type KoaConstructorOption = {
/** Environment */
env?: string | undefined;
/** Signed cookie keys */
keys?: string[] | undefined;
/** Trust proxy headers */
proxy?: boolean | undefined;
/** Subdomain offset */
subdomainOffset?: number | undefined;
/** Proxy IP header, defaults to X-Forwarded-For */
proxyIpHeader?: string | undefined;
/** Max IPs read from proxy IP header, default to 0 (means infinity) */
maxIpsCount?: number | undefined;
/** Enable AsyncLocalStorage */
asyncLocalStorage?: boolean | undefined;
};
/** Should equivalent to the argument of `new KoaFavicon(path, { maxage, mime })` */
export type KoaFaviconOption = {
/** The path of the favicon file */
path: string;
/** `cache-control` `max-age` directive in millisecond, defaulting to 1 day */
maxage?: number | undefined;
/** MIME type of the file at path, defaulting to image/x-icon */
mime?: string | undefined;
};