Skip to content

Conversation

@ryanbas21
Copy link
Contributor

@ryanbas21 ryanbas21 commented Jan 21, 2025

JIRA Ticket

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

Description

adds device client to the SDK package

adds device client to the SDK package
@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2025

🦋 Changeset detected

Latest commit: 5d68b9f

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

This PR includes changesets to release 4 packages
Name Type
@forgerock/javascript-sdk Minor
@forgerock/davinci-client Patch
@forgerock/ping-protect Minor
@forgerock/token-vault Patch

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

@nx-cloud
Copy link

nx-cloud bot commented Jan 21, 2025

View your CI Pipeline Execution ↗ for commit 5d68b9f.

Command Status Duration Result
nx affected -t build lint test docs e2e-ci --ve... ✅ Succeeded 5m 12s View ↗
nx-cloud record -- nx format:check --verbose ✅ Succeeded 10s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-26 16:28:35 UTC

"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"@forgerock/device-client",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

package no longer exists.

"type": "module",
"dependencies": {
"@forgerock/javascript-sdk": "workspace:*",
"@forgerock/device-client": "workspace:*",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer exists

// @ts-nocheck
import * as forgerock from '@forgerock/javascript-sdk';
import { deviceClient } from '@forgerock/device-client';
import { deviceClient } from '@forgerock/javascript-sdk/device-client';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added as both an export from . and from /device-client.

import ChoiceCallback from './fr-auth/callbacks/choice-callback';
import ConfirmationCallback from './fr-auth/callbacks/confirmation-callback';
import DeviceProfileCallback from './fr-auth/callbacks/device-profile-callback';
import { deviceClient } from './device-client';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added it because if i dont i have to add a new entry point in the vite config, not a big problem if we do not want it exported from here though.

name: 'javascript-sdk',
formats: ['es', 'cjs'],
fileName: (format, fileName) => {
console.log(fileName);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is still here.

@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 94.55081% with 37 lines in your changes missing coverage. Please review.

Project coverage is 58.91%. Comparing base (d1340c6) to head (5d68b9f).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...s/javascript-sdk/src/device-client/device.store.ts 90.27% 36 Missing ⚠️
...es/javascript-sdk/src/device-client/types/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #530      +/-   ##
===========================================
+ Coverage    57.25%   58.91%   +1.66%     
===========================================
  Files          123      123              
  Lines        26967    27295     +328     
  Branches      1717     1776      +59     
===========================================
+ Hits         15439    16080     +641     
+ Misses       11528    11215     -313     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

fix types, add tests, fix tests, fix manual e2e
Copy link
Contributor

@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.

Mostly some naming fixes needed.

Comment on lines 27 to 29
const un = url.searchParams.get('un') || 'spetrov';
const platformHeader = url.searchParams.get('platformHeader') === 'true' ? true : false;
const pw = url.searchParams.get('pw') || 'Demo1234!';
const pw = url.searchParams.get('pw') || '1111';
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we mean to commit this?

Comment on lines 54 to 56
deleteOathDevice: builder.mutation<
DeletedOAthDevice,
RetrieveOathQuery & { device: OathDevice }
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this quite often throughout the codebase. Can we make sure all references to "oath" are either OATH, Oath or oath? Currently, I see OAth quite a bit, which I'd like to correct to Oath.

query: ({ realm = realmPath, userId }) =>
`/json/realms/${realm}/users/${userId}/devices/2fa/binding?_queryFilter=true`,
}),
updateBindingDeviceName: builder.mutation<Device, BindingDeviceQuery>({
Copy link
Contributor

Choose a reason for hiding this comment

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

We're also not consistent here. Can we make sure to use bound and not binding? So, it would be getBoundDevices, updateBoundDeviceName and deleteBoundDevice.

body: device satisfies Device,
}),
}),
getDeviceProfile: builder.query<GeneralResponse<ProfileDevice[]>, GetProfileDevices>({
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we querying for a single profile here, or are we querying for all of the user's profiles. I would think all, so I'd expect the name to be plural: getDeviceProfiles.

name: 'javascript-sdk',
formats: ['es', 'cjs'],
fileName: (format, fileName) => {
console.log(fileName);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is still here.

userId: string;
};

export type OAthResponse = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Another naming inconsistency.

realm?: string;
} & Device;
};
export type BindingDeviceQuery = GetBoundDevicesQuery & { device: Device };
Copy link
Contributor

Choose a reason for hiding this comment

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

"Binding" instead of "Bound".

@ryanbas21 ryanbas21 force-pushed the device-client-sdk branch 2 times, most recently from e2bc5c1 to 856b3fb Compare January 26, 2025 16:15
renamed all per comments to better fit naming schemes
@ryanbas21 ryanbas21 merged commit 74d2352 into develop Jan 27, 2025
5 checks passed
@github-actions github-actions bot mentioned this pull request Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants