Skip to content

Commit

Permalink
correct tables._client type
Browse files Browse the repository at this point in the history
also arc.ws._api returns client.ApiGatewayManagementApi -- need to double check this is correct
  • Loading branch information
tbeseda committed Feb 2, 2024
1 parent 0326877 commit 662f70f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ function instantiateAPI () {
*/
function _api (callback) {
if (callback) instantiateAPI()
.then(client => callback(null, client))
.then(client => callback(null, client.ApiGatewayManagementApi))
.catch(callback)

else return new Promise((res, rej) => {
instantiateAPI()
.then(client => res(client))
.then(client => res(client.ApiGatewayManagementApi))
.catch(rej)
})
}
Expand Down
4 changes: 1 addition & 3 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { AwsLiteClient } from "@aws-lite/client"
import type { GetConnectionResponse } from "@aws-lite/apigatewaymanagementapi-types";
import type { QueryResponse, ScanResponse, UpdateItemResponse } from "@aws-lite/dynamodb-types"
import type { PublishResponse } from "@aws-lite/sns-types"
import type { SendMessageResponse } from "@aws-lite/sqs-types"
import type { Context } from "aws-lambda";
Expand Down Expand Up @@ -98,8 +97,7 @@ arc.static("/", { stagePath: false });

// TABLES
const dbClient = await arc.tables()
expectType<AwsLiteClient["DynamoDB"]>(dbClient._db)
// expectType<DynamoDB.DocumentClient>(dbClient._doc)
expectType<AwsLiteClient["DynamoDB"]>(dbClient._client)
expectType<string>(dbClient.name('widgets'))
expectType<Record<string, string>>(dbClient.reflect())
const myTable = dbClient.foobar
Expand Down
3 changes: 2 additions & 1 deletion types/tables.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export type ArcDB<Tables> = ArcDBWith<Tables> & {
reflect(): {
[tableName in keyof Tables]: string;
};
_db: AwsLiteClient["DynamoDB"];
_client: AwsLiteClient["DynamoDB"];
// _db: DynamoDB;
// _doc: DynamoDB.DocumentClient;
};

Expand Down

0 comments on commit 662f70f

Please sign in to comment.