forked from aws/aws-lambda-nodejs-runtime-interface-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
62 lines (62 loc) · 2.22 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
/**
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* This module defines types, enums and interfaces common to the other modules.
*/
/// <reference types="node" />
import { IncomingHttpHeaders } from "http";
export interface InvocationResponse {
bodyJson: string;
headers: IncomingHttpHeaders;
}
export interface NativeClient {
initializeClient: (userAgent: string) => void;
done: (id: string, bodyString: string) => void;
error: (id: string, bodyString: string, xrayString: string) => void;
next: () => Promise<InvocationResponse>;
}
export declare enum INVOKE_HEADER {
ClientContext = "lambda-runtime-client-context",
CognitoIdentity = "lambda-runtime-cognito-identity",
ARN = "lambda-runtime-invoked-function-arn",
AWSRequestId = "lambda-runtime-aws-request-id",
DeadlineMs = "lambda-runtime-deadline-ms",
XRayTrace = "lambda-runtime-trace-id"
}
export interface IEnvironmentData {
functionVersion?: string;
functionName?: string;
memoryLimitInMB?: string;
logGroupName?: string;
logStreamName?: string;
}
export interface IHeaderData {
clientContext?: string;
identity?: string;
invokedFunctionArn?: string;
awsRequestId?: string;
getRemainingTimeInMillis: () => number;
}
export declare type ErrorStringOrUndefined = Error | string | undefined;
export declare type ErrorStringOrUndefinedOrNull = ErrorStringOrUndefined | null;
/**
*
*/
export interface ICallbackContext {
callbackWaitsForEmptyEventLoop: boolean;
succeed: (result: unknown) => void;
fail: (err: ErrorStringOrUndefinedOrNull) => void;
done: (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void;
}
export declare type CallbackFunction = (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void;
export interface IBeforeExitListener {
invoke: () => void;
reset: () => () => void;
set: (listener: () => void) => () => void;
}
export interface IErrorCallbacks {
uncaughtException: (err: Error) => void;
unhandledRejection: (err: Error) => void;
}
export declare type HandlerFunction = (body: unknown, data: IEnvironmentData & IHeaderData, callback: CallbackFunction) => PromiseLike<unknown> | unknown;
//# sourceMappingURL=index.d.ts.map