Skip to content

Commit

Permalink
merge awslite
Browse files Browse the repository at this point in the history
  • Loading branch information
brianleroux committed Feb 8, 2024
2 parents ca1077e + 11dafe6 commit 12a3e35
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

---

## [5.0.2] 2024-02-08

Upgraded to new explicit plugin resolution with [aws-lite](https://aws-lite.org)!

---

## [5.0.0 - 5.0.1] 2024-02-03

Begin Data just got a lot faster. Gone are the days of 500-1000ms cold starts due to instantiating the AWS SDK – Begin Data v5 is now between 2-5x faster, and uses 2-4x less memory, courtesy of [aws-lite](https://aws-lite.org)!
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"src/*"
],
"dependencies": {
"@aws-lite/client": "^0.16.1",
"@aws-lite/dynamodb": "^0.3.3",
"@aws-lite/ssm": "^0.2.2",
"@aws-lite/client": "^0.17.1",
"@aws-lite/dynamodb": "^0.3.4",
"@aws-lite/ssm": "^0.2.3",
"@begin/hashid": "^1.0.0",
"run-parallel": "^1.2.0",
"run-waterfall": "^1.1.7"
Expand Down
6 changes: 4 additions & 2 deletions src/helpers/_dynamo.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ module.exports = function getDynamo (callback) {

let local = ARC_ENV === 'testing' || ARC_LOCAL
if (!local) {
aws(function gotClient (err, client) {
let plugins = [ import('@aws-lite/dynamodb') ]
aws({ plugins }, function gotClient (err, client) {
if (err) callback(err)
else {
db = client.dynamodb
db = client.ddb
callback(null, db)
}
})
Expand All @@ -35,6 +36,7 @@ module.exports = function getDynamo (callback) {
protocol: 'http',
host: 'localhost',
port,
plugins: [ import('@aws-lite/dynamodb') ],
region: AWS_REGION || 'us-west-2'
},
function gotClient (err, client) {
Expand Down
7 changes: 5 additions & 2 deletions src/helpers/_get-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ module.exports = function getPorts (callback) {
}
let Name = `/${toLogicalID(`${app}-${env}`)}/ARC_SANDBOX/ports`
let config = {
endpoint: `http://localhost:2222/_arc/ssm`,
plugins: [ import('@aws-lite/ssm') ],
protocol: 'http',
host: 'localhost',
port: 2222,
pathPrefix: '_arc/ssm',
region: AWS_REGION || 'us-west-2',
}

aws(config, function gotClient (err, client) {
if (err) callback(err)
else {
Expand Down
10 changes: 7 additions & 3 deletions src/helpers/_get-table-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ module.exports = function getTableName (callback) {
getPorts((err, ports) => {
if (err) callback(err)
else go({
endpoint: `http://localhost:${ports._arc}/_arc/ssm`,
protocol: 'http',
host: 'localhost',
port: ports._arc,
pathPrefix: '_arc/ssm',
region: AWS_REGION || 'us-west-2',
})
})
Expand All @@ -40,8 +43,9 @@ module.exports = function getTableName (callback) {
go()
}

function go (config) {
aws(config, function gotClient (err, client) {
function go (config = {}) {
let plugins = [ import('@aws-lite/ssm') ]
aws({ plugins, ...config }, function gotClient (err, client) {
if (err) callback(err)
else {
let { ssm } = client
Expand Down

0 comments on commit 12a3e35

Please sign in to comment.