Skip to content

SDKS-3938: Migrate device client#318

Merged
ancheetah merged 4 commits into
mainfrom
SDKS-3938-update-device-client
Jun 12, 2025
Merged

SDKS-3938: Migrate device client#318
ancheetah merged 4 commits into
mainfrom
SDKS-3938-update-device-client

Conversation

@ancheetah
Copy link
Copy Markdown
Collaborator

JIRA Ticket

https://pingidentity.atlassian.net/browse/SDKS-3938

Description

  • Copied device client package from legacy sdk to unified sdk
  • adds manual e2e test scripts

No changeset. Added device client package and e2e app to changeset ignore

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2025

⚠️ No Changeset found

Latest commit: a3f4d67

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
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Jun 5, 2025

View your CI Pipeline Execution ↗ for commit a3f4d67.

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

☁️ Nx Cloud last updated this comment at 2025-06-11 19:42:49 UTC

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 39 lines in your changes missing coverage. Please review.

Project coverage is 61.66%. Comparing base (3129a9e) to head (a3f4d67).

Files with missing lines Patch % Lines
...s/device-client/src/lib/device.store.test.utils.ts 78.57% 33 Missing ⚠️
packages/device-client/src/lib/device.store.ts 97.94% 3 Missing ⚠️
packages/device-client/src/lib/types/index.ts 0.00% 2 Missing ⚠️
packages/device-client/src/types.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #318       +/-   ##
===========================================
+ Coverage   48.16%   61.66%   +13.49%     
===========================================
  Files          29       33        +4     
  Lines        1715     1985      +270     
  Branches      192      288       +96     
===========================================
+ Hits          826     1224      +398     
+ Misses        889      761      -128     
Files with missing lines Coverage Δ
...ckages/device-client/src/lib/device.store.utils.ts 100.00% <100.00%> (ø)
packages/device-client/src/lib/services/index.ts 100.00% <100.00%> (+98.73%) ⬆️
.../device-client/src/lib/types/bound-device.types.ts 100.00% <ø> (ø)
packages/device-client/src/lib/types/oath.types.ts 100.00% <ø> (ø)
...evice-client/src/lib/types/profile-device.types.ts 100.00% <100.00%> (ø)
...s/device-client/src/lib/types/push-device.types.ts 100.00% <ø> (ø)
...ages/device-client/src/lib/types/webauthn.types.ts 100.00% <ø> (ø)
packages/device-client/src/types.ts 50.00% <50.00%> (ø)
packages/device-client/src/lib/types/index.ts 14.28% <0.00%> (-2.39%) ⬇️
packages/device-client/src/lib/device.store.ts 95.05% <97.94%> (+94.00%) ⬆️
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

Deployed ff8be35 to https://ForgeRock.github.io/ping-javascript-sdk/pr-318/ff8be35c780c436dfdfa0f494a68e92a49582e70 branch gh-pages in ForgeRock/ping-javascript-sdk

@ancheetah ancheetah force-pushed the SDKS-3938-update-device-client branch from 3ab8247 to 22a1021 Compare June 5, 2025 20:14
Copy link
Copy Markdown
Collaborator

@cerebrl cerebrl left a comment

Choose a reason for hiding this comment

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

I think this is really well done. I like the reuse of the autoscript for this particular context. It's super clean. Let's just discuss whether we want to carryover RxJS into this repo or not.

Comment thread packages/device-client/src/lib/mock-data/msw-mock-data.ts
Comment on lines 7 to +14
export type OathDevice = {
id: string;
_id: string;
deviceManagementStatus: boolean;
deviceName: string;
uuid: string;
createdDate: Date;
lastAccessDate: Date;
createdDate: number;
lastAccessDate: number;
_rev: 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.

This reminds me of a MongoDB document. I wonder if they are using a NoSQL data store for storying this info.

Comment thread e2e/device-client-app/src/autoscript.ts Outdated
return response.data;
return response.data.result;
} catch (error) {
return { error };
Copy link
Copy Markdown
Collaborator

@cerebrl cerebrl Jun 6, 2025

Choose a reason for hiding this comment

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

@ryanbas21 Should these methods return the GenericError type that we settled on in DaVinci Client? My thought is that we should probably be consistent with errors throughout this SDK suite.

} from './mock-data/msw-mock-data.js';

// Create handlers
export const handlers = [
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.

I feel like this array of handlers should be moved to its own file. That would shorten this file up and make it a bit more readable.

Copy link
Copy Markdown
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.

Honestly, this is excellent work. This looks fantastic. I'm just leaving a comment regarding the rxjs discussion

Comment thread e2e/device-client-app/src/autoscript.ts Outdated
@ancheetah ancheetah marked this pull request as ready for review June 10, 2025 22:54
@ancheetah
Copy link
Copy Markdown
Collaborator Author

  • updated device client test user to avoid conflicts with Stoyan's automated tests
  • moved msw handlers to their own file
  • updated device client delete methods to return null
  • updated device client integration tests
  • removed rxjs from e2e tests and replaced with Effect

@ancheetah ancheetah requested review from cerebrl and ryanbas21 June 10, 2025 22:55
Copy link
Copy Markdown
Collaborator

@cerebrl cerebrl left a comment

Choose a reason for hiding this comment

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

Initial scan looks good. Just a few small comments.

return undefined;
}
if (error) {
handleError(error, 'Failed to delete device: ');
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.

I feel like we should use handleError consistently throughout these store methods. Is there a reason we only use it in some?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was just trying not to fix what wasn't broken. The other get/update methods originally didn't handle errors from RTK. They just check for data and if it's missing it'll throw a 'response did not contain data' error. To be more consistent I can update the other methods to check for errors first before returning data.

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.

Fair enough. We can improve this in the future.

endpoints: (builder) => ({
// oath endpoints
getOAthDevices: builder.query<OAthResponse, RetrieveOathQuery>({
getOAthDevices: builder.query<OathResponse, RetrieveOathQuery>({
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.

Can we change OAth to Oath?

@ancheetah ancheetah force-pushed the SDKS-3938-update-device-client branch from e672208 to a3f4d67 Compare June 11, 2025 19:40
Copy link
Copy Markdown
Collaborator

@cerebrl cerebrl left a comment

Choose a reason for hiding this comment

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

I think this is good for the migration story. I'll make a few improvement stories in Jira to continue iterating on this foundation.

@ancheetah ancheetah merged commit 0b9f15d into main Jun 12, 2025
4 checks passed
@ancheetah ancheetah deleted the SDKS-3938-update-device-client branch June 12, 2025 15:24
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