SDKS-3938: Migrate device client#318
Conversation
|
|
View your CI Pipeline Execution ↗ for commit a3f4d67.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAttention: Patch coverage is
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
🚀 New features to boost your workflow:
|
|
Deployed ff8be35 to https://ForgeRock.github.io/ping-javascript-sdk/pr-318/ff8be35c780c436dfdfa0f494a68e92a49582e70 branch gh-pages in ForgeRock/ping-javascript-sdk |
3ab8247 to
22a1021
Compare
cerebrl
left a comment
There was a problem hiding this comment.
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.
| export type OathDevice = { | ||
| id: string; | ||
| _id: string; | ||
| deviceManagementStatus: boolean; | ||
| deviceName: string; | ||
| uuid: string; | ||
| createdDate: Date; | ||
| lastAccessDate: Date; | ||
| createdDate: number; | ||
| lastAccessDate: number; | ||
| _rev: string; |
There was a problem hiding this comment.
This reminds me of a MongoDB document. I wonder if they are using a NoSQL data store for storying this info.
| return response.data; | ||
| return response.data.result; | ||
| } catch (error) { | ||
| return { error }; |
There was a problem hiding this comment.
@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 = [ |
There was a problem hiding this comment.
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.
ryanbas21
left a comment
There was a problem hiding this comment.
Honestly, this is excellent work. This looks fantastic. I'm just leaving a comment regarding the rxjs discussion
|
cerebrl
left a comment
There was a problem hiding this comment.
Initial scan looks good. Just a few small comments.
| return undefined; | ||
| } | ||
| if (error) { | ||
| handleError(error, 'Failed to delete device: '); |
There was a problem hiding this comment.
I feel like we should use handleError consistently throughout these store methods. Is there a reason we only use it in some?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Fair enough. We can improve this in the future.
| endpoints: (builder) => ({ | ||
| // oath endpoints | ||
| getOAthDevices: builder.query<OAthResponse, RetrieveOathQuery>({ | ||
| getOAthDevices: builder.query<OathResponse, RetrieveOathQuery>({ |
There was a problem hiding this comment.
Can we change OAth to Oath?
e672208 to
a3f4d67
Compare
cerebrl
left a comment
There was a problem hiding this comment.
I think this is good for the migration story. I'll make a few improvement stories in Jira to continue iterating on this foundation.
JIRA Ticket
https://pingidentity.atlassian.net/browse/SDKS-3938
Description
No changeset. Added device client package and e2e app to changeset ignore