New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@begin/data

Package Overview
Dependencies
Maintainers
4
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@begin/data - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2-RC.1

src/helpers/_is-node-18.js

11

package.json
{
"name": "@begin/data",
"version": "4.0.1",
"version": "4.0.2-RC.1",
"description": "Begin Data is a durable and fast key/value document store built on top of DynamoDB",

@@ -34,2 +34,6 @@ "main": "src/index.js",

"@architect/sandbox": "^5.1.0-RC.0",
"@aws-sdk/client-dynamodb": "^3.216.0",
"@aws-sdk/client-ssm": "^3.216.0",
"@aws-sdk/lib-dynamodb": "^3.216.0",
"aws-sdk": "^2.1261.0",
"eslint": "^8.10.0",

@@ -41,3 +45,6 @@ "tap-spec": "^5.0.0",

"eslintConfig": {
"extends": "@architect/eslint-config"
"extends": "@architect/eslint-config",
"rules": {
"global-require": "off"
}
},

@@ -44,0 +51,0 @@ "keywords": [

60

src/helpers/_dynamo.js
let https = require('https')
let getPorts = require('./_get-ports')
let isNode18 = require('./_is-node-18')
let db, doc

@@ -9,16 +10,9 @@

function getDynamo (type, callback) {
if (!type) throw ReferenceError('Must supply Dynamo service interface type')
// We really only want to load aws-sdk if absolutely necessary
// eslint-disable-next-line
let dynamo = require('aws-sdk/clients/dynamodb')
let { ARC_ENV, AWS_REGION, ARC_LOCAL } = process.env
let { ARC_ENV, AWS_REGION } = process.env
let local = ARC_ENV === 'testing'
let DB = dynamo
let Doc = dynamo.DocumentClient
if (db && type === 'db') {
return callback(null, db)
}
if (doc && type === 'doc') {

@@ -28,20 +22,27 @@ return callback(null, doc)

let DB, Doc
if (isNode18) {
let dynamo = require('@aws-sdk/client-dynamodb')
let docclient = require('@aws-sdk/lib-dynamodb')
DB = dynamo.DynamoDB
Doc = docclient.DynamoDBDocument
}
else {
let dynamo = require('aws-sdk/clients/dynamodb')
DB = dynamo
Doc = dynamo.DocumentClient
}
let local = ARC_ENV === 'testing' || ARC_LOCAL
if (!local) {
let agent = new https.Agent({
keepAlive: true,
maxSockets: 50, // Node can set to Infinity; AWS maxes at 50; check back on this every once in a while
rejectUnauthorized: true,
})
// TODO? migrate to using `AWS_NODEJS_CONNECTION_REUSE_ENABLED`?
let config = {
httpOptions: { agent }
agent: new https.Agent({
keepAlive: true,
maxSockets: 50, // Node can set to Infinity; AWS maxes at 50
rejectUnauthorized: true,
})
}
if (type === 'db') {
db = new DB(config)
return callback(null, db)
}
if (type === 'doc') {
doc = new Doc(config)
return callback(null, doc)
}
db = isNode18 ? new DB : new DB(config)
doc = isNode18 ? Doc.from(db) : new Doc(config)
return callback(null, type === 'db' ? db : doc)
}

@@ -60,10 +61,5 @@ else {

}
if (type === 'db') {
db = new DB(config)
return callback(null, db)
}
if (type === 'doc') {
doc = new Doc(config)
return callback(null, doc)
}
db = new DB(config)
doc = isNode18 ? Doc.from(db) : new Doc(config)
return callback(null, type === 'db' ? db : doc)
}

@@ -70,0 +66,0 @@ })

@@ -0,1 +1,2 @@

let isNode18 = require('./_is-node-18')
let toLogicalID = require('./_to-logical-id')

@@ -22,5 +23,2 @@ let configuredPorts

else {
// We really only want to load aws-sdk if absolutely necessary, and only the client we need
// eslint-disable-next-line
let SSM = require('aws-sdk/clients/ssm')
let local = env === 'testing'

@@ -39,2 +37,4 @@ if (!local && !app) {

}
let SSM = isNode18 ? require('@aws-sdk/client-ssm').SSM : require('aws-sdk/clients/ssm')
let ssm = new SSM(config)

@@ -41,0 +41,0 @@ ssm.getParameter({ Name }, function done (err, result) {

@@ -0,1 +1,2 @@

let isNode18 = require('./_is-node-18')
let toLogicalID = require('./_to-logical-id')

@@ -17,6 +18,2 @@ let getPorts = require('./_get-ports')

// We really only want to load aws-sdk if absolutely necessary, and only the client we need
// eslint-disable-next-line
let SSM = require('aws-sdk/clients/ssm')
let local = ARC_ENV === 'testing'

@@ -44,2 +41,4 @@ if (!local && !app) {

function go (config) {
let SSM = isNode18 ? require('@aws-sdk/client-ssm').SSM : require('aws-sdk/clients/ssm')
let ssm = new SSM(config)

@@ -46,0 +45,0 @@ ssm.getParameter({ Name }, function done (err, result) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc