@asgardeo/javascript 0.16.2 → 0.18.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/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts +5 -5
- package/dist/cjs/index.js +16 -11
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +16 -11
- package/dist/index.js.map +2 -2
- package/dist/models/v2/embedded-signin-flow-v2.d.ts +9 -9
- package/dist/models/v2/embedded-signup-flow-v2.d.ts +9 -9
- package/dist/utils/processOpenIDScopes.d.ts +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -355,11 +355,14 @@ Message: ${this.message}`;
|
|
|
355
355
|
// src/utils/processOpenIDScopes.ts
|
|
356
356
|
var processOpenIDScopes = (scopes) => {
|
|
357
357
|
let processedScopes = [];
|
|
358
|
-
|
|
358
|
+
let userConfiguredScopes = false;
|
|
359
|
+
if (scopes !== void 0 && scopes !== null) {
|
|
359
360
|
if (Array.isArray(scopes)) {
|
|
360
361
|
processedScopes = scopes;
|
|
362
|
+
userConfiguredScopes = scopes.length > 0;
|
|
361
363
|
} else if (typeof scopes === "string") {
|
|
362
|
-
processedScopes = scopes.split(" ");
|
|
364
|
+
processedScopes = scopes ? scopes.split(" ") : [];
|
|
365
|
+
userConfiguredScopes = scopes.length > 0;
|
|
363
366
|
} else {
|
|
364
367
|
throw new AsgardeoRuntimeError(
|
|
365
368
|
"Scopes must be a string or an array of strings.",
|
|
@@ -369,11 +372,13 @@ var processOpenIDScopes = (scopes) => {
|
|
|
369
372
|
);
|
|
370
373
|
}
|
|
371
374
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
processedScopes.
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
if (!userConfiguredScopes) {
|
|
376
|
+
OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
|
|
377
|
+
if (!processedScopes.includes(defaultScope)) {
|
|
378
|
+
processedScopes.push(defaultScope);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
377
382
|
return processedScopes.join(" ");
|
|
378
383
|
};
|
|
379
384
|
var processOpenIDScopes_default = processOpenIDScopes;
|
|
@@ -3024,7 +3029,7 @@ var executeEmbeddedSignInFlowV2 = async ({
|
|
|
3024
3029
|
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3025
3030
|
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3026
3031
|
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3027
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "
|
|
3032
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3028
3033
|
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3029
3034
|
const response = await fetch(endpoint, {
|
|
3030
3035
|
...requestConfig,
|
|
@@ -3124,7 +3129,7 @@ var executeEmbeddedSignUpFlowV2 = async ({
|
|
|
3124
3129
|
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3125
3130
|
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3126
3131
|
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3127
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "
|
|
3132
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3128
3133
|
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3129
3134
|
const response = await fetch(endpoint, {
|
|
3130
3135
|
...requestConfig,
|
|
@@ -3210,8 +3215,8 @@ var executeEmbeddedUserOnboardingFlowV2 = async ({
|
|
|
3210
3215
|
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3211
3216
|
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3212
3217
|
const hasOnlyFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3213
|
-
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "
|
|
3214
|
-
const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "
|
|
3218
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3219
|
+
const hasFlowIdWithInputs = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && "inputs" in cleanPayload;
|
|
3215
3220
|
const requestPayload = hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3216
3221
|
if ("flowType" in requestPayload && requestPayload["flowType"] !== "USER_ONBOARDING" /* UserOnboarding */) {
|
|
3217
3222
|
requestPayload["flowType"] = "USER_ONBOARDING" /* UserOnboarding */;
|