
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@clocklimited/crud-service
Advanced tools
Simple crud service for object definition, validation, basic persistence and collection.
npm install @clocklimited/crud-service
const createCrudService = require('@clocklimited/crud-service')
const save = require('save')
const schema = require('./schema')
const service = createCrudService('things', save('thing'), schema())
// service now has some slightly inflated CRUD functionality:
// .create() .read() .update() .partialUpdate()
// .delete() .deleteMany() .find() .count()
Create a new crud service that stores entites in the provided collection. This should be
a save instance with your preferred engine. A
schemata schema is required for validation
service has the following CRUD-y methods:
All options arguments are optional.
Omitting cb when calling service.find() will return a stream.
service also has the following method:
This facilitates a pipeline for object manipulation before certain operations.
pre() can be called multiple times for the same hook and the processor functions
will be queued up. A processor function has the signature function (entity, cb) {},
and should callback with cb(err, entity).
A simple example is to maintain a lastUpdated property on service objects:
const setUpdateTime = (entity, cb) => {
entity.lastUpdated = new Date()
cb(null, entity)
}
service.pre('update', setUpdateTime)
service.pre('partialUpdate', setUpdateTime)
The available pre hooks are:
create - after validation, just before persistencecreateValidate - before validationupdate - after validation, just before persistenceupdateValidate - before validationpartialUpdate - after validation, just before persistencepartialValidate - before validationdelete - before deletionPaul Serby follow me on twitter @serby
Clock Limited follow us on twitter @clock
Licensed under the ISC
FAQs
Create a crud service by combining schemata and save
We found that @clocklimited/crud-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.