fix(journey-client): align config with DaVinci and OIDC clients#557
fix(journey-client): align config with DaVinci and OIDC clients#557
Conversation
…gOptions Allow the same config object to be shared across journey-client, davinci-client, and oidc-client. Properties like clientId, scope, and redirectUri are accepted but not used — a warning is logged when they are provided.
🦋 Changeset detectedLatest commit: d78e883 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
📝 WalkthroughWalkthroughThis change aligns Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
View your CI Pipeline Execution ↗ for commit d78e883
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/journey-client/src/lib/client.store.ts`:
- Around line 89-110: The code currently warns only for top-level ignored keys
via ignoredProperties/providedIgnored, so serverConfig.timeout is silently
ignored; update the check to detect nested serverConfig.timeout (e.g., inspect
config.serverConfig?.timeout) and include it in the warning (or add 'timeout' to
ignoredProperties when appropriate) so that the log.warn call reports when
timeout is provided but not used by journey-client; reference the existing
identifiers ignoredProperties, providedIgnored, config and the
wellknown/serverConfig usage to locate where to add the nested check and include
the key in the joined warning string.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 67c4f0be-178a-450f-92f1-0c7cf246840d
📒 Files selected for processing (5)
.changeset/journey-client-config-alignment.mdpackages/journey-client/src/lib/client.store.test.tspackages/journey-client/src/lib/client.store.tspackages/journey-client/src/lib/config.types.test-d.tspackages/journey-client/src/lib/config.types.ts
| const ignoredProperties = [ | ||
| 'callbackFactory', | ||
| 'clientId', | ||
| 'middleware', | ||
| 'oauthThreshold', | ||
| 'platformHeader', | ||
| 'prefix', | ||
| 'realmPath', | ||
| 'redirectUri', | ||
| 'scope', | ||
| 'tokenStore', | ||
| 'tree', | ||
| 'type', | ||
| ] as const; | ||
|
|
||
| const providedIgnored = ignoredProperties.filter((prop) => config[prop] !== undefined); | ||
|
|
||
| if (providedIgnored.length > 0) { | ||
| log.warn( | ||
| `The following configuration properties are not used by journey-client and will be ignored: ${providedIgnored.join(', ')}`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
serverConfig.timeout is silently ignored without a warning.
JourneyServerConfig now accepts timeout, but this warning path only checks top-level keys. Since only wellknown is read later, timeout is effectively ignored with no signal to callers.
🔧 Proposed fix
const ignoredProperties = [
'callbackFactory',
'clientId',
'middleware',
'oauthThreshold',
'platformHeader',
'prefix',
'realmPath',
'redirectUri',
'scope',
'tokenStore',
'tree',
'type',
] as const;
- const providedIgnored = ignoredProperties.filter((prop) => config[prop] !== undefined);
+ const providedIgnored = ignoredProperties.filter(
+ (prop) => Object.prototype.hasOwnProperty.call(config, prop) && config[prop] !== undefined,
+ );
+
+ if (config.serverConfig?.timeout !== undefined) {
+ providedIgnored.push('serverConfig.timeout' as (typeof ignoredProperties)[number]);
+ }
if (providedIgnored.length > 0) {
log.warn(
`The following configuration properties are not used by journey-client and will be ignored: ${providedIgnored.join(', ')}`,
);
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/journey-client/src/lib/client.store.ts` around lines 89 - 110, The
code currently warns only for top-level ignored keys via
ignoredProperties/providedIgnored, so serverConfig.timeout is silently ignored;
update the check to detect nested serverConfig.timeout (e.g., inspect
config.serverConfig?.timeout) and include it in the warning (or add 'timeout' to
ignoredProperties when appropriate) so that the log.warn call reports when
timeout is provided but not used by journey-client; reference the existing
identifiers ignoredProperties, providedIgnored, config and the
wellknown/serverConfig usage to locate where to add the nested check and include
the key in the joined warning string.
@forgerock/davinci-client
@forgerock/device-client
@forgerock/journey-client
@forgerock/oidc-client
@forgerock/protect
@forgerock/sdk-types
@forgerock/sdk-utilities
@forgerock/iframe-manager
@forgerock/sdk-logger
@forgerock/sdk-oidc
@forgerock/sdk-request-middleware
@forgerock/storage
commit: |
|
Deployed fa4a263 to https://ForgeRock.github.io/ping-javascript-sdk/pr-557/fa4a263c34ee6242fc9edcc0765a404a62f6445a branch gh-pages in ForgeRock/ping-javascript-sdk |
📦 Bundle Size Analysis📦 Bundle Size Analysis🆕 New Packages🆕 @forgerock/journey-client - 89.1 KB (new) ➖ No Changes➖ @forgerock/sdk-logger - 1.6 KB 13 packages analyzed • Baseline from latest Legend🆕 New package ℹ️ How bundle sizes are calculated
🔄 Updated automatically on each push to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (14.83%) is below the target coverage (40.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #557 +/- ##
===========================================
- Coverage 70.90% 14.83% -56.08%
===========================================
Files 53 153 +100
Lines 2021 26282 +24261
Branches 377 1057 +680
===========================================
+ Hits 1433 3899 +2466
- Misses 588 22383 +21795
🚀 New features to boost your workflow:
|
Summary
JourneyClientConfigfromAsyncLegacyConfigOptionsso the same config object can be shared across journey-client, davinci-client, and oidc-clientclientId,scope, andredirectUriare now accepted but ignored — a warning is logged when they are providedserverConfig.wellknownremains requiredTest plan
JourneyClientConfigextendsAsyncLegacyConfigOptionsserverConfig.wellknownis required (negative@ts-expect-errortest)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
timeoutproperty for configuring request timeoutsDocumentation
serverConfig.wellknownis required