Closed peterphanouvong closed 1 week ago
The pull request introduces significant changes across multiple files, primarily focusing on the refactoring of the setup
function to improve user claims retrieval from tokens. The previous asynchronous calls have been replaced with direct property accesses from the tokens. Additionally, a new factory function for organization data retrieval has been added, and enhancements to session management have been implemented, including better cookie handling and error management. The changes also include the addition of new tests for the generateOrganizationObject
function and the removal of outdated tests for the generateUserObject
function.
File | Change Summary |
---|---|
src/handlers/setup.ts | Refactored setup function to retrieve user claims directly from tokens; added error check for claims. |
src/session/getOrganization.js | Deleted file containing factory function for organization data retrieval based on session information. |
src/session/getOrganization.ts | Added factory function to fetch organization data using session tokens; includes error handling. |
src/session/sessionManager.js | Enhanced session item handling and cookie management; added MAX_LENGTH constant and splitString function. Updated methods for better error handling and cleanup. |
src/utils/generateOrganizationObject.ts | Introduced getOrgProperty function for modular property retrieval; modified generateOrganizationObject to use this new function. |
tests/frontend/generate-organization-object.test.ts | New test suite for generateOrganizationObject covering various scenarios. |
tests/frontend/generate-user-object.test.ts | New test suite for generateUserObject function covering various scenarios. |
tests/frontend/utils.test.ts | Removed entire test suite for generateUserObject function. |
src/routerClients/PagesRouterClient.js | Updated session management logic to use pageRouterSessionManager instead of sessionManager . |
src/session/getUser.ts | Modified getUserFactory to clarify handling of id_token by introducing an intermediate variable. |
setup
function in src/handlers/setup.js
, enhancing user object creation and error handling.setup
function in src/handlers/setup.ts
, aligning with the main PR on user properties handling from tokens.getIdToken
function, relevant to token handling similar to the changes in the main PR.[!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
> If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.src/session/sessionManager.js
Oops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-jest". (The package "eslint-plugin-jest" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm install eslint-plugin-jest@latest --save-dev The plugin "eslint-plugin-jest" was referenced from the config file in ".eslintrc.json". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
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
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.