Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
##Introduction
neo4apis is a ruby gem for building objects which import data into neo4j. It takes care of batching of queries for better import performance and creating indexes for better query performance. It also uses MERGEs to make sure the same node/relationship isn't imported twice. neo4apis is for anybody who want to build a gem or even just an adapter in their application which encapsulates the logic of data import from some source. For examples see the drivers for Twitter and GitHub
In the below example we assume that a variable awesome_client
is passed in which allows us to make requests to the API. This may be, for example, provided by another gem.
##To install
gem 'neo4apis'
in your Gemfile or gem install neo4apis
##To use
require 'neo4apis'
module Neo4Apis
class AwesomeSite < Base
# Adds a prefix to labels so that they become AwesomeSiteUser and AwesomeSiteWidget (optional)
common_label :AwesomeSite
# Number of queries which are built up until batch request to DB is made (optional, default = 500)
batch_size 2000
uuid :User, :id
uuid :Widget, :uuid
def import_widget_search(*args)
@client.widget_search(*args).each do |widget|
add_widget(widget)
end
end
importer :Widget do |widget|
user_node = add_user(widget.owner)
# add_node comes from From Neo4Apis::Base
# Imports the uuid and text values from the widget object to the node
node = add_node(:Widget, widget, [:uuid, :text]) do |node|
# Imports the double_foo property to the node which isn't a simple copy
node.double_foo = widget.foo * 2
end
# add_relationship comes from Neo4Apis::Base
add_relationship(:owns, user_node, node)
node
end
importer :User do |user|
add_node :User, user, [:id, :username, :name]
end
end
end
Then somebody else could use your gem in the following manner:
neo4j_session = Neo4j::Session.open # From the neo4j-core gem
awesome_client = Awesome.open # From a theoretical API wrapping gem
neo4apis_awesome = Neo4Apis::AwesomeSite.new(neo4j_session)
neo4apis_awesome.batch do
awesome_client.widget_search('cool').each do |widget|
neo4apis_awesome.import :Widget, widget # import is provided by neo4apis
end
end
Options can be used in the instantiation of the Neo4Apis client:
neo4apis_awesome = Neo4Apis::AwesomeSite.new(neo4j_session, {option: value})
relationship_transform
Allowed values upcase
, downcase
, and none
. Default: upcase
How should relationship types be transformed when saving? Neo4j recommends upper case relationship types, so upcase
is the default. none
sends through relationship types as specified in the add_relationship method
FAQs
Unknown package
We found that neo4apis 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
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.