![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
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.
commodo-fields-storage-crud-logs
Advanced tools
Appends "createdOn", "updatedOn", and "savedOn" fields to your model.
Appends createdOn
, updatedOn
, and savedOn
fields to your model. The fields are automatically updated with current time before the model is about to be saved.
npm install --save commodo-fields-storage-crud-logs
Or if you prefer yarn:
yarn add commodo-fields-storage-crud-logs
import { compose } from "ramda";
import { withFields, string } from "@commodo/fields";
import { withCrudLogs } from "commodo-fields-storage-crud-logs";
const Company = compose(
withFields({
name: string(),
// Other fields you might need...
}),
withCrudLogs(),
withStorage(...), // Required.
// Other higher order functions (HOFs) you might need...
)();
const company = new Company();
company.name = "Acme Corporation";
// All fields null as a default value.
console.log(company.createdOn); // Logs null.
console.log(company.updatedOn); // Logs null.
console.log(company.savedOn); // Logs null.
// Upon saving the model for the first time, "createdOn" and "savedOn" fields will receive a value:
await company.save();
console.log(company.createdOn); // Logs "2020-04-19T14:34:42.993Z" (same as savedOn).
console.log(company.updatedOn); // Logs null.
console.log(company.savedOn); // Logs "2020-04-19T14:34:42.993Z" (same as createdOn).
// On every following save, only the "updatedOn" and "savedOn" fields will be updated:
await company.save();
console.log(company.createdOn); // Logs "2020-04-19T14:34:42.993Z" (no change here).
console.log(company.updatedOn); // Logs "2020-04-19T14:37:05.726Z" (same as savedOn).
console.log(company.savedOn); // Logs "2020-04-19T14:34:42.993Z" (same as updatedOn).
withCrudLogs
is used with the withStorage
functionIn order to update the field values accordingly, the withCrudLogs
internally utilizes the beforeSave
, beforeCreate
, and beforeUpdate
hooks, which are exposed by the withStorage
function.
Thanks goes to these wonderful people (emoji key):
Adrian Smijulj 💻 📖 💡 👀 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Appends "createdOn", "updatedOn", and "savedOn" fields to your model.
The npm package commodo-fields-storage-crud-logs receives a total of 5 weekly downloads. As such, commodo-fields-storage-crud-logs popularity was classified as not popular.
We found that commodo-fields-storage-crud-logs 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
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.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.