Repository navigation
feat(plugin-gateway): add valueOf, resolveIdentifier, widgetImageURL and channel count - #221
Merged
Merged
Conversation
|
✅ Clean pass · Architecture Data flow View
Tip The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: the full single-commit diff, checked against the surrounding plugin-gateway managers, ReactionEmoji, Widget and the cache helpers.
DataManager#valueOf(): returns the manager's cache, matching discord.js.GuildEmojiManager#resolveIdentifier(): resolves aGuildEmoji, a cached emoji ID (sync or async throughwhenAll) or falls back toReactionEmoji.resolveIdentifier. The throw-instead-of-nulldeviation is documented in the changeset.GuildManager#widgetImageURL(): resolves a guild, an ID or anything withguildId, and throws the newGuildResolveerror otherwise.GuildChannelManager#channelCountWithoutThreads: counts through the internalChannelManager#_countInGuildover the raw store, reusingiterableCache()andguard(), soCacheNotIterableandcacheErrorsbehave likelistCached.- Tests, changeset and spec: runtime tests across sync, default and async caches, plus a type-level consumption test.
ℹ️ Nitpicks
GuildManager#widgetImageURLrebuilds the same${RouteBases.api}${Routes.guildWidgetImage(id)}?style=${style}string asWidget#imageURL(structures/guilds/Widget.ts:89). A shared helper would keep the two from drifting.- In
tests/guild-manager-methods.test.ts,GIVEN a synchronous cache THEN the count is synchronousoverlaps with the thread test just above it, which already asserts a synchronoustoBe(1). One of the two could go.
claude-sonnet-5-5 | 𝕏
7 of 11 tasks
9 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🔗 Linked issue
Refs #216
🧭 Context
#216 tracks discord.js manager parity for
@wolfstar/plugin-gateway. It is split into several PRs; this first one carries the small manager methods, so the issue stays open.📚 Description
Adds four small discord.js manager members:
DataManager#valueOf(),GuildEmojiManager#resolveIdentifier(),GuildManager#widgetImageURL(guild, style?)andGuildChannelManager#channelCountWithoutThreads.Where this departs from the plan on the issue:
guild.members,guild.roles,guild.presencesandguild.voiceStatesin the plan landed in feat(plugin-gateway): add guild managers with caches keyed by id #219 while this PR was in progress. I had drafted them as thin views; that code is dropped.rawFetchGuildActiveThreadsis skipped, nothing would consume it.Widget#imageURLalready exists, sowidgetImageURLis only the manager-level counterpart.resolveIdentifierthrows for a value it cannot resolve, where discord.js returnsnull. An uncached emoji ID still answersnull.channelCountWithoutThreadsenumerates the raw channel store (GuildChannelManagerhas no cache of its own), so it throwsCacheNotIterablewhen the store cannot enumerate its entries.Design notes are in
docs/superpowers/specs/2026-10-06-guild-manager-methods-design.md.Key changes
DataManager#valueOf()GuildEmojiManager#resolveIdentifier()GuildManager#widgetImageURL()guildId; throwsGuildResolve.GuildChannelManager#channelCountWithoutThreadsCacheRead<number>: guild channels in the channel store, threads excluded.Verification:
pnpm lint,pnpm build,pnpm typecheckandpnpm testall pass locally (109 test files, 1508 tests). The new tests run against a synchronous cache, the defaultCollectionCacheand an asynchronous store, plus a type-level consumption test.Type of Change
Pre-flight Checklist
pnpm changeset(orpnpm changeset add --emptyif no release is needed). See .changeset/README.md.