@battle-racing/br-common-lib 1.0.1 → 1.1.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/definitions/RoleDefinitions.d.ts +2 -0
- package/dist/definitions/RoleDefinitions.js +25 -0
- package/dist/definitions/index.d.ts +1 -0
- package/dist/definitions/index.js +17 -0
- package/dist/index.d.ts +2 -19
- package/dist/index.js +2 -19
- package/dist/{damage → types/damage}/Damage.d.ts +2 -1
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.js +37 -0
- package/dist/types/role/Permission.d.ts +11 -0
- package/dist/types/role/Permission.js +12 -0
- package/dist/types/role/RoleDefinition.d.ts +7 -0
- package/dist/types/role/UserRole.d.ts +6 -0
- package/dist/types/role/UserRole.js +7 -0
- package/dist/types/role/index.d.ts +3 -0
- package/dist/types/role/index.js +19 -0
- package/dist/{user → types/user}/User.d.ts +2 -0
- package/dist/types/utils/ObjectValues.js +2 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/index.js +18 -0
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +1 -2
- package/dist/utils/roles.utils.d.ts +4 -0
- package/dist/utils/roles.utils.js +20 -0
- package/package.json +3 -2
- package/src/definitions/RoleDefinitions.ts +24 -0
- package/src/definitions/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/types/index.ts +2 -0
- package/src/types/role/Permission.ts +16 -0
- package/src/types/role/RoleDefinition.ts +8 -0
- package/src/types/role/UserRole.ts +8 -0
- package/src/types/role/index.ts +3 -0
- package/src/types/user/User.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/roles.utils.ts +20 -0
- /package/dist/{checkpoint → types/checkpoint}/Checkpoint.d.ts +0 -0
- /package/dist/{checkpoint → types/checkpoint}/Checkpoint.js +0 -0
- /package/dist/{checkpoint → types/checkpoint}/CheckpointType.d.ts +0 -0
- /package/dist/{checkpoint → types/checkpoint}/CheckpointType.js +0 -0
- /package/dist/{checkpoint → types/checkpoint}/index.d.ts +0 -0
- /package/dist/{checkpoint → types/checkpoint}/index.js +0 -0
- /package/dist/{color → types/color}/ColorInfo.d.ts +0 -0
- /package/dist/{color → types/color}/ColorInfo.js +0 -0
- /package/dist/{color → types/color}/ColorName.d.ts +0 -0
- /package/dist/{color → types/color}/ColorName.js +0 -0
- /package/dist/{color → types/color}/index.d.ts +0 -0
- /package/dist/{color → types/color}/index.js +0 -0
- /package/dist/{command → types/command}/CommandConfig.d.ts +0 -0
- /package/dist/{command → types/command}/CommandConfig.js +0 -0
- /package/dist/{command → types/command}/index.d.ts +0 -0
- /package/dist/{command → types/command}/index.js +0 -0
- /package/dist/{damage → types/damage}/Damage.js +0 -0
- /package/dist/{damage → types/damage}/DamageName.d.ts +0 -0
- /package/dist/{damage → types/damage}/DamageName.js +0 -0
- /package/dist/{damage → types/damage}/DamageTarget.d.ts +0 -0
- /package/dist/{damage → types/damage}/DamageTarget.js +0 -0
- /package/dist/{damage → types/damage}/index.d.ts +0 -0
- /package/dist/{damage → types/damage}/index.js +0 -0
- /package/dist/{flow → types/flow}/Flow.d.ts +0 -0
- /package/dist/{flow → types/flow}/Flow.js +0 -0
- /package/dist/{flow → types/flow}/index.d.ts +0 -0
- /package/dist/{flow → types/flow}/index.js +0 -0
- /package/dist/{game → types/game}/Game.d.ts +0 -0
- /package/dist/{game → types/game}/Game.js +0 -0
- /package/dist/{game → types/game}/GameStatus.d.ts +0 -0
- /package/dist/{game → types/game}/GameStatus.js +0 -0
- /package/dist/{game → types/game}/GameType.d.ts +0 -0
- /package/dist/{game → types/game}/GameType.js +0 -0
- /package/dist/{game → types/game}/GameWarningEvent.d.ts +0 -0
- /package/dist/{game → types/game}/GameWarningEvent.js +0 -0
- /package/dist/{game → types/game}/KartRankingItem.d.ts +0 -0
- /package/dist/{game → types/game}/KartRankingItem.js +0 -0
- /package/dist/{game → types/game}/battle/Battle.d.ts +0 -0
- /package/dist/{game → types/game}/battle/Battle.js +0 -0
- /package/dist/{game → types/game}/battle/index.d.ts +0 -0
- /package/dist/{game → types/game}/battle/index.js +0 -0
- /package/dist/{game → types/game}/index.d.ts +0 -0
- /package/dist/{game → types/game}/index.js +0 -0
- /package/dist/{game → types/game}/race/KartProgress.d.ts +0 -0
- /package/dist/{game → types/game}/race/KartProgress.js +0 -0
- /package/dist/{game → types/game}/race/Race.d.ts +0 -0
- /package/dist/{game → types/game}/race/Race.js +0 -0
- /package/dist/{game → types/game}/race/index.d.ts +0 -0
- /package/dist/{game → types/game}/race/index.js +0 -0
- /package/dist/{gameTrack → types/gameTrack}/GameTrack.d.ts +0 -0
- /package/dist/{gameTrack → types/gameTrack}/GameTrack.js +0 -0
- /package/dist/{gameTrack → types/gameTrack}/GameTrackKartsConfig.d.ts +0 -0
- /package/dist/{gameTrack → types/gameTrack}/GameTrackKartsConfig.js +0 -0
- /package/dist/{gameTrack → types/gameTrack}/index.d.ts +0 -0
- /package/dist/{gameTrack → types/gameTrack}/index.js +0 -0
- /package/dist/{hardware → types/hardware}/KartEffect.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/KartEffect.js +0 -0
- /package/dist/{hardware → types/hardware}/ModuleName.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ModuleName.js +0 -0
- /package/dist/{hardware → types/hardware}/ModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/BallSensorCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/BallSensorCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/BallSensorDiskThrowerModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/BallSensorDiskThrowerModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/BallSensorStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/BallSensorStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/ConfigureBallSensorDiskThrowerModuleOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/ConfigureBallSensorDiskThrowerModuleOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballSensor/index.js +0 -0
- /package/dist/{hardware → types/hardware}/ballShooter/BallShooterCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballShooter/BallShooterCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/ballShooter/BallShooterStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballShooter/BallShooterStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/ballShooter/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/ballShooter/index.js +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/ConfigDiskSensorBallShooterModuleOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/ConfigDiskSensorBallShooterModuleOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/DiskSensorBallShooterModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/DiskSensorBallShooterModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/DiskSensorCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/DiskSensorCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/DiskSensorStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/DiskSensorStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskSensor/index.js +0 -0
- /package/dist/{hardware → types/hardware}/diskThrower/DiskThrowerCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskThrower/DiskThrowerCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/diskThrower/DiskThrowerStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskThrower/DiskThrowerStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/diskThrower/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/diskThrower/index.js +0 -0
- /package/dist/{hardware → types/hardware}/emergency/EmergencyActionCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/emergency/EmergencyActionCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/emergency/EmergencyModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/emergency/EmergencyModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/emergency/EmergencyStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/emergency/EmergencyStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/emergency/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/emergency/index.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagActionCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagActionCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagConfigurationOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagConfigurationOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagMediaName.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagMediaName.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagShowMediaOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagShowMediaOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/FlagStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/flag/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/flag/index.js +0 -0
- /package/dist/{hardware → types/hardware}/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/index.js +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBActionCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBActionCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBConfigurationOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBConfigurationOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBShowEffectOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBShowEffectOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/rgb/RGBStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/rgb/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/rgb/index.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenBattleViewConfig.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenBattleViewConfig.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenCountdownParams.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenCountdownParams.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenFinishViewInput.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenFinishViewInput.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenGameTimeLeft.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenGameTimeLeft.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenKartPosition.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenKartPosition.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenRaceLaps.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenRaceLaps.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenRaceViewConfig.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenRaceViewConfig.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenUpdateGameViewInput.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenUpdateGameViewInput.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenView.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenView.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenViewBaseConfig.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/ScreenViewBaseConfig.js +0 -0
- /package/dist/{hardware → types/hardware}/screen/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/screen/index.js +0 -0
- /package/dist/{hardware → types/hardware}/sound/PlaySoundOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/sound/PlaySoundOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/sound/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/sound/index.js +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedActionCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedActionCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedChangeOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedChangeOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedConfiguration.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedConfiguration.js +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/speed/SpeedStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/speed/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/speed/index.js +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserCommand.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserCommand.js +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserConfigureModuleOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserConfigureModuleOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserSendActionsOptions.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserSendActionsOptions.js +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/StarLaserStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/star-laser/index.js +0 -0
- /package/dist/{hardware → types/hardware}/steering-wheel/SteeringWheelModuleStatus.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/steering-wheel/SteeringWheelModuleStatus.js +0 -0
- /package/dist/{hardware → types/hardware}/steering-wheel/index.d.ts +0 -0
- /package/dist/{hardware → types/hardware}/steering-wheel/index.js +0 -0
- /package/dist/{kart → types/kart}/Kart.d.ts +0 -0
- /package/dist/{kart → types/kart}/Kart.js +0 -0
- /package/dist/{kart → types/kart}/KartShield.d.ts +0 -0
- /package/dist/{kart → types/kart}/KartShield.js +0 -0
- /package/dist/{kart → types/kart}/KartStatus.d.ts +0 -0
- /package/dist/{kart → types/kart}/KartStatus.js +0 -0
- /package/dist/{kart → types/kart}/index.d.ts +0 -0
- /package/dist/{kart → types/kart}/index.js +0 -0
- /package/dist/{kartTracking → types/kartTracking}/CheckpointEvent.d.ts +0 -0
- /package/dist/{kartTracking → types/kartTracking}/CheckpointEvent.js +0 -0
- /package/dist/{kartTracking → types/kartTracking}/KartTracking.d.ts +0 -0
- /package/dist/{kartTracking → types/kartTracking}/KartTracking.js +0 -0
- /package/dist/{kartTracking → types/kartTracking}/index.d.ts +0 -0
- /package/dist/{kartTracking → types/kartTracking}/index.js +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUp.d.ts +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUp.js +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpName.d.ts +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpName.js +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpShield.d.ts +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpShield.js +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpTarget.d.ts +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpTarget.js +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpType.d.ts +0 -0
- /package/dist/{powerUp → types/powerUp}/PowerUpType.js +0 -0
- /package/dist/{powerUp → types/powerUp}/index.d.ts +0 -0
- /package/dist/{powerUp → types/powerUp}/index.js +0 -0
- /package/dist/{response → types/response}/ErrorResponse.d.ts +0 -0
- /package/dist/{response → types/response}/ErrorResponse.js +0 -0
- /package/dist/{response → types/response}/Response.d.ts +0 -0
- /package/dist/{response → types/response}/Response.js +0 -0
- /package/dist/{response → types/response}/SuccesResponse.d.ts +0 -0
- /package/dist/{response → types/response}/SuccesResponse.js +0 -0
- /package/dist/{response → types/response}/index.d.ts +0 -0
- /package/dist/{response → types/response}/index.js +0 -0
- /package/dist/{socket/SocketHardwareModulesEventsParams.js → types/role/RoleDefinition.js} +0 -0
- /package/dist/{socket → types/socket}/SocketHardwareModulesEventsParams.d.ts +0 -0
- /package/dist/{socket/SocketHardwareOnDataEventsParams.js → types/socket/SocketHardwareModulesEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/SocketHardwareOnDataEventsParams.d.ts +0 -0
- /package/dist/{socket/SocketPowerUpEventsParams.js → types/socket/SocketHardwareOnDataEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/SocketPowerUpEventsParams.d.ts +0 -0
- /package/dist/{socket/clientToServer/SocketGameTrackClientToServerEventsParams.js → types/socket/SocketPowerUpEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/clientToServer/SocketGameTrackClientToServerEventsParams.d.ts +0 -0
- /package/dist/{socket/clientToServer/SocketKartClientToServerEventsParams.js → types/socket/clientToServer/SocketGameTrackClientToServerEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/clientToServer/SocketKartClientToServerEventsParams.d.ts +0 -0
- /package/dist/{socket/clientToServer/SocketWebAppClientToServerEventsParams.js → types/socket/clientToServer/SocketKartClientToServerEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/clientToServer/SocketWebAppClientToServerEventsParams.d.ts +0 -0
- /package/dist/{socket/inputs/MacAddressGameTrackConnection.js → types/socket/clientToServer/SocketWebAppClientToServerEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/clientToServer/index.d.ts +0 -0
- /package/dist/{socket → types/socket}/clientToServer/index.js +0 -0
- /package/dist/{socket → types/socket}/index.d.ts +0 -0
- /package/dist/{socket → types/socket}/index.js +0 -0
- /package/dist/{socket → types/socket}/inputs/MacAddressGameTrackConnection.d.ts +0 -0
- /package/dist/{socket/inputs/SocketInitRaspberryInput.js → types/socket/inputs/MacAddressGameTrackConnection.js} +0 -0
- /package/dist/{socket → types/socket}/inputs/SocketInitRaspberryInput.d.ts +0 -0
- /package/dist/{socket/inputs/SocketRegisterKartCheckpointInput.js → types/socket/inputs/SocketInitRaspberryInput.js} +0 -0
- /package/dist/{socket → types/socket}/inputs/SocketRegisterKartCheckpointInput.d.ts +0 -0
- /package/dist/{socket/serverToClient/SocketGameTrackServerToClientEventParams.js → types/socket/inputs/SocketRegisterKartCheckpointInput.js} +0 -0
- /package/dist/{socket → types/socket}/inputs/index.d.ts +0 -0
- /package/dist/{socket → types/socket}/inputs/index.js +0 -0
- /package/dist/{socket → types/socket}/serverToClient/SocketGameTrackServerToClientEventParams.d.ts +0 -0
- /package/dist/{socket/serverToClient/SocketKartServerToClientEventsParams.js → types/socket/serverToClient/SocketGameTrackServerToClientEventParams.js} +0 -0
- /package/dist/{socket → types/socket}/serverToClient/SocketKartServerToClientEventsParams.d.ts +0 -0
- /package/dist/{socket/serverToClient/SocketWebAppServerToClientEventsParams.js → types/socket/serverToClient/SocketKartServerToClientEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/serverToClient/SocketWebAppServerToClientEventsParams.d.ts +0 -0
- /package/dist/{socket/utils/SocketParamsToEvents.js → types/socket/serverToClient/SocketWebAppServerToClientEventsParams.js} +0 -0
- /package/dist/{socket → types/socket}/serverToClient/index.d.ts +0 -0
- /package/dist/{socket → types/socket}/serverToClient/index.js +0 -0
- /package/dist/{socket → types/socket}/utils/SocketParamsToEvents.d.ts +0 -0
- /package/dist/{sounds/SoundName.js → types/socket/utils/SocketParamsToEvents.js} +0 -0
- /package/dist/{socket → types/socket}/utils/index.d.ts +0 -0
- /package/dist/{socket → types/socket}/utils/index.js +0 -0
- /package/dist/{sounds → types/sounds}/SoundName.d.ts +0 -0
- /package/dist/{user/User.js → types/sounds/SoundName.js} +0 -0
- /package/dist/{sounds → types/sounds}/index.d.ts +0 -0
- /package/dist/{sounds → types/sounds}/index.js +0 -0
- /package/dist/{user/UserOrigin.js → types/user/User.js} +0 -0
- /package/dist/{user → types/user}/UserOrigin.d.ts +0 -0
- /package/dist/{utils/ArithmeticString.js → types/user/UserOrigin.js} +0 -0
- /package/dist/{user → types/user}/index.d.ts +0 -0
- /package/dist/{user → types/user}/index.js +0 -0
- /package/dist/{utils → types/utils}/ArithmeticString.d.ts +0 -0
- /package/dist/{utils/ObjectValues.js → types/utils/ArithmeticString.js} +0 -0
- /package/dist/{utils → types/utils}/ObjectValues.d.ts +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROLE_DEFINITIONS = void 0;
|
|
4
|
+
const Permission_1 = require("../types/role/Permission");
|
|
5
|
+
const UserRole_1 = require("../types/role/UserRole");
|
|
6
|
+
exports.ROLE_DEFINITIONS = [
|
|
7
|
+
{
|
|
8
|
+
role: UserRole_1.USER_ROLE.SUPER_ADMIN,
|
|
9
|
+
description: 'Complete access to all features and settings',
|
|
10
|
+
permissions: [
|
|
11
|
+
Permission_1.PERMISSIONS.FULL_ACCESS,
|
|
12
|
+
Permission_1.PERMISSIONS.KARTS_HARDWARE_TEST,
|
|
13
|
+
Permission_1.PERMISSIONS.KARTS_POWER_UP_TEST,
|
|
14
|
+
Permission_1.PERMISSIONS.GAME_TRACK_CONFIG_HARDWARE,
|
|
15
|
+
Permission_1.PERMISSIONS.GAME_TRACK_CONFIG_KARTS,
|
|
16
|
+
Permission_1.PERMISSIONS.GAME_TRACK_MANAGE_GAMES,
|
|
17
|
+
Permission_1.PERMISSIONS.KARTS_TRACKING,
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
role: UserRole_1.USER_ROLE.OPERATOR,
|
|
22
|
+
description: 'Game Track Operator',
|
|
23
|
+
permissions: [Permission_1.PERMISSIONS.GAME_TRACK_MANAGE_GAMES],
|
|
24
|
+
},
|
|
25
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RoleDefinitions';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./RoleDefinitions"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Webapp, Backend and Raspberry
|
|
4
|
-
*/
|
|
5
|
-
export * from './checkpoint';
|
|
6
|
-
export * from './color';
|
|
7
|
-
export * from './command';
|
|
8
|
-
export * from './damage';
|
|
9
|
-
export * from './flow';
|
|
10
|
-
export * from './game';
|
|
11
|
-
export * from './gameTrack';
|
|
12
|
-
export * from './hardware';
|
|
13
|
-
export * from './kart';
|
|
14
|
-
export * from './kartTracking';
|
|
15
|
-
export * from './powerUp';
|
|
16
|
-
export * from './response';
|
|
17
|
-
export * from './socket';
|
|
18
|
-
export * from './sounds';
|
|
19
|
-
export * from './user';
|
|
1
|
+
export * from './definitions';
|
|
2
|
+
export * from './types';
|
|
20
3
|
export * from './utils';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This types are shared wihin the 3 Repositories
|
|
4
|
-
* Webapp, Backend and Raspberry
|
|
5
|
-
*/
|
|
6
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
3
|
if (k2 === undefined) k2 = k;
|
|
8
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -18,19 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
15
|
};
|
|
20
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./command"), exports);
|
|
24
|
-
__exportStar(require("./damage"), exports);
|
|
25
|
-
__exportStar(require("./flow"), exports);
|
|
26
|
-
__exportStar(require("./game"), exports);
|
|
27
|
-
__exportStar(require("./gameTrack"), exports);
|
|
28
|
-
__exportStar(require("./hardware"), exports);
|
|
29
|
-
__exportStar(require("./kart"), exports);
|
|
30
|
-
__exportStar(require("./kartTracking"), exports);
|
|
31
|
-
__exportStar(require("./powerUp"), exports);
|
|
32
|
-
__exportStar(require("./response"), exports);
|
|
33
|
-
__exportStar(require("./socket"), exports);
|
|
34
|
-
__exportStar(require("./sounds"), exports);
|
|
35
|
-
__exportStar(require("./user"), exports);
|
|
17
|
+
__exportStar(require("./definitions"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
36
19
|
__exportStar(require("./utils"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KartEffect } from '../hardware';
|
|
1
|
+
import type { FlagMediaName, KartEffect } from '../hardware';
|
|
2
2
|
import type { SoundName } from '../sounds';
|
|
3
3
|
import type { DamageEffectName } from './DamageName';
|
|
4
4
|
import type { DamageTarget } from './DamageTarget';
|
|
@@ -11,4 +11,5 @@ export interface Damage {
|
|
|
11
11
|
rgbEffect: KartEffect;
|
|
12
12
|
/** Quantity of damage will affect the Kart */
|
|
13
13
|
amount: number;
|
|
14
|
+
flagMediaName: FlagMediaName;
|
|
14
15
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This types are shared wihin the 3 Repositories
|
|
3
|
+
* Webapp, Backend and Raspberry
|
|
4
|
+
*/
|
|
5
|
+
export * from './checkpoint';
|
|
6
|
+
export * from './color';
|
|
7
|
+
export * from './command';
|
|
8
|
+
export * from './damage';
|
|
9
|
+
export * from './flow';
|
|
10
|
+
export * from './game';
|
|
11
|
+
export * from './gameTrack';
|
|
12
|
+
export * from './hardware';
|
|
13
|
+
export * from './kart';
|
|
14
|
+
export * from './kartTracking';
|
|
15
|
+
export * from './powerUp';
|
|
16
|
+
export * from './response';
|
|
17
|
+
export * from './role';
|
|
18
|
+
export * from './socket';
|
|
19
|
+
export * from './sounds';
|
|
20
|
+
export * from './user';
|
|
21
|
+
export * from './utils';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This types are shared wihin the 3 Repositories
|
|
4
|
+
* Webapp, Backend and Raspberry
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./checkpoint"), exports);
|
|
22
|
+
__exportStar(require("./color"), exports);
|
|
23
|
+
__exportStar(require("./command"), exports);
|
|
24
|
+
__exportStar(require("./damage"), exports);
|
|
25
|
+
__exportStar(require("./flow"), exports);
|
|
26
|
+
__exportStar(require("./game"), exports);
|
|
27
|
+
__exportStar(require("./gameTrack"), exports);
|
|
28
|
+
__exportStar(require("./hardware"), exports);
|
|
29
|
+
__exportStar(require("./kart"), exports);
|
|
30
|
+
__exportStar(require("./kartTracking"), exports);
|
|
31
|
+
__exportStar(require("./powerUp"), exports);
|
|
32
|
+
__exportStar(require("./response"), exports);
|
|
33
|
+
__exportStar(require("./role"), exports);
|
|
34
|
+
__exportStar(require("./socket"), exports);
|
|
35
|
+
__exportStar(require("./sounds"), exports);
|
|
36
|
+
__exportStar(require("./user"), exports);
|
|
37
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ObjectValues } from '../utils';
|
|
2
|
+
export declare const PERMISSIONS: {
|
|
3
|
+
readonly FULL_ACCESS: "FULL_ACCESS";
|
|
4
|
+
readonly KARTS_HARDWARE_TEST: "MANAGE_KARTS";
|
|
5
|
+
readonly KARTS_POWER_UP_TEST: "MANAGE_POWER_UPS";
|
|
6
|
+
readonly GAME_TRACK_MANAGE_GAMES: "MANAGE_GAMES";
|
|
7
|
+
readonly GAME_TRACK_CONFIG_KARTS: "CONFIG_KARTS";
|
|
8
|
+
readonly GAME_TRACK_CONFIG_HARDWARE: "CONFIG_HARDWARE";
|
|
9
|
+
readonly KARTS_TRACKING: "KARTS_TRACKING";
|
|
10
|
+
};
|
|
11
|
+
export type Permission = ObjectValues<typeof PERMISSIONS>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PERMISSIONS = void 0;
|
|
4
|
+
exports.PERMISSIONS = {
|
|
5
|
+
FULL_ACCESS: 'FULL_ACCESS',
|
|
6
|
+
KARTS_HARDWARE_TEST: 'MANAGE_KARTS',
|
|
7
|
+
KARTS_POWER_UP_TEST: 'MANAGE_POWER_UPS',
|
|
8
|
+
GAME_TRACK_MANAGE_GAMES: 'MANAGE_GAMES',
|
|
9
|
+
GAME_TRACK_CONFIG_KARTS: 'CONFIG_KARTS',
|
|
10
|
+
GAME_TRACK_CONFIG_HARDWARE: 'CONFIG_HARDWARE',
|
|
11
|
+
KARTS_TRACKING: 'KARTS_TRACKING',
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Permission"), exports);
|
|
18
|
+
__exportStar(require("./RoleDefinition"), exports);
|
|
19
|
+
__exportStar(require("./UserRole"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ObjectValues"), exports);
|
|
18
|
+
__exportStar(require("./ArithmeticString"), exports);
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './ArithmeticString';
|
|
1
|
+
export * from './roles.utils';
|
package/dist/utils/index.js
CHANGED
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./ArithmeticString"), exports);
|
|
17
|
+
__exportStar(require("./roles.utils"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Permission, UserRole } from '../types';
|
|
2
|
+
export declare function hasPermission(userRole: UserRole, requiredPermission: Permission): boolean;
|
|
3
|
+
export declare function hasAnyPermission(userRole: UserRole, requiredPermissions: Permission[]): boolean;
|
|
4
|
+
export declare function hasAllPermissions(userRole: UserRole, requiredPermissions: Permission[]): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasPermission = hasPermission;
|
|
4
|
+
exports.hasAnyPermission = hasAnyPermission;
|
|
5
|
+
exports.hasAllPermissions = hasAllPermissions;
|
|
6
|
+
const definitions_1 = require("../definitions");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
function hasPermission(userRole, requiredPermission) {
|
|
9
|
+
if (userRole === types_1.USER_ROLE.SUPER_ADMIN) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
const roleDefinition = definitions_1.ROLE_DEFINITIONS.find((def) => def.role === userRole);
|
|
13
|
+
return roleDefinition ? roleDefinition.permissions.includes(requiredPermission) : false;
|
|
14
|
+
}
|
|
15
|
+
function hasAnyPermission(userRole, requiredPermissions) {
|
|
16
|
+
return requiredPermissions.some((perm) => hasPermission(userRole, perm));
|
|
17
|
+
}
|
|
18
|
+
function hasAllPermissions(userRole, requiredPermissions) {
|
|
19
|
+
return requiredPermissions.every((perm) => hasPermission(userRole, perm));
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@battle-racing/br-common-lib",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Common library for all Battle Racing Repositorios",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc"
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"release": "npm run build && npm publish"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"Battle",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PERMISSIONS } from '../types/role/Permission';
|
|
2
|
+
import type { RoleDefinition } from '../types/role/RoleDefinition';
|
|
3
|
+
import { USER_ROLE } from '../types/role/UserRole';
|
|
4
|
+
|
|
5
|
+
export const ROLE_DEFINITIONS: RoleDefinition[] = [
|
|
6
|
+
{
|
|
7
|
+
role: USER_ROLE.SUPER_ADMIN,
|
|
8
|
+
description: 'Complete access to all features and settings',
|
|
9
|
+
permissions: [
|
|
10
|
+
PERMISSIONS.FULL_ACCESS,
|
|
11
|
+
PERMISSIONS.KARTS_HARDWARE_TEST,
|
|
12
|
+
PERMISSIONS.KARTS_POWER_UP_TEST,
|
|
13
|
+
PERMISSIONS.GAME_TRACK_CONFIG_HARDWARE,
|
|
14
|
+
PERMISSIONS.GAME_TRACK_CONFIG_KARTS,
|
|
15
|
+
PERMISSIONS.GAME_TRACK_MANAGE_GAMES,
|
|
16
|
+
PERMISSIONS.KARTS_TRACKING,
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
role: USER_ROLE.OPERATOR,
|
|
21
|
+
description: 'Game Track Operator',
|
|
22
|
+
permissions: [PERMISSIONS.GAME_TRACK_MANAGE_GAMES],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RoleDefinitions';
|
package/src/index.ts
ADDED
package/src/types/index.ts
CHANGED
|
@@ -15,7 +15,9 @@ export * from './kart';
|
|
|
15
15
|
export * from './kartTracking';
|
|
16
16
|
export * from './powerUp';
|
|
17
17
|
export * from './response';
|
|
18
|
+
export * from './role';
|
|
18
19
|
export * from './socket';
|
|
19
20
|
export * from './sounds';
|
|
20
21
|
export * from './user';
|
|
21
22
|
export * from './utils';
|
|
23
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ObjectValues } from '../utils';
|
|
2
|
+
|
|
3
|
+
export const PERMISSIONS = {
|
|
4
|
+
FULL_ACCESS: 'FULL_ACCESS',
|
|
5
|
+
|
|
6
|
+
KARTS_HARDWARE_TEST: 'MANAGE_KARTS',
|
|
7
|
+
KARTS_POWER_UP_TEST: 'MANAGE_POWER_UPS',
|
|
8
|
+
|
|
9
|
+
GAME_TRACK_MANAGE_GAMES: 'MANAGE_GAMES',
|
|
10
|
+
GAME_TRACK_CONFIG_KARTS: 'CONFIG_KARTS',
|
|
11
|
+
GAME_TRACK_CONFIG_HARDWARE: 'CONFIG_HARDWARE',
|
|
12
|
+
|
|
13
|
+
KARTS_TRACKING: 'KARTS_TRACKING',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type Permission = ObjectValues<typeof PERMISSIONS>;
|
package/src/types/user/User.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './roles.utils';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ROLE_DEFINITIONS } from '../definitions';
|
|
2
|
+
import { Permission, USER_ROLE, UserRole } from '../types';
|
|
3
|
+
|
|
4
|
+
export function hasPermission(userRole: UserRole, requiredPermission: Permission): boolean {
|
|
5
|
+
if (userRole === USER_ROLE.SUPER_ADMIN) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const roleDefinition = ROLE_DEFINITIONS.find((def) => def.role === userRole);
|
|
10
|
+
|
|
11
|
+
return roleDefinition ? roleDefinition.permissions.includes(requiredPermission) : false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function hasAnyPermission(userRole: UserRole, requiredPermissions: Permission[]): boolean {
|
|
15
|
+
return requiredPermissions.some((perm) => hasPermission(userRole, perm));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function hasAllPermissions(userRole: UserRole, requiredPermissions: Permission[]): boolean {
|
|
19
|
+
return requiredPermissions.every((perm) => hasPermission(userRole, perm));
|
|
20
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|