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.
waterline-orientdb
Advanced tools
Waterline/Sails.js adapter for OrientDB.
Warning
waterline-orientdb
maps the logicalid
attribute to the required@rid
physical-layer OrientDB Record ID. In the current version ofwaterline-orientdb
, you should not sort byid
.
Install from NPM.
$ npm install appscot/waterline-orientdb --save
var orientAdapter = require('waterline-orientdb');
var config = {
adapters: {
'default': orientAdapter,
orient: orientAdapter,
},
connections: {
myLocalOrient: {
adapter: 'orient',
host: 'localhost',
port: 2424,
user: 'root',
password: 'root',
database: 'waterline'
}
}
}
Waterline-orientdb will represent most models in OrientDB as Vertices. The exception being Many-to-Many through join tables which are represented by Edges.
To learn how to create associations with Waterline/Sails.js check the Waterline Docs Associations Page. Below we go through how waterline-orientdb approaches each kind of associations.
For One-to-One Associations waterline-orientdb creates a LINK (OrientDB Types) to associate records.
One-to-Many Associations are represented in OrientDB by a LINKSET.
Many-to-Many Associations are handled by Waterline core, creating a join table holding foreign keys to the associated records. Waterline-orientdb does not change this behaviour for now but we may replace the join table by Edges in a future release. Currently it's not deemed a priority.
In Many-to-Many Through Association the join table is represented in OrientDB by Edges. Waterline-orientdb automatically creates the edges whenever an association is created. The Edge is named after the property tableName or identity in case tableName is missing.
The main difference between waterline-orientdb and sails-orientdb is the way associations/edges are created. In sails-orientdb
a special attribute named 'edge' is required while waterline-orientdb tries to adhere to waterline specficiation.
Waterline-orientdb mimics sails-mongo adapter behaviour and maps the logical id
attribute to the required @rid
physical-layer OrientDB Record ID.
From the waterline adapter interfaces waterline-orientdb supports Semantic
and Associations
interfaces.
Currently the following integration tests from waterline-adapter-tests are broken:
If you want to take a stab at these feel free to issue a Pull Request.
This adapter adds the following methods:
createEdge(@from, @to, @options, @callback)
Creates edge between specified two model instances by ID in the form parameters "@from" and "@to"
usage:
//Assume a model named "Post"
Post.createEdge('#12:1','#13:1',{'@class':'Comments'},function(err, result){
});
deleteEdges(@from, @to, @options, @callback)
Deletes edges between specified two model instances by ID in the form parameters "@from" and "@to"
usage:
//Assume a model named "Post"
Post.deleteEdges('#12:1','#13:1',null,function(err, result){
});
getDB(connection, collection, cb)
Returns a native Oriento object
usage:
//Assume a model named "Post"
Post.getDB(function(err, result){
});
/**
* Venue Model
*
* Join table between teams and associations
*/
var Waterline = require('waterline');
module.exports = Waterline.Collection.extend({
tableName: 'venueTable',
identity: 'venue',
connection: 'associations',
attributes: {
seats: 'integer',
teamRef: {
columnName: 'teamRef',
type: 'string',
foreignKey: true,
references: 'team',
on: 'id',
onKey: 'id',
via: 'stadiumRef'
},
stadiumRef: {
columnName: 'stadiumRef',
type: 'string',
foreignKey: true,
references: 'stadium',
on: 'id',
onKey: 'id',
via: 'teamRef'
}
}
});
/**
* Team.js
*/
var Waterline = require('waterline');
module.exports = Waterline.Collection.extend({
tableName: 'teamTable',
identity: 'team',
connection: 'associations',
attributes: {
name: 'string',
mascot: 'string',
stadiums: {
collection: 'Stadium',
through: 'venue',
via: 'team',
dominant: true
}
});
/**
* Stadium.js
*/
var Waterline = require('waterline');
module.exports = Waterline.Collection.extend({
tableName: 'stadiumTable',
identity: 'stadium',
connection: 'associations',
attributes: {
name: 'string',
teams: {
collection: 'Team',
through: 'venue',
via: 'stadium'
}
}
});
An edge named venueTable will be created from Team to Stadium model instances whenever an instance of team model is saved with a 'stadiums' attribute.
See FAQ.md
.
Waterline is a new kind of storage and retrieval engine.
It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in MySQL, LDAP, MongoDB, or Facebook.
Thanks so much to Srinath Janakiraman (vjsrinath) who built the original sails-orient
adapter.
FAQs
OrientDB adapter for Waterline / Sails.js ORM
The npm package waterline-orientdb receives a total of 0 weekly downloads. As such, waterline-orientdb popularity was classified as not popular.
We found that waterline-orientdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.