-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(structures): add SKU structure #11389
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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11389 +/- ##
==========================================
- Coverage 31.66% 31.62% -0.05%
==========================================
Files 383 385 +2
Lines 13900 13918 +18
Branches 1095 1096 +1
==========================================
Hits 4401 4401
- Misses 9365 9383 +18
Partials 134 134
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📝 WalkthroughWalkthroughThis pull request introduces a new SKU (Stock Keeping Unit) structure to the codebase. It adds a generic SKU class that extends Structure, along with an associated SKUFlagsBitField class for managing SKU-related bitfield flags. Both are exported from the structures package. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/structures/src/skus/SKU.ts`:
- Around line 63-67: The flags getter in SKU (the get flags() accessor that
reads this[kData].flags and returns new SKUFlagsBitField(this[kData].flags as
SKUFlags) or null) wrongly uses a truthy check so a value of 0 becomes null;
change the check to a nullish check (e.g., test for null/undefined) so 0 is
treated as a valid bitfield and only undefined/null returns null, and apply the
same nullish-check fix to the equivalent getters in Message.ts, Attachment.ts,
and GuildChannelMixin.ts (use the corresponding BitField classes and kData
accessors in each file).
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
packages/structures/src/bitfields/SKUFlagsBitField.tspackages/structures/src/index.tspackages/structures/src/skus/SKU.tspackages/structures/src/skus/index.ts
🧰 Additional context used
🧬 Code graph analysis (2)
packages/structures/src/skus/SKU.ts (1)
packages/structures/src/utils/symbols.ts (1)
kData(1-1)
packages/structures/src/bitfields/SKUFlagsBitField.ts (1)
packages/discord.js/typings/index.d.ts (1)
BitField(663-680)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Tests
🔇 Additional comments (3)
packages/structures/src/skus/index.ts (1)
1-1: LGTM: simple barrel export.packages/structures/src/index.ts (1)
11-11: LGTM: public export is straightforward.packages/structures/src/bitfields/SKUFlagsBitField.ts (1)
7-11: The typing pattern in SKUFlagsBitField is consistent with 4 of 5 BitField implementations in the codebase (MessageFlagsBitField, ChannelFlagsBitField, AttachmentFlagsBitField all usekeyof FlagTypedirectly). SKUFlagsBitField is actively used in production code (SKU.ts) without type errors. The claim thatkeyof SKUFlagsevaluates tonevercontradicts the actual behavior of identical patterns elsewhere in the same codebase and package. No fix is required.Likely an incorrect or invalid review comment.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
This PR will add the SKU structure, based on the documentation of the structure on the Discord API, found here.
This PR does not add tests for the associated structure.
This PR also adds a new
SKUFlagsBitFieldto/bitfields.Mentioning #10981 for visibility.