Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Database agnostic ODM
$ npm install --save lawson nosqwal-memory
orm.js
import nosqwal from 'nosqwal-memory';
import lawson from 'lawson';
const noSqwalInstance = noSqwal();
export const collection = lawson(noSqwalInstance).defineCollection;
models/user.js
import {collection} from '../orm';
export default collection('user', {
username: 'string',
email: 'string',
password: 'string'
});
import user from './models/user';
/* create */
user.create({
username: 'test',
email: 'test@test.com',
password: 'secret'
})
/* get */
.then(createdUser => {
return user.get(createdUser.id);
})
/* update */
.then(newUser => {
newUser.username = 'bobby';
return user.update(newUser.id, newUser);
})
.then(updatedUser => {
console.log('user updated');
})
.then(() => {
return user.query({
where: {
username: 'bobby'
}
});
})
.then(users => {
console.log(user.length);
// => 1
return user.delete(users[0].id);
})
.catch(e => {
console.warn(e);
});
Create a new instance of lawson
Type: Nosqwal instance
required
Define a new collection
Type: string
required
the name of the collection
Type: object
required
The schema of the document, see its definition here
Returns a Promise, that resolve to the requested document
Type: string
required
Returns a Promise, that resolve when the document is updated
Type: object
required
the new version of the document that will be updated
Type: string
required
the id of the document to update
Returns a Promise, that resolve to the created document
Type: object
required
The document that will be created
Returns a Promise when the document is deleted
Type: string
required
The id of the document that will be deleted
Returns a Promise, that resolve to all the documents
Type: object
Used to filter out results of the query
Type: number
The number of documents to return
Type: number
default: 0
The number of documents to skip
Like query(), but return a promise for only one document
Type: object
Used to filter out results of the query
Like first(), but throws an error if there is more that one document that matches the where clause
Type: object
Used to filter out results of the query
MIT © Thomas Sileghem
FAQs
Database agnostic ODM
We found that lawson 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.