
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
mekanika-adapter
Advanced tools
An abstract adapter class for mekanika adapters.
Alpha release
adapter
is a method for instantiating new Adapter classes, and returning those adapter instances from an internal cache once declared.
Adapters are designed to map Qo - Query objects to a given service (such as a REST API, a database, a filesystem, etc). Typically they will sit on top of a service driver, and do little more than error check the Qo and translate it into a format the driver can process, finally passing (err, res)
back to the callback.
Adapters should by definition be extremely lightweight. Their only 'smart' is their translation layer between Qo and driver APIs. In exceptional circumstances where a driver API is significantly simpler than the default set of Qo actions, an adapter may implement Qo actions via the driver API.
In general an adapter will map as much of the Qo specification that is natively supported by the underlying driver.
New Adapters are instantiated as follows:
var myadapter = adapter.new( 'myadapter', defaultConfig );
// adapter('myadapter') instanceof adapter.Adapter
// -> true
All adapters can be retrieved using the adapter( name )
format, and are stored in the adapter
cache.
adapter
has the following static methods:
Adapters map a query request object to corresponding actions of a particular service. To do this, adapters must implement an .exec( query, cb )
method that:
cb
callback passing cb( err, res )
err
: Error object or null
res
: Results of successful execution (or undefined
)All Adapters are EventEmitters (based on EventEmitter2)
The initial Adapter
class is very simple:
var moo = adapter.new( 'moo', {prop: true} );
// -> { identity: 'moo', config: {prop: true} }
On the Prototype
{}
object (used to store config)Error('Not implemented')
.exec( query, cb )
Two paths for finding records, either via:
Identifiers
{identifiers: ['xyz']}
Constraints
[{field:'name', operator:'eq', condition:'joe'}]
There are two (independent) update paths, updating via either/or:
Modifiers
{set: $field, value: $value}
{inc: $field, value: $value}
(can be negative)Content
content: [ {vip: true} ]
Where multiple identifiers
are set, the content or modifiers should be applied to all ids. If no identifiers are set, the update will be applied to where
conditions, eg:
{
action: 'update',
resource: 'users',
modifiers: [{set:'vip', value: true}],
where: [{field:'points', operator:'gte', constraint:500}]
}
// Sets 'vip' to true on users who have points >= 500
npm install --production
For development, requires globally installed:
MIT
FAQs
Abstract mekanika adapter class
We found that mekanika-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.