-
Notifications
You must be signed in to change notification settings - Fork 22
feat(audittrail): now audit trail can be configured by mode or output type to ignore some fields #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… type to ignore some fields You can also configure the output to ignore some fields of the audit trail by choosing those options (mode or output) herbsjs#90
Suggestions are welcome! 😃 |
README.md
Outdated
|
||
```javascript | ||
auditTrail: { | ||
mode: "minimal", // if minimal won't output especific fields: steps, request, return and user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest starting without a "shortcut" like mode: "minimal"
, leaving to future improvements.
Any assumptions we make now about this shortcuts now will probably be wrong.
This feature can be achieved by the user using config.auditTrail.mininal
, where:
config.auditTrail = { mininal: { ... } }
const uc = usecase('A use case', {
auditTrail: config.auditTrail.mininal
@@ -85,6 +91,33 @@ class UseCase { | |||
} | |||
|
|||
get auditTrail() { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way it was implemented, the audit is collected but discarded at the end, when auditTrail()
is called. I would suggest not collect the data at all, changing each audit line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be display 8000 ed to describe this comment to others. Learn more.
I understand your point, but I think that adding these validations at the time of collection will make the code more complex, which could be an improvement in the future if there is any clear performance record.
src/usecase.js
Outdated
@@ -85,6 +91,33 @@ class UseCase { | |||
} | |||
|
|||
get auditTrail() { | |||
|
|||
if(this._mainStep.auditTrail.configuration && this._mainStep.auditTrail.configuration?.mode === "minimal") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since is is used so many times, this._mainStep.auditTrail.configuration
can be stored in a variable, for a cleaner code
README.md
Outdated
```javascript | ||
auditTrail: { | ||
mode: "minimal", // if minimal won't output especific fields: steps, request, return and user | ||
output:{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output
is really necessary? Could it be just auditTrail: { steps: false }
(for ex)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put output precisely to make it more evident what those true or false variables would be. Precisely so that there are no breaks in future developments. But since we removed minimal
, I also remove the output
Codecov Report
@@ Coverage Diff @@
## master #92 +/- ##
==========================================
+ Coverage 97.64% 98.14% +0.50%
==========================================
Files 7 7
Lines 255 270 +15
==========================================
+ Hits 249 265 +16
+ Misses 6 5 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@jhomarolo, all fine to merge! great contribution! could you open a issue (and a PR) to document this new behavior? tks |
🎉 This PR is included in version 2.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Now buchu have the auditTrail configuration and user inside the context variable BREAKING CHANGE: Projects that are using ctx.user. A ctx.user variable will now be overridden by context. So now this variable becomes reserved by the library and we recommend not using it beyond the purpose of capturing user information coming via authorize re herbsjs/buchu#92
# [2.0.0](v1.6.2...v2.0.0) (2023-03-06) ### Features * **buchu:** update buchu version to 2.1.0 ([d038691](d038691)) ### BREAKING CHANGES * **buchu:** Projects that are using ctx.user. A ctx.user variable will now be overridden by context. So now this variable becomes reserved by the library and we recommend not using it beyond the purpose of capturing user information coming via authorize re herbsjs/buchu#92
Fixes and changes #90
Proposed Changes
Readiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance