-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
index.d.ts
87 lines (76 loc) · 1.87 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
77
78
79
80
81
82
83
84
85
86
87
import * as restana from 'restana'
declare namespace fastgateway {
type Type = 'http' | 'lambda'
type Method =
| 'GET'
| 'DELETE'
| 'PATCH'
| 'POST'
| 'PUT'
| 'HEAD'
| 'OPTIONS'
| 'TRACE'
interface Docs {
name: string
endpoint: string
type: string
}
interface ProxyFactoryOpts {
proxyType: string
opts: {}
route: Route
}
interface Route {
proxyType?: Type
proxyConfig?: {}
proxyHandler?: Function
pathRegex?: string
timeout?: number
prefix: string | RegExp
docs?: Docs
prefixRewrite?: string
target: string
methods?: Method[]
middlewares?: Function[]
urlRewrite?: Function
hooks?: Hooks
disableQsOverwrite?: boolean
}
interface WebSocketRoute {
proxyType: 'websocket'
proxyConfig?: {} // https://github.com/faye/faye-websocket-node#initialization-options
prefix: string
target: string
subProtocols?: [] // https://github.com/faye/faye-websocket-node#subprotocol-negotiation
hooks?: WebSocketHooks
}
interface WebSocketHooks {
onOpen?: (ws: any, searchParams: URLSearchParams) => Promise<void>
}
interface Hooks {
onRequest?: Function
rewriteHeaders?: Function
onResponse?: Function
rewriteRequestHeaders?: Function
request?: {
timeout?: number
[x: string]: any
}
queryString?: string
[x: string]: any
}
interface Options<P extends restana.Protocol> {
server?: Object | restana.Service<P> | Express.Application
proxyFactory?: (opts: ProxyFactoryOpts) => Function
restana?: {}
middlewares?: Function[]
pathRegex?: string
timeout?: number
targetOverride?: string
routes: (Route | WebSocketRoute)[]
}
}
declare function fastgateway<
P extends restana.Protocol = restana.Protocol.HTTP,
>(opts?: fastgateway.Options<P>): restana.Service<P>
export = fastgateway