@asgardeo/javascript 0.13.0 → 0.14.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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2026, 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 { GetOrganizationUnitChildrenConfig, OrganizationUnitListResponse } from '../../models/v2/organization-unit';
19
+ /**
20
+ * Retrieves the child organization units of a given parent OU.
21
+ *
22
+ * @param config - Request configuration including `baseUrl`/`url`, `organizationUnitId`,
23
+ * and optional `limit`/`offset` pagination parameters.
24
+ * @returns A promise that resolves with the paginated list of child organization units.
25
+ *
26
+ * @throws {AsgardeoAPIError} When the server returns a non-OK response.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const children = await getOrganizationUnitChildren({
31
+ * baseUrl: 'https://localhost:8090',
32
+ * organizationUnitId: '0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1',
33
+ * limit: 10,
34
+ * offset: 0,
35
+ * });
36
+ * console.log(children.organizationUnits);
37
+ * ```
38
+ *
39
+ * @experimental This function targets the Asgardeo V2 platform API
40
+ */
41
+ declare const getOrganizationUnitChildren: ({ url, baseUrl, organizationUnitId, limit, offset, ...requestConfig }: GetOrganizationUnitChildrenConfig) => Promise<OrganizationUnitListResponse>;
42
+ export default getOrganizationUnitChildren;
package/dist/cjs/index.js CHANGED
@@ -104,6 +104,7 @@ __export(index_exports, {
104
104
  getLatestStateParam: () => getLatestStateParam_default,
105
105
  getMeOrganizations: () => getMeOrganizations_default,
106
106
  getOrganization: () => getOrganization_default,
107
+ getOrganizationUnitChildren: () => getOrganizationUnitChildren_default,
107
108
  getRedirectBasedSignUpUrl: () => getRedirectBasedSignUpUrl_default,
108
109
  getSchemas: () => getSchemas_default,
109
110
  getScim2Me: () => getScim2Me_default,
@@ -3413,6 +3414,52 @@ var getFlowMetaV2 = async ({
3413
3414
  };
3414
3415
  var getFlowMetaV2_default = getFlowMetaV2;
3415
3416
 
3417
+ // src/api/v2/getOrganizationUnitChildren.ts
3418
+ var getOrganizationUnitChildren = async ({
3419
+ url,
3420
+ baseUrl,
3421
+ organizationUnitId,
3422
+ limit = 10,
3423
+ offset = 0,
3424
+ ...requestConfig
3425
+ }) => {
3426
+ if (!organizationUnitId) {
3427
+ throw new AsgardeoAPIError(
3428
+ "Organization Unit ID is required",
3429
+ "getOrganizationUnitChildren-ValidationError-001",
3430
+ "javascript",
3431
+ 400,
3432
+ "If an organization unit ID is not provided, the request cannot be constructed correctly."
3433
+ );
3434
+ }
3435
+ const queryParams = new URLSearchParams({
3436
+ limit: String(limit),
3437
+ offset: String(offset)
3438
+ });
3439
+ const endpoint = url ?? `${baseUrl}/organization-units/${organizationUnitId}/ous?${queryParams.toString()}`;
3440
+ const response = await fetch(endpoint, {
3441
+ ...requestConfig,
3442
+ headers: {
3443
+ Accept: "application/json",
3444
+ ...requestConfig.headers
3445
+ },
3446
+ method: "GET"
3447
+ });
3448
+ if (!response.ok) {
3449
+ const errorText = await response.text();
3450
+ throw new AsgardeoAPIError(
3451
+ `Failed to fetch organization unit children: ${errorText}`,
3452
+ "getOrganizationUnitChildren-ResponseError-001",
3453
+ "javascript",
3454
+ response.status,
3455
+ response.statusText
3456
+ );
3457
+ }
3458
+ const listResponse = await response.json();
3459
+ return listResponse;
3460
+ };
3461
+ var getOrganizationUnitChildren_default = getOrganizationUnitChildren;
3462
+
3416
3463
  // src/constants/ApplicationNativeAuthenticationConstants.ts
3417
3464
  var ApplicationNativeAuthenticationConstants = {
3418
3465
  SupportedAuthenticators: {
@@ -3487,6 +3534,7 @@ var EmbeddedFlowComponentType2 = /* @__PURE__ */ ((EmbeddedFlowComponentType3) =
3487
3534
  EmbeddedFlowComponentType3["Icon"] = "ICON";
3488
3535
  EmbeddedFlowComponentType3["Image"] = "IMAGE";
3489
3536
  EmbeddedFlowComponentType3["OtpInput"] = "OTP_INPUT";
3537
+ EmbeddedFlowComponentType3["OuSelect"] = "OU_SELECT";
3490
3538
  EmbeddedFlowComponentType3["PasswordInput"] = "PASSWORD_INPUT";
3491
3539
  EmbeddedFlowComponentType3["PhoneInput"] = "PHONE_INPUT";
3492
3540
  EmbeddedFlowComponentType3["RichText"] = "RICH_TEXT";
@@ -5420,6 +5468,7 @@ var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTh
5420
5468
  getLatestStateParam,
5421
5469
  getMeOrganizations,
5422
5470
  getOrganization,
5471
+ getOrganizationUnitChildren,
5423
5472
  getRedirectBasedSignUpUrl,
5424
5473
  getSchemas,
5425
5474
  getScim2Me,