Skip to content

Commit b31c68d

Browse files
authored
replace deprecated with jsdocs (#350) RELEASE
1 parent 392e373 commit b31c68d

File tree

2 files changed

+74
-79
lines changed

2 files changed

+74
-79
lines changed

lib/management/sso.ts

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { SdkResponse, transformResponse } from '@descope/core-js-sdk';
2-
import { deprecate } from 'util';
32
import { CoreSdk } from '../types';
43
import apiPaths from './paths';
54
import {
@@ -13,58 +12,58 @@ import {
1312
} from './types';
1413

1514
const withSSOSettings = (sdk: CoreSdk, managementKey?: string) => ({
16-
getSettings: deprecate(
17-
(tenantId: string): Promise<SdkResponse<SSOSettingsResponse>> =>
18-
transformResponse<SSOSettingsResponse>(
19-
sdk.httpClient.get(apiPaths.sso.settings, {
20-
queryParams: { tenantId },
21-
token: managementKey,
22-
}),
23-
(data) => data,
24-
),
25-
'getSettings is deprecated, please use loadSettings instead',
26-
),
15+
/**
16+
* @deprecated Use loadSettings instead
17+
*/
18+
getSettings: (tenantId: string): Promise<SdkResponse<SSOSettingsResponse>> =>
19+
transformResponse<SSOSettingsResponse>(
20+
sdk.httpClient.get(apiPaths.sso.settings, {
21+
queryParams: { tenantId },
22+
token: managementKey,
23+
}),
24+
(data) => data,
25+
),
2726
deleteSettings: (tenantId: string): Promise<SdkResponse<never>> =>
2827
transformResponse(
2928
sdk.httpClient.delete(apiPaths.sso.settings, {
3029
queryParams: { tenantId },
3130
token: managementKey,
3231
}),
3332
),
34-
configureSettings: deprecate(
35-
(
36-
tenantId: string,
37-
idpURL: string,
38-
idpCert: string,
39-
entityId: string,
40-
redirectURL: string,
41-
domains: string[],
42-
): Promise<SdkResponse<never>> =>
43-
transformResponse(
44-
sdk.httpClient.post(
45-
apiPaths.sso.settings,
46-
{ tenantId, idpURL, entityId, idpCert, redirectURL, domains },
47-
{ token: managementKey },
48-
),
33+
/**
34+
* @deprecated Use configureSAMLSettings instead
35+
*/
36+
configureSettings: (
37+
tenantId: string,
38+
idpURL: string,
39+
idpCert: string,
40+
entityId: string,
41+
redirectURL: string,
42+
domains: string[],
43+
): Promise<SdkResponse<never>> =>
44+
transformResponse(
45+
sdk.httpClient.post(
46+
apiPaths.sso.settings,
47+
{ tenantId, idpURL, entityId, idpCert, redirectURL, domains },
48+
{ token: managementKey },
4949
),
50-
'configureSettings is deprecated, please use configureSAMLSettings instead ',
51-
),
52-
configureMetadata: deprecate(
53-
(
54-
tenantId: string,
55-
idpMetadataURL: string,
56-
redirectURL: string,
57-
domains: string[],
58-
): Promise<SdkResponse<never>> =>
59-
transformResponse(
60-
sdk.httpClient.post(
61-
apiPaths.sso.metadata,
62-
{ tenantId, idpMetadataURL, redirectURL, domains },
63-
{ token: managementKey },
64-
),
50+
),
51+
/**
52+
* @deprecated Use configureSAMLByMetadata instead
53+
*/
54+
configureMetadata: (
55+
tenantId: string,
56+
idpMetadataURL: string,
57+
redirectURL: string,
58+
domains: string[],
59+
): Promise<SdkResponse<never>> =>
60+
transformResponse(
61+
sdk.httpClient.post(
62+
apiPaths.sso.metadata,
63+
{ tenantId, idpMetadataURL, redirectURL, domains },
64+
{ token: managementKey },
6565
),
66-
'configureMetadata is deprecated, please use configureSAMLByMetadata instead',
67-
),
66+
),
6867
configureMapping: (
6968
tenantId: string,
7069
roleMappings?: RoleMappings,

lib/management/user.ts

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
UserResponse,
66
LoginOptions,
77
} from '@descope/core-js-sdk';
8-
import { deprecate } from 'util';
98
import {
109
ProviderTokenResponse,
1110
AssociatedTenant,
@@ -453,6 +452,7 @@ const withUser = (sdk: CoreSdk, managementKey?: string) => {
453452
/**
454453
* Search all users. Results can be filtered according to tenants and/or
455454
* roles, and also paginated used the limit and page parameters.
455+
* @deprecated Use search instead
456456
* @param tenantIds optional list of tenant IDs to filter by
457457
* @param roles optional list of roles to filter by
458458
* @param limit optionally limit the response, leave out for default limit
@@ -461,41 +461,37 @@ const withUser = (sdk: CoreSdk, managementKey?: string) => {
461461
* @param withTestUser optionally include test users in search
462462
* @returns An array of UserResponse found by the query
463463
*/
464-
465-
searchAll: deprecate(
466-
(
467-
tenantIds?: string[],
468-
roles?: string[],
469-
limit?: number,
470-
page?: number,
471-
testUsersOnly?: boolean,
472-
withTestUser?: boolean,
473-
customAttributes?: Record<string, AttributesTypes>,
474-
statuses?: UserStatus[],
475-
emails?: string[],
476-
phones?: string[],
477-
): Promise<SdkResponse<UserResponse[]>> =>
478-
transformResponse<MultipleUsersResponse, UserResponse[]>(
479-
sdk.httpClient.post(
480-
apiPaths.user.search,
481-
{
482-
tenantIds,
483-
roleNames: roles,
484-
limit,
485-
page,
486-
testUsersOnly,
487-
withTestUser,
488-
customAttributes,
489-
statuses,
490-
emails,
491-
phones,
492-
},
493-
{ token: managementKey },
494-
),
495-
(data) => data.users,
464+
searchAll: (
465+
tenantIds?: string[],
466+
roles?: string[],
467+
limit?: number,
468+
page?: number,
469+
testUsersOnly?: boolean,
470+
withTestUser?: boolean,
471+
customAttributes?: Record<string, AttributesTypes>,
472+
statuses?: UserStatus[],
473+
emails?: string[],
474+
phones?: string[],
475+
): Promise<SdkResponse<UserResponse[]>> =>
476+
transformResponse<MultipleUsersResponse, UserResponse[]>(
477+
sdk.httpClient.post(
478+
apiPaths.user.search,
479+
{
480+
tenantIds,
481+
roleNames: roles,
482+
limit,
483+
page,
484+
testUsersOnly,
485+
withTestUser,
486+
customAttributes,
487+
statuses,
488+
emails,
489+
phones,
490+
},
491+
{ token: managementKey },
496492
),
497-
'searchAll is deprecated please use search() instead',
498-
),
493+
(data) => data.users,
494+
),
499495
/**
500496
* Search all users. Results can be filtered according to tenants roles and more,
501497
* Pagination is also available using the limit and page parameters.

0 commit comments

Comments
 (0)