Skip to content
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

Convert OAuthClient to TypeScript and improve documentation #5328

Merged
merged 3 commits into from Mar 17, 2023

Conversation

robertknight
Copy link
Member

Convert oauth-client.js to TS and add additional documentation in the form of specification links and types for messages sent from the authorization popup window in h to the client.

Convert oauth-client.js to TS and add additional documentation in the form of
specification links and types for messages sent from the authorization popup
window in h to the client.
@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #5328 (f7d18a2) into main (cbccdb9) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #5328      +/-   ##
==========================================
+ Coverage   99.17%   99.18%   +0.01%     
==========================================
  Files         236      236              
  Lines        9375     9377       +2     
  Branches     2247     2247              
==========================================
+ Hits         9298     9301       +3     
+ Misses         77       76       -1     
Impacted Files Coverage Δ
src/sidebar/util/oauth-client.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

clientId: string;
tokenEndpoint: string;
authorizationEndpoint: string;
revokeEndpoint: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specific to this PR, but something that has popped my mind lately.

Would it make sense to set public properties in classes as readonly? Assuming we don't want to be able to update them, of course, but when actually having a class, I would expect updates to happen via meaningful methods, if anything, and access to properties only with read purposes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to set public properties in classes as readonly?

Hmm... I suppose there is a tradeoff between the boilerplate of readonly markers / getters for preventing re-assignment statically / dynamically vs the benefit of enforcing invariants. It will probably make sense to approach this differently depending on whether we are talking about a public API exposed to third parties vs. an internal API where we are only concerned about our own accidental misuse.

In this context the intent is that all the values are provided at construction time, although it should be safe to re-assign afterwards.

Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@robertknight robertknight merged commit c8c1e6f into main Mar 17, 2023
4 checks passed
@robertknight robertknight deleted the oauth-client-ts branch March 17, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants