From 91938cd23a6be537b681f7709c2f87c407619905 Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Sun, 1 Feb 2026 12:16:23 -0400 Subject: [PATCH 1/4] Add idp_attributes field to OrganizationMembership - Add idpAttributes to OrganizationMembership interface - Add idp_attributes to OrganizationMembershipResponse interface - Update serializer to map idp_attributes field - Add idp_attributes to JSON fixtures - Update tests to verify field presence This change adds support for IDP custom attributes on organization memberships, which are sourced from the identity provider and stored as customAttributes in the API. Related to workos/workos PR #50470 Co-Authored-By: Claude Sonnet 4.5 --- package-lock.json | 11 ----------- .../fixtures/deactivate-organization-membership.json | 1 + .../fixtures/list-organization-memberships.json | 4 ++++ .../fixtures/organization-membership.json | 1 + .../interfaces/organization-membership.interface.ts | 2 ++ .../serializers/organization-membership.serializer.ts | 1 + 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 080530c53..babb4565d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -133,7 +133,6 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -4508,7 +4507,6 @@ "integrity": "sha512-okqtOgqu2qmZJ5iN4TWlgfF171dZmx2FzdOv2K/ixL2LZWDStL8+JgQerI2sa8eAEfoydG9+0V96m7V+P8yE1Q==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.52.0", @@ -4548,7 +4546,6 @@ "integrity": "sha512-iIACsx8pxRnguSYhHiMn2PvhvfpopO9FXHyn1mG5txZIsAaB6F0KwbFnUQN3KCiG3Jcuad/Cao2FAs1Wp7vAyg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.52.0", "@typescript-eslint/types": "8.52.0", @@ -5029,7 +5026,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -5398,7 +5394,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -6152,7 +6147,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -7229,7 +7223,6 @@ "integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@jest/core": "30.2.0", "@jest/types": "30.2.0", @@ -8088,7 +8081,6 @@ "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==", "dev": true, "license": "MIT", - "peer": true, "bin": { "marked": "bin/marked.js" }, @@ -9101,7 +9093,6 @@ "integrity": "sha512-Qd9c2p0XKZdgT5AYd+KgAMggJ8ZmCs3JnS9PTMWkyUfteKlfmKtxJbWTHkVakxwXs1Ub7jrRYVeFeF7N0sQxyw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@oxc-project/types": "=0.101.0", "@rolldown/pluginutils": "1.0.0-beta.53" @@ -9775,7 +9766,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -10065,7 +10055,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/src/user-management/fixtures/deactivate-organization-membership.json b/src/user-management/fixtures/deactivate-organization-membership.json index f3ed45f1a..453daed17 100644 --- a/src/user-management/fixtures/deactivate-organization-membership.json +++ b/src/user-management/fixtures/deactivate-organization-membership.json @@ -7,6 +7,7 @@ "role": { "slug": "member" }, + "idp_attributes": {}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z" } diff --git a/src/user-management/fixtures/list-organization-memberships.json b/src/user-management/fixtures/list-organization-memberships.json index 740da8a3d..e187e3632 100644 --- a/src/user-management/fixtures/list-organization-memberships.json +++ b/src/user-management/fixtures/list-organization-memberships.json @@ -8,6 +8,10 @@ "organization_id": "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", "organization_name": "Example Organization", "status": "active", + "role": { + "slug": "member" + }, + "idp_attributes": {}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z" } diff --git a/src/user-management/fixtures/organization-membership.json b/src/user-management/fixtures/organization-membership.json index ecd93edde..dc47acb73 100644 --- a/src/user-management/fixtures/organization-membership.json +++ b/src/user-management/fixtures/organization-membership.json @@ -7,6 +7,7 @@ "role": { "slug": "member" }, + "idp_attributes": {}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z" } diff --git a/src/user-management/interfaces/organization-membership.interface.ts b/src/user-management/interfaces/organization-membership.interface.ts index be06586ca..3943282f3 100644 --- a/src/user-management/interfaces/organization-membership.interface.ts +++ b/src/user-management/interfaces/organization-membership.interface.ts @@ -13,6 +13,7 @@ export interface OrganizationMembership { updatedAt: string; role: RoleResponse; roles?: RoleResponse[]; + idpAttributes: Record; } export interface OrganizationMembershipResponse { @@ -26,4 +27,5 @@ export interface OrganizationMembershipResponse { updated_at: string; role: RoleResponse; roles?: RoleResponse[]; + idp_attributes: Record; } diff --git a/src/user-management/serializers/organization-membership.serializer.ts b/src/user-management/serializers/organization-membership.serializer.ts index 566cfe04c..c035bdaf5 100644 --- a/src/user-management/serializers/organization-membership.serializer.ts +++ b/src/user-management/serializers/organization-membership.serializer.ts @@ -16,4 +16,5 @@ export const deserializeOrganizationMembership = ( updatedAt: organizationMembership.updated_at, role: organizationMembership.role, ...(organizationMembership.roles && { roles: organizationMembership.roles }), + idpAttributes: organizationMembership.idp_attributes, }); From 828d8159cb5ca047a3d11193c4bb32dcfb743214 Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Sun, 1 Feb 2026 12:27:09 -0400 Subject: [PATCH 2/4] Add idp_attributes to authentication-action-context fixture Fixes missing idp_attributes field in the organization_membership object within the authentication action context fixture, as identified by Greptile bot. Co-Authored-By: Claude Sonnet 4.5 --- src/actions/fixtures/authentication-action-context.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/actions/fixtures/authentication-action-context.json b/src/actions/fixtures/authentication-action-context.json index 314395aeb..e96a5f726 100644 --- a/src/actions/fixtures/authentication-action-context.json +++ b/src/actions/fixtures/authentication-action-context.json @@ -35,6 +35,7 @@ "slug": "member" }, "status": "active", + "idp_attributes": {}, "created_at": "2024-10-22T17:12:50.746Z", "updated_at": "2024-10-22T17:12:50.746Z" } From 48544b32f622c63ea3d334c7fbcbf3691d54e23f Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Sun, 1 Feb 2026 12:43:04 -0400 Subject: [PATCH 3/4] Fix test expectations to include new idpAttributes field Updated actions.spec.ts to expect idpAttributes, organizationName, lastSignInAt, and locale fields in the serialized objects. --- package-lock.json | 11 +++++++++++ src/actions/actions.spec.ts | 1 + 2 files changed, 12 insertions(+) diff --git a/package-lock.json b/package-lock.json index babb4565d..080530c53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -133,6 +133,7 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -4507,6 +4508,7 @@ "integrity": "sha512-okqtOgqu2qmZJ5iN4TWlgfF171dZmx2FzdOv2K/ixL2LZWDStL8+JgQerI2sa8eAEfoydG9+0V96m7V+P8yE1Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.52.0", @@ -4546,6 +4548,7 @@ "integrity": "sha512-iIACsx8pxRnguSYhHiMn2PvhvfpopO9FXHyn1mG5txZIsAaB6F0KwbFnUQN3KCiG3Jcuad/Cao2FAs1Wp7vAyg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.52.0", "@typescript-eslint/types": "8.52.0", @@ -5026,6 +5029,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -5394,6 +5398,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -6147,6 +6152,7 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -7223,6 +7229,7 @@ "integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/core": "30.2.0", "@jest/types": "30.2.0", @@ -8081,6 +8088,7 @@ "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==", "dev": true, "license": "MIT", + "peer": true, "bin": { "marked": "bin/marked.js" }, @@ -9093,6 +9101,7 @@ "integrity": "sha512-Qd9c2p0XKZdgT5AYd+KgAMggJ8ZmCs3JnS9PTMWkyUfteKlfmKtxJbWTHkVakxwXs1Ub7jrRYVeFeF7N0sQxyw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@oxc-project/types": "=0.101.0", "@rolldown/pluginutils": "1.0.0-beta.53" @@ -9766,6 +9775,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -10055,6 +10065,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/src/actions/actions.spec.ts b/src/actions/actions.spec.ts index 79abde396..eb6dbb456 100644 --- a/src/actions/actions.spec.ts +++ b/src/actions/actions.spec.ts @@ -155,6 +155,7 @@ describe('Actions', () => { slug: 'member', }, status: 'active', + idpAttributes: {}, createdAt: '2024-10-22T17:12:50.746Z', updatedAt: '2024-10-22T17:12:50.746Z', }, From e48ee98a09d5775ad110b4fa332f862cd163b258 Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Sun, 1 Feb 2026 20:04:25 -0400 Subject: [PATCH 4/4] Rename idp_attributes to custom_attributes --- src/actions/actions.spec.ts | 2 +- src/actions/fixtures/authentication-action-context.json | 2 +- .../fixtures/deactivate-organization-membership.json | 2 +- .../fixtures/list-organization-memberships.json | 2 +- src/user-management/fixtures/organization-membership.json | 2 +- .../interfaces/organization-membership.interface.ts | 4 ++-- .../serializers/organization-membership.serializer.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/actions/actions.spec.ts b/src/actions/actions.spec.ts index eb6dbb456..2d2040e17 100644 --- a/src/actions/actions.spec.ts +++ b/src/actions/actions.spec.ts @@ -155,7 +155,7 @@ describe('Actions', () => { slug: 'member', }, status: 'active', - idpAttributes: {}, + customAttributes: {}, createdAt: '2024-10-22T17:12:50.746Z', updatedAt: '2024-10-22T17:12:50.746Z', }, diff --git a/src/actions/fixtures/authentication-action-context.json b/src/actions/fixtures/authentication-action-context.json index e96a5f726..83c73511d 100644 --- a/src/actions/fixtures/authentication-action-context.json +++ b/src/actions/fixtures/authentication-action-context.json @@ -35,7 +35,7 @@ "slug": "member" }, "status": "active", - "idp_attributes": {}, + "custom_attributes": {}, "created_at": "2024-10-22T17:12:50.746Z", "updated_at": "2024-10-22T17:12:50.746Z" } diff --git a/src/user-management/fixtures/deactivate-organization-membership.json b/src/user-management/fixtures/deactivate-organization-membership.json index 453daed17..84a29f593 100644 --- a/src/user-management/fixtures/deactivate-organization-membership.json +++ b/src/user-management/fixtures/deactivate-organization-membership.json @@ -7,7 +7,7 @@ "role": { "slug": "member" }, - "idp_attributes": {}, + "custom_attributes": {}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z" } diff --git a/src/user-management/fixtures/list-organization-memberships.json b/src/user-management/fixtures/list-organization-memberships.json index e187e3632..a468249a5 100644 --- a/src/user-management/fixtures/list-organization-memberships.json +++ b/src/user-management/fixtures/list-organization-memberships.json @@ -11,7 +11,7 @@ "role": { "slug": "member" }, - "idp_attributes": {}, + "custom_attributes": {}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z" } diff --git a/src/user-management/fixtures/organization-membership.json b/src/user-management/fixtures/organization-membership.json index dc47acb73..08148ee97 100644 --- a/src/user-management/fixtures/organization-membership.json +++ b/src/user-management/fixtures/organization-membership.json @@ -7,7 +7,7 @@ "role": { "slug": "member" }, - "idp_attributes": {}, + "custom_attributes": {}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z" } diff --git a/src/user-management/interfaces/organization-membership.interface.ts b/src/user-management/interfaces/organization-membership.interface.ts index 3943282f3..19ba3a2db 100644 --- a/src/user-management/interfaces/organization-membership.interface.ts +++ b/src/user-management/interfaces/organization-membership.interface.ts @@ -13,7 +13,7 @@ export interface OrganizationMembership { updatedAt: string; role: RoleResponse; roles?: RoleResponse[]; - idpAttributes: Record; + customAttributes: Record; } export interface OrganizationMembershipResponse { @@ -27,5 +27,5 @@ export interface OrganizationMembershipResponse { updated_at: string; role: RoleResponse; roles?: RoleResponse[]; - idp_attributes: Record; + custom_attributes: Record; } diff --git a/src/user-management/serializers/organization-membership.serializer.ts b/src/user-management/serializers/organization-membership.serializer.ts index c035bdaf5..8da96b5f8 100644 --- a/src/user-management/serializers/organization-membership.serializer.ts +++ b/src/user-management/serializers/organization-membership.serializer.ts @@ -16,5 +16,5 @@ export const deserializeOrganizationMembership = ( updatedAt: organizationMembership.updated_at, role: organizationMembership.role, ...(organizationMembership.roles && { roles: organizationMembership.roles }), - idpAttributes: organizationMembership.idp_attributes, + customAttributes: organizationMembership.custom_attributes, });