Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
loopback-softdel-mixin
Advanced tools
A mixin to automatically generate created and updated Date attributes for loopback Models
This is forked from gausie/loopback-softdelete-mixin
This module is designed for the Strongloop Loopback framework. It allows entities of any Model to be "soft deleted" by adding deletedAt
and _isDeleted
attributes. Queries following the standard format will no return these entities; they can only be accessed by adding { deleted: true }
to the query object (at the same level as where
, include
etc).
It is heavily inspired by loopback-ds-timestamp-mixin.
npm install --save loopback-sdelete-mixin
To use with your Models add the mixins
attribute to the definition object of your model config.
{
"name": "Widget",
"properties": {
"name": {
"type": "string",
},
},
"mixins": {
"SoftDelete" : true,
},
},
There are a number of configurable options to the mixin. You can specify alternative property names for deletedAt
and _isDeleted
, as well as configuring deletion to "scrub" the entity. If true, this sets all but the "id" fields to null. If an array, it will only scrub properties with those names.
"mixins": {
"SoftDelete": {
"deletedAt": "deletedOn",
"_isDeleted": "deleted",
"scrub": true,
},
},
To run queries that include deleted items in the response, add { deleted: true }
to the query object (at the same level as where
, include
etc).
FAQs
A mixin to automatically generate created and updated Date attributes for loopback Models
We found that loopback-softdel-mixin 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.