@@ -11,16 +11,16 @@ import {
11
11
Jwt ,
12
12
Lambda ,
13
13
ApiGatewayEventRequestContextHttp ,
14
- APIGatewayEventClientCertificate ,
14
+ ApiGatewayEventClientCertificate ,
15
15
Context ,
16
16
CognitoIdentity ,
17
17
ClientContext ,
18
18
ClientContextClient ,
19
19
ClientContextEnv ,
20
- APIGatewayEventValidity ,
20
+ ApiGatewayEventValidity ,
21
21
} from "./glambda.mjs" ;
22
22
23
- export function to_api_gateway_proxy_event_v2 ( event ) {
23
+ export function toApiGatewayProxyEventV2 ( event ) {
24
24
return new ApiGatewayProxyEventV2 (
25
25
event . version ,
26
26
event . routeKey ,
@@ -31,30 +31,30 @@ export function to_api_gateway_proxy_event_v2(event) {
31
31
maybeDict ( event . queryStringParameters ) ,
32
32
maybeDict ( event . pathParameters ) ,
33
33
maybeDict ( event . stageVariables ) ,
34
- to_request_context ( event . requestContext ) ,
34
+ toRequestContext ( event . requestContext ) ,
35
35
maybe ( event . body ) ,
36
36
event . isBase64Encoded ,
37
37
) ;
38
38
}
39
39
40
- function to_request_context ( ctx ) {
40
+ function toRequestContext ( ctx ) {
41
41
return new ApiGatewayRequestContextV2 (
42
42
ctx . routeKey ,
43
43
ctx . accountId ,
44
44
ctx . stage ,
45
45
ctx . requestId ,
46
- maybe ( to_authorizer ( ctx . authorizer ) ) ,
46
+ maybe ( toAuthorizer ( ctx . authorizer ) ) ,
47
47
ctx . apiId ,
48
48
ctx . domainName ,
49
49
ctx . domainPrefix ,
50
50
ctx . time ,
51
51
ctx . timeEpoch ,
52
- to_http ( ctx . http ) ,
53
- maybe ( to_authentication ( ctx . authentication ) ) ,
52
+ toHttp ( ctx . http ) ,
53
+ maybe ( toAuthentication ( ctx . authentication ) ) ,
54
54
) ;
55
55
}
56
56
57
- function to_http ( http ) {
57
+ function toHttp ( http ) {
58
58
return new ApiGatewayEventRequestContextHttp (
59
59
http . method ,
60
60
http . path ,
@@ -64,46 +64,46 @@ function to_http(http) {
64
64
) ;
65
65
}
66
66
67
- function to_authentication ( auth ) {
67
+ function toAuthentication ( auth ) {
68
68
if ( ! auth ) {
69
69
return undefined ;
70
70
}
71
71
return new ApiGatewayEventRequestContextAuthentication (
72
- to_client_cert ( auth . clientCert ) ,
72
+ toClientCert ( auth . clientCert ) ,
73
73
) ;
74
74
}
75
75
76
- function to_client_cert ( cert ) {
77
- return new APIGatewayEventClientCertificate (
76
+ function toClientCert ( cert ) {
77
+ return new ApiGatewayEventClientCertificate (
78
78
cert . clientCertPem ,
79
79
cert . issuerDN ,
80
80
cert . serialNumber ,
81
81
cert . subjectDN ,
82
- to_validity ( cert . validity ) ,
82
+ toValidity ( cert . validity ) ,
83
83
) ;
84
84
}
85
85
86
- function to_validity ( validity ) {
87
- return new APIGatewayEventValidity ( validity . notAfter , validity . notBefore ) ;
86
+ function toValidity ( validity ) {
87
+ return new ApiGatewayEventValidity ( validity . notAfter , validity . notBefore ) ;
88
88
}
89
- function to_authorizer ( auth ) {
89
+ function toAuthorizer ( auth ) {
90
90
if ( ! auth ) {
91
91
return undefined ;
92
92
}
93
93
if ( auth . iam ) {
94
- return new Iam ( to_iam_authorizer ( auth . iam ) ) ;
94
+ return new Iam ( toIamAuthorizer ( auth . iam ) ) ;
95
95
}
96
96
if ( auth . jwt ) {
97
97
return new Jwt (
98
98
auth . principalId ,
99
99
auth . integrationLatency ,
100
- to_jwt_authorizer ( auth . jwt ) ,
100
+ toJwtAuthorizer ( auth . jwt ) ,
101
101
) ;
102
102
}
103
103
return new Lambda ( auth . lambda ) ;
104
104
}
105
105
106
- function to_iam_authorizer ( iam ) {
106
+ function toIamAuthorizer ( iam ) {
107
107
return new ApiGatewayEventRequestContextIamAuthorizer (
108
108
iam . accessKey ,
109
109
iam . accountId ,
@@ -114,7 +114,7 @@ function to_iam_authorizer(iam) {
114
114
) ;
115
115
}
116
116
117
- function to_jwt_authorizer ( jwt ) {
117
+ function toJwtAuthorizer ( jwt ) {
118
118
return new ApiGatewayEventRequestContextJwtAuthorizer (
119
119
jwt . claims ,
120
120
maybeList ( jwt . scopes ) ,
@@ -142,7 +142,7 @@ function maybeDict(a) {
142
142
return new None ( ) ;
143
143
}
144
144
145
- export function from_api_gateway_proxy_result_v2 ( result ) {
145
+ export function fromApiGatewayProxyResultV2 ( result ) {
146
146
return {
147
147
statusCode : result . status_code ,
148
148
headers : Object . fromEntries ( result . headers . entries ( ) ) ,
@@ -152,7 +152,7 @@ export function from_api_gateway_proxy_result_v2(result) {
152
152
} ;
153
153
}
154
154
155
- export function to_context ( ctx ) {
155
+ export function toContext ( ctx ) {
156
156
return new Context (
157
157
ctx . callbackWaitsForEmptyEventLoop ,
158
158
ctx . functionName ,
@@ -162,12 +162,12 @@ export function to_context(ctx) {
162
162
ctx . awsRequestId ,
163
163
ctx . logGroupName ,
164
164
ctx . logStreamName ,
165
- maybe ( to_cognito_identity ( ctx . identity ) ) ,
166
- maybe ( to_client_context ( ctx . clientContext ) ) ,
165
+ maybe ( toCognitoIdentity ( ctx . identity ) ) ,
166
+ maybe ( toClientContext ( ctx . clientContext ) ) ,
167
167
) ;
168
168
}
169
169
170
- function to_cognito_identity ( identity ) {
170
+ function toCognitoIdentity ( identity ) {
171
171
if ( ! identity ) {
172
172
return undefined ;
173
173
}
@@ -177,18 +177,18 @@ function to_cognito_identity(identity) {
177
177
) ;
178
178
}
179
179
180
- function to_client_context ( ctx ) {
180
+ function toClientContext ( ctx ) {
181
181
if ( ! ctx ) {
182
182
return undefined ;
183
183
}
184
184
return new ClientContext (
185
- to_client_context_client ( ctx . client ) ,
185
+ toClientContextClient ( ctx . client ) ,
186
186
maybe ( ctx . custom ) ,
187
- to_client_context_env ( ctx . env ) ,
187
+ toClientContextEnv ( ctx . env ) ,
188
188
) ;
189
189
}
190
190
191
- function to_client_context_client ( client ) {
191
+ function toClientContextClient ( client ) {
192
192
return new ClientContextClient (
193
193
client . appTitle ,
194
194
client . appVersionName ,
@@ -197,7 +197,7 @@ function to_client_context_client(client) {
197
197
) ;
198
198
}
199
199
200
- function to_client_context_env ( env ) {
200
+ function toClientContextEnv ( env ) {
201
201
return new ClientContextEnv (
202
202
env . platformVersion ,
203
203
env . platform ,
0 commit comments