Skip to content

refactor: remove @forgerock/javascript-sdk dependency from device-client and e2e app - #816

Draft
ryanbas21 wants to merge 3 commits into
mainfrom
refactor/remove-javascript-sdk-from-device-client
Draft

refactor: remove @forgerock/javascript-sdk dependency from device-client and e2e app#816
ryanbas21 wants to merge 3 commits into
mainfrom
refactor/remove-javascript-sdk-from-device-client

Conversation

@ryanbas21

Copy link
Copy Markdown
Collaborator

Summary

Removes the legacy @forgerock/javascript-sdk runtime dependency from two places:

  1. packages/device-clientConfigOptions now aliases LegacyConfigOptions from @forgerock/sdk-types, removing the @forgerock/javascript-sdk dependency entirely.
  2. e2e/device-client-app — migrated from @forgerock/javascript-sdk to @forgerock/journey-client + @forgerock/oidc-client.

Config mapping (legacy → new clients)

Legacy (Config / javascript-sdk) New (journey-client / oidc-client)
serverConfig.baseUrl OIDC/Journey client serverConfig
realmPath realmPath on the respective client config
clientId clientId on OIDC client config
token.get() (manual renew) token.get({ backgroundRenew: true })
platformHeader dropped — unsupported by new clients

Behavior notes

  • Token flow is now background-renew based (backgroundRenew: true).
  • oidc() error results are validated before caching (previously errors could be cached).
  • Logout errors are no longer silently ignored.
  • platformHeader param dropped (not supported by the new clients).
  • The @forgerock/javascript-sdk catalog entry is intentionally kepttools/interface-mapping-validator still uses it.

Verification

  • device-client build / lint / test ✅
  • device-client-app build / lint / typecheck / dev-server ✅
  • journey-suites e2e: 15 passed / 0 failed
  • No automated suite covers device-client-app — validated via manual tenant harness.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e7cf5ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@nx-cloud

nx-cloud Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e7cf5ef

Command Status Duration Result
nx run-many -t build --no-agents ✅ Succeeded <1s View ↗
nx affected -t build lint test typecheck e2e-ci ✅ Succeeded 2m 41s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-09 22:04:59 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@forgerock/davinci-client

pnpm add https://pkg.pr.new/@forgerock/davinci-client@816

@forgerock/device-client

pnpm add https://pkg.pr.new/@forgerock/device-client@816

@forgerock/journey-client

pnpm add https://pkg.pr.new/@forgerock/journey-client@816

@forgerock/oidc-client

pnpm add https://pkg.pr.new/@forgerock/oidc-client@816

@forgerock/protect

pnpm add https://pkg.pr.new/@forgerock/protect@816

@forgerock/sdk-types

pnpm add https://pkg.pr.new/@forgerock/sdk-types@816

@forgerock/sdk-utilities

pnpm add https://pkg.pr.new/@forgerock/sdk-utilities@816

@forgerock/iframe-manager

pnpm add https://pkg.pr.new/@forgerock/iframe-manager@816

@forgerock/sdk-logger

pnpm add https://pkg.pr.new/@forgerock/sdk-logger@816

@forgerock/sdk-oidc

pnpm add https://pkg.pr.new/@forgerock/sdk-oidc@816

@forgerock/sdk-request-middleware

pnpm add https://pkg.pr.new/@forgerock/sdk-request-middleware@816

@forgerock/storage

pnpm add https://pkg.pr.new/@forgerock/storage@816

commit: e7cf5ef

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Deployed faf19eb to https://ForgeRock.github.io/ping-javascript-sdk/pr-816/faf19eb620411d968e0c25495f326d9012ffee8f branch gh-pages in ForgeRock/ping-javascript-sdk

@codecov-commenter

codecov-commenter commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 24.35%. Comparing base (eafe277) to head (e7cf5ef).
⚠️ Report is 135 commits behind head on main.

❌ Your project status has failed because the head coverage (24.35%) 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     #816      +/-   ##
==========================================
+ Coverage   18.07%   24.35%   +6.28%     
==========================================
  Files         155      164       +9     
  Lines       24398    25823    +1425     
  Branches     1203     1703     +500     
==========================================
+ Hits         4410     6290    +1880     
+ Misses      19988    19533     -455     
Files with missing lines Coverage Δ
packages/device-client/src/lib/device.store.ts 80.21% <ø> (ø)
packages/device-client/src/lib/types/index.ts 14.28% <ø> (ø)

... and 26 files with indirect coverage changes

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

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Analysis

📦 Bundle Size Analysis

🆕 New Packages

🆕 @forgerock/device-client - 0.0 KB (new)
🆕 @forgerock/device-client - 10.0 KB (new)
🆕 @forgerock/journey-client - 0.0 KB (new)
🆕 @forgerock/journey-client - 93.8 KB (new)

📊 Minor Changes

📈 @forgerock/sdk-types - 9.1 KB (+0.0 KB)

➖ No Changes

@forgerock/recognize - 4284.4 KB
@forgerock/oidc-client - 35.5 KB
@forgerock/storage - 1.5 KB
@forgerock/iframe-manager - 3.2 KB
@forgerock/sdk-logger - 1.6 KB
@forgerock/sdk-oidc - 5.7 KB
@forgerock/sdk-request-middleware - 4.6 KB
@forgerock/sdk-utilities - 18.8 KB
@forgerock/protect - 144.6 KB
@forgerock/davinci-client - 59.7 KB


15 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

@ryanbas21
ryanbas21 force-pushed the refactor/remove-javascript-sdk-from-device-client branch from e2d67ec to c4f8ecb Compare September 9, 2026 16:00

@ancheetah ancheetah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tysm for doing this! Looks good, just a couple questions. Would be great if we could get a ticket on the board to align the Device Client config with our other clients so you could pass around the same config object.

I still need to verify the tests manually but I'll let you know how it goes.

* of the MIT license. See the LICENSE file for details.
*/
import { type ConfigOptions } from '@forgerock/javascript-sdk';
import { type ConfigOptions } from './types/index.js';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this a circular dependency? Should we import it from sdk-types package instead?

import type { LegacyConfigOptions as ConfigOptions } from '@forgerock/sdk-types';

export type { ConfigOptions } from '@forgerock/javascript-sdk';
import type { LegacyConfigOptions } from '@forgerock/sdk-types';

export type ConfigOptions = LegacyConfigOptions;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this technically a breaking change we need to be concerned about? The tokenStore option now accepts CustomStorageObject instead of TokenStoreObject (legacy). This change makes sense and I know most of the properties in this config object are ignored by device client, including tokenStore, but if someone was previously passing a TokenStoreObject then this breaks for them.

@@ -1,63 +1,66 @@
/*
*
* Copyright © 2025 Ping Identity Corporation. All right reserved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

copyright should be 2025 - 2026

Comment on lines +125 to +128
yield* Effect.tryPromise({
try: () => oidcClientOrThrow().user.logout(),
catch: (err) => new Error(`Logout failed: ${err}`),
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need this? If we are starting the app from a fresh state then won't this always fail preventing you from proceeding?

if (response && 'error' in response) {
throw new Error(`Failed to get user info: ${response.error}`);
}
return response as unknown as Record<string, string>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nitpick but I don't think we need this cast. We have a better typed user response in the new oidc client. The device app only uses user.sub which I think is guaranteed from the new type.

Comment on lines +48 to +50
const callNext = (client: JourneyClient, step: JourneyResult) =>
Effect.tryPromise({
try: () => FRAuth.next(step),
try: () => client.next(step as Parameters<JourneyClient['next']>[0]),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Another nitpick but I don't think we need this cast either if you type the step parameter as JourneyStep

…ypes

ConfigOptions now aliases LegacyConfigOptions from @forgerock/sdk-types,
removing the runtime dependency on @forgerock/javascript-sdk. The catalog
entry remains for tools/interface-mapping-validator.
…lient

Replaces @forgerock/javascript-sdk usage with journey-client and
oidc-client. Token renewal now uses backgroundRenew and oidc() error
results are validated before caching. platformHeader is dropped as it
is unsupported by the new clients. Lockfile updates included here.
Addresses mend scan findings for transitive CVEs:
- fast-uri ^3.1.6 -> ^3.1.7
- undici ^7.29.0 -> ^7.29.1

vitest (CVE-2026-84373) is intentionally not touched here and will be
updated separately.
@ryanbas21
ryanbas21 force-pushed the refactor/remove-javascript-sdk-from-device-client branch from c4f8ecb to e7cf5ef Compare September 9, 2026 22:00
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.

3 participants