diff --git a/src/directory-sync/directory-sync.spec.ts b/src/directory-sync/directory-sync.spec.ts index 0dcb05c97..4dc63dca5 100644 --- a/src/directory-sync/directory-sync.spec.ts +++ b/src/directory-sync/directory-sync.spec.ts @@ -80,6 +80,7 @@ describe('DirectorySync', () => { }, directoryId: 'dir_123', organizationId: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true, @@ -107,6 +108,7 @@ describe('DirectorySync', () => { }, directory_id: 'dir_123', organization_id: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true, @@ -134,6 +136,7 @@ describe('DirectorySync', () => { }, directoryId: 'dir_123', organizationId: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true, @@ -162,6 +165,7 @@ describe('DirectorySync', () => { }, directory_id: 'dir_123', organization_id: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true, diff --git a/src/directory-sync/interfaces/directory-user.interface.ts b/src/directory-sync/interfaces/directory-user.interface.ts index 3e5cc3b91..7445313b7 100644 --- a/src/directory-sync/interfaces/directory-user.interface.ts +++ b/src/directory-sync/interfaces/directory-user.interface.ts @@ -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; @@ -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; diff --git a/src/directory-sync/serializers/directory-user.serializer.ts b/src/directory-sync/serializers/directory-user.serializer.ts index 95b9433a5..3a7049245 100644 --- a/src/directory-sync/serializers/directory-user.serializer.ts +++ b/src/directory-sync/serializers/directory-user.serializer.ts @@ -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, @@ -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, diff --git a/src/directory-sync/utils/get-primary-email.spec.ts b/src/directory-sync/utils/get-primary-email.spec.ts index 9bece4d28..3ec704fd9 100644 --- a/src/directory-sync/utils/get-primary-email.spec.ts +++ b/src/directory-sync/utils/get-primary-email.spec.ts @@ -10,6 +10,7 @@ describe('getPrimaryEmail', () => { }, directoryId: 'dir_123', organizationId: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true, diff --git a/src/events/events.spec.ts b/src/events/events.spec.ts index bcb04bdb3..c0818598b 100644 --- a/src/events/events.spec.ts +++ b/src/events/events.spec.ts @@ -129,6 +129,7 @@ describe('Event', () => { }, directoryId: 'dir_123', organizationId: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true, @@ -164,6 +165,7 @@ describe('Event', () => { }, directory_id: 'dir_123', organization_id: 'org_123', + email: 'jonsnow@workos.com', emails: [ { primary: true,