@@ -12,11 +12,11 @@ export function api<T = any>(
12
12
custom : ( props : ApiSignature < T > ) => any
13
13
) : ( event : APIGatewayEvent , context : Context , callback : Callback ) => any {
14
14
return function handler ( event : APIGatewayEvent ) {
15
- const { body, requestContext , path, query, auth, headers, testRequest } = new Request ( event ) . getProperties ( ) ;
15
+ const { body, websocket , path, query, auth, headers, testRequest } = new Request ( event ) . getProperties ( ) ;
16
16
const signature : ApiSignature < T > = {
17
17
event,
18
18
body,
19
- requestContext ,
19
+ websocket ,
20
20
path,
21
21
query,
22
22
headers,
@@ -36,7 +36,7 @@ export function api<T = any>(
36
36
export interface ApiSignature < T = any > {
37
37
event : APIGatewayEvent ; // original event
38
38
body : T ; // JSON parsed body payload if exists (otherwise undefined)
39
- requestContext : WebsocketRequestContext ; // websocket connection payload
39
+ websocket : WebsocketRequest ; // websocket connection payload
40
40
path : { [ name : string ] : string } ; // path param payload as key-value pairs if exists (otherwise undefined)
41
41
query : { [ name : string ] : string } ; // query param payload as key-value pairs if exists (otherwise undefined)
42
42
headers : { [ name : string ] : string } ; // header payload as key-value pairs if exists (otherwise undefined)
@@ -50,7 +50,7 @@ export interface ApiSignature<T = any> {
50
50
error ( error ?: any ) : ApiResponse ; // returns 500 status code with optional error as body
51
51
}
52
52
53
- export interface WebsocketRequestContext {
53
+ export interface WebsocketRequest {
54
54
accountId : string ;
55
55
apiId : string ;
56
56
connectedAt ?: number ;
0 commit comments