-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: add audit metrics for authenticated access #42
Conversation
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
node/metrics/useQuote.ts
Outdated
} | ||
|
||
return metric | ||
} as UseQuoteMetric |
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.
You had to do this cast because you made UseQuoteMetric
into a class, so Typescript won't recognize an object created directly like this one as having that type, only objects created with new UseQuoteMetric
. They're not 100% equivalent in the end, so Typescript is right. Better to make UseQuoteMetric
a regular type or interface like I suggested further above.
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.
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.
That's just asking you to use interface
instead of type
. So you'd do interface UseQuoteFieldsMetric {
instead of type UseQuoteFieldsMetric = {
. Note that interface
in Typescript is just a way of defining an object type, it's nothing like interfaces in Java or in other languages.
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.
type
and interface
are almost the same thing in Typescript, but interface
allows extending from other interfaces, which helps abstract types by their superclass names and avoiding repetition. So it's usually preferred, unless you want to do some operations that only work with type
(such as &
).
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.
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.
@Rudge it works of course, and it's ok if you insist. But it feels like you're writing in a different language, it's weird for other devs reading it. Dropping the class and keeping the duplication when creating the object directly, as the code was already doing, would be more in sync with the usual JS way of coding. Classes are generally only used when you really get the benefit of having instances due to complex calculations within methods, but they're never used just to hold data like this (this is the first time I've seen it actually hehe).
It's a language thing, I know that other languages heavily use classes, but JS is the opposite. The class syntax exists, but it's very new and it's actually not implemented in the same way behind the scenes. So you'll notice that JS codebases tend to be almost functional.
Kudos, SonarCloud Quality Gate passed! 0 Bugs 0.0% Coverage The version of Java (11.0.17) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
Your PR has been merged! App is being published. 🚀 After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:
After that your app will be updated on all accounts. For more information on the deployment process check the docs. 📖 |
What problem is this solving?
We need to monitor the access in the app, checking the graphql operations with authentication access.
How to test it?
Workspace
Screenshots or example usage: