From cf138d7029619260aba51453096f9b92da66c718 Mon Sep 17 00:00:00 2001 From: Taylor Beseda Date: Tue, 26 Sep 2023 12:33:30 -0600 Subject: [PATCH] types playground --- test/types/package.json | 6 ++++++ test/types/playground.mjs | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/types/package.json create mode 100644 test/types/playground.mjs diff --git a/test/types/package.json b/test/types/package.json new file mode 100644 index 00000000..614a9a4b --- /dev/null +++ b/test/types/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@aws-lite/client": "file:../..", + "@aws-lite/dynamodb": "file:../../plugins/dynamodb" + } +} diff --git a/test/types/playground.mjs b/test/types/playground.mjs new file mode 100644 index 00000000..e2a89301 --- /dev/null +++ b/test/types/playground.mjs @@ -0,0 +1,36 @@ +import awsLite from '@aws-lite/client' + +async function main () { + const client = await awsLite({ + region: 'us-east-1', + }) + + const lambdas = await client({ + service: 'lambda', + endpoint: '/2015-03-31/functions/', + method: 'GET', + payload: { ok: true }, + }) + console.log(lambdas.Functions.length) + + const article = await client({ + service: 'dynamodb', + headers: { 'X-Amz-Target': 'DynamoDB_20120810.GetItem' }, + awsjson: [ 'Key' ], + payload: { + TableName: 'Articles', + Key: { articleID: '123-ABC' } + }, + }) + console.log(article.Item) + + const the_same_article = await client.dynamodb.GetItem({ + TableName: 'Articles', + Key: { articleID: '123-ABC' } + }) + console.log(the_same_article.Item) + + // const foo = await client.foobar() // ! error +} + +main()