1
- import { ApiGatewayManagementApi , DynamoDB , SNS , SQS } from "aws-sdk" ;
2
- import { Context } from "aws-lambda" ;
1
+ import type { AwsLiteClient } from "@aws-lite/client"
2
+ import type { GetConnectionResponse } from "@aws-lite/apigatewaymanagementapi-types" ;
3
+ import type { PublishResponse } from "@aws-lite/sns-types"
4
+ import type { SendMessageResponse } from "@aws-lite/sqs-types"
5
+ import type { Context } from "aws-lambda" ;
3
6
import { expectType , expectAssignable , expectNotAssignable } from "tsd" ;
4
7
import arc from "../" ;
5
8
import type { HttpHandler , HttpAsyncHandler } from "../"
6
9
import type { HttpMethods , HttpRequest , HttpResponse } from "./http" ;
7
10
11
+ // SERVICES
12
+ const servicesResult = await arc . services ( ) ;
13
+ expectType < Record < string , any > > ( servicesResult ) ;
14
+
8
15
// EVENTS
9
16
const eventsPublishArg = { name : "test" , payload : { foo : "bar" } } ;
10
17
const eventsPublishResult = await arc . events . publish ( eventsPublishArg ) ;
11
- expectType < SNS . Types . PublishResponse > ( eventsPublishResult ) ;
18
+ expectType < PublishResponse > ( eventsPublishResult ) ;
12
19
13
20
// QUEUES
14
21
const queuesPublishArg = { name : "test" , payload : { foo : "bar" } } ;
15
22
const queuesPublishResult = await arc . queues . publish ( queuesPublishArg ) ;
16
- expectType < SQS . Types . SendMessageResult > ( queuesPublishResult ) ;
23
+ expectType < SendMessageResponse > ( queuesPublishResult ) ;
17
24
18
25
// HTTP
19
26
const middleware : HttpHandler = ( req , res , next ) => {
@@ -94,8 +101,7 @@ arc.static("/", { stagePath: false });
94
101
95
102
// TABLES
96
103
const dbClient = await arc . tables ( )
97
- expectType < DynamoDB > ( dbClient . _db )
98
- expectType < DynamoDB . DocumentClient > ( dbClient . _doc )
104
+ expectType < AwsLiteClient [ "DynamoDB" ] > ( dbClient . _client )
99
105
expectType < string > ( dbClient . name ( 'widgets' ) )
100
106
expectType < Record < string , string > > ( dbClient . reflect ( ) )
101
107
const myTable = dbClient . foobar
@@ -122,9 +128,9 @@ await myTable.scanAll({
122
128
} )
123
129
124
130
// WS
125
- expectType < ApiGatewayManagementApi > ( arc . ws . _api ) ;
131
+ expectType < AwsLiteClient [ " ApiGatewayManagementApi" ] > ( await arc . ws . _api ( ) ) ;
126
132
expectType < void > ( await arc . ws . send ( { id : "foo" , payload : { bar : "baz" } } ) ) ;
127
133
expectType < void > ( await arc . ws . close ( { id : "foo" } ) ) ;
128
- expectType < ApiGatewayManagementApi . Types . GetConnectionResponse > (
134
+ expectType < GetConnectionResponse > (
129
135
await arc . ws . info ( { id : "foo" } ) ,
130
136
) ;
0 commit comments