-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.d.ts
35 lines (27 loc) · 776 Bytes
/
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
/*!
* modofun
* Copyright (c) 2018 Filipe Tavares
* MIT Licensed
*/
export = modofun;
interface Func {
(...args: any[]): any;
}
interface Handlers {
[key: string]: Func | (Middleware | Func)[],
}
interface Middleware {
(request: any, response: any, next?: (err?: any) => void): void;
}
interface Options {
type?: 'gcloud' | 'aws' | 'azure';
mode?: 'function' | 'reqres';
middleware?: Middleware[];
checkArity?: boolean;
errorHandler?: (error: any, request: any, response: any) => void;
}
declare function modofun(handlers: Handlers, options: Options): Func;
declare function modofun(handlers: Handlers, middleware?: Middleware[]): Func;
declare namespace modofun {
function arity(amount: number): Middleware;
}