Add username query functionality and utilities with tests#2680
Add username query functionality and utilities with tests#2680KiroFyzu wants to merge 6 commits into
Conversation
|
Thanks for opening this pull request and contributing to the project! The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch. In the meantime, anyone in the community is encouraged to test this pull request and provide feedback. ✅ How to confirm it worksIf you’ve tested this PR, please comment below with: This helps us speed up the review and merge process. 📦 To test this PR locally:If you encounter any issues or have feedback, feel free to comment as well. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
👮 Files not reviewed due to content moderation or server errors (8)
📝 Walkthrough
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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.
1 issue found across 8 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This pull request introduces support for WhatsApp username lookups and utilities for handling username keys. It adds new API methods for querying usernames, utility functions for generating and validating username keys, and comprehensive tests for these new features. Additionally, it updates the documentation and improves protocol parsing for username fields.
WhatsApp Username Lookup and Utilities
API and Type Additions:
WAUsernameQuery,WAUsernameLookupResult,WAUsernameInfo) tosrc/Types/Socket.tsto support username queries and results.onWhatsAppUsernameandfetchUsernamemethods inmakeSocket(insrc/Socket/socket.ts) for username-based lookups and fetching usernames by JID. [1] [2]src/Utils/index.tsto include new username utilities.Username Key Utilities:
src/Utils/username.tswith utility functions for validating, generating, and working with username keys (e.g.,isValidUsernameKey,makeRandomUsernameKey).Protocol and Parsing Improvements:
USyncUsernameProtocolto parse username fields from both string and buffer content, ensuring compatibility with different response formats.Testing:
src/__tests__/Utils/username.test.ts) and USync username protocol parsing (src/__tests__/WAUSync/username.test.ts). [1] [2]Documentation:
README.mdto reference the new package source.Summary by cubic
Adds username lookup via new socket APIs and username-key utilities. Improves USync username parsing, adds types, tests, and README docs.
onWhatsAppUsernameandfetchUsernameinmakeSocketfor username lookups and fetching by JID.isValidUsernameKey,isRepeatedDigitUsernameKey,makeRepeatedDigitUsernameKey,makeRandomUsernameKey(exported viasrc/Utils/index.ts).USyncUsernameProtocolto parse usernames from strings and buffers; addedWAUsernameQuery,WAUsernameLookupResult, andWAUsernameInfotypes. Added unit tests and updated README.Written for commit ffc47a4. Summary will update on new commits.