{"id":28101285,"url":"https://github.com/jellyvision/sequelize-logbook","last_synced_at":"2025-07-03T09:06:30.802Z","repository":{"id":71242954,"uuid":"105290309","full_name":"Jellyvision/sequelize-logbook","owner":"Jellyvision","description":"A plugin for adding a log book / revision history / audit / paper trail to a sequelize model.","archived":false,"fork":false,"pushed_at":"2017-09-29T16:11:52.000Z","size":7,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-13T19:12:51.294Z","etag":null,"topics":["audit","audit-log","audit-logs","history","history-tracking","logbook","logging","papertrail","revision","revision-history","revisions","sequelize","sequelizejs","versioning","versions"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jellyvision.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-29T15:49:28.000Z","updated_at":"2024-05-22T21:18:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"c09b64b8-108d-4de7-bf1d-b53b8f854b46","html_url":"https://github.com/Jellyvision/sequelize-logbook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jellyvision/sequelize-logbook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jellyvision%2Fsequelize-logbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jellyvision%2Fsequelize-logbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jellyvision%2Fsequelize-logbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jellyvision%2Fsequelize-logbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jellyvision","download_url":"https://codeload.github.com/Jellyvision/sequelize-logbook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jellyvision%2Fsequelize-logbook/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263296443,"owners_count":23444489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit","audit-log","audit-logs","history","history-tracking","logbook","logging","papertrail","revision","revision-history","revisions","sequelize","sequelizejs","versioning","versions"],"created_at":"2025-05-13T18:54:37.296Z","updated_at":"2025-07-03T09:06:30.790Z","avatar_url":"https://github.com/Jellyvision.png","language":"JavaScript","readme":"# Sequelize-Logbook\n\nA plugin for adding a log book / revision history / audit / [paper trail](https://en.wiktionary.org/wiki/paper_trail) to a sequelize model.\n\n# 🎛 Usage\n\n## When using the [models/index.js](https://github.com/sequelize/express-example/blob/master/models/index.js) `associate` pattern: \n`my-model.js`\n```javascript\nconst trackRevisions = require('sequelize-logbook')\n\nmodule.exports = function(sequelize, DataTypes) {\n  let MyModel = sequelize.define('MyModel', {\n    ...\n    classMethods: {\n      ...\n      associate: function(){\n        ...\n        trackRevisions(MyModel)\n      }\n    }\n  })\n}\n\n```\n\n## General use\n```javascript\nconst trackRevisions = require('sequelize-logbook')\n\nlet MyModel = sequelize.define('MyModel', {...})\nlet AnotherModel = sequelize.define('AnotherModel', {...})\ntrackRevisions(MyModel)\ntrackRevisions(AnotherModel)\n\n```\n\n## 🐲 whoDunnit / blame / author tracking. \n\nSequelizeRevisions will look against the global sequelize object\nfor a whoDunnit key. If this key is present, it will save this value\nas the author of the revision. \nOtherwise, it'll fall back to process.env.NODE_ENV\n\n```javascript\nconst sequelize = new Sequelize(db, user, password, config)\nsequelize.whoDunnit = 'yourUserString'\n```\n\n# ⚠ Caveats\n\nRevisions will **not** be automatically generated for instances created, deleted, or updated with **Bulk** actions\nIf you want revisions generated for Bulk actions, pass `individualHooks: true` as a sequelize option.\n\n# 🏗 Contributing ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)\n\n## 📐 Tests \n`npm run test`\n\n## ✂ Linting\n`npm run prettier`\n\n# ✨ Inspired by\n\n* [ssteffl's snippet](https://gist.github.com/ssteffl/f58ce60105c365a8d482)\n* [PaperTrail](https://github.com/airblade/paper_trail)\n\n## Related: \n\nThis library is similar to these other packages, with the addition of: \n1. whoDunnit / blame history\n2. Unit tests! 📏\n\n* [sequelize-paper-trail](https://www.npmjs.com/package/sequelize-paper-trail) - ⛔ [empty unit tests](https://github.com/nielsgl/sequelize-paper-trail/blob/master/test/index.spec.js)\n* [sequelize-temporal](https://github.com/bonaval/sequelize-temporal) - 👴 not maintained\n* [sequelize-revisions](https://github.com/bkniffler/sequelize-revisions) - 🚫 no unit tests\n\n# License\n\nSequelize-logbook is [MIT licensed](./LICENSE]).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellyvision%2Fsequelize-logbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjellyvision%2Fsequelize-logbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellyvision%2Fsequelize-logbook/lists"}