-
Notifications
You must be signed in to change notification settings - Fork 16
feat: createPortalUrl #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new "portal" URL generation feature was added across the SDK. This includes new Changes
Sequence Diagram(s)sequenceDiagram
participant ClientApp
participant SDKClient
participant AuthCodeClass
participant SessionManager
participant PortalUrlUtil
ClientApp->>SDKClient: portal(options)
SDKClient->>AuthCodeClass: createPortalUrl(sessionManager, options)
AuthCodeClass->>PortalUrlUtil: createPortalUrl(sessionManager, options)
PortalUrlUtil->>SessionManager: getAccessToken()
PortalUrlUtil->>PortalUrlUtil: set up storage and context
PortalUrlUtil->>PortalUrlUtil: generatePortalUrl(domain, returnUrl, subNav)
PortalUrlUtil-->>AuthCodeClass: { url }
AuthCodeClass-->>SDKClient: { url }
SDKClient-->>ClientApp: { url }
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
lib/sdk/clients/browser/authcode-with-pkce.ts (1)
67-77
: Fix JSDoc comment - copy-paste error.The JSDoc comment on line 69 incorrectly states "return login url" but should say "return portal url".
/** * Method makes use of the `createPortalUrl` method of the AuthCodeWithPKCE - * client above to return login url. + * client above to return portal url. * @param {GeneratePortalUrlParams} options - * @returns {Promise<URL>} required authorization URL + * @returns {Promise<{url: URL}>} required portal URL */The implementation logic is correct and follows the established pattern.
lib/sdk/oauth2-flows/AuthCodeAbstract.ts (1)
75-86
: Fix JSDoc documentation to accurately describe portal URL functionalityThe abstract method signature and structure are correct, but the JSDoc comment appears to be copied from the
createAuthorizationURL
method and doesn't accurately describe the portal URL functionality./** - * Abstract method mandates implementation of logic required for creating auth URL - * in kinde client's login and register methods, as well saving state parameter to - * the session using the provided sessionManager. + * Abstract method mandates implementation of logic required for creating portal URL + * for accessing Kinde's portal interface, utilizing session data for authentication. * @param {SessionManager} sessionManager - * @param {AuthURLOptions} options - * @returns {Promise<URL>} required authorization URL + * @param {GeneratePortalUrlParams} options + * @returns {Promise<{url: URL}>} object containing the portal URL */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
package.json
is excluded by!**/*.json
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
,!**/*.yaml
tsconfig.json
is excluded by!**/*.json
📒 Files selected for processing (7)
lib/sdk/clients/browser/authcode-with-pkce.ts
(3 hunks)lib/sdk/clients/server/authorization-code.ts
(3 hunks)lib/sdk/clients/types.ts
(1 hunks)lib/sdk/oauth2-flows/AuthCodeAbstract.ts
(2 hunks)lib/sdk/oauth2-flows/AuthCodeWithPKCE.ts
(2 hunks)lib/sdk/oauth2-flows/AuthorizationCode.ts
(2 hunks)lib/sdk/utilities/createPortalUrl.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Build and test TypeScript SDK CI
lib/sdk/utilities/createPortalUrl.ts
[warning] 1-1: Prettier formatting check failed. Code style issues found. Forgot to run Prettier?
🔇 Additional comments (12)
lib/sdk/utilities/createPortalUrl.ts (1)
10-29
: LGTM! Well-structured portal URL creation logic.The implementation correctly:
- Validates session token existence before proceeding
- Sets up in-memory storage for the external utility
- Properly delegates to the
generatePortalUrl
function with all required parameters- Returns the expected format
{url: URL}
The error handling for missing sessions is appropriate and provides a clear error message.
lib/sdk/clients/types.ts (1)
15-16
: LGTM! Appropriate type exports for portal functionality.The re-exports of
PortalPage
andGeneratePortalUrlParams
from@kinde/js-utils
follow the existing pattern and are necessary to support the new portal URL generation feature.lib/sdk/clients/browser/authcode-with-pkce.ts (2)
4-4
: LGTM! Appropriate type import for portal functionality.The import of
GeneratePortalUrlParams
type is necessary for the new portal method.
395-395
: LGTM! Portal method properly exposed in client interface.The
portal
method is correctly included in the returned client interface, making it available to consumers of this client.lib/sdk/oauth2-flows/AuthorizationCode.ts (2)
10-11
: LGTM! Appropriate imports for portal functionality.The imports for
GeneratePortalUrlParams
type andcreatePortalUrl
utility function are necessary for the new portal URL generation feature.
57-73
: LGTM! Well-implemented portal URL creation method.The implementation correctly:
- Follows the abstract class contract
- Omits the
domain
parameter from options since it's provided by the config- Delegates to the shared utility function with proper domain configuration
- Has accurate JSDoc documentation and type annotations
The design properly separates concerns by using the utility function for the core logic.
lib/sdk/oauth2-flows/AuthCodeWithPKCE.ts (2)
15-16
: LGTM: Clean import additionsThe imports for the new portal URL functionality are properly added and follow the established import patterns in the file.
72-88
: LGTM: Solid implementation of portal URL generationThe
createPortalUrl
method implementation is well-structured:
- Properly implements the abstract method contract from the parent class
- Correctly uses
Omit<GeneratePortalUrlParams, 'domain'>
since domain is provided by the class configuration- Delegates to the utility function while merging the
authDomain
from config- Documentation is clear and follows the established JSDoc patterns
The implementation follows the same pattern as other methods in the class.
lib/sdk/clients/server/authorization-code.ts (3)
15-15
: LGTM: Appropriate type importThe import for
GeneratePortalUrlParams
is correctly added to support the new portal method functionality.
77-91
: LGTM: Consistent client method implementationThe
portal
method implementation follows the established patterns:
- Takes
SessionManager
andGeneratePortalUrlParams
as parameters- Delegates to the underlying client's
createPortalUrl
method- Uses proper async/await pattern
- JSDoc documentation is clear and consistent with other methods
- Returns the expected
Promise<{ url: URL }>
typeThe implementation is consistent with other client methods like
login
,register
, andcreateOrg
.
195-195
: LGTM: Proper method exposureThe
portal
method is correctly added to the returned client interface, making it available to consumers alongside other authentication methods.lib/sdk/oauth2-flows/AuthCodeAbstract.ts (1)
16-16
: LGTM: Appropriate type importThe import for
GeneratePortalUrlParams
is correctly added to support the new abstract method signature.
242789f
to
b5437c2
Compare
b5437c2
to
e358d4c
Compare
Explain your changes
Add createPortalUrl support
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.