kinde-oss / kinde-react-native-sdk-0-7x

Kinde React Native SDK for authentication for 0.7x
MIT License
21 stars 9 forks source link

Refactor: removed dependancies #35

Closed DanielRivers closed 4 months ago

DanielRivers commented 7 months ago

Explain your changes

This removes superagent and qs which were unused

It also refactors url-parse dependency out in favour of the native URLSearchParams

Checklist

🛟 If you need help, consider asking for advice over in the Kinde community.

Summary by CodeRabbit

coderabbitai[bot] commented 7 months ago

Walkthrough

The project updates focus on refining URL handling across various components, enhancing security and maintainability. Changes include the removal of outdated dependencies, adoption of URLSearchParams for more structured URL and parameter management, and adjustments in the OAuth flow to bolster security. A new changelog file has been introduced to document these and future modifications systematically.

Changes

File(s) Summary of Changes
CHANGELOG.md Introduced to document project changes including new features and updates.
__tests__/index.spec.ts, src/.../KindeSDK.ts Refactored URL construction using URLSearchParams for enhanced readability and maintainability.
package.json Removed dependencies qs, superagent, url-parse and updated react-native-keychain.
src/.../AuthorizationCode.ts Updated authorize method for robust PKCE flow handling and simplified URL parameter construction.

Recent Review Details **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between fa60bf1b5c776827782586691446f22ac81c4d0d and 9a7d4afc0b094b40ce356c9319c276f9ce08caf4.
Files selected for processing (5) * CHANGELOG.md (1 hunks) * __tests__/index.spec.ts (8 hunks) * package.json (1 hunks) * src/SDK/KindeSDK.ts (3 hunks) * src/SDK/OAuth/AuthorizationCode.ts (2 hunks)
Additional comments not posted (12)
src/SDK/OAuth/AuthorizationCode.ts (1)
`48-76`: The refactoring of the `authenticate` method to use `URLSearchParams` for constructing URL parameters is a solid improvement. It enhances readability and maintainability of the code.
package.json (1)
`47-47`: Updating the version constraint for `react-native-keychain` to `>= 8.0` is a prudent choice to ensure compatibility with newer versions.
src/SDK/KindeSDK.ts (2)
`188-200`: > :memo: **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [191-216] The changes in the `logout` method to use `URLSearchParams` for constructing the URL parameters are well-implemented and improve the clarity and maintainability of the code. --- `242-248`: The `getToken` method's use of `URLSearchParams` to extract parameters from the URL is a robust approach, enhancing the method's reliability in handling URL parameters.
__tests__/index.spec.ts (8)
`291-302`: Refactor URL parameter construction to use `URLSearchParams`. This change enhances readability and maintainability by adopting a more structured approach to URL parameter handling, aligning with the PR's objectives to improve URL handling across the project. --- `321-333`: Refactor URL parameter construction for registration endpoint to use `URLSearchParams`. This change is consistent with the PR's goal of enhancing URL handling by using modern JavaScript features. It improves the clarity and structure of the URL parameter construction. --- `363-365`: Refactor logout URL construction to use `URLSearchParams`. This modification simplifies the URL construction process for the logout functionality, making the code more maintainable and robust. --- `413-425`: Refactor URL parameter construction for creating an organization to use `URLSearchParams`. This change aligns with the PR's objectives by using `URLSearchParams` to handle URL parameters, which enhances the readability and maintainability of the code. --- `485-496`: Refactor URL parameter construction for authentication endpoint in Expo environment to use `URLSearchParams`. Adopting `URLSearchParams` in the Expo environment for constructing URL parameters is a positive change, enhancing the structure and readability of the code. --- `509-520`: Refactor URL parameter construction for registration endpoint in Expo environment to use `URLSearchParams`. This change continues the trend of improving URL handling within the project by utilizing `URLSearchParams`, which is beneficial for maintaining a consistent and clean approach across different environments. --- `534-536`: Refactor logout URL construction in Expo environment to use `URLSearchParams`. The use of `URLSearchParams` for constructing logout URLs in the Expo environment aligns with the overall improvements made in URL handling across the project. --- `578-590`: Refactor URL parameter construction for creating an organization in Expo environment to use `URLSearchParams`. This modification is consistent with the PR's objectives to enhance URL handling by using modern JavaScript features, improving the clarity and structure of the URL parameter construction in different environments.
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.