-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
80 lines (69 loc) · 2.55 KB
/
index.d.ts
File metadata and controls
80 lines (69 loc) · 2.55 KB
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
class ServerlessLambdaEvent {
resource: string
path: string
httpMethod: string
headers: Object
queryStringParameters: null | Object
pathParameters: null | Objec
stageVariables: null | Object
requestContext: {
path: string
accountId: string
resourceId: string
stage: string
requestId: string
identity: {
cognitoIdentityPoolId: null
accountId: null
cognitoIdentityId: null
caller: null
apiKey: string
sourceIp: string
accessKey: null
cognitoAuthenticationType: null
cognitoAuthenticationProvider: null
userArn: null
userAgent: string
user: null
},
resourcePath: string
httpMethod: string
apiId: string
},
body: string
isBase64Encoded: false
verbose: boolean
}
interface LambdaWrapOptions {
headers?: object
verboseError?: boolean
verboseLog?: boolean
callbackWaitsForEmptyEventLoop?: boolean
log?: Logger
logFields?: Object
createLogMeta?: Function
filterLogData?: Function
}
function lambdaHandler (event: Object, context: Object, callback: Function): void
interface wrapperFunctionType { (event: ServerlessLambdaEvent, context: Object): any }
interface Logger {
log (...args:any[]): any
error (...args:any[]): any
warn (...args:any[]): any
info (...args:any[]): any
}
interface responseHandlerType { (data: Object, event: ServerlessLambdaEvent, context: Object, callback: Function, options?: LambdaWrapOptions): any }
interface errorResponseHandlerType { (error: Error, event: ServerlessLambdaEvent, context: Object, callback: Function, options?: LambdaWrapOptions): any }
interface beforeMiddlewareType { (event: ServerlessLambdaEvent, context?: Object): any }
interface catchMiddlewareType { (error: Error, event?: ServerlessLambdaEvent, context?: Object): any }
interface finallyMiddlewareType { (error?: Error, response?: Object, event?: ServerlessLambdaEvent, context?: Object): any }
interface wrapFn {
(wrapperFunction: wrapperFunctionType): lambdaHandler
(wrapperFunction: wrapperFunctionType, localOptions: LambdaWrapOptions): lambdaHandler
responseHandler: responseHandler
errorResponseHandler: responseHandler
before (beforeMiddleware: beforeMiddlewareType): void
catch (catchMiddleware: catchMiddlewareType): void
finally (finallyMiddleware: finallyMiddlewareType): void
};
export function lambdaWrap(globalOptions: LambdaWrapOptions): wrapFn;