Gathering detailed insights and metrics for objection-paranoia
Gathering detailed insights and metrics for objection-paranoia
Gathering detailed insights and metrics for objection-paranoia
Gathering detailed insights and metrics for objection-paranoia
npm install objection-paranoia
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
3 Stars
7 Commits
1 Watchers
8 Branches
1 Contributors
Updated on Jan 28, 2024
Latest Version
1.0.3
Package Id
objection-paranoia@1.0.3
Unpacked Size
10.23 kB
Size
3.55 kB
File Count
7
NPM Version
8.19.4
Node Version
16.20.2
Published on
Jan 28, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
(https://www.npmjs.com/package/objection-paranoia)
Automatically handle soft-deleting with your Objection.js models.
Install from npm:
1npm install objection-paranoia
Register the plugin with an instance of objection:
1const objectionSoftDelete = require('objection-paranoia'); 2objectionSoftDelete.register(objection);
By default, objection-paranoia uses the deleted_at
attribute for soft-deletes. You can optionally pass in an options object as the second argument to register to specify a custom attribute to use:
1objectionSoftDelete.register(objection, { 2 columnName: 'deleted_at', 3});
columnName: the name of the column to use as the soft delete flag on the model (Default: 'deleted_at'). The column must exist on the table for the model.
You can specify different column names per-model by using the options:
1objectionSoftDelete.register(objection, { 2 columnName: 'deleted_at', 3 deletedValue: new Date() | knex.fn.now(), 4 notDeletedValue: null | true | false, 5});
deletedValue: you can set this option to allow a different value than "new Date()" to be set in the specified column. For instance, you can use the following code to make a timestamp (you need knex instance to do so)
1objectionSoftDelete.register(objection, { 2 columnName: 'deleted_at', 3 deletedValue: new Date() | knex.fn.now(), 4});
notDeletedValue: you can set (and should) this option along with deletedValue to allow a different value than "null" to be set in the specified column. For instance, you can use the following code to restore the column to null (you need knex instance to do so)
1objectionSoftDelete.register(objection, { 2 columnName: 'deleted_at', 3 deletedValue: new Date() | knex.fn.now(), 4 notDeletedValue: null | true | false, 5});
When soft-delete is enabled on a model, the delete timestamp will be set to new Date()
on deletion.
Set the softDelete
static property on your model to true:
1class MyModel { 2 static get softDelete() { 3 return true; 4 } 5}
When softDelete is enabled, all delete queries to this model will instead update the model with a delete timestamp, and all queries to find these models will omit deleted instances.
1MyModel.query().withDeleted();
1MyModel.query().forceDelete();
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/5 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
17 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More