Skip to content

Conversation

cerebrl
Copy link
Collaborator

@cerebrl cerebrl commented Aug 6, 2025

JIRA Ticket

SDKS-4251

Description

Complete userinfo endpoint work and improve error typing across SDK.

Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: 6c06e70

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@forgerock/oidc-client Minor
@forgerock/storage Minor
@forgerock/davinci-client Minor
@forgerock/sdk-types Minor
@forgerock/sdk-oidc Minor
@forgerock/sdk-utilities Minor
@forgerock/iframe-manager Minor
@forgerock/sdk-logger Minor
@forgerock/sdk-request-middleware Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

nx-cloud bot commented Aug 6, 2025

View your CI Pipeline Execution ↗ for commit 6c06e70

Command Status Duration Result
nx run-many -t build ✅ Succeeded <1s View ↗
nx affected -t build typecheck lint test e2e-ci ✅ Succeeded 1m View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-07 22:06:36 UTC

@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.42%. Comparing base (ccf3fc1) to head (6c06e70).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/davinci-client/src/lib/node.slice.ts 33.33% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (33.33%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #363      +/-   ##
==========================================
+ Coverage   52.26%   60.42%   +8.15%     
==========================================
  Files          20       32      +12     
  Lines        1588     2044     +456     
  Branches      188      290     +102     
==========================================
+ Hits          830     1235     +405     
- Misses        758      809      +51     
Files with missing lines Coverage Δ
packages/davinci-client/src/lib/client.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/node.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/node.slice.ts 78.44% <33.33%> (ø)

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

github-actions bot commented Aug 6, 2025

Deployed 943b676 to https://ForgeRock.github.io/ping-javascript-sdk/pr-363/943b676a92368e29712bfb59020adf8ee6b86cad branch gh-pages in ForgeRock/ping-javascript-sdk

Copy link
Contributor

github-actions bot commented Aug 6, 2025

📦 Bundle Size Analysis

📦 Bundle Size Analysis

🚨 Significant Changes

🔺 @forgerock/oidc-client - 17.9 KB (+4.3 KB, +31.3%)

📊 Minor Changes

📉 @forgerock/davinci-client - 34.1 KB (-0.2 KB)
📈 @forgerock/sdk-types - 5.9 KB (+0.3 KB)
📉 @forgerock/storage - 1.4 KB (-0.0 KB)

➖ No Changes

@pingidentity/protect - 108.4 KB
@forgerock/device-client - 9.2 KB
@forgerock/sdk-utilities - 4.0 KB
@forgerock/sdk-oidc - 3.5 KB
@forgerock/sdk-request-middleware - 4.2 KB
@forgerock/sdk-logger - 1.6 KB
@forgerock/iframe-manager - 2.4 KB


11 packages analyzed • Baseline from latest main build

Legend

🆕 New package
🔺 Size increased
🔻 Size decreased
➖ No change

ℹ️ How bundle sizes are calculated
  • Current Size: Total gzipped size of all files in the package's dist directory
  • Baseline: Comparison against the latest build from the main branch
  • Files included: All build outputs except source maps and TypeScript build cache
  • Exclusions: .map, .tsbuildinfo, and .d.ts.map files

🔄 Updated automatically on each push to this PR

config: OidcConfig,
options: GetAuthorizationUrlOptions,
) {
): Micro.Micro<never, AuthorizeErrorResponse, never> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may have spoken about this but why do we only return an error here? it feels odd?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we spoke about this very piece of code in our meeting, but let me know if you have any follow up questions.

Copy link
Collaborator

@ancheetah ancheetah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left a few comments just for typos.

Comment on lines 172 to 174
* @param code - The authorization code received from the authorization server.
* @param state - The state parameter from the authorization URL creation.
* @param options - Optional storage configuration for persisting tokens.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params are missing documented types

* @param code - The authorization code received from the authorization server.
* @param state - The state parameter from the authorization URL creation.
* @param options - Optional storage configuration for persisting tokens.
* @returns {Promise<TokenExchangeErrorResponse | OauthTokens>}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the return type here should be updated to Promise<TokenExchangeResponse | GenericError | TokenExchangeErrorResponse>

/**
* @function info - Retrieves user information using the userinfo endpoint from the wellknown configuration.
* It requires an access token stored in the configured storage.
* @returns {Promise<AuthorizeErrorResponse | any>} - Returns a promise that resolves to user information or an error response.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return type should be Promise<GenericError | TokenExchangeResponse>

* @param {WellKnownResponse} wellknown - The well-known configuration for the OIDC server.
* @param {OidcConfig} config - The OIDC client configuration.
* @param {OptionalAuthorizeOptions} options - Optional parameters for the authorization request.
* @description Builds the authorization options for the OIDC client.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate. already a description above

config: OidcConfig,
options: GetAuthorizationUrlOptions,
) {
): Micro.Micro<[string, OidcConfig, GetAuthorizationUrlOptions], AuthorizeErrorResponse, never> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing wrong here. Just wanted to mention that I really like when you include the return types for effects on functions like you did here. It helps me better understand the return type without having to hover over for intellisense.

Copy link
Collaborator

@ryanbas21 ryanbas21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just two small comments

),
).pipe(
Micro.map(({ data, error }) => {
if (error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not fail here? I know RTK doesn't error, but i'm curious if there's any benefit to us manually handling it this way instead?

The benefit I see is more explicit handling of error paths rather than inter-mixing it as much in the success.

Small benefit perhaps. Nothing major.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I can make this change.

if ('status' in error) {
status = error.status;
}
return {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious if we added readonly _tag property if we would get the benefit of Error discrimination without using the Micro.TaggedError class

@cerebrl cerebrl merged commit b917bb2 into main Aug 8, 2025
3 checks passed
@cerebrl cerebrl deleted the oidc-userinfo branch August 8, 2025 16:59
@ryanbas21 ryanbas21 mentioned this pull request Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants