@asgardeo/react 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AsgardeoReactClient.d.ts +10 -3
- package/dist/__temp__/api.d.ts +11 -5
- package/dist/__temp__/models.d.ts +3 -3
- package/dist/api/scim2/createOrganization.d.ts +74 -0
- package/dist/api/scim2/getAllOrganizations.d.ts +56 -0
- package/dist/api/scim2/getMeOrganizations.d.ts +52 -0
- package/dist/api/scim2/getOrganization.d.ts +61 -0
- package/dist/api/scim2/updateOrganization.d.ts +74 -0
- package/dist/cjs/index.js +9854 -17224
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +5 -5
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +5 -5
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +5 -5
- package/dist/components/control/AsgardeoLoading.d.ts +45 -0
- package/dist/components/factories/FieldFactory.d.ts +3 -3
- package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +53 -0
- package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
- package/dist/components/presentation/Organization/BaseOrganization.d.ts +66 -0
- package/dist/components/presentation/Organization/Organization.d.ts +66 -0
- package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +117 -0
- package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
- package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +153 -0
- package/dist/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
- package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +141 -0
- package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +70 -0
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +29 -40
- package/dist/components/presentation/SignIn/SignIn.d.ts +2 -1
- package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +4 -4
- package/dist/components/presentation/SignIn/types.d.ts +6 -6
- package/dist/components/presentation/SignUp/BaseSignUp.d.ts +126 -0
- package/dist/components/presentation/SignUp/SignUp.d.ts +55 -0
- package/dist/components/presentation/SignUp/options/CheckboxInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/DateInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/DividerComponent.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/EmailInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/FormContainer.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/GoogleButton.d.ts +25 -0
- package/dist/components/presentation/SignUp/options/ImageComponent.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/NumberInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/PasswordInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/SignUpOptionFactory.d.ts +100 -0
- package/dist/components/presentation/SignUp/options/SocialButton.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/SubmitButton.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/TelephoneInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/TextInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/Typography.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/index.d.ts +26 -0
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +34 -22
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +60 -4
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +17 -15
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
- package/dist/components/primitives/Avatar/Avatar.d.ts +21 -8
- package/dist/components/primitives/Card/Card.d.ts +8 -9
- package/dist/components/primitives/Divider/Divider.d.ts +8 -8
- package/dist/components/primitives/Icons/Building.d.ts +40 -0
- package/dist/components/primitives/Icons/BuildingAlt.d.ts +40 -0
- package/dist/components/primitives/Icons/Check.d.ts +40 -0
- package/dist/components/primitives/Icons/ChevronDown.d.ts +40 -0
- package/dist/components/primitives/Icons/LogOut.d.ts +23 -0
- package/dist/components/primitives/Icons/Plus.d.ts +23 -0
- package/dist/components/primitives/Icons/Settings.d.ts +0 -0
- package/dist/components/primitives/Icons/User.d.ts +23 -0
- package/dist/components/primitives/Icons/X.d.ts +23 -0
- package/dist/components/primitives/Icons/index.d.ts +27 -0
- package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +123 -0
- package/dist/components/primitives/KeyValueInput/index.d.ts +0 -0
- package/dist/components/primitives/Popover/Popover.d.ts +19 -19
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +3 -2
- package/dist/contexts/Organization/OrganizationContext.d.ts +74 -0
- package/dist/contexts/Organization/OrganizationProvider.d.ts +90 -0
- package/dist/contexts/Organization/useOrganization.d.ts +104 -0
- package/dist/contexts/Theme/types.d.ts +38 -9
- package/dist/contexts/User/UserContext.d.ts +3 -2
- package/dist/contexts/User/UserProvider.d.ts +2 -1
- package/dist/hooks/useForm.d.ts +52 -52
- package/dist/index.d.ts +39 -0
- package/dist/index.js +9605 -16988
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User } from '@asgardeo/browser';
|
|
18
|
+
import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User, EmbeddedFlowExecuteResponse, SignUpOptions, EmbeddedFlowExecuteRequestPayload, EmbeddedSignInFlowHandleRequestPayload, Organization, EmbeddedFlowExecuteRequestConfig } from '@asgardeo/browser';
|
|
19
19
|
import { AsgardeoReactConfig } from './models/config';
|
|
20
20
|
/**
|
|
21
21
|
* Client for mplementing Asgardeo in React applications.
|
|
@@ -26,13 +26,20 @@ import { AsgardeoReactConfig } from './models/config';
|
|
|
26
26
|
declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> extends AsgardeoBrowserClient<T> {
|
|
27
27
|
private asgardeo;
|
|
28
28
|
constructor();
|
|
29
|
-
initialize(config:
|
|
29
|
+
initialize(config: AsgardeoReactConfig): Promise<boolean>;
|
|
30
30
|
getUser(): Promise<User>;
|
|
31
31
|
getUserProfile(): Promise<UserProfile>;
|
|
32
|
+
getOrganizations(): Promise<Organization[]>;
|
|
33
|
+
getCurrentOrganization(): Promise<Organization | null>;
|
|
34
|
+
switchOrganization(organization: Organization): Promise<void>;
|
|
32
35
|
isLoading(): boolean;
|
|
36
|
+
isInitialized(): Promise<boolean>;
|
|
33
37
|
isSignedIn(): Promise<boolean>;
|
|
34
|
-
signIn(options?: SignInOptions): Promise<User>;
|
|
38
|
+
signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
39
|
+
signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
|
|
35
40
|
signOut(options?: SignOutOptions, afterSignOut?: (redirectUrl: string) => void): Promise<string>;
|
|
36
41
|
signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (redirectUrl: string) => void): Promise<string>;
|
|
42
|
+
signUp(options?: SignUpOptions): Promise<void>;
|
|
43
|
+
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
37
44
|
}
|
|
38
45
|
export default AsgardeoReactClient;
|
package/dist/__temp__/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2025, WSO2
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
3
|
*
|
|
4
|
-
* WSO2
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
6
6
|
* in compliance with the License.
|
|
7
7
|
* You may obtain a copy of the License at
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AsgardeoSPAClient, AuthClientConfig, User, LegacyConfig as Config,
|
|
18
|
+
import { AsgardeoSPAClient, AuthClientConfig, User, LegacyConfig as Config, IdToken, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, SPACustomGrantConfig } from '@asgardeo/browser';
|
|
19
19
|
import { AuthStateInterface } from './models';
|
|
20
20
|
declare class AuthAPI {
|
|
21
21
|
static DEFAULT_STATE: AuthStateInterface;
|
|
@@ -44,6 +44,12 @@ declare class AuthAPI {
|
|
|
44
44
|
* @returns {Promise<AuthClientConfig<Config>>} - A promise that resolves with the configuration data.
|
|
45
45
|
*/
|
|
46
46
|
getConfigData(): Promise<AuthClientConfig<Config>>;
|
|
47
|
+
/**
|
|
48
|
+
* Method to get the configuration data.
|
|
49
|
+
*
|
|
50
|
+
* @returns {Promise<AuthClientConfig<Config>>} - A promise that resolves with the configuration data.
|
|
51
|
+
*/
|
|
52
|
+
isInitialized(): Promise<boolean>;
|
|
47
53
|
/**
|
|
48
54
|
* Method to handle user Sign In requests.
|
|
49
55
|
*
|
|
@@ -129,14 +135,14 @@ declare class AuthAPI {
|
|
|
129
135
|
* @return {Promise<DecodedIDTokenPayloadInterface>} - A Promise that resolves with
|
|
130
136
|
* the decoded payload of the id token.
|
|
131
137
|
*/
|
|
132
|
-
getDecodedIdToken(): Promise<
|
|
138
|
+
getDecodedIdToken(): Promise<IdToken>;
|
|
133
139
|
/**
|
|
134
140
|
* This method decodes the payload of the idp id token and returns it.
|
|
135
141
|
*
|
|
136
142
|
* @return {Promise<DecodedIDTokenPayloadInterface>} - A Promise that resolves with
|
|
137
143
|
* the decoded payload of the idp id token.
|
|
138
144
|
*/
|
|
139
|
-
getDecodedIDPIDToken(): Promise<
|
|
145
|
+
getDecodedIDPIDToken(): Promise<IdToken>;
|
|
140
146
|
/**
|
|
141
147
|
* This method returns the ID token.
|
|
142
148
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { AsgardeoAuthException, AuthClientConfig, AuthSPAClientConfig, Config, TokenExchangeRequestConfig,
|
|
18
|
+
import { AsgardeoAuthException, AuthClientConfig, AuthSPAClientConfig, Config, TokenExchangeRequestConfig, IdToken, Hooks, HttpClientInstance, HttpRequestConfig, HttpResponse, OIDCEndpoints, SignInConfig, User } from '@asgardeo/browser';
|
|
19
19
|
export interface ReactConfig {
|
|
20
20
|
/**
|
|
21
21
|
* The SDK's `AuthProvider` by default is listening to the URL changes to see
|
|
@@ -69,8 +69,8 @@ export interface AuthContextInterface {
|
|
|
69
69
|
revokeAccessToken(): Promise<boolean>;
|
|
70
70
|
getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>;
|
|
71
71
|
getHttpClient(): Promise<HttpClientInstance>;
|
|
72
|
-
getDecodedIDPIDToken(): Promise<
|
|
73
|
-
getDecodedIdToken(): Promise<
|
|
72
|
+
getDecodedIDPIDToken(): Promise<IdToken>;
|
|
73
|
+
getDecodedIdToken(): Promise<IdToken>;
|
|
74
74
|
getIdToken(): Promise<string>;
|
|
75
75
|
getAccessToken(): Promise<string>;
|
|
76
76
|
refreshAccessToken(): Promise<User>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { Organization } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Interface for organization creation payload.
|
|
21
|
+
*/
|
|
22
|
+
export interface CreateOrganizationPayload {
|
|
23
|
+
/**
|
|
24
|
+
* Organization description.
|
|
25
|
+
*/
|
|
26
|
+
description: string;
|
|
27
|
+
/**
|
|
28
|
+
* Organization handle/slug.
|
|
29
|
+
*/
|
|
30
|
+
orgHandle?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Organization name.
|
|
33
|
+
*/
|
|
34
|
+
name: string;
|
|
35
|
+
/**
|
|
36
|
+
* Parent organization ID.
|
|
37
|
+
*/
|
|
38
|
+
parentId: string;
|
|
39
|
+
/**
|
|
40
|
+
* Organization type.
|
|
41
|
+
*/
|
|
42
|
+
type: 'TENANT';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new organization.
|
|
46
|
+
*
|
|
47
|
+
* @param config - Configuration object containing baseUrl, payload and optional request config.
|
|
48
|
+
* @returns A promise that resolves with the created organization information.
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* try {
|
|
52
|
+
* const organization = await createOrganization({
|
|
53
|
+
* baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
|
|
54
|
+
* payload: {
|
|
55
|
+
* description: "Share your screens",
|
|
56
|
+
* name: "Team Viewer",
|
|
57
|
+
* orgHandle: "team-viewer",
|
|
58
|
+
* parentId: "f4825104-4948-40d9-ab65-a960eee3e3d5",
|
|
59
|
+
* type: "TENANT"
|
|
60
|
+
* }
|
|
61
|
+
* });
|
|
62
|
+
* console.log(organization);
|
|
63
|
+
* } catch (error) {
|
|
64
|
+
* if (error instanceof AsgardeoAPIError) {
|
|
65
|
+
* console.error('Failed to create organization:', error.message);
|
|
66
|
+
* }
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const createOrganization: ({ baseUrl, payload, ...requestConfig }: Partial<Request> & {
|
|
71
|
+
baseUrl: string;
|
|
72
|
+
payload: CreateOrganizationPayload;
|
|
73
|
+
}) => Promise<Organization>;
|
|
74
|
+
export default createOrganization;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { Organization } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Interface for paginated organization response.
|
|
21
|
+
*/
|
|
22
|
+
export interface PaginatedOrganizationsResponse {
|
|
23
|
+
hasMore?: boolean;
|
|
24
|
+
nextCursor?: string;
|
|
25
|
+
organizations: Organization[];
|
|
26
|
+
totalCount?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves all organizations with pagination support.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
32
|
+
* @returns A promise that resolves with the paginated organizations information.
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* try {
|
|
36
|
+
* const response = await getAllOrganizations({
|
|
37
|
+
* baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
|
|
38
|
+
* filter: "",
|
|
39
|
+
* limit: 10,
|
|
40
|
+
* recursive: false
|
|
41
|
+
* });
|
|
42
|
+
* console.log(response.organizations);
|
|
43
|
+
* } catch (error) {
|
|
44
|
+
* if (error instanceof AsgardeoAPIError) {
|
|
45
|
+
* console.error('Failed to get organizations:', error.message);
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare const getAllOrganizations: ({ baseUrl, filter, limit, recursive, ...requestConfig }: Partial<Request> & {
|
|
51
|
+
baseUrl: string;
|
|
52
|
+
filter?: string;
|
|
53
|
+
limit?: number;
|
|
54
|
+
recursive?: boolean;
|
|
55
|
+
}) => Promise<PaginatedOrganizationsResponse>;
|
|
56
|
+
export default getAllOrganizations;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { Organization } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the organizations associated with the current user.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Configuration object containing baseUrl, optional query parameters, and request config.
|
|
23
|
+
* @returns A promise that resolves with the organizations information.
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* try {
|
|
27
|
+
* const organizations = await getMeOrganizations({
|
|
28
|
+
* baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
|
|
29
|
+
* after: "",
|
|
30
|
+
* before: "",
|
|
31
|
+
* filter: "",
|
|
32
|
+
* limit: 10,
|
|
33
|
+
* recursive: false
|
|
34
|
+
* });
|
|
35
|
+
* console.log(organizations);
|
|
36
|
+
* } catch (error) {
|
|
37
|
+
* if (error instanceof AsgardeoAPIError) {
|
|
38
|
+
* console.error('Failed to get organizations:', error.message);
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const getMeOrganizations: ({ baseUrl, after, authorizedAppName, before, filter, limit, recursive, ...requestConfig }: Partial<Request> & {
|
|
44
|
+
baseUrl: string;
|
|
45
|
+
after?: string;
|
|
46
|
+
authorizedAppName?: string;
|
|
47
|
+
before?: string;
|
|
48
|
+
filter?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
recursive?: boolean;
|
|
51
|
+
}) => Promise<Organization[]>;
|
|
52
|
+
export default getMeOrganizations;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Extended organization interface with additional properties
|
|
20
|
+
*/
|
|
21
|
+
export interface OrganizationDetails {
|
|
22
|
+
attributes?: Record<string, any>;
|
|
23
|
+
created?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
id: string;
|
|
26
|
+
lastModified?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
orgHandle: string;
|
|
29
|
+
parent?: {
|
|
30
|
+
id: string;
|
|
31
|
+
ref: string;
|
|
32
|
+
};
|
|
33
|
+
permissions?: string[];
|
|
34
|
+
status?: string;
|
|
35
|
+
type?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves detailed information for a specific organization.
|
|
39
|
+
*
|
|
40
|
+
* @param config - Configuration object containing baseUrl, organizationId, and request config.
|
|
41
|
+
* @returns A promise that resolves with the organization details.
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* try {
|
|
45
|
+
* const organization = await getOrganization({
|
|
46
|
+
* baseUrl: "https://api.asgardeo.io/t/dxlab",
|
|
47
|
+
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
|
|
48
|
+
* });
|
|
49
|
+
* console.log(organization);
|
|
50
|
+
* } catch (error) {
|
|
51
|
+
* if (error instanceof AsgardeoAPIError) {
|
|
52
|
+
* console.error('Failed to get organization:', error.message);
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const getOrganization: ({ baseUrl, organizationId, ...requestConfig }: Partial<Request> & {
|
|
58
|
+
baseUrl: string;
|
|
59
|
+
organizationId: string;
|
|
60
|
+
}) => Promise<OrganizationDetails>;
|
|
61
|
+
export default getOrganization;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { OrganizationDetails } from './getOrganization';
|
|
19
|
+
/**
|
|
20
|
+
* Updates the organization information using the Organizations Management API.
|
|
21
|
+
*
|
|
22
|
+
* @param baseUrl - The base URL for the API.
|
|
23
|
+
* @param organizationId - The ID of the organization to update.
|
|
24
|
+
* @param operations - Array of patch operations to apply.
|
|
25
|
+
* @param requestConfig - Additional request config if needed.
|
|
26
|
+
* @returns A promise that resolves with the updated organization information.
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Using the helper function to create operations automatically
|
|
30
|
+
* const operations = createPatchOperations({
|
|
31
|
+
* name: "Updated Organization Name", // Will use REPLACE
|
|
32
|
+
* description: "", // Will use REMOVE (empty string)
|
|
33
|
+
* customField: "Some value" // Will use REPLACE
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* await updateOrganization({
|
|
37
|
+
* baseUrl: "https://api.asgardeo.io/t/<ORG>",
|
|
38
|
+
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
39
|
+
* operations
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Or manually specify operations
|
|
43
|
+
* await updateOrganization({
|
|
44
|
+
* baseUrl: "https://api.asgardeo.io/t/<ORG>",
|
|
45
|
+
* organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
|
|
46
|
+
* operations: [
|
|
47
|
+
* { operation: "REPLACE", path: "/name", value: "Updated Organization Name" },
|
|
48
|
+
* { operation: "REMOVE", path: "/description" }
|
|
49
|
+
* ]
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare const updateOrganization: ({ baseUrl, organizationId, operations, ...requestConfig }: {
|
|
54
|
+
baseUrl: string;
|
|
55
|
+
organizationId: string;
|
|
56
|
+
operations: Array<{
|
|
57
|
+
operation: "REPLACE" | "ADD" | "REMOVE";
|
|
58
|
+
path: string;
|
|
59
|
+
value?: any;
|
|
60
|
+
}>;
|
|
61
|
+
} & Partial<Request>) => Promise<OrganizationDetails>;
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to convert field updates to patch operations format.
|
|
64
|
+
* Uses REMOVE operation when the value is empty, otherwise uses REPLACE.
|
|
65
|
+
*
|
|
66
|
+
* @param payload - Object containing field updates
|
|
67
|
+
* @returns Array of patch operations
|
|
68
|
+
*/
|
|
69
|
+
export declare const createPatchOperations: (payload: Record<string, any>) => Array<{
|
|
70
|
+
operation: "REPLACE" | "REMOVE";
|
|
71
|
+
path: string;
|
|
72
|
+
value?: any;
|
|
73
|
+
}>;
|
|
74
|
+
export default updateOrganization;
|