@asgardeo/javascript 0.0.1 → 0.1.1

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.
Files changed (73) hide show
  1. package/README.md +3 -3
  2. package/dist/AsgardeoJavaScriptClient.d.ts +17 -50
  3. package/dist/IsomorphicCrypto.d.ts +4 -4
  4. package/dist/{__legacy__/data/data-layer.d.ts → StorageManager.d.ts} +27 -26
  5. package/dist/__legacy__/client.d.ts +82 -98
  6. package/dist/__legacy__/helpers/authentication-helper.d.ts +9 -9
  7. package/dist/__legacy__/models/client-config.d.ts +6 -6
  8. package/dist/__legacy__/models/index.d.ts +0 -5
  9. package/dist/api/createOrganization.d.ts +129 -0
  10. package/dist/api/executeEmbeddedSignInFlow.d.ts +21 -0
  11. package/dist/api/executeEmbeddedSignUpFlow.d.ts +44 -0
  12. package/dist/api/getAllOrganizations.d.ts +112 -0
  13. package/dist/api/getMeOrganizations.d.ts +119 -0
  14. package/dist/api/getOrganization.d.ts +109 -0
  15. package/dist/api/getSchemas.d.ts +89 -0
  16. package/dist/api/getScim2Me.d.ts +89 -0
  17. package/dist/api/{oidc/getUserInfo.d.ts → getUserInfo.d.ts} +1 -1
  18. package/dist/api/initializeEmbeddedSignInFlow.d.ts +51 -0
  19. package/dist/api/updateMeProfile.d.ts +82 -0
  20. package/dist/api/updateOrganization.d.ts +118 -0
  21. package/dist/cjs/index.js +2437 -1224
  22. package/dist/cjs/index.js.map +4 -4
  23. package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +39 -0
  24. package/dist/constants/OIDCRequestConstants.d.ts +14 -0
  25. package/dist/constants/PKCEConstants.d.ts +1 -0
  26. package/dist/constants/ScopeConstants.d.ts +3 -6
  27. package/dist/constants/TokenExchangeConstants.d.ts +3 -3
  28. package/dist/constants/VendorConstants.d.ts +31 -0
  29. package/dist/{__legacy__/exception → errors}/exception.d.ts +3 -0
  30. package/dist/{__legacy__/data/index.d.ts → i18n/en-US.d.ts} +4 -2
  31. package/dist/{__legacy__/exception → i18n}/index.d.ts +2 -2
  32. package/dist/index.d.ts +44 -11
  33. package/dist/index.js +2399 -1219
  34. package/dist/index.js.map +4 -4
  35. package/dist/models/client.d.ts +60 -5
  36. package/dist/models/config.d.ts +51 -2
  37. package/dist/models/crypto.d.ts +2 -2
  38. package/dist/models/embedded-flow.d.ts +66 -0
  39. package/dist/models/embedded-signin-flow.d.ts +99 -0
  40. package/dist/{__legacy__/models/custom-grant.d.ts → models/field.d.ts} +13 -9
  41. package/dist/models/flow.d.ts +30 -0
  42. package/dist/models/i18n.d.ts +90 -0
  43. package/dist/{__legacy__/models/authorization-url.d.ts → models/oauth-request.d.ts} +3 -3
  44. package/dist/models/oauth-response.d.ts +1 -17
  45. package/dist/models/organization.d.ts +24 -0
  46. package/dist/models/scim2-schema.d.ts +3 -0
  47. package/dist/{__legacy__/models/data.d.ts → models/session.d.ts} +4 -0
  48. package/dist/models/store.d.ts +1 -1
  49. package/dist/models/token.d.ts +79 -20
  50. package/dist/models/user.d.ts +11 -84
  51. package/dist/theme/createTheme.d.ts +1 -1
  52. package/dist/theme/types.d.ts +29 -17
  53. package/dist/utils/deepMerge.d.ts +44 -0
  54. package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +2 -2
  55. package/dist/utils/extractUserClaimsFromIdToken.d.ts +2 -2
  56. package/dist/utils/flattenUserSchema.d.ts +64 -0
  57. package/dist/utils/generateFlattenedUserProfile.d.ts +53 -0
  58. package/dist/utils/generateUserProfile.d.ts +55 -0
  59. package/dist/utils/get.d.ts +29 -0
  60. package/dist/utils/getAuthorizeRequestUrlParams.d.ts +59 -0
  61. package/dist/utils/getI18nBundles.d.ts +26 -0
  62. package/dist/utils/getLatestStateParam.d.ts +40 -0
  63. package/dist/utils/isEmpty.d.ts +48 -0
  64. package/dist/utils/processOpenIDScopes.d.ts +36 -0
  65. package/dist/{__legacy__/core/index.d.ts → utils/resolveFieldName.d.ts} +3 -2
  66. package/dist/utils/resolveFieldType.d.ts +20 -0
  67. package/dist/utils/set.d.ts +30 -0
  68. package/dist/utils/withVendorCSSClassPrefix.d.ts +32 -0
  69. package/package.json +4 -4
  70. package/dist/__legacy__/core/authentication-core.d.ts +0 -51
  71. package/dist/__legacy__/models/fetch.d.ts +0 -55
  72. package/dist/__legacy__/models/user.d.ts +0 -85
  73. package/dist/models/id-token.d.ts +0 -55
@@ -0,0 +1,21 @@
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 { EmbeddedFlowExecuteRequestConfig } from '../models/embedded-flow';
19
+ import { EmbeddedSignInFlowHandleResponse } from '../models/embedded-signin-flow';
20
+ declare const executeEmbeddedSignInFlow: ({ url, baseUrl, payload, ...requestConfig }: EmbeddedFlowExecuteRequestConfig) => Promise<EmbeddedSignInFlowHandleResponse>;
21
+ export default executeEmbeddedSignInFlow;
@@ -0,0 +1,44 @@
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 { EmbeddedFlowExecuteResponse, EmbeddedFlowExecuteRequestConfig } from '../models/embedded-flow';
19
+ /**
20
+ * Executes an embedded signup flow by sending a request to the specified flow execution endpoint.
21
+ *
22
+ * @param requestConfig - Request configuration object containing URL and payload.
23
+ * @returns A promise that resolves with the flow execution response.
24
+ * @throws AsgardeoAPIError when the request fails or URL is invalid.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * try {
29
+ * const embeddedSignUpResponse = await executeEmbeddedSignUpFlow({
30
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/api/server/v1/flow/execute",
31
+ * payload: {
32
+ * flowType: "REGISTRATION"
33
+ * }
34
+ * });
35
+ * console.log(embeddedSignUpResponse);
36
+ * } catch (error) {
37
+ * if (error instanceof AsgardeoAPIError) {
38
+ * console.error('Embedded SignUp flow execution failed:', error.message);
39
+ * }
40
+ * }
41
+ * ```
42
+ */
43
+ declare const executeEmbeddedSignUpFlow: ({ url, baseUrl, payload, ...requestConfig }: EmbeddedFlowExecuteRequestConfig) => Promise<EmbeddedFlowExecuteResponse>;
44
+ export default executeEmbeddedSignUpFlow;
@@ -0,0 +1,112 @@
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 '../models/organization';
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
+ * Configuration for the getAllOrganizations request
30
+ */
31
+ export interface GetAllOrganizationsConfig extends Omit<RequestInit, 'method'> {
32
+ /**
33
+ * The base URL for the API endpoint.
34
+ */
35
+ baseUrl: string;
36
+ /**
37
+ * Filter expression for organizations
38
+ */
39
+ filter?: string;
40
+ /**
41
+ * Maximum number of organizations to return
42
+ */
43
+ limit?: number;
44
+ /**
45
+ * Whether to include child organizations recursively
46
+ */
47
+ recursive?: boolean;
48
+ /**
49
+ * Optional custom fetcher function.
50
+ * If not provided, native fetch will be used
51
+ */
52
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
53
+ }
54
+ /**
55
+ * Retrieves all organizations with pagination support.
56
+ *
57
+ * @param config - Configuration object containing baseUrl, optional query parameters, and request config.
58
+ * @returns A promise that resolves with the paginated organizations information.
59
+ * @example
60
+ * ```typescript
61
+ * // Using default fetch
62
+ * try {
63
+ * const response = await getAllOrganizations({
64
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
65
+ * filter: "",
66
+ * limit: 10,
67
+ * recursive: false
68
+ * });
69
+ * console.log(response.organizations);
70
+ * } catch (error) {
71
+ * if (error instanceof AsgardeoAPIError) {
72
+ * console.error('Failed to get organizations:', error.message);
73
+ * }
74
+ * }
75
+ * ```
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // Using custom fetcher (e.g., axios-based httpClient)
80
+ * try {
81
+ * const response = await getAllOrganizations({
82
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
83
+ * filter: "",
84
+ * limit: 10,
85
+ * recursive: false,
86
+ * fetcher: async (url, config) => {
87
+ * const response = await httpClient({
88
+ * url,
89
+ * method: config.method,
90
+ * headers: config.headers,
91
+ * ...config
92
+ * });
93
+ * // Convert axios-like response to fetch-like Response
94
+ * return {
95
+ * ok: response.status >= 200 && response.status < 300,
96
+ * status: response.status,
97
+ * statusText: response.statusText,
98
+ * json: () => Promise.resolve(response.data),
99
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
100
+ * } as Response;
101
+ * }
102
+ * });
103
+ * console.log(response.organizations);
104
+ * } catch (error) {
105
+ * if (error instanceof AsgardeoAPIError) {
106
+ * console.error('Failed to get organizations:', error.message);
107
+ * }
108
+ * }
109
+ * ```
110
+ */
111
+ declare const getAllOrganizations: ({ baseUrl, filter, limit, recursive, fetcher, ...requestConfig }: GetAllOrganizationsConfig) => Promise<PaginatedOrganizationsResponse>;
112
+ export default getAllOrganizations;
@@ -0,0 +1,119 @@
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 '../models/organization';
19
+ /**
20
+ * Configuration for the getMeOrganizations request
21
+ */
22
+ export interface GetMeOrganizationsConfig extends Omit<RequestInit, 'method'> {
23
+ /**
24
+ * The base URL for the API endpoint.
25
+ */
26
+ baseUrl: string;
27
+ /**
28
+ * Base64 encoded cursor value for forward pagination
29
+ */
30
+ after?: string;
31
+ /**
32
+ * Authorized application name filter
33
+ */
34
+ authorizedAppName?: string;
35
+ /**
36
+ * Base64 encoded cursor value for backward pagination
37
+ */
38
+ before?: string;
39
+ /**
40
+ * Filter expression for organizations
41
+ */
42
+ filter?: string;
43
+ /**
44
+ * Maximum number of organizations to return
45
+ */
46
+ limit?: number;
47
+ /**
48
+ * Whether to include child organizations recursively
49
+ */
50
+ recursive?: boolean;
51
+ /**
52
+ * Optional custom fetcher function.
53
+ * If not provided, native fetch will be used
54
+ */
55
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
56
+ }
57
+ /**
58
+ * Retrieves the organizations associated with the current user.
59
+ *
60
+ * @param config - Configuration object containing baseUrl, optional query parameters, and request config.
61
+ * @returns A promise that resolves with the organizations information.
62
+ * @example
63
+ * ```typescript
64
+ * // Using default fetch
65
+ * try {
66
+ * const organizations = await getMeOrganizations({
67
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
68
+ * after: "",
69
+ * before: "",
70
+ * filter: "",
71
+ * limit: 10,
72
+ * recursive: false
73
+ * });
74
+ * console.log(organizations);
75
+ * } catch (error) {
76
+ * if (error instanceof AsgardeoAPIError) {
77
+ * console.error('Failed to get organizations:', error.message);
78
+ * }
79
+ * }
80
+ * ```
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // Using custom fetcher (e.g., axios-based httpClient)
85
+ * try {
86
+ * const organizations = await getMeOrganizations({
87
+ * baseUrl: "https://api.asgardeo.io/t/<ORGANIZATION>",
88
+ * after: "",
89
+ * before: "",
90
+ * filter: "",
91
+ * limit: 10,
92
+ * recursive: false,
93
+ * fetcher: async (url, config) => {
94
+ * const response = await httpClient({
95
+ * url,
96
+ * method: config.method,
97
+ * headers: config.headers,
98
+ * ...config
99
+ * });
100
+ * // Convert axios-like response to fetch-like Response
101
+ * return {
102
+ * ok: response.status >= 200 && response.status < 300,
103
+ * status: response.status,
104
+ * statusText: response.statusText,
105
+ * json: () => Promise.resolve(response.data),
106
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
107
+ * } as Response;
108
+ * }
109
+ * });
110
+ * console.log(organizations);
111
+ * } catch (error) {
112
+ * if (error instanceof AsgardeoAPIError) {
113
+ * console.error('Failed to get organizations:', error.message);
114
+ * }
115
+ * }
116
+ * ```
117
+ */
118
+ declare const getMeOrganizations: ({ baseUrl, after, authorizedAppName, before, filter, limit, recursive, fetcher, ...requestConfig }: GetMeOrganizationsConfig) => Promise<Organization[]>;
119
+ export default getMeOrganizations;
@@ -0,0 +1,109 @@
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
+ * Configuration for the getOrganization request
39
+ */
40
+ export interface GetOrganizationConfig extends Omit<RequestInit, 'method'> {
41
+ /**
42
+ * The base URL for the API endpoint.
43
+ */
44
+ baseUrl: string;
45
+ /**
46
+ * The ID of the organization to retrieve
47
+ */
48
+ organizationId: string;
49
+ /**
50
+ * Optional custom fetcher function.
51
+ * If not provided, native fetch will be used
52
+ */
53
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
54
+ }
55
+ /**
56
+ * Retrieves detailed information for a specific organization.
57
+ *
58
+ * @param config - Configuration object containing baseUrl, organizationId, and request config.
59
+ * @returns A promise that resolves with the organization details.
60
+ * @example
61
+ * ```typescript
62
+ * // Using default fetch
63
+ * try {
64
+ * const organization = await getOrganization({
65
+ * baseUrl: "https://api.asgardeo.io/t/dxlab",
66
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
67
+ * });
68
+ * console.log(organization);
69
+ * } catch (error) {
70
+ * if (error instanceof AsgardeoAPIError) {
71
+ * console.error('Failed to get organization:', error.message);
72
+ * }
73
+ * }
74
+ * ```
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * // Using custom fetcher (e.g., axios-based httpClient)
79
+ * try {
80
+ * const organization = await getOrganization({
81
+ * baseUrl: "https://api.asgardeo.io/t/dxlab",
82
+ * organizationId: "0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1",
83
+ * fetcher: async (url, config) => {
84
+ * const response = await httpClient({
85
+ * url,
86
+ * method: config.method,
87
+ * headers: config.headers,
88
+ * ...config
89
+ * });
90
+ * // Convert axios-like response to fetch-like Response
91
+ * return {
92
+ * ok: response.status >= 200 && response.status < 300,
93
+ * status: response.status,
94
+ * statusText: response.statusText,
95
+ * json: () => Promise.resolve(response.data),
96
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
97
+ * } as Response;
98
+ * }
99
+ * });
100
+ * console.log(organization);
101
+ * } catch (error) {
102
+ * if (error instanceof AsgardeoAPIError) {
103
+ * console.error('Failed to get organization:', error.message);
104
+ * }
105
+ * }
106
+ * ```
107
+ */
108
+ declare const getOrganization: ({ baseUrl, organizationId, fetcher, ...requestConfig }: GetOrganizationConfig) => Promise<OrganizationDetails>;
109
+ export default getOrganization;
@@ -0,0 +1,89 @@
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 { Schema } from '../models/scim2-schema';
19
+ /**
20
+ * Configuration for the getSchemas request
21
+ */
22
+ export interface GetSchemasConfig extends Omit<RequestInit, 'method'> {
23
+ /**
24
+ * The absolute API endpoint.
25
+ */
26
+ url?: string;
27
+ /**
28
+ * The base path of the API endpoint.
29
+ */
30
+ baseUrl?: string;
31
+ /**
32
+ * Optional custom fetcher function.
33
+ * If not provided, native fetch will be used
34
+ */
35
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
36
+ }
37
+ /**
38
+ * Retrieves the SCIM2 schemas from the specified endpoint.
39
+ *
40
+ * @param config - Request configuration object.
41
+ * @returns A promise that resolves with the SCIM2 schemas information.
42
+ * @example
43
+ * ```typescript
44
+ * // Using default fetch
45
+ * try {
46
+ * const schemas = await getSchemas({
47
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas",
48
+ * });
49
+ * console.log(schemas);
50
+ * } catch (error) {
51
+ * if (error instanceof AsgardeoAPIError) {
52
+ * console.error('Failed to get schemas:', error.message);
53
+ * }
54
+ * }
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Using custom fetcher (e.g., axios-based httpClient)
60
+ * try {
61
+ * const schemas = await getSchemas({
62
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas",
63
+ * fetcher: async (url, config) => {
64
+ * const response = await httpClient({
65
+ * url,
66
+ * method: config.method,
67
+ * headers: config.headers,
68
+ * ...config
69
+ * });
70
+ * // Convert axios-like response to fetch-like Response
71
+ * return {
72
+ * ok: response.status >= 200 && response.status < 300,
73
+ * status: response.status,
74
+ * statusText: response.statusText,
75
+ * json: () => Promise.resolve(response.data),
76
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
77
+ * } as Response;
78
+ * }
79
+ * });
80
+ * console.log(schemas);
81
+ * } catch (error) {
82
+ * if (error instanceof AsgardeoAPIError) {
83
+ * console.error('Failed to get schemas:', error.message);
84
+ * }
85
+ * }
86
+ * ```
87
+ */
88
+ declare const getSchemas: ({ url, baseUrl, fetcher, ...requestConfig }: GetSchemasConfig) => Promise<Schema[]>;
89
+ export default getSchemas;
@@ -0,0 +1,89 @@
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 { User } from '../models/user';
19
+ /**
20
+ * Configuration for the getScim2Me request
21
+ */
22
+ export interface GetScim2MeConfig extends Omit<RequestInit, 'method'> {
23
+ /**
24
+ * The absolute API endpoint.
25
+ */
26
+ url?: string;
27
+ /**
28
+ * The base path of the API endpoint.
29
+ */
30
+ baseUrl?: string;
31
+ /**
32
+ * Optional custom fetcher function.
33
+ * If not provided, native fetch will be used
34
+ */
35
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
36
+ }
37
+ /**
38
+ * Retrieves the user profile information from the specified SCIM2 /Me endpoint.
39
+ *
40
+ * @param config - Request configuration object.
41
+ * @returns A promise that resolves with the user profile information.
42
+ * @example
43
+ * ```typescript
44
+ * // Using default fetch
45
+ * try {
46
+ * const userProfile = await getScim2Me({
47
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me",
48
+ * });
49
+ * console.log(userProfile);
50
+ * } catch (error) {
51
+ * if (error instanceof AsgardeoAPIError) {
52
+ * console.error('Failed to get user profile:', error.message);
53
+ * }
54
+ * }
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Using custom fetcher (e.g., axios-based httpClient)
60
+ * try {
61
+ * const userProfile = await getScim2Me({
62
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me",
63
+ * fetcher: async (url, config) => {
64
+ * const response = await httpClient({
65
+ * url,
66
+ * method: config.method,
67
+ * headers: config.headers,
68
+ * ...config
69
+ * });
70
+ * // Convert axios-like response to fetch-like Response
71
+ * return {
72
+ * ok: response.status >= 200 && response.status < 300,
73
+ * status: response.status,
74
+ * statusText: response.statusText,
75
+ * json: () => Promise.resolve(response.data),
76
+ * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
77
+ * } as Response;
78
+ * }
79
+ * });
80
+ * console.log(userProfile);
81
+ * } catch (error) {
82
+ * if (error instanceof AsgardeoAPIError) {
83
+ * console.error('Failed to get user profile:', error.message);
84
+ * }
85
+ * }
86
+ * ```
87
+ */
88
+ declare const getScim2Me: ({ url, baseUrl, fetcher, ...requestConfig }: GetScim2MeConfig) => Promise<User>;
89
+ export default getScim2Me;
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { User } from '../../models/user';
18
+ import { User } from '../models/user';
19
19
  /**
20
20
  * Retrieves the user information from the specified OIDC userinfo endpoint.
21
21
  *
@@ -0,0 +1,51 @@
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 { EmbeddedFlowExecuteRequestConfig } from '../models/embedded-flow';
19
+ import { EmbeddedSignInFlowInitiateResponse } from '../models/embedded-signin-flow';
20
+ /**
21
+ * Sends an authorization request to the specified OAuth2/OIDC authorization endpoint.
22
+ *
23
+ * @param requestConfig - Request configuration object containing URL and payload.
24
+ * @returns A promise that resolves with the authorization response.
25
+ * @throws AsgardeoAPIError when the request fails or URL is invalid.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * try {
30
+ * const authResponse = await initializeEmbeddedSignInFlow({
31
+ * url: "https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/authorize",
32
+ * payload: {
33
+ * response_type: "code",
34
+ * client_id: "your-client-id",
35
+ * redirect_uri: "https://your-app.com/callback",
36
+ * scope: "openid profile email",
37
+ * state: "random-state-value",
38
+ * code_challenge: "your-pkce-challenge",
39
+ * code_challenge_method: "S256"
40
+ * }
41
+ * });
42
+ * console.log(authResponse);
43
+ * } catch (error) {
44
+ * if (error instanceof AsgardeoAPIError) {
45
+ * console.error('Authorization failed:', error.message);
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ declare const initializeEmbeddedSignInFlow: ({ url, baseUrl, payload, ...requestConfig }: EmbeddedFlowExecuteRequestConfig) => Promise<EmbeddedSignInFlowInitiateResponse>;
51
+ export default initializeEmbeddedSignInFlow;