
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@c8/base-model
Advanced tools
A base model for all bookshelf-based models on our database layer.
A base model for all bookshelf-based models on our database layer.
'createdDate'
and 'lastUpdatedDate'
timestamps to the Model (this can be changed by setting hasTimestamps
to false
);delAttribute
);findAll
, findById
, insert
, removeById
, updateById
);
remove
does not hard-delete, instead it sets the is_deleted
column to true
(this behaviour can be changed by
overriding the function or by setting delAttribute
to false);NOTE: BaseMode assumes you're using the awesome bookshelf-camelcase
plugin. If you're not, just set hasTimestamps: ['created_date', 'last_updated_date']
and delAttribute: 'is_deleted'
npm install @c8/base-model
BaseModel
requires you to pass in an initialized instance of bookshelf, like in the example below:
const bookshelf = require('bookshelf')(db)
const BaseModel = require('../lib/index')(bookshelf)
const MyModel = BaseModel.extend({
tableName: 'my_table' // needs to have created_date, last_updated_date and is_deleted columns
})
module.exports = bookshelf.model('MyModel', MyModel)
findAll(opts)
@param {object} [opts]
An optional options object@param {boolean} [opts.includeRemoved]
Find removed items as well@returns {Promise.<Array>}
A Promise resolving to the fetched entries array.findById(id, opts)
@param {number} id
- The ID of the entry to get.@param {object} [opts]
An optional options object@param {boolean} [opts.includeRemoved]
Find removed items as well@returns {Promise.<Object>}
A promise resolving to the fetched entry.@throws {NotFoundError}
An entry with the given id
must exist.findWhere(where, opts)
@param {number} where
- The criteria to be met.@param {object} [opts]
- An optional options object.@param {boolean} [opts.includeRemoved]
- Find removed items as well.@returns {Promise.<Array>}
- A promise resolving to the fetched entries array.insert(obj)
@param {object} obj
- The object to be created.@returns {Promise.<Object>}
A Promise resolving to the newly created entry.removeById(id)
@param {number} id
- The entry ID.@returns {Promise.<Object>}
A Promise resolving to the destroyed entry.@throws {NotFoundError}
A Campaign with the given id
must exist.updateById(id, entry, opts)
@param {number} id
- The ID of the Campaign to update.@param {object} entry
- The Campaign object to update.@param {object} [opts]
An optional options object@param {boolean} [opts.includeRemoved]
Find removed items as well@returns {Promise.<Object>}
A Promise resolving to the updated entry fields.@throws {TypeError}
entry.id
must exist and be integer.@throws {NotFoundError}
An entry with the given entry.id
must exist.FAQs
A base model for all bookshelf-based models on our database layer.
The npm package @c8/base-model receives a total of 2 weekly downloads. As such, @c8/base-model popularity was classified as not popular.
We found that @c8/base-model demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.