Skip to content

Commit 52b0122

Browse files
authored
Remove deprecated properties for v8 (#1365)
## Description This pull request removes several deprecated fields and enum values from user management and directory sync interfaces, as well as from organization domain state definitions. These changes help clean up the codebase and ensure that only current, supported attributes are exposed in the interfaces. ### Deprecated field removals **User management authorization options:** * Removed the deprecated `context` field from both `AuthorizationURLOptions` and `UserManagementAuthorizationURLOptions` interfaces, as it is no longer required for getting authorization URLs. [[1]](diffhunk://#diff-b5a04503adce4aaadee02b4511ee9bd11ec26a46927bde7c07d85ad31786e4bbL9-L13) [[2]](diffhunk://#diff-22f5a89986b17dd45c06dbbba9f624690b22d5ede6e7455dade9d3fb7924f131L6-L10) **Directory user interfaces:** * Removed deprecated fields (`emails`, `username`, and `jobTitle`) from both `DirectoryUser` and `DirectoryUserResponse` interfaces, as these should now be accessed through custom attributes. [[1]](diffhunk://#diff-2151436e8d7d3a67c1165760fdfa80802fd72276034e54114c3ddfcdfe03e7fcL22-L41) [[2]](diffhunk://#diff-2151436e8d7d3a67c1165760fdfa80802fd72276034e54114c3ddfcdfe03e7fcL61-L80) ### Enum cleanup **Organization domain state:** * Removed the deprecated `LegacyVerified` value from the `OrganizationDomainState` enum. ## 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.
1 parent 58d9a23 commit 52b0122

File tree

15 files changed

+6
-208
lines changed

15 files changed

+6
-208
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"check:runtimes": "tsx scripts/ecosystem-check.ts",
3737
"prettier": "prettier \"src/**/*.{js,ts,tsx}\" --check",
3838
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
39-
"prepublishOnly": "npm run build"
39+
"prepublishOnly": "npm run build",
40+
"typecheck": "tsc --noEmit"
4041
},
4142
"dependencies": {
4243
"iron-session": "^8.0.4",

src/client/user-management.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ export interface AuthorizationURLOptions {
66
codeChallenge?: string;
77
codeChallengeMethod?: 'S256';
88
connectionId?: string;
9-
/**
10-
* @deprecated We previously required initiate login endpoints to return the `context`
11-
* query parameter when getting the authorization URL. This is no longer necessary.
12-
*/
13-
context?: string;
149
organizationId?: string;
1510
domainHint?: string;
1611
loginHint?: string;
@@ -43,7 +38,6 @@ export function getAuthorizationUrl(
4338
connectionId,
4439
codeChallenge,
4540
codeChallengeMethod,
46-
context,
4741
clientId,
4842
domainHint,
4943
loginHint,
@@ -70,18 +64,10 @@ export function getAuthorizationUrl(
7064
);
7165
}
7266

73-
if (context) {
74-
console.warn(
75-
`WorkOS: \`context\` is deprecated. We previously required initiate login endpoints to return the
76-
\`context\` query parameter when getting the authorization URL. This is no longer necessary.`,
77-
);
78-
}
79-
8067
const query = toQueryString({
8168
connection_id: connectionId,
8269
code_challenge: codeChallenge,
8370
code_challenge_method: codeChallengeMethod,
84-
context,
8571
organization_id: organizationId,
8672
domain_hint: domainHint,
8773
login_hint: loginHint,

src/common/net/fetch-client.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,10 @@ export class FetchHttpClient extends HttpClient implements HttpClientInterface {
175175
const { 'User-Agent': userAgent } = (this.options?.headers ||
176176
{}) as RequestHeaders;
177177

178-
// Create AbortController for timeout if configured
179-
let abortController: AbortController | undefined;
180-
let timeoutId: ReturnType<typeof setTimeout> | undefined;
181-
182178
// Access timeout from the options with default of 60 seconds
183179
const timeout = this.options?.timeout ?? DEFAULT_FETCH_TIMEOUT; // Default 60 seconds
184-
abortController = new AbortController();
185-
timeoutId = setTimeout(() => {
180+
const abortController = new AbortController();
181+
const timeoutId = setTimeout(() => {
186182
abortController?.abort();
187183
}, timeout);
188184

src/directory-sync/directory-sync.spec.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,12 @@ describe('DirectorySync', () => {
8181
directoryId: 'dir_123',
8282
organizationId: 'org_123',
8383
84-
emails: [
85-
{
86-
primary: true,
87-
type: 'type',
88-
89-
},
90-
],
9184
firstName: 'Jon',
9285
groups: [group],
9386
idpId: 'idp_foo',
9487
lastName: 'Snow',
95-
jobTitle: 'Knight of the Watch',
9688
rawAttributes: {},
9789
state: 'active',
98-
username: 'jonsnow',
9990
createdAt: '2021-10-27 15:21:50.640959',
10091
updatedAt: '2021-12-13 12:15:45.531847',
10192
};
@@ -109,21 +100,12 @@ describe('DirectorySync', () => {
109100
directory_id: 'dir_123',
110101
organization_id: 'org_123',
111102
112-
emails: [
113-
{
114-
primary: true,
115-
type: 'type',
116-
117-
},
118-
],
119103
first_name: 'Jon',
120104
groups: [groupResponse],
121105
idp_id: 'idp_foo',
122106
last_name: 'Snow',
123-
job_title: 'Knight of the Watch',
124107
raw_attributes: {},
125108
state: 'active',
126-
username: 'jonsnow',
127109
created_at: '2021-10-27 15:21:50.640959',
128110
updated_at: '2021-12-13 12:15:45.531847',
129111
};
@@ -137,21 +119,12 @@ describe('DirectorySync', () => {
137119
directoryId: 'dir_123',
138120
organizationId: 'org_123',
139121
140-
emails: [
141-
{
142-
primary: true,
143-
type: 'type',
144-
145-
},
146-
],
147122
firstName: 'Jon',
148123
groups: [group],
149124
idpId: 'idp_foo',
150125
lastName: 'Snow',
151-
jobTitle: 'Knight of the Watch',
152126
rawAttributes: {},
153127
state: 'active',
154-
username: 'jonsnow',
155128
role: { slug: 'super_admin' },
156129
createdAt: '2021-10-27 15:21:50.640959',
157130
updatedAt: '2021-12-13 12:15:45.531847',
@@ -166,21 +139,12 @@ describe('DirectorySync', () => {
166139
directory_id: 'dir_123',
167140
organization_id: 'org_123',
168141
169-
emails: [
170-
{
171-
primary: true,
172-
type: 'type',
173-
174-
},
175-
],
176142
first_name: 'Jon',
177143
groups: [groupResponse],
178144
idp_id: 'idp_foo',
179145
last_name: 'Snow',
180-
job_title: 'Knight of the Watch',
181146
raw_attributes: {},
182147
state: 'active',
183-
username: 'jonsnow',
184148
role: { slug: 'super_admin' },
185149
created_at: '2021-10-27 15:21:50.640959',
186150
updated_at: '2021-12-13 12:15:45.531847',

src/directory-sync/interfaces/directory-user.interface.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,7 @@ export interface DirectoryUser<
1919
idpId: string;
2020
firstName: string | null;
2121
email: string | null;
22-
/** @deprecated Will be removed in a future major version.
23-
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
24-
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
25-
*/
26-
emails: {
27-
type?: string;
28-
value?: string;
29-
primary?: boolean;
30-
}[];
31-
/** @deprecated Will be removed in a future major version.
32-
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
33-
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
34-
*/
35-
username: string | null;
3622
lastName: string | null;
37-
/** @deprecated Will be removed in a future major version.
38-
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
39-
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
40-
*/
41-
jobTitle: string | null;
4223
state: 'active' | 'inactive';
4324
role?: RoleResponse;
4425
createdAt: string;
@@ -58,26 +39,7 @@ export interface DirectoryUserResponse<
5839
idp_id: string;
5940
first_name: string | null;
6041
email: string | null;
61-
/** @deprecated Will be removed in a future major version.
62-
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
63-
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
64-
*/
65-
emails: {
66-
type?: string;
67-
value?: string;
68-
primary?: boolean;
69-
}[];
70-
/** @deprecated Will be removed in a future major version.
71-
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
72-
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
73-
*/
74-
username: string | null;
7542
last_name: string | null;
76-
/** @deprecated Will be removed in a future major version.
77-
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
78-
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
79-
*/
80-
job_title: string | null;
8143
state: 'active' | 'inactive';
8244
role?: RoleResponse;
8345
created_at: string;

src/directory-sync/serializers/directory-user.serializer.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ export const deserializeDirectoryUser = <
2323
idpId: directoryUser.idp_id,
2424
firstName: directoryUser.first_name,
2525
email: directoryUser.email,
26-
emails: directoryUser.emails,
27-
username: directoryUser.username,
2826
lastName: directoryUser.last_name,
29-
jobTitle: directoryUser.job_title,
3027
state: directoryUser.state,
3128
role: directoryUser.role,
3229
createdAt: directoryUser.created_at,
@@ -54,10 +51,7 @@ export const deserializeUpdatedEventDirectoryUser = (
5451
idpId: directoryUser.idp_id,
5552
firstName: directoryUser.first_name,
5653
email: directoryUser.email,
57-
emails: directoryUser.emails,
58-
username: directoryUser.username,
5954
lastName: directoryUser.last_name,
60-
jobTitle: directoryUser.job_title,
6155
state: directoryUser.state,
6256
role: directoryUser.role,
6357
createdAt: directoryUser.created_at,

src/directory-sync/utils/get-primary-email.spec.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/directory-sync/utils/get-primary-email.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/events/events.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,11 @@ describe('Event', () => {
129129
directoryId: 'dir_123',
130130
organizationId: 'org_123',
131131
132-
emails: [
133-
{
134-
primary: true,
135-
type: 'type',
136-
137-
},
138-
],
139132
firstName: 'Jon',
140133
idpId: 'idp_foo',
141134
lastName: 'Snow',
142-
jobTitle: 'Knight of the Watch',
143135
rawAttributes: {},
144136
state: 'active',
145-
username: 'jonsnow',
146137
role: { slug: 'super_admin' },
147138
previousAttributes: {
148139
role: { slug: 'member' },
@@ -165,20 +156,11 @@ describe('Event', () => {
165156
directory_id: 'dir_123',
166157
organization_id: 'org_123',
167158
168-
emails: [
169-
{
170-
primary: true,
171-
type: 'type',
172-
173-
},
174-
],
175159
first_name: 'Jon',
176160
idp_id: 'idp_foo',
177161
last_name: 'Snow',
178-
job_title: 'Knight of the Watch',
179162
raw_attributes: {},
180163
state: 'active',
181-
username: 'jonsnow',
182164
role: { slug: 'super_admin' },
183165
previous_attributes: {
184166
role: { slug: 'member' },

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export * from './common/exceptions';
1515
export * from './common/interfaces';
1616
export * from './common/utils/pagination';
1717
export * from './directory-sync/interfaces';
18-
export * from './directory-sync/utils/get-primary-email';
1918
export * from './events/interfaces';
2019
export * from './fga/interfaces';
2120
export * from './organizations/interfaces';

0 commit comments

Comments
 (0)