Closed peterphanouvong closed 2 months ago
The recent changes encompass a significant refactor of user data management, including the introduction of a new asynchronous factory function, getUserOrganizationsFactory
, to retrieve user organization data. Utility functions have been enhanced for user object creation and error handling. Type definitions have been refined to improve clarity and flexibility, and TypeScript support has been integrated into the build configuration across multiple components. Additional tests have been added to ensure the correctness of the new and existing utility functions.
Files | Change Summary |
---|---|
src/handlers/setup.js , src/session/getUser.js |
Refactored user object creation to utilize generateUserObject , which adds phone_number and username . Improved error handling for expired JWT tokens. |
src/utils/generateUserObject.js , src/utils/generateUserObject.ts |
Introduced generateUserObject function for dynamic construction of user objects from provided data and properties, enhancing profile creation capabilities. |
types.d.ts |
Updated KindeUser type definition by renaming properties for clarity and adding support for custom properties. |
clientConfig/rollup.config.js , componentConfig/rollup.config.js , middlewareConfig/rollup.config.js , serverConfig/rollup.config.js |
Added @rollup/plugin-typescript to the Rollup configuration to support TypeScript files in the build process. |
src/session/index.ts |
Modified function signature to enhance type safety by explicitly typing request and response parameters. |
src/session/kindeServerClient.ts |
Removed type annotations for kindeClient , simplifying its export while potentially affecting type inference. |
src/utils/getUserProperties.ts |
Introduced getUserProperties utility function with an empty implementation for future enhancements related to user properties. |
src/utils/version.js |
Removed a semicolon from the exported version constant declaration. |
tests/frontend/utils.test.tsx , tests/frontend/utils.test.ts |
Added tests for generateUserObject and removeTrailingSlash to validate various scenarios, ensuring correct handling of user data constructs. |
src/session/getUserOrganizations.ts |
Introduced getUserOrganizationsFactory , an asynchronous function for retrieving user organization data based on session information. |
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?
Explain your changes
generateUserObject
helper functionChecklist
🛟 If you need help, consider asking for advice over in the Kinde community.