Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add email standard attribute to DirectoryUser and mark deprecated standard attributes #1223

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/directory-sync/directory-sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe('DirectorySync', () => {
},
directoryId: 'dir_123',
organizationId: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down Expand Up @@ -107,6 +108,7 @@ describe('DirectorySync', () => {
},
directory_id: 'dir_123',
organization_id: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down Expand Up @@ -134,6 +136,7 @@ describe('DirectorySync', () => {
},
directoryId: 'dir_123',
organizationId: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down Expand Up @@ -162,6 +165,7 @@ describe('DirectorySync', () => {
},
directory_id: 'dir_123',
organization_id: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down
26 changes: 26 additions & 0 deletions src/directory-sync/interfaces/directory-user.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ export interface DirectoryUser<
customAttributes: TCustomAttributes;
idpId: string;
firstName: string | null;
email: string | null;
/** @deprecated Will be removed in a future major version.
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
emails: {
type?: string;
value?: string;
primary?: boolean;
}[];
/** @deprecated Will be removed in a future major version.
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
username: string | null;
lastName: string | null;
/** @deprecated Will be removed in a future major version.
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
jobTitle: string | null;
state: 'active' | 'inactive';
role?: RoleResponse;
Expand All @@ -44,13 +57,26 @@ export interface DirectoryUserResponse<
custom_attributes: TCustomAttributes;
idp_id: string;
first_name: string | null;
email: string | null;
/** @deprecated Will be removed in a future major version.
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
emails: {
type?: string;
value?: string;
primary?: boolean;
}[];
/** @deprecated Will be removed in a future major version.
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
username: string | null;
last_name: string | null;
/** @deprecated Will be removed in a future major version.
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
job_title: string | null;
state: 'active' | 'inactive';
role?: RoleResponse;
Expand Down
2 changes: 2 additions & 0 deletions src/directory-sync/serializers/directory-user.serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const deserializeDirectoryUser = <
customAttributes: directoryUser.custom_attributes,
idpId: directoryUser.idp_id,
firstName: directoryUser.first_name,
email: directoryUser.email,
emails: directoryUser.emails,
username: directoryUser.username,
lastName: directoryUser.last_name,
Expand Down Expand Up @@ -52,6 +53,7 @@ export const deserializeUpdatedEventDirectoryUser = (
customAttributes: directoryUser.custom_attributes,
idpId: directoryUser.idp_id,
firstName: directoryUser.first_name,
email: directoryUser.email,
emails: directoryUser.emails,
username: directoryUser.username,
lastName: directoryUser.last_name,
Expand Down
1 change: 1 addition & 0 deletions src/directory-sync/utils/get-primary-email.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('getPrimaryEmail', () => {
},
directoryId: 'dir_123',
organizationId: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down
2 changes: 2 additions & 0 deletions src/events/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ describe('Event', () => {
},
directoryId: 'dir_123',
organizationId: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down Expand Up @@ -164,6 +165,7 @@ describe('Event', () => {
},
directory_id: 'dir_123',
organization_id: 'org_123',
email: '[email protected]',
emails: [
{
primary: true,
Expand Down