Skip to content

Commit

Permalink
types playground
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeseda committed Sep 26, 2023
1 parent ad5a017 commit cf138d7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"@aws-lite/client": "file:../..",
"@aws-lite/dynamodb": "file:../../plugins/dynamodb"
}
}
36 changes: 36 additions & 0 deletions test/types/playground.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import awsLite from '@aws-lite/client'

Check failure on line 1 in test/types/playground.mjs

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

Unable to resolve path to module '@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()

0 comments on commit cf138d7

Please sign in to comment.