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

feat: Introduce DisplayType component that outputs pretty-printed types #306

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

blaine-arcjet
Copy link
Contributor

@blaine-arcjet blaine-arcjet commented Dec 4, 2024

This introduces an Astro component that loads a module, extracts a specified type, simplifies it by one level, and then pretty-prints it.

This will ensure that our docs always match exported types from the SDK packages and can reduce the work needed to document large types like NoseconeOptions.

It doesn't work on all types because we might want to handwrite them in a simpler fashion, such as the SensitiveInfoOptions; this is common when we have heavy use of generics.

This work also highlighted some places where we should probably export types, such as BotOptionsAllow and BotOptionsDeny.

TypeScript has a hardcoded truncation length. It is on their roadmap, but in the meantime I introduced patch-package to update the value when we do npm ci.

Lastly, I cleaned up some of the wording in the reference documentation where I introduced <DisplayType />

@blaine-arcjet blaine-arcjet requested a review from a team December 4, 2024 21:02
Copy link

vercel bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
arcjet-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 9:02pm

Copy link

socket-security bot commented Dec 4, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] environment, filesystem Transitive: eval, shell +62 2.64 MB ds300
npm/[email protected] None 0 7.83 MB prettier-bot
npm/[email protected] Transitive: environment, network +4 458 kB antfu
npm/[email protected] None 0 400 kB sindresorhus

View full report↗︎

Copy link

socket-security bot commented Dec 4, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/@typescript/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@blaine-arcjet
Copy link
Contributor Author

@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/@typescript/[email protected]

@blaine-arcjet
Copy link
Contributor Author

@SocketSecurity ignore npm/[email protected]

@davidmytton
Copy link
Contributor

Nice! Any reason why you didn't also do rate limiting, bot detection, and signup form protection?

@blaine-arcjet
Copy link
Contributor Author

Any reason why you didn't also do rate limiting, bot detection, and signup form protection?

Yes, the reason was stated as

This work also highlighted some places where we should probably export types, such as BotOptionsAllow and BotOptionsDeny.

I see that I wasn't explicit that those changes would need to be done to effectively use this component on types for those rules.

@blaine-arcjet blaine-arcjet merged commit a619a78 into main Dec 5, 2024
4 checks passed
@blaine-arcjet blaine-arcjet deleted the phated/display-type branch December 5, 2024 17:35
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.

2 participants