From 6c63eab8558b19d9d8d3ae6575be42da0ef7757f Mon Sep 17 00:00:00 2001 From: Rees Pozzi Date: Thu, 4 Jan 2024 10:37:15 +0000 Subject: [PATCH] Fix code formatting --- src/applicationManager.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/applicationManager.ts b/src/applicationManager.ts index 484d1ee..c56dbe2 100644 --- a/src/applicationManager.ts +++ b/src/applicationManager.ts @@ -581,18 +581,28 @@ export async function updateApplicationAppRoles({ /** * Necessary where an app role is deleted, they must all be disabled first. Easier to disable by default and enable when updating. */ -async function disableAppRoles(applicationId: string, token: string, appRoles: AppRoles) { +async function disableAppRoles( + applicationId: string, + token: string, + appRoles: AppRoles, +) { const app = await readApplication({ token, applicationId }); let appRolesJson: Array = app.appRoles; // Finds pairs of displayName and ID of app roles to compare existing app roles with incoming app roles - const incomingAppRolePairs = appRoles.map(({ displayName, id }) => `name:${displayName}_id:${id}`); - const existingAppRolePairs = appRolesJson.map(({ displayName, id }) => `name:${displayName}_id:${id}`); - const commonPairs = existingAppRolePairs.filter(pair => incomingAppRolePairs.includes(pair)); + const incomingAppRolePairs = appRoles.map( + ({ displayName, id }) => `name:${displayName}_id:${id}`, + ); + const existingAppRolePairs = appRolesJson.map( + ({ displayName, id }) => `name:${displayName}_id:${id}`, + ); + const commonPairs = existingAppRolePairs.filter((pair) => + incomingAppRolePairs.includes(pair), + ); // Break here if app roles are the same as current file - not disabling all roles if unnecessary - if(!(commonPairs.length < existingAppRolePairs.length)){ - return + if (!(commonPairs.length < existingAppRolePairs.length)) { + return; } // Keep fetched array of AppRoles but change enabled to false