![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@northernv/supermodel
Advanced tools
Completely inspired by knex-supermodel, just altered with some personal modifications to meet my needs
npm install -S @northernv/supermodel;
yarn add @northernv/supermodel;
In your models, that are Javascript classes, just extend
with the main class
const { default: Base } = require('@northernv/supermodel')
class User extends Base {
}
@northernv/supermodel
is meant to be a very lite but not quite an ORM for knex. This is accomplished by providing a base model that is simply an ES6 class that you extend in your own models. You can override the provided methods or even add to them to make your own. Each method will always return your model back to you!
This package requires ES6 features only available in node 6+.
Each subclass will have automatic access to static methods to create
, fetch
, collection
, forge
, update
and destroy
, count
, getAll
.
const { default: Base } = require('@northernv/supermodel')
const knex = require('knex')
const db = knex({ ...knexOptions })
class User extends Base {
constructor(opts) {
super(opts);
}
}
// Note: It converts properties to snake_case
const user = User.create({ fooBar: 'hello', barBaz: 'baz' }, { db });
console.log(user.fooBar); // hello
console.log(user.foo_bar); // hello
console.log(user.barBaz); // baz
You may either provide a transacting knex to each method or chain it.
let user;
knex.transaction((trx) => {
User.fetch({ id: '123' }, { db: trx })
.then((u) => {
user = u;
return user.update({ foo: 'baz' });
});
});
This software is licensed under the MIT license.
FAQs
A Base model for Knex
We found that @northernv/supermodel 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.