-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove distinction between "Managed" and "Unmanaged" users (#831)
## Description This PR removes the distinction between "Managed" and "Unmanaged" users from the SDK. This concept is being removed from the API in the near future. This is a breaking change to the User Management portion of the SDK. Resolves USRLD-843. ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/reference) or code snippets need updates. ``` [ ] Yes ``` If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
- Loading branch information
1 parent
61304f1
commit d03e135
Showing
6 changed files
with
15 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,12 @@ | ||
import { UnexpectedUserTypeException } from '../exceptions'; | ||
import { BaseUser, User, UserResponse } from '../interfaces'; | ||
import { User, UserResponse } from '../interfaces'; | ||
|
||
export const deserializeUser = (user: UserResponse): User => { | ||
const baseUser: BaseUser = { | ||
object: user.object, | ||
id: user.id, | ||
email: user.email, | ||
firstName: user.first_name, | ||
lastName: user.last_name, | ||
createdAt: user.created_at, | ||
updatedAt: user.updated_at, | ||
}; | ||
|
||
switch (user.user_type) { | ||
case 'managed': | ||
return { | ||
...baseUser, | ||
userType: user.user_type, | ||
ssoProfileId: user.sso_profile_id, | ||
}; | ||
case 'unmanaged': | ||
return { | ||
...baseUser, | ||
userType: user.user_type, | ||
emailVerifiedAt: user.email_verified_at, | ||
googleOauthProfileId: user.google_oauth_profile_id, | ||
microsoftOauthProfileId: user.microsoft_oauth_profile_id, | ||
}; | ||
default: | ||
throw new UnexpectedUserTypeException(user); | ||
} | ||
}; | ||
export const deserializeUser = (user: UserResponse): User => ({ | ||
object: user.object, | ||
id: user.id, | ||
email: user.email, | ||
emailVerifiedAt: user.email_verified_at, | ||
firstName: user.first_name, | ||
lastName: user.last_name, | ||
createdAt: user.created_at, | ||
updatedAt: user.updated_at, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ describe('UserManagement', () => { | |
email: '[email protected]', | ||
firstName: 'Test 01', | ||
lastName: 'User', | ||
userType: 'unmanaged', | ||
emailVerifiedAt: '2023-07-17T20:07:20.055Z', | ||
}); | ||
}); | ||
|
@@ -87,7 +86,6 @@ describe('UserManagement', () => { | |
email: '[email protected]', | ||
firstName: 'Test 01', | ||
lastName: 'User', | ||
userType: 'unmanaged', | ||
emailVerifiedAt: '2023-07-17T20:07:20.055Z', | ||
createdAt: '2023-07-18T02:07:19.911Z', | ||
updatedAt: '2023-07-18T02:07:19.911Z', | ||
|