@c-rex/core 0.3.0-build.32 → 0.3.0-build.34

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/OIDC.js CHANGED
@@ -1582,15 +1582,12 @@ var formatIssuer = (issuer) => {
1582
1582
  return newIssuer;
1583
1583
  };
1584
1584
  var formatApiUrl = (apiUrl) => {
1585
- let newApiUrl = apiUrl;
1586
- const lastChar = newApiUrl.charAt(newApiUrl.length - 1);
1587
- if (lastChar !== "/") {
1588
- newApiUrl += "/";
1589
- }
1590
- if (!newApiUrl.includes("iirds/v1/")) {
1591
- newApiUrl += "iirds/v1/";
1592
- }
1593
- return newApiUrl;
1585
+ const url = new URL(apiUrl);
1586
+ const segments = url.pathname.split("/").filter(Boolean);
1587
+ const isTerminalIirdsArea = segments.length >= 2 && segments[segments.length - 2]?.toLowerCase() === "iirds" && segments[segments.length - 1]?.toLowerCase() === "v1";
1588
+ const normalizedSegments = isTerminalIirdsArea ? segments.slice(0, -2) : segments;
1589
+ url.pathname = normalizedSegments.length > 0 ? `/${normalizedSegments.join("/")}/` : "/";
1590
+ return url.toString();
1594
1591
  };
1595
1592
  var mergeConfigs = (defaultConfig, envVars) => {
1596
1593
  const definedEnvVars = {};