@bigbinary/neeto-playwright-commons 1.22.25 → 1.22.26

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/index.cjs.js CHANGED
@@ -193547,11 +193547,11 @@ class RoleApis {
193547
193547
 
193548
193548
  class RolesPage {
193549
193549
  constructor(page, neetoPlaywrightUtilities) {
193550
- this.getPermissionIds = async (targetPermissions) => {
193550
+ this.getPermissionIds = async (targetPermissions, isGranularPermission = false) => {
193551
193551
  const { permissions } = await this.roleApis
193552
193552
  .fetch("permissions")
193553
193553
  .then(response => response === null || response === void 0 ? void 0 : response.json());
193554
- const permissionObjects = targetPermissions.flatMap(permission => permissions.filter((p) => p.category === permission));
193554
+ const permissionObjects = targetPermissions.flatMap(permission => permissions.filter((p) => isGranularPermission ? p.name === permission : p.category === permission));
193555
193555
  return ramda.pluck("id", permissionObjects);
193556
193556
  };
193557
193557
  this.getRoleIdAndOrganizationId = async (roleName) => {
@@ -193561,13 +193561,13 @@ class RolesPage {
193561
193561
  const { id: roleId, organization_id: organizationId } = neetoCist.findBy({ name: roleName }, roles.organization_roles);
193562
193562
  return { roleId, organizationId };
193563
193563
  };
193564
- this.addCustomRoleViaRequest = async (roleName, targetPermissions) => {
193565
- const permissionIds = await this.getPermissionIds(targetPermissions);
193564
+ this.addCustomRoleViaRequest = async (roleName, targetPermissions, isGranularPermission = false) => {
193565
+ const permissionIds = await this.getPermissionIds(targetPermissions, isGranularPermission);
193566
193566
  return this.roleApis.addRole(roleName, permissionIds);
193567
193567
  };
193568
- this.editRoleViaRequest = async (roleName, targetPermissions) => {
193568
+ this.editRoleViaRequest = async (roleName, targetPermissions, isGranularPermission = false) => {
193569
193569
  const [permissionIds, { roleId, organizationId }] = await Promise.all([
193570
- this.getPermissionIds(targetPermissions),
193570
+ this.getPermissionIds(targetPermissions, isGranularPermission),
193571
193571
  this.getRoleIdAndOrganizationId(roleName),
193572
193572
  ]);
193573
193573
  return this.roleApis.editRole(roleId, {