Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
bookshelf-modelbase
Advanced tools
##Why
Bookshelf.js is awesome. However,
we found ourselves extending bookshelf.Model
for the same reasons over and
over - parsing and formatting (to and from DB) niceties, adding timestamps, and
validating data on save, for example. Since these are problems you'll likely
have to solve for most use cases of Bookshelf, it made sense to provide a
convenient set of core model features.
bookshelf-modelbase
will not force you to use it for all your models.
If you want to use it for some and not others, nothing bad will happen.
bookshelf-modelbase
requires you to pass in an initialized instance
of bookshelf, meaning that you can configure bookshelf however you please.
Outside of overriding bookshelf.Model
, there is nothing you can do to
your bookshelf instance that will break bookshelf-modelbase
.
Adds timestamps (createdAt
and updatedAt
)
Validate own attributes on save using Joi.
You can pass in a validation object as a class attribute when you extend
bookshelf-modelbase
- see below for usage.
Writes attributes to the db as snake_case
,
but exposes them in code as camelCase
.
##Usage
var db = require(knex)(require('./knexfile'));
var bookshelf = require('bookshelf')(db);
// Pass an initialized bookshelf instance
var ModelBase = require('bookshelf-modelbase')(bookshelf);
var User = ModelBase.extend({
}, {
validation: <Joi validation object, defaults to Joi.any()>
})
FAQs
Extensible ModelBase for bookshelf-based model layers
The npm package bookshelf-modelbase receives a total of 250 weekly downloads. As such, bookshelf-modelbase popularity was classified as not popular.
We found that bookshelf-modelbase 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.