@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.
package/dist/index.js CHANGED
@@ -54,7 +54,10 @@ const TokenConstants = {
54
54
  "RS256",
55
55
  "RS512",
56
56
  "RS384",
57
- "PS256"
57
+ "PS256",
58
+ "ML-DSA-44",
59
+ "ML-DSA-65",
60
+ "ML-DSA-87"
58
61
  ] },
59
62
  Storage: { StorageKeys: { REFRESH_TOKEN_TIMER: "refresh_token_timer" } }
60
63
  };
@@ -1111,7 +1114,7 @@ var getUserInfo_default = getUserInfo;
1111
1114
  const USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
1112
1115
  /**
1113
1116
  * Removes userstore prefixes from a username if they exist.
1114
- * This is commonly used to clean usernames returned from SCIM2 endpoints
1117
+ * This is commonly used to clean usernames returned from profile endpoints
1115
1118
  * that include userstore prefixes like "DEFAULT/", "ASGARDEO_USER/", "PRIMARY/", etc.
1116
1119
  *
1117
1120
  * @param username - The username string to process
@@ -1141,7 +1144,7 @@ const removeUserstorePrefix = (username) => {
1141
1144
  };
1142
1145
  /**
1143
1146
  * Processes a user object to remove userstore prefixes from username fields.
1144
- * This is a helper function for processing user objects returned from SCIM2 endpoints.
1147
+ * This is a helper function for processing user objects returned from profile endpoints.
1145
1148
  * Handles various username field variations: username, userName, and user_name.
1146
1149
  *
1147
1150
  * @param user - The user object to process
@@ -1173,9 +1176,9 @@ const processUsername = (user) => {
1173
1176
  var processUsername_default = processUsername;
1174
1177
 
1175
1178
  //#endregion
1176
- //#region src/api/getScim2Me.ts
1179
+ //#region src/api/getUsersMe.ts
1177
1180
  /**
1178
- * Retrieves the user profile information from the specified SCIM2 /Me endpoint.
1181
+ * Retrieves the user profile information from the specified /users/me endpoint.
1179
1182
  *
1180
1183
  * @param config - Request configuration object.
1181
1184
  * @returns A promise that resolves with the user profile information.
@@ -1183,8 +1186,8 @@ var processUsername_default = processUsername;
1183
1186
  * ```typescript
1184
1187
  * // Using default fetch
1185
1188
  * try {
1186
- * const userProfile = await getScim2Me({
1187
- * url: "https://localhost:8090/scim2/Me",
1189
+ * const userProfile = await getUsersMe({
1190
+ * url: "https://localhost:8090/users/me",
1188
1191
  * });
1189
1192
  * console.log(userProfile);
1190
1193
  * } catch (error) {
@@ -1198,8 +1201,8 @@ var processUsername_default = processUsername;
1198
1201
  * ```typescript
1199
1202
  * // Using custom fetcher (e.g., axios-based httpClient)
1200
1203
  * try {
1201
- * const userProfile = await getScim2Me({
1202
- * url: "https://localhost:8090/scim2/Me",
1204
+ * const userProfile = await getUsersMe({
1205
+ * url: "https://localhost:8090/users/me",
1203
1206
  * fetcher: async (url, config) => {
1204
1207
  * const response = await httpClient({
1205
1208
  * url,
@@ -1225,95 +1228,14 @@ var processUsername_default = processUsername;
1225
1228
  * }
1226
1229
  * ```
1227
1230
  */
1228
- const getScim2Me = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1231
+ const getUsersMe = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1229
1232
  try {
1230
1233
  new URL(url ?? baseUrl);
1231
1234
  } catch (error$1) {
1232
- 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.");
1235
+ 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.");
1233
1236
  }
1234
1237
  const fetchFn = fetcher || fetch;
1235
- const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
1236
- const requestInit = {
1237
- ...requestConfig,
1238
- headers: {
1239
- Accept: "application/json",
1240
- "Content-Type": "application/scim+json",
1241
- ...requestConfig.headers
1242
- },
1243
- method: "GET"
1244
- };
1245
- try {
1246
- const response = await fetchFn(resolvedUrl, requestInit);
1247
- if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getScim2Me-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
1248
- return processUsername_default(await response.json());
1249
- } catch (error$1) {
1250
- if (error$1 instanceof ThunderIDAPIError) throw error$1;
1251
- throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getScim2Me-NetworkError-001", "javascript", 0, "Network Error");
1252
- }
1253
- };
1254
- var getScim2Me_default = getScim2Me;
1255
-
1256
- //#endregion
1257
- //#region src/api/getSchemas.ts
1258
- /**
1259
- * Retrieves the SCIM2 schemas from the specified endpoint.
1260
- *
1261
- * @param config - Request configuration object.
1262
- * @returns A promise that resolves with the SCIM2 schemas information.
1263
- * @example
1264
- * ```typescript
1265
- * // Using default fetch
1266
- * try {
1267
- * const schemas = await getSchemas({
1268
- * url: "https://localhost:8090/scim2/Schemas",
1269
- * });
1270
- * console.log(schemas);
1271
- * } catch (error) {
1272
- * if (error instanceof ThunderIDAPIError) {
1273
- * console.error('Failed to get schemas:', error.message);
1274
- * }
1275
- * }
1276
- * ```
1277
- *
1278
- * @example
1279
- * ```typescript
1280
- * // Using custom fetcher (e.g., axios-based httpClient)
1281
- * try {
1282
- * const schemas = await getSchemas({
1283
- * url: "https://localhost:8090/scim2/Schemas",
1284
- * fetcher: async (url, config) => {
1285
- * const response = await httpClient({
1286
- * url,
1287
- * method: config.method,
1288
- * headers: config.headers,
1289
- * ...config
1290
- * });
1291
- * // Convert axios-like response to fetch-like Response
1292
- * return {
1293
- * ok: response.status >= 200 && response.status < 300,
1294
- * status: response.status,
1295
- * statusText: response.statusText,
1296
- * json: () => Promise.resolve(response.data),
1297
- * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))
1298
- * } as Response;
1299
- * }
1300
- * });
1301
- * console.log(schemas);
1302
- * } catch (error) {
1303
- * if (error instanceof ThunderIDAPIError) {
1304
- * console.error('Failed to get schemas:', error.message);
1305
- * }
1306
- * }
1307
- * ```
1308
- */
1309
- const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1310
- try {
1311
- new URL(url ?? baseUrl);
1312
- } catch (error$1) {
1313
- 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.");
1314
- }
1315
- const fetchFn = fetcher || fetch;
1316
- const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
1238
+ const resolvedUrl = url ?? `${baseUrl}/users/me`;
1317
1239
  const requestInit = {
1318
1240
  ...requestConfig,
1319
1241
  headers: {
@@ -1325,19 +1247,24 @@ const getSchemas = async ({ url, baseUrl, fetcher,...requestConfig }) => {
1325
1247
  };
1326
1248
  try {
1327
1249
  const response = await fetchFn(resolvedUrl, requestInit);
1328
- if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getSchemas-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch SCIM2 schemas");
1329
- return await response.json();
1250
+ if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "getUsersMe-ResponseError-001", "javascript", response.status, response.statusText, "Failed to fetch user profile");
1251
+ const user = await response.json();
1252
+ const attributes = user["attributes"] ?? {};
1253
+ return processUsername_default({
1254
+ ...user,
1255
+ ...attributes
1256
+ });
1330
1257
  } catch (error$1) {
1331
1258
  if (error$1 instanceof ThunderIDAPIError) throw error$1;
1332
- throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getSchemas-NetworkError-001", "javascript", 0, "Network Error");
1259
+ throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "getUsersMe-NetworkError-001", "javascript", 0, "Network Error");
1333
1260
  }
1334
1261
  };
1335
- var getSchemas_default = getSchemas;
1262
+ var getUsersMe_default = getUsersMe;
1336
1263
 
1337
1264
  //#endregion
1338
1265
  //#region src/api/updateMeProfile.ts
1339
1266
  /**
1340
- * Updates the user profile information at the specified SCIM2 Me endpoint.
1267
+ * Updates the user profile information at the specified /users/me endpoint.
1341
1268
  *
1342
1269
  * @param config - Configuration object with URL, payload and optional request config.
1343
1270
  * @returns A promise that resolves with the updated user profile information.
@@ -1345,8 +1272,8 @@ var getSchemas_default = getSchemas;
1345
1272
  * ```typescript
1346
1273
  * // Using default fetch
1347
1274
  * await updateMeProfile({
1348
- * url: "https://localhost:8090/scim2/Me",
1349
- * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } }
1275
+ * url: "https://localhost:8090/users/me",
1276
+ * payload: { mobileNumbers: ["0777933830"] }
1350
1277
  * });
1351
1278
  * ```
1352
1279
  *
@@ -1354,8 +1281,8 @@ var getSchemas_default = getSchemas;
1354
1281
  * ```typescript
1355
1282
  * // Using custom fetcher (e.g., axios-based httpClient)
1356
1283
  * await updateMeProfile({
1357
- * url: "https://localhost:8090/scim2/Me",
1358
- * payload: { "urn:scim:wso2:schema": { mobileNumbers: ["0777933830"] } },
1284
+ * url: "https://localhost:8090/users/me",
1285
+ * payload: { mobileNumbers: ["0777933830"] },
1359
1286
  * fetcher: async (url, config) => {
1360
1287
  * const response = await httpClient({
1361
1288
  * url,
@@ -1382,29 +1309,28 @@ const updateMeProfile = async ({ url, baseUrl, payload, fetcher,...requestConfig
1382
1309
  } catch (error$1) {
1383
1310
  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.");
1384
1311
  }
1385
- const data = {
1386
- Operations: [{
1387
- op: "replace",
1388
- value: payload
1389
- }],
1390
- schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
1391
- };
1312
+ const data = { attributes: payload };
1392
1313
  const fetchFn = fetcher || fetch;
1393
- const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
1314
+ const resolvedUrl = url ?? `${baseUrl}/users/me`;
1394
1315
  const requestInit = {
1395
- method: "PATCH",
1396
1316
  ...requestConfig,
1317
+ method: "PUT",
1397
1318
  body: JSON.stringify(data),
1398
1319
  headers: {
1399
1320
  ...requestConfig.headers,
1400
1321
  Accept: "application/json",
1401
- "Content-Type": "application/scim+json"
1322
+ "Content-Type": "application/json"
1402
1323
  }
1403
1324
  };
1404
1325
  try {
1405
1326
  const response = await fetchFn(resolvedUrl, requestInit);
1406
1327
  if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "updateMeProfile-ResponseError-001", "javascript", response.status, response.statusText, "Failed to update user profile");
1407
- return processUsername_default(await response.json());
1328
+ const user = await response.json();
1329
+ const attributes = user["attributes"] ?? {};
1330
+ return processUsername_default({
1331
+ ...user,
1332
+ ...attributes
1333
+ });
1408
1334
  } catch (error$1) {
1409
1335
  if (error$1 instanceof ThunderIDAPIError) throw error$1;
1410
1336
  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");
@@ -1707,25 +1633,6 @@ let FlowMode = /* @__PURE__ */ function(FlowMode$1) {
1707
1633
  return FlowMode$1;
1708
1634
  }({});
1709
1635
 
1710
- //#endregion
1711
- //#region src/models/scim2-schema.ts
1712
- /**
1713
- * Well-known SCIM2 schema IDs
1714
- */
1715
- let WellKnownSchemaIds = /* @__PURE__ */ function(WellKnownSchemaIds$1) {
1716
- /** Core Schema */
1717
- WellKnownSchemaIds$1["Core"] = "urn:ietf:params:scim:schemas:core:2.0";
1718
- /** Custom User Schema */
1719
- WellKnownSchemaIds$1["CustomUser"] = "urn:scim:schemas:extension:custom:User";
1720
- /** Enterprise User Schema */
1721
- WellKnownSchemaIds$1["EnterpriseUser"] = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User";
1722
- /** System User Schema */
1723
- WellKnownSchemaIds$1["SystemUser"] = "urn:scim:wso2:schema";
1724
- /** User Schema */
1725
- WellKnownSchemaIds$1["User"] = "urn:ietf:params:scim:schemas:core:2.0:User";
1726
- return WellKnownSchemaIds$1;
1727
- }({});
1728
-
1729
1636
  //#endregion
1730
1637
  //#region src/models/field.ts
1731
1638
  /**
@@ -3078,7 +2985,7 @@ const getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {
3078
2985
  const authorizeRequestParams = /* @__PURE__ */ new Map();
3079
2986
  authorizeRequestParams.set("response_type", "code");
3080
2987
  authorizeRequestParams.set("client_id", clientId);
3081
- authorizeRequestParams.set("scope", scopes ?? "");
2988
+ if (scopes !== void 0) authorizeRequestParams.set("scope", scopes);
3082
2989
  authorizeRequestParams.set("redirect_uri", redirectUri);
3083
2990
  if (responseMode) authorizeRequestParams.set("response_mode", responseMode);
3084
2991
  const pkceKey = pkceOptions?.key;
@@ -4326,209 +4233,6 @@ const isRecognizedBaseUrlPattern = (baseUrl) => {
4326
4233
  };
4327
4234
  var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
4328
4235
 
4329
- //#endregion
4330
- //#region src/utils/flattenUserSchema.ts
4331
- /**
4332
- * Flattens nested schema attributes into a flat structure for easier processing
4333
- *
4334
- * This function processes SCIM2 schemas and creates a flattened representation by:
4335
- * - Processing sub-attributes and creating dot-notation names (e.g., 'name.givenName')
4336
- * - Adding schema ID reference to each flattened attribute
4337
- * - Preserving all original attribute properties while adding schema context
4338
- * - Only including leaf-level attributes (sub-attributes) and top-level simple attributes
4339
- *
4340
- * @param schemas - Array of SCIM2 schemas containing nested attribute structures
4341
- * @returns Array of flattened schema attributes with dot-notation names and schema references
4342
- *
4343
- * @example
4344
- * ```typescript
4345
- * const schemas = [
4346
- * {
4347
- * id: 'urn:ietf:params:scim:schemas:core:2.0:User',
4348
- * attributes: [
4349
- * {
4350
- * name: 'userName',
4351
- * type: 'string',
4352
- * multiValued: false
4353
- * },
4354
- * {
4355
- * name: 'name',
4356
- * type: 'complex',
4357
- * multiValued: false,
4358
- * subAttributes: [
4359
- * { name: 'givenName', type: 'string', multiValued: false },
4360
- * { name: 'familyName', type: 'string', multiValued: false }
4361
- * ]
4362
- * }
4363
- * ]
4364
- * }
4365
- * ];
4366
- *
4367
- * const flattened = flattenUserSchema(schemas);
4368
- * // Result: [
4369
- * // { name: 'userName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
4370
- * // { name: 'name.givenName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
4371
- * // { name: 'name.familyName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' }
4372
- * // ]
4373
- * ```
4374
- */
4375
- const flattenUserSchema = (schemas) => {
4376
- const flattenedAttributes = [];
4377
- schemas.forEach((schema) => {
4378
- if (schema.attributes && Array.isArray(schema.attributes)) schema.attributes.forEach((attribute) => {
4379
- if (attribute.subAttributes && Array.isArray(attribute.subAttributes)) attribute.subAttributes.forEach((subAttribute) => {
4380
- flattenedAttributes.push({
4381
- ...subAttribute,
4382
- name: `${attribute.name}.${subAttribute.name}`,
4383
- schemaId: schema.id
4384
- });
4385
- });
4386
- else flattenedAttributes.push({
4387
- ...attribute,
4388
- schemaId: schema.id
4389
- });
4390
- });
4391
- });
4392
- return flattenedAttributes;
4393
- };
4394
- var flattenUserSchema_default = flattenUserSchema;
4395
-
4396
- //#endregion
4397
- //#region src/utils/get.ts
4398
- /**
4399
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4400
- *
4401
- * WSO2 LLC. licenses this file to you under the Apache License,
4402
- * Version 2.0 (the "License"); you may not use this file except
4403
- * in compliance with the License.
4404
- * You may obtain a copy of the License at
4405
- *
4406
- * http://www.apache.org/licenses/LICENSE-2.0
4407
- *
4408
- * Unless required by applicable law or agreed to in writing,
4409
- * software distributed under the License is distributed on an
4410
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4411
- * KIND, either express or implied. See the License for the
4412
- * specific language governing permissions and limitations
4413
- * under the License.
4414
- */
4415
- /**
4416
- * Gets the value at path of object. If the resolved value is undefined,
4417
- * the defaultValue is returned in its place.
4418
- * Similar to Lodash's get() function
4419
- *
4420
- * @param object - The object to query
4421
- * @param path - The path of the property to get
4422
- * @param defaultValue - The value returned for undefined resolved values
4423
- * @returns The resolved value
4424
- */
4425
- const get = (object, path, defaultValue) => {
4426
- if (!object || !path) return defaultValue;
4427
- const result = (Array.isArray(path) ? path : path.split(".")).reduce((current, key) => current?.[key], object);
4428
- return result !== void 0 ? result : defaultValue;
4429
- };
4430
- var get_default = get;
4431
-
4432
- //#endregion
4433
- //#region src/utils/set.ts
4434
- /**
4435
- * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4436
- *
4437
- * WSO2 LLC. licenses this file to you under the Apache License,
4438
- * Version 2.0 (the "License"); you may not use this file except
4439
- * in compliance with the License.
4440
- * You may obtain a copy of the License at
4441
- *
4442
- * http://www.apache.org/licenses/LICENSE-2.0
4443
- *
4444
- * Unless required by applicable law or agreed to in writing,
4445
- * software distributed under the License is distributed on an
4446
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4447
- * KIND, either express or implied. See the License for the
4448
- * specific language governing permissions and limitations
4449
- * under the License.
4450
- */
4451
- /**
4452
- * Sets the value at path of object. If a portion of path doesn't exist,
4453
- * it's created. Arrays are created for missing index properties while
4454
- * objects are created for all other missing properties.
4455
- * Similar to Lodash's set() function
4456
- *
4457
- * @param object - The object to modify
4458
- * @param path - The path of the property to set
4459
- * @param value - The value to set
4460
- * @returns The object
4461
- */
4462
- const set = (object, path, value) => {
4463
- if (!object || !path) return object;
4464
- const pathArray = Array.isArray(path) ? path : path.split(".");
4465
- const lastIndex = pathArray.length - 1;
4466
- pathArray.reduce((current, key, index) => {
4467
- if (index === lastIndex) current[key] = value;
4468
- else if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
4469
- const nextKey = pathArray[index + 1];
4470
- current[key] = /^\d+$/.test(nextKey) ? [] : {};
4471
- }
4472
- return current[key];
4473
- }, object);
4474
- return object;
4475
- };
4476
- var set_default = set;
4477
-
4478
- //#endregion
4479
- //#region src/utils/generateUserProfile.ts
4480
- /**
4481
- * Creates a profile structure from ME response based on processed schemas
4482
- *
4483
- * This function processes each schema attribute and populates the profile dynamically by:
4484
- * - Extracting values from the ME response using the schema attribute names
4485
- * - Handling multi-valued attributes by converting single values to arrays when needed
4486
- * - Setting appropriate default values based on schema type and multiValued properties
4487
- * - Using dynamic property setting to build the final profile object
4488
- *
4489
- * @param meResponse - The ME API response containing user data
4490
- * @param processedSchemas - The processed and flattened schemas with name, type, and multiValued properties
4491
- * @returns Flat profile object with dynamically populated user attributes
4492
- *
4493
- * @example
4494
- * ```typescript
4495
- * const meResponse = {
4496
- * userName: 'john.doe',
4497
- * emails: ['john@example.com', 'john.doe@work.com'],
4498
- * name: { givenName: 'John', familyName: 'Doe' }
4499
- * };
4500
- *
4501
- * const schemas = [
4502
- * { name: 'userName', type: 'STRING', multiValued: false },
4503
- * { name: 'emails', type: 'STRING', multiValued: true },
4504
- * { name: 'name.givenName', type: 'STRING', multiValued: false }
4505
- * ];
4506
- *
4507
- * const profile = generateUserProfile(meResponse, schemas);
4508
- * // Result: {
4509
- * // userName: 'john.doe',
4510
- * // emails: ['john@example.com', 'john.doe@work.com'],
4511
- * // 'name.givenName': 'John'
4512
- * // }
4513
- * ```
4514
- */
4515
- const generateUserProfile = (meResponse, processedSchemas) => {
4516
- const profile = {};
4517
- processedSchemas.forEach((schema) => {
4518
- const { name, type, multiValued } = schema;
4519
- if (!name) return;
4520
- let value = get_default(meResponse, name);
4521
- if (value !== void 0) {
4522
- if (multiValued && !Array.isArray(value)) value = [value];
4523
- } else if (multiValued) value = void 0;
4524
- else if (type === "STRING") value = "";
4525
- else value = void 0;
4526
- set_default(profile, name, value);
4527
- });
4528
- return profile;
4529
- };
4530
- var generateUserProfile_default = generateUserProfile;
4531
-
4532
4236
  //#endregion
4533
4237
  //#region src/utils/getLatestStateParam.ts
4534
4238
  /**
@@ -4574,95 +4278,14 @@ var getLatestStateParam_default = getLatestStateParam;
4574
4278
  //#endregion
4575
4279
  //#region src/utils/generateFlattenedUserProfile.ts
4576
4280
  /**
4577
- * Generates a flattened user profile from a response object and schema definitions.
4578
- *
4579
- * This function processes user data according to schema specifications, creating
4580
- * a flat object with dot notation keys instead of nested objects. Multi-valued
4581
- * properties and type-specific defaults are handled appropriately.
4582
- *
4583
- * Additionally, any fields present in the response but not defined in the schema
4584
- * will be included to ensure no user data is lost during flattening.
4281
+ * Generates a flattened user profile by returning the user profile as-is.
4585
4282
  *
4586
4283
  * @param meResponse - The response object containing user data
4587
- * @param processedSchemas - Array of schema objects defining field properties
4588
- * @param processedSchemas[].name - The field name/path for the property
4589
- * @param processedSchemas[].type - The data type of the field (e.g., 'STRING')
4590
- * @param processedSchemas[].multiValued - Whether the field can contain multiple values
4591
- *
4592
- * @returns A flattened user profile object with dot notation keys
4593
- *
4594
- * @example
4595
- * ```typescript
4596
- * const schemas = [
4597
- * { name: 'name.givenName', type: 'STRING', multiValued: false },
4598
- * { name: 'emails', type: 'STRING', multiValued: true }
4599
- * ];
4600
- * const response = {
4601
- * name: { givenName: 'John' },
4602
- * emails: 'john@example.com',
4603
- * country: 'US' // This will be included even if not in schema
4604
- * };
4605
- * const profile = generateFlattenedUserProfile(response, schemas);
4606
- * // Result: { "name.givenName": 'John', emails: ['john@example.com'], country: 'US' }
4607
- * ```
4284
+ * @param _processedSchemas - Deprecated/unused schemas parameter
4285
+ * @returns The user profile object
4608
4286
  */
4609
- const generateFlattenedUserProfile = (meResponse, processedSchemas) => {
4610
- const profile = {};
4611
- const allSchemaNames = processedSchemas.map((schema) => schema.name).filter(Boolean);
4612
- processedSchemas.forEach((schema) => {
4613
- const { name, type, multiValued } = schema;
4614
- if (!name) return;
4615
- if (allSchemaNames.some((schemaName) => schemaName !== name && schemaName.startsWith(`${name}.`))) return;
4616
- let value = get_default(meResponse, name);
4617
- if (value === void 0) {
4618
- const dotIndex = name.indexOf(".");
4619
- if (dotIndex > 0) {
4620
- const head = name.slice(0, dotIndex);
4621
- const tail = name.slice(dotIndex + 1);
4622
- const arr = meResponse[head];
4623
- if (Array.isArray(arr)) {
4624
- const match = arr.find((item) => item?.type === tail);
4625
- if (match?.value !== void 0) value = match.value;
4626
- }
4627
- }
4628
- }
4629
- if (value === void 0) [
4630
- "urn:ietf:params:scim:schemas:core:2.0:User",
4631
- "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User",
4632
- "urn:scim:wso2:schema",
4633
- "urn:scim:schemas:extension:custom:User"
4634
- ].some((namespace) => {
4635
- if (meResponse[namespace]) {
4636
- if (meResponse[namespace][name] !== void 0) {
4637
- value = meResponse[namespace][name];
4638
- return true;
4639
- }
4640
- const nestedValue = get_default(meResponse[namespace], name);
4641
- if (nestedValue !== void 0) {
4642
- value = nestedValue;
4643
- return true;
4644
- }
4645
- }
4646
- return false;
4647
- });
4648
- if (value !== void 0) {
4649
- if (multiValued && !Array.isArray(value)) value = [value];
4650
- } else if (multiValued) value = void 0;
4651
- else if (type === "STRING") value = "";
4652
- else value = void 0;
4653
- profile[name] = value;
4654
- });
4655
- const flattenObject = (obj, prefix = "") => {
4656
- if (obj && typeof obj === "object" && !Array.isArray(obj)) Object.keys(obj).forEach((key) => {
4657
- const fullKey = prefix ? `${prefix}.${key}` : key;
4658
- const value = obj[key];
4659
- if (Object.prototype.hasOwnProperty.call(profile, fullKey)) return;
4660
- if (allSchemaNames.some((schemaName) => schemaName.startsWith(`${fullKey}.`))) flattenObject(value, fullKey);
4661
- else profile[fullKey] = value;
4662
- });
4663
- };
4664
- flattenObject(meResponse);
4665
- return profile;
4287
+ const generateFlattenedUserProfile = (meResponse, _processedSchemas) => {
4288
+ return { ...meResponse };
4666
4289
  };
4667
4290
  var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
4668
4291
 
@@ -4811,6 +4434,129 @@ const extractEmojiFromUri = (uri) => {
4811
4434
  };
4812
4435
  var extractEmojiFromUri_default = extractEmojiFromUri;
4813
4436
 
4437
+ //#endregion
4438
+ //#region src/utils/set.ts
4439
+ /**
4440
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4441
+ *
4442
+ * WSO2 LLC. licenses this file to you under the Apache License,
4443
+ * Version 2.0 (the "License"); you may not use this file except
4444
+ * in compliance with the License.
4445
+ * You may obtain a copy of the License at
4446
+ *
4447
+ * http://www.apache.org/licenses/LICENSE-2.0
4448
+ *
4449
+ * Unless required by applicable law or agreed to in writing,
4450
+ * software distributed under the License is distributed on an
4451
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4452
+ * KIND, either express or implied. See the License for the
4453
+ * specific language governing permissions and limitations
4454
+ * under the License.
4455
+ */
4456
+ /**
4457
+ * Sets the value at path of object. If a portion of path doesn't exist,
4458
+ * it's created. Arrays are created for missing index properties while
4459
+ * objects are created for all other missing properties.
4460
+ * Similar to Lodash's set() function
4461
+ *
4462
+ * @param object - The object to modify
4463
+ * @param path - The path of the property to set
4464
+ * @param value - The value to set
4465
+ * @returns The object
4466
+ */
4467
+ const set = (object, path, value) => {
4468
+ if (!object || !path) return object;
4469
+ const pathArray = Array.isArray(path) ? path : path.split(".");
4470
+ const lastIndex = pathArray.length - 1;
4471
+ pathArray.reduce((current, key, index) => {
4472
+ if (index === lastIndex) current[key] = value;
4473
+ else if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
4474
+ const nextKey = pathArray[index + 1];
4475
+ current[key] = /^\d+$/.test(nextKey) ? [] : {};
4476
+ }
4477
+ return current[key];
4478
+ }, object);
4479
+ return object;
4480
+ };
4481
+ var set_default = set;
4482
+
4483
+ //#endregion
4484
+ //#region src/utils/get.ts
4485
+ /**
4486
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
4487
+ *
4488
+ * WSO2 LLC. licenses this file to you under the Apache License,
4489
+ * Version 2.0 (the "License"); you may not use this file except
4490
+ * in compliance with the License.
4491
+ * You may obtain a copy of the License at
4492
+ *
4493
+ * http://www.apache.org/licenses/LICENSE-2.0
4494
+ *
4495
+ * Unless required by applicable law or agreed to in writing,
4496
+ * software distributed under the License is distributed on an
4497
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4498
+ * KIND, either express or implied. See the License for the
4499
+ * specific language governing permissions and limitations
4500
+ * under the License.
4501
+ */
4502
+ /**
4503
+ * Gets the value at path of object. If the resolved value is undefined,
4504
+ * the defaultValue is returned in its place.
4505
+ * Similar to Lodash's get() function
4506
+ *
4507
+ * @param object - The object to query
4508
+ * @param path - The path of the property to get
4509
+ * @param defaultValue - The value returned for undefined resolved values
4510
+ * @returns The resolved value
4511
+ */
4512
+ const get = (object, path, defaultValue) => {
4513
+ if (!object || !path) return defaultValue;
4514
+ const result = (Array.isArray(path) ? path : path.split(".")).reduce((current, key) => current?.[key], object);
4515
+ return result !== void 0 ? result : defaultValue;
4516
+ };
4517
+ var get_default = get;
4518
+
4519
+ //#endregion
4520
+ //#region src/utils/startCase.ts
4521
+ /**
4522
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
4523
+ *
4524
+ * WSO2 LLC. licenses this file to you under the Apache License,
4525
+ * Version 2.0 (the "License"); you may not use this file except
4526
+ * in compliance with the License.
4527
+ * You may obtain a copy of the License at
4528
+ *
4529
+ * http://www.apache.org/licenses/LICENSE-2.0
4530
+ *
4531
+ * Unless required by applicable law or agreed to in writing,
4532
+ * software distributed under the License is distributed on an
4533
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4534
+ * KIND, either express or implied. See the License for the
4535
+ * specific language governing permissions and limitations
4536
+ * under the License.
4537
+ */
4538
+ /**
4539
+ * Converts the first character of `string` to upper case.
4540
+ *
4541
+ * @param string - The string to convert.
4542
+ * @returns The converted string.
4543
+ */
4544
+ const upperFirst = (str) => {
4545
+ if (!str) return "";
4546
+ return str.charAt(0).toUpperCase() + str.slice(1);
4547
+ };
4548
+ /**
4549
+ * Converts `string` to start case.
4550
+ *
4551
+ * @param string - The string to convert.
4552
+ * @returns The start cased string.
4553
+ */
4554
+ const startCase = (str) => {
4555
+ if (!str) return "";
4556
+ return str.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).map((word) => upperFirst(word)).join(" ");
4557
+ };
4558
+ var startCase_default = startCase;
4559
+
4814
4560
  //#endregion
4815
4561
  //#region src/utils/removeTrailingSlash.ts
4816
4562
  /**
@@ -6342,4 +6088,4 @@ const normalizeTranslations = (translations) => {
6342
6088
  var normalizeTranslations_default = normalizeTranslations;
6343
6089
 
6344
6090
  //#endregion
6345
- export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, DEFAULT_THEME, DEFAULT_VALIDATION_MESSAGE_KEYS, EMOJI_URI_SCHEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedRecoveryFlowStatus, EmbeddedRecoveryFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, FieldType, FlowMetaType, FlowMode, HttpClient, IsomorphicCrypto, OIDCRequestConstants_default as OIDCRequestConstants, StorageManager_default as StorageManager, ThunderIDAPIError, ThunderIDAuthException, ThunderIDError, ThunderIDJavaScriptClient_default as ThunderIDJavaScriptClient, ThunderIDRuntimeError, TokenConstants_default as TokenConstants, TranslationBundleConstants_default as TranslationBundleConstants, VendorConstants_default as VendorConstants, WellKnownSchemaIds, arrayBufferToBase64url_default as arrayBufferToBase64url, base64urlToArrayBuffer_default as base64urlToArrayBuffer, bem_default as bem, buildValidatorFromRules_default as buildValidatorFromRules, configure as configureLogger, countryCodeToFlagEmoji, createComponentLogger, createLogger, createPackageComponentLogger, createPackageLogger, createTheme_default as createTheme, debug, deepMerge_default as deepMerge, error, evaluateValidationRule_default as evaluateValidationRule, executeEmbeddedRecoveryFlow_default as executeEmbeddedRecoveryFlow, executeEmbeddedSignInFlow_default as executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow_default as executeEmbeddedSignUpFlow, executeEmbeddedUserOnboardingFlow_default as executeEmbeddedUserOnboardingFlow, extractEmojiFromUri_default as extractEmojiFromUri, extractPkceStorageKeyFromState_default as extractPkceStorageKeyFromState, extractUserClaimsFromIdToken_default as extractUserClaimsFromIdToken, flattenUserSchema_default as flattenUserSchema, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, generateUserProfile_default as generateUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getSchemas_default as getSchemas, getScim2Me_default as getScim2Me, getUserInfo_default as getUserInfo, getVendorPrefix_default as getVendorPrefix, info, isEmojiUri_default as isEmojiUri, isEmpty_default as isEmpty, isRecognizedBaseUrlPattern_default as isRecognizedBaseUrlPattern, logger_default as logger, normalizeTranslations_default as normalizeTranslations, processOpenIDScopes_default as processOpenIDScopes, processUsername_default as processUsername, removeTrailingSlash_default as removeTrailingSlash, resolveFieldName_default as resolveFieldName, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji_default as resolveLocaleEmoji, resolveMeta, set_default as set, updateMeProfile_default as updateMeProfile, warn, withVendorCSSClassPrefix_default as withVendorCSSClassPrefix };
6091
+ export { ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants, AuthenticationHelper_default as AuthenticationHelper, DEFAULT_THEME, DEFAULT_VALIDATION_MESSAGE_KEYS, EMOJI_URI_SCHEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowResponseType, EmbeddedFlowTextVariant, EmbeddedFlowType, EmbeddedRecoveryFlowStatus, EmbeddedRecoveryFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, FieldType, FlowMetaType, FlowMode, HttpClient, IsomorphicCrypto, OIDCRequestConstants_default as OIDCRequestConstants, StorageManager_default as StorageManager, ThunderIDAPIError, ThunderIDAuthException, ThunderIDError, ThunderIDJavaScriptClient_default as ThunderIDJavaScriptClient, ThunderIDRuntimeError, TokenConstants_default as TokenConstants, TranslationBundleConstants_default as TranslationBundleConstants, VendorConstants_default as VendorConstants, arrayBufferToBase64url_default as arrayBufferToBase64url, base64urlToArrayBuffer_default as base64urlToArrayBuffer, bem_default as bem, buildValidatorFromRules_default as buildValidatorFromRules, configure as configureLogger, countryCodeToFlagEmoji, createComponentLogger, createLogger, createPackageComponentLogger, createPackageLogger, createTheme_default as createTheme, debug, deepMerge_default as deepMerge, error, evaluateValidationRule_default as evaluateValidationRule, executeEmbeddedRecoveryFlow_default as executeEmbeddedRecoveryFlow, executeEmbeddedSignInFlow_default as executeEmbeddedSignInFlow, executeEmbeddedSignUpFlow_default as executeEmbeddedSignUpFlow, executeEmbeddedUserOnboardingFlow_default as executeEmbeddedUserOnboardingFlow, extractEmojiFromUri_default as extractEmojiFromUri, extractPkceStorageKeyFromState_default as extractPkceStorageKeyFromState, extractUserClaimsFromIdToken_default as extractUserClaimsFromIdToken, formatDate_default as formatDate, generateFlattenedUserProfile_default as generateFlattenedUserProfile, get_default as get, getDefaultI18nBundles_default as getDefaultI18nBundles, getFlowMeta_default as getFlowMeta, getLatestStateParam_default as getLatestStateParam, getOrganizationUnitChildren_default as getOrganizationUnitChildren, getRedirectBasedSignUpUrl_default as getRedirectBasedSignUpUrl, getUserInfo_default as getUserInfo, getUsersMe_default as getUsersMe, getVendorPrefix_default as getVendorPrefix, info, isEmojiUri_default as isEmojiUri, isEmpty_default as isEmpty, isRecognizedBaseUrlPattern_default as isRecognizedBaseUrlPattern, logger_default as logger, normalizeTranslations_default as normalizeTranslations, processOpenIDScopes_default as processOpenIDScopes, processUsername_default as processUsername, removeTrailingSlash_default as removeTrailingSlash, resolveFieldName_default as resolveFieldName, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji_default as resolveLocaleEmoji, resolveMeta, set_default as set, startCase_default as startCase, updateMeProfile_default as updateMeProfile, warn, withVendorCSSClassPrefix_default as withVendorCSSClassPrefix };