@thunderid/javascript 0.6.0 → 0.7.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.
@@ -74,7 +74,10 @@ const TokenConstants = {
74
74
  "RS256",
75
75
  "RS512",
76
76
  "RS384",
77
- "PS256"
77
+ "PS256",
78
+ "ML-DSA-44",
79
+ "ML-DSA-65",
80
+ "ML-DSA-87"
78
81
  ] },
79
82
  Storage: { StorageKeys: { REFRESH_TOKEN_TIMER: "refresh_token_timer" } }
80
83
  };
@@ -1131,7 +1134,7 @@ var getUserInfo_default = getUserInfo;
1131
1134
  const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
1132
1135
  /**
1133
1136
  * Removes userstore prefixes from a username if they exist.
1134
- * This is commonly used to clean usernames returned from SCIM2 endpoints
1137
+ * This is commonly used to clean usernames returned from profile endpoints
1135
1138
  * that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
1136
1139
  *
1137
1140
  * @param username - The username string to process
@@ -1161,7 +1164,7 @@ const removeUserstorePrefix = (username) => {
1161
1164
  };
1162
1165
  /**
1163
1166
  * Processes a user object to remove userstore prefixes from username fields.
1164
- * This is a helper function for processing user objects returned from SCIM2 endpoints.
1167
+ * This is a helper function for processing user objects returned from profile endpoints.
1165
1168
  * Handles various username field variations: username, userName, and user_name.
1166
1169
  *
1167
1170
  * @param user - The user object to process
@@ -1193,9 +1196,9 @@ const processUsername = (user) => {
1193
1196
  var processUsername_default = processUsername;
1194
1197
 
1195
1198
  //#endregion
1196
- //#region src/api/getScim2Me.ts
1199
+ //#region src/api/getUsersMe.ts
1197
1200
  /**
1198
- * Retrieves the user profile information from the specified SCIM2 /Me endpoint.
1201
+ * Retrieves the user profile information from the specified /users/me endpoint.
1199
1202
  *
1200
1203
  * @param config - Request configuration object.
1201
1204
  * @returns A promise that resolves with the user profile information.
@@ -1203,8 +1206,8 @@ var processUsername_default = processUsername;
1203
1206
  * ```typescript
1204
1207
  * // Using default fetch
1205
1208
  * try {
1206
- * const userProfile = await getScim2Me({
1207
- * url: "https://localhost:8090/scim2/Me",
1209
+ * const userProfile = await getUsersMe({
1210
+ * url: "https://localhost:8090/users/me",
1208
1211
  * });
1209
1212
  * console.log(userProfile);
1210
1213
  * } catch (error) {
@@ -1218,8 +1221,8 @@ var processUsername_default = processUsername;
1218
1221
  * ```typescript
1219
1222
  * // Using custom fetcher (e.g., axios-based httpClient)
1220
1223
  * try {
1221
- * const userProfile = await getScim2Me({
1222
- * url: "https://localhost:8090/scim2/Me",
1224
+ * const userProfile = await getUsersMe({
1225
+ * url: "https://localhost:8090/users/me",
1223
1226
  * fetcher: async (url, config) => {
1224
1227
  * const response = await httpClient({
1225
1228
  * url,
@@ -1245,95 +1248,14 @@ var processUsername_default = processUsername;
1245
1248
  * }
1246
1249
  * ```
1247
1250
  */
1248
- const getScim2Me = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1251
+ const getUsersMe = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1249
1252
  try {
1250
1253
  new URL(url ?? baseUrl);
1251
1254
  } catch (error$1) {
1252
- throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getScim2Me-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
1255
+ throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getUsersMe-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
1253
1256
  }
1254
1257
  const fetchFn = fetcher || fetch;
1255
- const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
1256
- const requestInit = {
1257
- ...requestConfig,
1258
- headers: {
1259
- Accept: "application/json",
1260
- "Content-Type": "application/scim+json",
1261
- ...requestConfig.headers
1262
- },
1263
- method: "GET"
1264
- };
1265
- try {
1266
- const response = await fetchFn(resolvedUrl, requestInit);
1267
- if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getScim2Me-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
1268
- return processUsername_default(await response.json());
1269
- } catch (error$1) {
1270
- if (error$1 instanceof ThunderIDAPIError) throw error$1;
1271
- throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getScim2Me-NetworkError-001", "javascript", 0, "Network Error");
1272
- }
1273
- };
1274
- var getScim2Me_default = getScim2Me;
1275
-
1276
- //#endregion
1277
- //#region src/api/getSchemas.ts
1278
- /**
1279
- * Retrieves the SCIM2 schemas from the specified endpoint.
1280
- *
1281
- * @param config - Request configuration object.
1282
- * @returns A promise that resolves with the SCIM2 schemas information.
1283
- * @example
1284
- * ```typescript
1285
- * // Using default fetch
1286
- * try {
1287
- * const schemas = await getSchemas({
1288
- * url: "https://localhost:8090/scim2/Schemas",
1289
- * });
1290
- * console.log(schemas);
1291
- * } catch (error) {
1292
- * if (error instanceof ThunderIDAPIError) {
1293
- * console.error('Failed to get schemas:', error.message);
1294
- * }
1295
- * }
1296
- * ```
1297
- *
1298
- * @example
1299
- * ```typescript
1300
- * // Using custom fetcher (e.g., axios-based httpClient)
1301
- * try {
1302
- * const schemas = await getSchemas({
1303
- * url: "https://localhost:8090/scim2/Schemas",
1304
- * fetcher: async (url, config) => {
1305
- * const response = await httpClient({
1306
- * url,
1307
- * method: config.method,
1308
- * headers: config.headers,
1309
- * ...config
1310
- * });
1311
- * // Convert axios-like response to fetch-like Response
1312
- * return {
1313
- * ok: response.status >= 200 && response.status < 300,
1314
- * status: response.status,
1315
- * statusText: response.statusText,
1316
- * json: () => Promise.resolve(response.data),
1317
- * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
1318
- * } as Response;
1319
- * }
1320
- * });
1321
- * console.log(schemas);
1322
- * } catch (error) {
1323
- * if (error instanceof ThunderIDAPIError) {
1324
- * console.error('Failed to get schemas:', error.message);
1325
- * }
1326
- * }
1327
- * ```
1328
- */
1329
- const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1330
- try {
1331
- new URL(url ?? baseUrl);
1332
- } catch (error$1) {
1333
- throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "getSchemas-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
1334
- }
1335
- const fetchFn = fetcher || fetch;
1336
- const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
1258
+ const resolvedUrl = url ?? `${baseUrl}/users/me`;
1337
1259
  const requestInit = {
1338
1260
  ...requestConfig,
1339
1261
  headers: {
@@ -1345,19 +1267,24 @@ const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1345
1267
  };
1346
1268
  try {
1347
1269
  const response = await fetchFn(resolvedUrl, requestInit);
1348
- if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getSchemas-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch SCIM2 schemas");
1349
- return await response.json();
1270
+ if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
1271
+ const user = await response.json();
1272
+ const attributes = user["attributes"] ?? {};
1273
+ return processUsername_default({
1274
+ ...user,
1275
+ ...attributes
1276
+ });
1350
1277
  } catch (error$1) {
1351
1278
  if (error$1 instanceof ThunderIDAPIError) throw error$1;
1352
- throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getSchemas-NetworkError-001", "javascript", 0, "Network Error");
1279
+ throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
1353
1280
  }
1354
1281
  };
1355
- var getSchemas_default = getSchemas;
1282
+ var getUsersMe_default = getUsersMe;
1356
1283
 
1357
1284
  //#endregion
1358
1285
  //#region src/api/updateMeProfile.ts
1359
1286
  /**
1360
- * Updates the user profile information at the specified SCIM2 Me endpoint.
1287
+ * Updates the user profile information at the specified /users/me endpoint.
1361
1288
  *
1362
1289
  * @param config - Configuration object with URL, payload and optional request config.
1363
1290
  * @returns A promise that resolves with the updated user profile information.
@@ -1365,8 +1292,8 @@ var getSchemas_default = getSchemas;
1365
1292
  * ```typescript
1366
1293
  * // Using default fetch
1367
1294
  * await updateMeProfile({
1368
- * url: "https://localhost:8090/scim2/Me",
1369
- * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
1295
+ * url: "https://localhost:8090/users/me",
1296
+ * payload: { mobileNumbers: ["0777933830"] }
1370
1297
  * });
1371
1298
  * ```
1372
1299
  *
@@ -1374,8 +1301,8 @@ var getSchemas_default = getSchemas;
1374
1301
  * ```typescript
1375
1302
  * // Using custom fetcher (e.g., axios-based httpClient)
1376
1303
  * await updateMeProfile({
1377
- * url: "https://localhost:8090/scim2/Me",
1378
- * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
1304
+ * url: "https://localhost:8090/users/me",
1305
+ * payload: { mobileNumbers: ["0777933830"] },
1379
1306
  * fetcher: async (url, config) => {
1380
1307
  * const response = await httpClient({
1381
1308
  * url,
@@ -1402,29 +1329,28 @@ const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig
1402
1329
  } catch (error$1) {
1403
1330
  throw new ThunderIDAPIError(`Invalid URL provided. ${error$1?.toString()}`, "updateMeProfile-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
1404
1331
  }
1405
- const data = {
1406
- Operations: [{
1407
- op: "replace",
1408
- value: payload
1409
- }],
1410
- schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
1411
- };
1332
+ const data = { attributes: payload };
1412
1333
  const fetchFn = fetcher || fetch;
1413
- const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
1334
+ const resolvedUrl = url ?? `${baseUrl}/users/me`;
1414
1335
  const requestInit = {
1415
- method: "PATCH",
1416
1336
  ...requestConfig,
1337
+ method: "PUT",
1417
1338
  body: JSON.stringify(data),
1418
1339
  headers: {
1419
1340
  ...requestConfig.headers,
1420
1341
  Accept: "application/json",
1421
- "Content-Type": "application/scim+json"
1342
+ "Content-Type": "application/json"
1422
1343
  }
1423
1344
  };
1424
1345
  try {
1425
1346
  const response = await fetchFn(resolvedUrl, requestInit);
1426
1347
  if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
1427
- return processUsername_default(await response.json());
1348
+ const user = await response.json();
1349
+ const attributes = user["attributes"] ?? {};
1350
+ return processUsername_default({
1351
+ ...user,
1352
+ ...attributes
1353
+ });
1428
1354
  } catch (error$1) {
1429
1355
  if (error$1 instanceof ThunderIDAPIError) throw error$1;
1430
1356
  throw new ThunderIDAPIError(error$1?.response?.data?.detail || "An error occurred while updating the user profile. Please try again.", "updateMeProfile-NetworkError-001", "javascript", error$1?.data?.status, "Network Error");
@@ -1727,25 +1653,6 @@ let FlowMode = /* @__PURE__ */ function(FlowMode$1) {
1727
1653
  return FlowMode$1;
1728
1654
  }({});
1729
1655
 
1730
- //#endregion
1731
- //#region src/models/scim2-schema.ts
1732
- /**
1733
- * Well-known SCIM2 schema IDs
1734
- */
1735
- let WellKnownSchemaIds = /* @__PURE__ */ function(WellKnownSchemaIds$1) {
1736
- /** Core Schema */
1737
- WellKnownSchemaIds$1["Core"] = "urn:ietf:params:scim:schemas:core:2.0";
1738
- /** Custom User Schema */
1739
- WellKnownSchemaIds$1["CustomUser"] = "urn:scim:schemas:extension:custom:User";
1740
- /** Enterprise User Schema */
1741
- WellKnownSchemaIds$1["EnterpriseUser"] = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";
1742
- /** System User Schema */
1743
- WellKnownSchemaIds$1["SystemUser"] = "urn:scim:wso2:schema";
1744
- /** User Schema */
1745
- WellKnownSchemaIds$1["User"] = "urn:ietf:params:scim:schemas:core:2.0:User";
1746
- return WellKnownSchemaIds$1;
1747
- }({});
1748
-
1749
1656
  //#endregion
1750
1657
  //#region src/models/field.ts
1751
1658
  /**
@@ -3098,7 +3005,7 @@ const getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
3098
3005
  const authorizeRequestParams = /* @__PURE__ */ new Map();
3099
3006
  authorizeRequestParams.set("response_type", "code");
3100
3007
  authorizeRequestParams.set("client_id", clientId);
3101
- authorizeRequestParams.set("scope", scopes ?? "");
3008
+ if (scopes !== void 0) authorizeRequestParams.set("scope", scopes);
3102
3009
  authorizeRequestParams.set("redirect_uri", redirectUri);
3103
3010
  if (responseMode) authorizeRequestParams.set("response_mode", responseMode);
3104
3011
  const pkceKey = pkceOptions?.key;
@@ -4346,209 +4253,6 @@ const isRecognizedBaseUrlPattern = (baseUrl) => {
4346
4253
  };
4347
4254
  var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
4348
4255
 
4349
- //#endregion
4350
- //#region src/utils/flattenUserSchema.ts
4351
- /**
4352
- * Flattens nested schema attributes into a flat structure for easier processing
4353
- *
4354
- * This function processes SCIM2 schemas and creates a flattened representation by:
4355
- * - Processing sub-attributes and creating dot-notation names (e.g., 'name.givenName')
4356
- * - Adding schema ID reference to each flattened attribute
4357
- * - Preserving all original attribute properties while adding schema context
4358
- * - Only including leaf-level attributes (sub-attributes) and top-level simple attributes
4359
- *
4360
- * @param schemas - Array of SCIM2 schemas containing nested attribute structures
4361
- * @returns Array of flattened schema attributes with dot-notation names and schema references
4362
- *
4363
- * @example
4364
- * ```typescript
4365
- * const schemas = [
4366
- * {
4367
- * id: 'urn:ietf:params:scim:schemas:core:2.0:User',
4368
- * attributes: [
4369
- * {
4370
- * name: 'userName',
4371
- * type: 'string',
4372
- * multiValued: false
4373
- * },
4374
- * {
4375
- * name: 'name',
4376
- * type: 'complex',
4377
- * multiValued: false,
4378
- * subAttributes: [
4379
- * { name: 'givenName', type: 'string', multiValued: false },
4380
- * { name: 'familyName', type: 'string', multiValued: false }
4381
- * ]
4382
- * }
4383
- * ]
4384
- * }
4385
- * ];
4386
- *
4387
- * const flattened = flattenUserSchema(schemas);
4388
- * // Result: [
4389
- * // { name: 'userName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
4390
- * // { name: 'name.givenName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
4391
- * // { name: 'name.familyName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' }
4392
- * // ]
4393
- * ```
4394
- */
4395
- const flattenUserSchema = (schemas) => {
4396
- const flattenedAttributes = [];
4397
- schemas.forEach((schema) => {
4398
- if (schema.attributes && Array.isArray(schema.attributes)) schema.attributes.forEach((attribute) => {
4399
- if (attribute.subAttributes && Array.isArray(attribute.subAttributes)) attribute.subAttributes.forEach((subAttribute) => {
4400
- flattenedAttributes.push({
4401
- ...subAttribute,
4402
- name: `${attribute.name}.${subAttribute.name}`,
4403
- schemaId: schema.id
4404
- });
4405
- });
4406
- else flattenedAttributes.push({
4407
- ...attribute,
4408
- schemaId: schema.id
4409
- });
4410
- });
4411
- });
4412
- return flattenedAttributes;
4413
- };
4414
- var flattenUserSchema_default = flattenUserSchema;
4415
-
4416
- //#endregion
4417
- //#region src/utils/get.ts
4418
- /**
4419
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4420
- *
4421
- * WSO2 LLC. licenses this file to you under the Apache License,
4422
- * Version 2.0 (the "License"); you may not use this file except
4423
- * in compliance with the License.
4424
- * You may obtain a copy of the License at
4425
- *
4426
- * http://www.apache.org/licenses/LICENSE-2.0
4427
- *
4428
- * Unless required by applicable law or agreed to in writing,
4429
- * software distributed under the License is distributed on an
4430
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4431
- * KIND, either express or implied. See the License for the
4432
- * specific language governing permissions and limitations
4433
- * under the License.
4434
- */
4435
- /**
4436
- * Gets the value at path of object. If the resolved value is undefined,
4437
- * the defaultValue is returned in its place.
4438
- * Similar to Lodash's get() function
4439
- *
4440
- * @param object - The object to query
4441
- * @param path - The path of the property to get
4442
- * @param defaultValue - The value returned for undefined resolved values
4443
- * @returns The resolved value
4444
- */
4445
- const get = (object, path, defaultValue) => {
4446
- if (!object || !path) return defaultValue;
4447
- const result = (Array.isArray(path) ? path : path.split(".")).reduce((current, key) => current?.[key], object);
4448
- return result !== void 0 ? result : defaultValue;
4449
- };
4450
- var get_default = get;
4451
-
4452
- //#endregion
4453
- //#region src/utils/set.ts
4454
- /**
4455
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4456
- *
4457
- * WSO2 LLC. licenses this file to you under the Apache License,
4458
- * Version 2.0 (the "License"); you may not use this file except
4459
- * in compliance with the License.
4460
- * You may obtain a copy of the License at
4461
- *
4462
- * http://www.apache.org/licenses/LICENSE-2.0
4463
- *
4464
- * Unless required by applicable law or agreed to in writing,
4465
- * software distributed under the License is distributed on an
4466
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4467
- * KIND, either express or implied. See the License for the
4468
- * specific language governing permissions and limitations
4469
- * under the License.
4470
- */
4471
- /**
4472
- * Sets the value at path of object. If a portion of path doesn't exist,
4473
- * it's created. Arrays are created for missing index properties while
4474
- * objects are created for all other missing properties.
4475
- * Similar to Lodash's set() function
4476
- *
4477
- * @param object - The object to modify
4478
- * @param path - The path of the property to set
4479
- * @param value - The value to set
4480
- * @returns The object
4481
- */
4482
- const set = (object, path, value) => {
4483
- if (!object || !path) return object;
4484
- const pathArray = Array.isArray(path) ? path : path.split(".");
4485
- const lastIndex = pathArray.length - 1;
4486
- pathArray.reduce((current, key, index) => {
4487
- if (index === lastIndex) current[key] = value;
4488
- else if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
4489
- const nextKey = pathArray[index + 1];
4490
- current[key] = /^\d+$/.test(nextKey) ? [] : {};
4491
- }
4492
- return current[key];
4493
- }, object);
4494
- return object;
4495
- };
4496
- var set_default = set;
4497
-
4498
- //#endregion
4499
- //#region src/utils/generateUserProfile.ts
4500
- /**
4501
- * Creates a profile structure from ME response based on processed schemas
4502
- *
4503
- * This function processes each schema attribute and populates the profile dynamically by:
4504
- * - Extracting values from the ME response using the schema attribute names
4505
- * - Handling multi-valued attributes by converting single values to arrays when needed
4506
- * - Setting appropriate default values based on schema type and multiValued properties
4507
- * - Using dynamic property setting to build the final profile object
4508
- *
4509
- * @param meResponse - The ME API response containing user data
4510
- * @param processedSchemas - The processed and flattened schemas with name, type, and multiValued properties
4511
- * @returns Flat profile object with dynamically populated user attributes
4512
- *
4513
- * @example
4514
- * ```typescript
4515
- * const meResponse = {
4516
- * userName: 'john.doe',
4517
- * emails: ['john@example.com', 'john.doe@work.com'],
4518
- * name: { givenName: 'John', familyName: 'Doe' }
4519
- * };
4520
- *
4521
- * const schemas = [
4522
- * { name: 'userName', type: 'STRING', multiValued: false },
4523
- * { name: 'emails', type: 'STRING', multiValued: true },
4524
- * { name: 'name.givenName', type: 'STRING', multiValued: false }
4525
- * ];
4526
- *
4527
- * const profile = generateUserProfile(meResponse, schemas);
4528
- * // Result: {
4529
- * // userName: 'john.doe',
4530
- * // emails: ['john@example.com', 'john.doe@work.com'],
4531
- * // 'name.givenName': 'John'
4532
- * // }
4533
- * ```
4534
- */
4535
- const generateUserProfile = (meResponse, processedSchemas) => {
4536
- const profile = {};
4537
- processedSchemas.forEach((schema) => {
4538
- const { name, type, multiValued } = schema;
4539
- if (!name) return;
4540
- let value = get_default(meResponse, name);
4541
- if (value !== void 0) {
4542
- if (multiValued && !Array.isArray(value)) value = [value];
4543
- } else if (multiValued) value = void 0;
4544
- else if (type === "STRING") value = "";
4545
- else value = void 0;
4546
- set_default(profile, name, value);
4547
- });
4548
- return profile;
4549
- };
4550
- var generateUserProfile_default = generateUserProfile;
4551
-
4552
4256
  //#endregion
4553
4257
  //#region src/utils/getLatestStateParam.ts
4554
4258
  /**
@@ -4594,95 +4298,14 @@ var getLatestStateParam_default = getLatestStateParam;
4594
4298
  //#endregion
4595
4299
  //#region src/utils/generateFlattenedUserProfile.ts
4596
4300
  /**
4597
- * Generates a flattened user profile from a response object and schema definitions.
4598
- *
4599
- * This function processes user data according to schema specifications, creating
4600
- * a flat object with dot notation keys instead of nested objects. Multi-valued
4601
- * properties and type-specific defaults are handled appropriately.
4602
- *
4603
- * Additionally, any fields present in the response but not defined in the schema
4604
- * will be included to ensure no user data is lost during flattening.
4301
+ * Generates a flattened user profile by returning the user profile as-is.
4605
4302
  *
4606
4303
  * @param meResponse - The response object containing user data
4607
- * @param processedSchemas - Array of schema objects defining field properties
4608
- * @param processedSchemas[].name - The field name/path for the property
4609
- * @param processedSchemas[].type - The data type of the field (e.g., 'STRING')
4610
- * @param processedSchemas[].multiValued - Whether the field can contain multiple values
4611
- *
4612
- * @returns A flattened user profile object with dot notation keys
4613
- *
4614
- * @example
4615
- * ```typescript
4616
- * const schemas = [
4617
- * { name: 'name.givenName', type: 'STRING', multiValued: false },
4618
- * { name: 'emails', type: 'STRING', multiValued: true }
4619
- * ];
4620
- * const response = {
4621
- * name: { givenName: 'John' },
4622
- * emails: 'john@example.com',
4623
- * country: 'US' // This will be included even if not in schema
4624
- * };
4625
- * const profile = generateFlattenedUserProfile(response, schemas);
4626
- * // Result: { "name.givenName": 'John', emails: ['john@example.com'], country: 'US' }
4627
- * ```
4304
+ * @param _processedSchemas - Deprecated/unused schemas parameter
4305
+ * @returns The user profile object
4628
4306
  */
4629
- const generateFlattenedUserProfile = (meResponse, processedSchemas) => {
4630
- const profile = {};
4631
- const allSchemaNames = processedSchemas.map((schema) => schema.name).filter(Boolean);
4632
- processedSchemas.forEach((schema) => {
4633
- const { name, type, multiValued } = schema;
4634
- if (!name) return;
4635
- if (allSchemaNames.some((schemaName) => schemaName !== name && schemaName.startsWith(`${name}.`))) return;
4636
- let value = get_default(meResponse, name);
4637
- if (value === void 0) {
4638
- const dotIndex = name.indexOf(".");
4639
- if (dotIndex > 0) {
4640
- const head = name.slice(0, dotIndex);
4641
- const tail = name.slice(dotIndex + 1);
4642
- const arr = meResponse[head];
4643
- if (Array.isArray(arr)) {
4644
- const match = arr.find((item) => item?.type === tail);
4645
- if (match?.value !== void 0) value = match.value;
4646
- }
4647
- }
4648
- }
4649
- if (value === void 0) [
4650
- "urn:ietf:params:scim:schemas:core:2.0:User",
4651
- "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
4652
- "urn:scim:wso2:schema",
4653
- "urn:scim:schemas:extension:custom:User"
4654
- ].some((namespace) => {
4655
- if (meResponse[namespace]) {
4656
- if (meResponse[namespace][name] !== void 0) {
4657
- value = meResponse[namespace][name];
4658
- return true;
4659
- }
4660
- const nestedValue = get_default(meResponse[namespace], name);
4661
- if (nestedValue !== void 0) {
4662
- value = nestedValue;
4663
- return true;
4664
- }
4665
- }
4666
- return false;
4667
- });
4668
- if (value !== void 0) {
4669
- if (multiValued && !Array.isArray(value)) value = [value];
4670
- } else if (multiValued) value = void 0;
4671
- else if (type === "STRING") value = "";
4672
- else value = void 0;
4673
- profile[name] = value;
4674
- });
4675
- const flattenObject = (obj, prefix = "") => {
4676
- if (obj && typeof obj === "object" && !Array.isArray(obj)) Object.keys(obj).forEach((key) => {
4677
- const fullKey = prefix ? `${prefix}.${key}` : key;
4678
- const value = obj[key];
4679
- if (Object.prototype.hasOwnProperty.call(profile, fullKey)) return;
4680
- if (allSchemaNames.some((schemaName) => schemaName.startsWith(`${fullKey}.`))) flattenObject(value, fullKey);
4681
- else profile[fullKey] = value;
4682
- });
4683
- };
4684
- flattenObject(meResponse);
4685
- return profile;
4307
+ const generateFlattenedUserProfile = (meResponse, _processedSchemas) => {
4308
+ return { ...meResponse };
4686
4309
  };
4687
4310
  var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
4688
4311
 
@@ -4831,6 +4454,129 @@ const extractEmojiFromUri = (uri) => {
4831
4454
  };
4832
4455
  var extractEmojiFromUri_default = extractEmojiFromUri;
4833
4456
 
4457
+ //#endregion
4458
+ //#region src/utils/set.ts
4459
+ /**
4460
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4461
+ *
4462
+ * WSO2 LLC. licenses this file to you under the Apache License,
4463
+ * Version 2.0 (the "License"); you may not use this file except
4464
+ * in compliance with the License.
4465
+ * You may obtain a copy of the License at
4466
+ *
4467
+ * http://www.apache.org/licenses/LICENSE-2.0
4468
+ *
4469
+ * Unless required by applicable law or agreed to in writing,
4470
+ * software distributed under the License is distributed on an
4471
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4472
+ * KIND, either express or implied. See the License for the
4473
+ * specific language governing permissions and limitations
4474
+ * under the License.
4475
+ */
4476
+ /**
4477
+ * Sets the value at path of object. If a portion of path doesn't exist,
4478
+ * it's created. Arrays are created for missing index properties while
4479
+ * objects are created for all other missing properties.
4480
+ * Similar to Lodash's set() function
4481
+ *
4482
+ * @param object - The object to modify
4483
+ * @param path - The path of the property to set
4484
+ * @param value - The value to set
4485
+ * @returns The object
4486
+ */
4487
+ const set = (object, path, value) => {
4488
+ if (!object || !path) return object;
4489
+ const pathArray = Array.isArray(path) ? path : path.split(".");
4490
+ const lastIndex = pathArray.length - 1;
4491
+ pathArray.reduce((current, key, index) => {
4492
+ if (index === lastIndex) current[key] = value;
4493
+ else if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
4494
+ const nextKey = pathArray[index + 1];
4495
+ current[key] = /^\d+$/.test(nextKey) ? [] : {};
4496
+ }
4497
+ return current[key];
4498
+ }, object);
4499
+ return object;
4500
+ };
4501
+ var set_default = set;
4502
+
4503
+ //#endregion
4504
+ //#region src/utils/get.ts
4505
+ /**
4506
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4507
+ *
4508
+ * WSO2 LLC. licenses this file to you under the Apache License,
4509
+ * Version 2.0 (the "License"); you may not use this file except
4510
+ * in compliance with the License.
4511
+ * You may obtain a copy of the License at
4512
+ *
4513
+ * http://www.apache.org/licenses/LICENSE-2.0
4514
+ *
4515
+ * Unless required by applicable law or agreed to in writing,
4516
+ * software distributed under the License is distributed on an
4517
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4518
+ * KIND, either express or implied. See the License for the
4519
+ * specific language governing permissions and limitations
4520
+ * under the License.
4521
+ */
4522
+ /**
4523
+ * Gets the value at path of object. If the resolved value is undefined,
4524
+ * the defaultValue is returned in its place.
4525
+ * Similar to Lodash's get() function
4526
+ *
4527
+ * @param object - The object to query
4528
+ * @param path - The path of the property to get
4529
+ * @param defaultValue - The value returned for undefined resolved values
4530
+ * @returns The resolved value
4531
+ */
4532
+ const get = (object, path, defaultValue) => {
4533
+ if (!object || !path) return defaultValue;
4534
+ const result = (Array.isArray(path) ? path : path.split(".")).reduce((current, key) => current?.[key], object);
4535
+ return result !== void 0 ? result : defaultValue;
4536
+ };
4537
+ var get_default = get;
4538
+
4539
+ //#endregion
4540
+ //#region src/utils/startCase.ts
4541
+ /**
4542
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
4543
+ *
4544
+ * WSO2 LLC. licenses this file to you under the Apache License,
4545
+ * Version 2.0 (the "License"); you may not use this file except
4546
+ * in compliance with the License.
4547
+ * You may obtain a copy of the License at
4548
+ *
4549
+ * http://www.apache.org/licenses/LICENSE-2.0
4550
+ *
4551
+ * Unless required by applicable law or agreed to in writing,
4552
+ * software distributed under the License is distributed on an
4553
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4554
+ * KIND, either express or implied. See the License for the
4555
+ * specific language governing permissions and limitations
4556
+ * under the License.
4557
+ */
4558
+ /**
4559
+ * Converts the first character of `string` to upper case.
4560
+ *
4561
+ * @param string - The string to convert.
4562
+ * @returns The converted string.
4563
+ */
4564
+ const upperFirst = (str) => {
4565
+ if (!str) return "";
4566
+ return str.charAt(0).toUpperCase() + str.slice(1);
4567
+ };
4568
+ /**
4569
+ * Converts `string` to start case.
4570
+ *
4571
+ * @param string - The string to convert.
4572
+ * @returns The start cased string.
4573
+ */
4574
+ const startCase = (str) => {
4575
+ if (!str) return "";
4576
+ return str.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).map((word) => upperFirst(word)).join(" ");
4577
+ };
4578
+ var startCase_default = startCase;
4579
+
4834
4580
  //#endregion
4835
4581
  //#region src/utils/removeTrailingSlash.ts
4836
4582
  /**
@@ -6394,7 +6140,6 @@ exports.ThunderIDRuntimeError = ThunderIDRuntimeError;
6394
6140
  exports.TokenConstants = TokenConstants_default;
6395
6141
  exports.TranslationBundleConstants = TranslationBundleConstants_default;
6396
6142
  exports.VendorConstants = VendorConstants_default;
6397
- exports.WellKnownSchemaIds = WellKnownSchemaIds;
6398
6143
  exports.arrayBufferToBase64url = arrayBufferToBase64url_default;
6399
6144
  exports.base64urlToArrayBuffer = base64urlToArrayBuffer_default;
6400
6145
  exports.bem = bem_default;
@@ -6417,19 +6162,16 @@ exports.executeEmbeddedUserOnboardingFlow = executeEmbeddedUserOnboardingFlow_de
6417
6162
  exports.extractEmojiFromUri = extractEmojiFromUri_default;
6418
6163
  exports.extractPkceStorageKeyFromState = extractPkceStorageKeyFromState_default;
6419
6164
  exports.extractUserClaimsFromIdToken = extractUserClaimsFromIdToken_default;
6420
- exports.flattenUserSchema = flattenUserSchema_default;
6421
6165
  exports.formatDate = formatDate_default;
6422
6166
  exports.generateFlattenedUserProfile = generateFlattenedUserProfile_default;
6423
- exports.generateUserProfile = generateUserProfile_default;
6424
6167
  exports.get = get_default;
6425
6168
  exports.getDefaultI18nBundles = getDefaultI18nBundles_default;
6426
6169
  exports.getFlowMeta = getFlowMeta_default;
6427
6170
  exports.getLatestStateParam = getLatestStateParam_default;
6428
6171
  exports.getOrganizationUnitChildren = getOrganizationUnitChildren_default;
6429
6172
  exports.getRedirectBasedSignUpUrl = getRedirectBasedSignUpUrl_default;
6430
- exports.getSchemas = getSchemas_default;
6431
- exports.getScim2Me = getScim2Me_default;
6432
6173
  exports.getUserInfo = getUserInfo_default;
6174
+ exports.getUsersMe = getUsersMe_default;
6433
6175
  exports.getVendorPrefix = getVendorPrefix_default;
6434
6176
  exports.info = info;
6435
6177
  exports.isEmojiUri = isEmojiUri_default;
@@ -6446,6 +6188,7 @@ exports.resolveLocaleDisplayName = resolveLocaleDisplayName;
6446
6188
  exports.resolveLocaleEmoji = resolveLocaleEmoji_default;
6447
6189
  exports.resolveMeta = resolveMeta;
6448
6190
  exports.set = set_default;
6191
+ exports.startCase = startCase_default;
6449
6192
  exports.updateMeProfile = updateMeProfile_default;
6450
6193
  exports.warn = warn;
6451
6194
  exports.withVendorCSSClassPrefix = withVendorCSSClassPrefix_default;