https://github.com/bayer-group/json-diff-audit
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.9%) to scientific vocabulary
Keywords
Repository
Basic Info
- Host: GitHub
- Owner: Bayer-Group
- License: bsd-3-clause
- Language: JavaScript
- Default Branch: main
- Size: 87.9 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
JSON diff audit
json-diff-audit is a Node.js library that compares JSON objects consecutively, identifies differences, and generates detailed audit records for easy reporting and tracking changes.
Table of Contents
Install
npm:
sh
npm install json-diff-audit
Usage
Node
```js const { auditEventTransformer } = require('json-diff-audit')
const record1 = { employee : { name: "John Smith", }, date: "04-17-2023 9:16:2 pm", userId: "klewis", }
const record2 = { employee : { name: "Jane Thomas", }, date: "04-21-2023 10:23:2 am", userId: "mtimms", }
const result = auditEventTransformer.process([record1, record2], "employee")
console.info(JSON.stringify(result))
```
Input
auditEventTransformer.process(arg1, arg2)
arg1: Collection of domain objects to compare
arg2: Domain field for comparisons, defaults to "data"
Output
JSON
[
{
"path":"name",
"user":"mtimms",
"dateAndTime":"04-21-2023 10:23:2 am",
"field":"name",
"action":"update",
"oldValue":"John Smith",
"newValue":"Jane Thomas"
}
]
The output shows that an update was made to the name field, going from John Smith to Jane Thomas, and was made by user mtimms on 04-21-2023 at 10:23:2 am.
How it works
The input is a collection of records. Each record should have 3 fields
| Field | Description | |------| ---- | | userId | the user that made the changes to the current object | | date | the date and time the change was made | | < domain object > | the key name to the domain object that will be compared, defaults to 'data' |
The processing will compare each record in the collection to the next, they are assumed to be ordered by date. A list of deltas is calculated and turned into a collection of audit records. Each audit record will contain the following fields:
| Field | Description | |------| ---- | | user | the user that made the changes to the current object | | dateAndTime | the date and time the change was made | | field | the field key name that was affected | | action | the field in question was either an add, update, or delete | | oldValue | if an action is either update or delete, this field indicates the previous value | | newValue | if an action is either an update or add, this field indicates the new value | | path | the full path in dot notation to the affected field |
Logging
By default, json-diff-audit will only log errors encountered during it's function execution. Additional debugging output can be conditionally triggered by setting the environment variable json_diff_audit__debug = true.
Notes
- The path in the response is experimental at this time, certain cases with arrays are still being considered
- Comparison of domain objects is currently done by order in the collection, not by date.
Owner
- Name: Bayer Open Source
- Login: Bayer-Group
- Kind: organization
- Website: https://bayer.com/
- Repositories: 98
- Profile: https://github.com/Bayer-Group
Science for a better life
GitHub Events
Total
Last Year
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jared Edler | j****r@b****m | 15 |
| cnpeyt | c****n@b****m | 11 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- npm 25 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 2
npmjs.org: json-diff-audit
Detect changes and generate audit events for a series of JSON objects
- Homepage: https://github.com/Bayer-Group/json-diff-audit#readme
- License: BSD-3-Clause
-
Latest release: 1.0.0
published almost 2 years ago
Rankings
Maintainers (2)
Dependencies
- 441 dependencies
- @babel/eslint-parser ^7.24.6 development
- eslint ^8.57.0 development
- eslint-config-google ^0.14.0 development
- eslint-config-prettier ^9.1.0 development
- eslint-plugin-import ^2.29.1 development
- eslint-plugin-prettier ^5.1.3 development
- jest ^29.7.0 development
- prettier ^3.2.5 development
- json-diff ^1.0.6