-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
64 lines (60 loc) · 1.45 KB
/
types.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
import { Express } from 'express';
import Application from 'koa';
import { IncomingHttpHeaders } from 'http';
type AliyunApiGatewayContext = {
requestId: string;
region: string;
accountId: string;
credentials: {
accessKeyId: string;
accessKeySecret: string;
securityToken: string;
};
function: {
name: string;
handler: string;
memory: number;
timeout: number;
initializer: string;
};
service: {
name: string;
logProject: string;
logStore: string;
qualifier: string;
versionId: string;
};
tracing: {
spanContext: string;
jaegerEndpoint: string;
spanBaggages: Record<string, string>;
parseOpenTracingBaggages: () => Record<string, string>;
};
logger: {
debug: (message: string) => void;
info: (message: string) => void;
warn: (message: string) => void;
error: (message: string) => void;
log: (message: string) => void;
};
};
export type Event = Buffer;
export type Context = AliyunApiGatewayContext;
export type ServerlessEvent = {
path: string;
httpMethod: string;
headers: Record<string, string>;
queryParameters: Record<string, string>;
pathParameters: Record<string, string>;
body: string | undefined;
isBase64Encoded: boolean;
};
export type ServerlessAdapter = (app: Express | Application) => (
event: Event,
context: Context,
) => Promise<{
statusCode: number;
body: string;
headers: IncomingHttpHeaders;
isBase64Encoded: boolean;
}>;