From 662f70f8e6c5a11823acee216c526b37b0ec68f9 Mon Sep 17 00:00:00 2001 From: Taylor Beseda Date: Fri, 2 Feb 2024 09:20:26 -0700 Subject: [PATCH] correct tables._client type also arc.ws._api returns client.ApiGatewayManagementApi -- need to double check this is correct --- src/ws/index.js | 4 ++-- types/index.test-d.ts | 4 +--- types/tables.d.ts | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ws/index.js b/src/ws/index.js index 32bb67ab..bd1d1589 100644 --- a/src/ws/index.js +++ b/src/ws/index.js @@ -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) }) } diff --git a/types/index.test-d.ts b/types/index.test-d.ts index 6e991a6b..5ba5de3e 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -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"; @@ -98,8 +97,7 @@ arc.static("/", { stagePath: false }); // TABLES const dbClient = await arc.tables() -expectType(dbClient._db) -// expectType(dbClient._doc) +expectType(dbClient._client) expectType(dbClient.name('widgets')) expectType>(dbClient.reflect()) const myTable = dbClient.foobar diff --git a/types/tables.d.ts b/types/tables.d.ts index bba23cdd..2bf50b96 100644 --- a/types/tables.d.ts +++ b/types/tables.d.ts @@ -64,7 +64,8 @@ export type ArcDB = ArcDBWith & { reflect(): { [tableName in keyof Tables]: string; }; - _db: AwsLiteClient["DynamoDB"]; + _client: AwsLiteClient["DynamoDB"]; + // _db: DynamoDB; // _doc: DynamoDB.DocumentClient; };