From a0ba1713be018220b23d0cc802c90affb38ea61b Mon Sep 17 00:00:00 2001 From: jonatas Date: Mon, 1 Jun 2026 23:56:17 +0000 Subject: [PATCH 1/2] Add name field to Profile, User, and Actions interfaces Add the name field that the API now returns (ENT-5871) to the Node SDK: - SSO Profile interface + serializer - User interface + serializer - CreateUser/UpdateUser options + serializers - Actions UserData interface + serializer - All related fixtures and test assertions Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- src/actions/actions.spec.ts | 2 ++ src/actions/fixtures/authentication-action-context.json | 1 + src/actions/fixtures/user-registration-action-context.json | 1 + src/actions/interfaces/action.interface.ts | 2 ++ src/actions/serializers/action.serializer.ts | 1 + .../list-user-organization-membership-base-list-data.json | 1 + .../user-organization-membership-base-list-data.json | 1 + src/sso/__snapshots__/sso.spec.ts.snap | 2 ++ src/sso/interfaces/profile.interface.ts | 3 +++ src/sso/serializers/profile.serializer.ts | 1 + src/sso/sso.spec.ts | 7 +++++++ src/user-management/fixtures/list-users.json | 1 + src/user-management/fixtures/user.json | 1 + .../interfaces/create-user-options.interface.ts | 2 ++ .../interfaces/update-user-options.interface.ts | 2 ++ src/user-management/interfaces/user.interface.ts | 3 +++ .../serializers/create-user-options.serializer.ts | 1 + .../serializers/update-user-options.serializer.ts | 1 + src/user-management/serializers/user.serializer.ts | 1 + src/user-management/user-management.spec.ts | 4 ++++ 20 files changed, 38 insertions(+) diff --git a/src/actions/actions.spec.ts b/src/actions/actions.spec.ts index 094b54e92..25af43269 100644 --- a/src/actions/actions.spec.ts +++ b/src/actions/actions.spec.ts @@ -121,6 +121,7 @@ describe('Actions', () => { object: 'user', id: '01JATCHZVEC5EPANDPEZVM68Y9', email: 'jane@foocorp.com', + name: 'Jane Doe', firstName: 'Jane', lastName: 'Doe', emailVerified: true, @@ -178,6 +179,7 @@ describe('Actions', () => { userData: { object: 'user_data', email: 'jane@foocorp.com', + name: 'Jane Doe', firstName: 'Jane', lastName: 'Doe', }, diff --git a/src/actions/fixtures/authentication-action-context.json b/src/actions/fixtures/authentication-action-context.json index 1154605bb..3dd48e7de 100644 --- a/src/actions/fixtures/authentication-action-context.json +++ b/src/actions/fixtures/authentication-action-context.json @@ -4,6 +4,7 @@ "object": "user", "id": "01JATCHZVEC5EPANDPEZVM68Y9", "email": "jane@foocorp.com", + "name": "Jane Doe", "first_name": "Jane", "last_name": "Doe", "email_verified": true, diff --git a/src/actions/fixtures/user-registration-action-context.json b/src/actions/fixtures/user-registration-action-context.json index 3969b1e97..bfd422a17 100644 --- a/src/actions/fixtures/user-registration-action-context.json +++ b/src/actions/fixtures/user-registration-action-context.json @@ -3,6 +3,7 @@ "user_data": { "object": "user_data", "email": "jane@foocorp.com", + "name": "Jane Doe", "first_name": "Jane", "last_name": "Doe" }, diff --git a/src/actions/interfaces/action.interface.ts b/src/actions/interfaces/action.interface.ts index b8db8df2c..4fb314416 100644 --- a/src/actions/interfaces/action.interface.ts +++ b/src/actions/interfaces/action.interface.ts @@ -26,6 +26,7 @@ interface AuthenticationActionContext { export interface UserData { object: 'user_data'; email: string; + name: string; firstName: string; lastName: string; } @@ -59,6 +60,7 @@ interface AuthenticationActionPayload { export interface UserDataPayload { object: 'user_data'; email: string; + name: string; first_name: string; last_name: string; } diff --git a/src/actions/serializers/action.serializer.ts b/src/actions/serializers/action.serializer.ts index 330da06b1..970f308bd 100644 --- a/src/actions/serializers/action.serializer.ts +++ b/src/actions/serializers/action.serializer.ts @@ -15,6 +15,7 @@ const deserializeUserData = (userData: UserDataPayload): UserData => { return { object: userData.object, email: userData.email, + name: userData.name, firstName: userData.first_name, lastName: userData.last_name, }; diff --git a/src/groups/fixtures/list-user-organization-membership-base-list-data.json b/src/groups/fixtures/list-user-organization-membership-base-list-data.json index f6dc992a1..9cebb3be7 100644 --- a/src/groups/fixtures/list-user-organization-membership-base-list-data.json +++ b/src/groups/fixtures/list-user-organization-membership-base-list-data.json @@ -18,6 +18,7 @@ "user": { "object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "name": "Marcelina Davis", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", diff --git a/src/groups/fixtures/user-organization-membership-base-list-data.json b/src/groups/fixtures/user-organization-membership-base-list-data.json index f3a203398..2a4ee3517 100644 --- a/src/groups/fixtures/user-organization-membership-base-list-data.json +++ b/src/groups/fixtures/user-organization-membership-base-list-data.json @@ -16,6 +16,7 @@ "user": { "object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "name": "Marcelina Davis", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", diff --git a/src/sso/__snapshots__/sso.spec.ts.snap b/src/sso/__snapshots__/sso.spec.ts.snap index 5c62ce31b..85caf0b5e 100644 --- a/src/sso/__snapshots__/sso.spec.ts.snap +++ b/src/sso/__snapshots__/sso.spec.ts.snap @@ -34,6 +34,7 @@ exports[`SSO SSO getProfileAndToken with all information provided sends a reques "id": "prof_123", "idpId": "123", "lastName": "bar", + "name": "foo bar", "organizationId": "org_123", "rawAttributes": { "email": "foo@test.com", @@ -68,6 +69,7 @@ exports[`SSO SSO getProfileAndToken without a groups attribute sends a request t "id": "prof_123", "idpId": "123", "lastName": "bar", + "name": "foo bar", "organizationId": "org_123", "rawAttributes": { "email": "foo@test.com", diff --git a/src/sso/interfaces/profile.interface.ts b/src/sso/interfaces/profile.interface.ts index 6c59c79a9..59ce7324d 100644 --- a/src/sso/interfaces/profile.interface.ts +++ b/src/sso/interfaces/profile.interface.ts @@ -15,6 +15,8 @@ export interface Profile { connectionType: ConnectionType; /** The user's email address. */ email: string; + /** The user's full name. */ + name?: string; /** The user's first name. */ firstName?: string; /** The user's last name. */ @@ -38,6 +40,7 @@ export interface ProfileResponse { connection_id: string; connection_type: ConnectionType; email: string; + name?: string; first_name?: string; last_name?: string; role?: RoleResponse; diff --git a/src/sso/serializers/profile.serializer.ts b/src/sso/serializers/profile.serializer.ts index 2044d0a10..1e0f41074 100644 --- a/src/sso/serializers/profile.serializer.ts +++ b/src/sso/serializers/profile.serializer.ts @@ -12,6 +12,7 @@ export const deserializeProfile = ( connectionId: profile.connection_id, connectionType: profile.connection_type, email: profile.email, + ...(profile.name !== undefined && { name: profile.name }), ...(profile.first_name !== undefined && { firstName: profile.first_name }), ...(profile.last_name !== undefined && { lastName: profile.last_name }), ...(profile.role !== undefined && { role: profile.role }), diff --git a/src/sso/sso.spec.ts b/src/sso/sso.spec.ts index a12e26467..c4cad3bd1 100644 --- a/src/sso/sso.spec.ts +++ b/src/sso/sso.spec.ts @@ -340,6 +340,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { @@ -398,6 +399,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { @@ -451,6 +453,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { @@ -504,6 +507,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { @@ -544,6 +548,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { slug: 'admin' }, @@ -592,6 +597,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { slug: 'admin' }, @@ -662,6 +668,7 @@ describe('SSO', () => { connection_id: 'conn_123', connection_type: 'OktaSAML', email: 'foo@test.com', + name: 'foo bar', first_name: 'foo', last_name: 'bar', role: { diff --git a/src/user-management/fixtures/list-users.json b/src/user-management/fixtures/list-users.json index c96071871..eae265c3c 100644 --- a/src/user-management/fixtures/list-users.json +++ b/src/user-management/fixtures/list-users.json @@ -5,6 +5,7 @@ "object": "user", "id": "user_01H5JQDV7R7ATEYZDEG0W5PRYS", "email": "test01@example.com", + "name": "Test 01 User", "first_name": "Test 01", "last_name": "User", "created_at": "2023-07-18T02:07:19.911Z", diff --git a/src/user-management/fixtures/user.json b/src/user-management/fixtures/user.json index 73335c694..55465efce 100644 --- a/src/user-management/fixtures/user.json +++ b/src/user-management/fixtures/user.json @@ -2,6 +2,7 @@ "object": "user", "id": "user_01H5JQDV7R7ATEYZDEG0W5PRYS", "email": "test01@example.com", + "name": "Test 01 User", "first_name": "Test 01", "last_name": "User", "created_at": "2023-07-18T02:07:19.911Z", diff --git a/src/user-management/interfaces/create-user-options.interface.ts b/src/user-management/interfaces/create-user-options.interface.ts index fcd6c87db..3003f559d 100644 --- a/src/user-management/interfaces/create-user-options.interface.ts +++ b/src/user-management/interfaces/create-user-options.interface.ts @@ -5,6 +5,7 @@ export interface CreateUserOptions { password?: string; passwordHash?: string; passwordHashType?: PasswordHashType; + name?: string; firstName?: string; lastName?: string; emailVerified?: boolean; @@ -17,6 +18,7 @@ export interface SerializedCreateUserOptions { password?: string; password_hash?: string; password_hash_type?: PasswordHashType; + name?: string; first_name?: string; last_name?: string; email_verified?: boolean; diff --git a/src/user-management/interfaces/update-user-options.interface.ts b/src/user-management/interfaces/update-user-options.interface.ts index 501e2eb02..26be8ec52 100644 --- a/src/user-management/interfaces/update-user-options.interface.ts +++ b/src/user-management/interfaces/update-user-options.interface.ts @@ -3,6 +3,7 @@ import { PasswordHashType } from './password-hash-type.interface'; export interface UpdateUserOptions { userId: string; email?: string; + name?: string; firstName?: string; lastName?: string; emailVerified?: boolean; @@ -16,6 +17,7 @@ export interface UpdateUserOptions { export interface SerializedUpdateUserOptions { email?: string; + name?: string; first_name?: string; last_name?: string; email_verified?: boolean; diff --git a/src/user-management/interfaces/user.interface.ts b/src/user-management/interfaces/user.interface.ts index b22bd93a0..5b7c5b588 100644 --- a/src/user-management/interfaces/user.interface.ts +++ b/src/user-management/interfaces/user.interface.ts @@ -10,6 +10,8 @@ export interface User { emailVerified: boolean; /** A URL reference to an image representing the user. */ profilePictureUrl: string | null; + /** The full name of the user. */ + name: string | null; /** The first name of the user. */ firstName: string | null; /** The last name of the user. */ @@ -34,6 +36,7 @@ export interface UserResponse { email: string; email_verified: boolean; profile_picture_url: string | null; + name: string | null; first_name: string | null; last_name: string | null; last_sign_in_at: string | null; diff --git a/src/user-management/serializers/create-user-options.serializer.ts b/src/user-management/serializers/create-user-options.serializer.ts index 505ebd234..a512e1a23 100644 --- a/src/user-management/serializers/create-user-options.serializer.ts +++ b/src/user-management/serializers/create-user-options.serializer.ts @@ -7,6 +7,7 @@ export const serializeCreateUserOptions = ( password: options.password, password_hash: options.passwordHash, password_hash_type: options.passwordHashType, + name: options.name, first_name: options.firstName, last_name: options.lastName, email_verified: options.emailVerified, diff --git a/src/user-management/serializers/update-user-options.serializer.ts b/src/user-management/serializers/update-user-options.serializer.ts index 06cecc261..da5f6bfdb 100644 --- a/src/user-management/serializers/update-user-options.serializer.ts +++ b/src/user-management/serializers/update-user-options.serializer.ts @@ -5,6 +5,7 @@ export const serializeUpdateUserOptions = ( ): SerializedUpdateUserOptions => ({ email: options.email, email_verified: options.emailVerified, + name: options.name, first_name: options.firstName, last_name: options.lastName, password: options.password, diff --git a/src/user-management/serializers/user.serializer.ts b/src/user-management/serializers/user.serializer.ts index 2ed850c09..4ea2bf57d 100644 --- a/src/user-management/serializers/user.serializer.ts +++ b/src/user-management/serializers/user.serializer.ts @@ -5,6 +5,7 @@ export const deserializeUser = (user: UserResponse): User => ({ id: user.id, email: user.email, emailVerified: user.email_verified, + name: user.name ?? null, firstName: user.first_name, profilePictureUrl: user.profile_picture_url, lastName: user.last_name, diff --git a/src/user-management/user-management.spec.ts b/src/user-management/user-management.spec.ts index 66894530c..0cd5d3e31 100644 --- a/src/user-management/user-management.spec.ts +++ b/src/user-management/user-management.spec.ts @@ -58,6 +58,7 @@ describe('UserManagement', () => { id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', email: 'test01@example.com', profilePictureUrl: 'https://example.com/profile_picture.jpg', + name: 'Test 01 User', firstName: 'Test 01', lastName: 'User', emailVerified: true, @@ -81,6 +82,7 @@ describe('UserManagement', () => { id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', email: 'test01@example.com', profilePictureUrl: 'https://example.com/profile_picture.jpg', + name: 'Test 01 User', firstName: 'Test 01', lastName: 'User', emailVerified: true, @@ -145,6 +147,7 @@ describe('UserManagement', () => { expect(user).toMatchObject({ object: 'user', email: 'test01@example.com', + name: 'Test 01 User', firstName: 'Test 01', lastName: 'User', emailVerified: true, @@ -1452,6 +1455,7 @@ describe('UserManagement', () => { createdAt: '2023-07-18T02:07:19.911Z', email: 'test01@example.com', emailVerified: true, + name: 'Test 01 User', firstName: 'Test 01', id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', lastName: 'User', From 5ea8e08a9592bade80de469a90383998bf16303f Mon Sep 17 00:00:00 2001 From: jonatas Date: Tue, 2 Jun 2026 15:22:37 +0000 Subject: [PATCH 2/2] Align UserData.name to string | null with null fallback Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- src/actions/interfaces/action.interface.ts | 4 ++-- src/actions/serializers/action.serializer.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/actions/interfaces/action.interface.ts b/src/actions/interfaces/action.interface.ts index 4fb314416..6792c5daa 100644 --- a/src/actions/interfaces/action.interface.ts +++ b/src/actions/interfaces/action.interface.ts @@ -26,7 +26,7 @@ interface AuthenticationActionContext { export interface UserData { object: 'user_data'; email: string; - name: string; + name: string | null; firstName: string; lastName: string; } @@ -60,7 +60,7 @@ interface AuthenticationActionPayload { export interface UserDataPayload { object: 'user_data'; email: string; - name: string; + name: string | null; first_name: string; last_name: string; } diff --git a/src/actions/serializers/action.serializer.ts b/src/actions/serializers/action.serializer.ts index 970f308bd..1080249bc 100644 --- a/src/actions/serializers/action.serializer.ts +++ b/src/actions/serializers/action.serializer.ts @@ -15,7 +15,7 @@ const deserializeUserData = (userData: UserDataPayload): UserData => { return { object: userData.object, email: userData.email, - name: userData.name, + name: userData.name ?? null, firstName: userData.first_name, lastName: userData.last_name, };