From d3c2a60fa4331b41bd492373dab88f9aaa77fb3a Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 25 Nov 2024 12:01:09 +0000 Subject: [PATCH] [core] Reorganizing project packages (#320) --- composer.json | 8 +- src/Commands/Install.php | 134 +++++++++--------- src/DI/VirtualThermostatExtension.php | 10 +- src/Documents/Channels/Actors.php | 6 +- src/Documents/Channels/Configuration.php | 6 +- src/Documents/Channels/Preset.php | 6 +- src/Documents/Channels/Sensors.php | 6 +- src/Documents/Channels/State.php | 6 +- src/Documents/Devices/Device.php | 6 +- src/Drivers/Thermostat.php | 81 ++++++----- src/Entities/Channels/Actors.php | 2 +- src/Entities/Channels/Configuration.php | 20 +-- src/Entities/Channels/Preset.php | 12 +- src/Entities/Channels/Sensors.php | 2 +- src/Entities/Channels/State.php | 2 +- src/Entities/Devices/Device.php | 38 ++--- src/Helpers/Device.php | 36 ++--- src/Hydrators/Channels/Actors.php | 4 +- src/Hydrators/Channels/Configuration.php | 4 +- src/Hydrators/Channels/Preset.php | 4 +- src/Hydrators/Channels/Sensors.php | 4 +- src/Hydrators/Channels/State.php | 4 +- tests/cases/unit/BaseTestCase.php | 4 +- .../DI/VirtualThermostatExtensionTest.php | 2 +- tests/cases/unit/DbTestCase.php | 4 +- tests/cases/unit/Drivers/ThermostatTest.php | 5 +- tests/common.neon | 6 +- tests/fixtures/dummy/DummyChannelDocument.php | 6 +- tests/fixtures/dummy/DummyChannelEntity.php | 2 +- .../fixtures/dummy/DummyConnectorDocument.php | 6 +- tests/fixtures/dummy/DummyConnectorEntity.php | 2 +- tests/fixtures/dummy/DummyDeviceDocument.php | 6 +- tests/fixtures/dummy/DummyDeviceEntity.php | 2 +- 33 files changed, 226 insertions(+), 220 deletions(-) diff --git a/composer.json b/composer.json index c07ae83..d3007b4 100644 --- a/composer.json +++ b/composer.json @@ -38,15 +38,15 @@ "contributte/translation": "^2.0", "cweagans/composer-patches": "^1.7", "doctrine/orm": "2.15.*", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/devices-module": "dev-main", "fastybird/metadata-library": "dev-main", - "fastybird/tools-library": "dev-main", + "fastybird/tools": "dev-main", "fastybird/virtual-connector": "dev-main", "ipub/doctrine-crud": "^5.0", - "nette/di": "^3.0", + "nette/di": "^3.2", "psr/log": "^3.0", - "ramsey/uuid": "^4.5", + "ramsey/uuid": "^4.7", "react/async": "^4.0", "react/event-loop": "^1.3", "react/promise": "^3", diff --git a/src/Commands/Install.php b/src/Commands/Install.php index fe0cb0d..b6aeea6 100644 --- a/src/Commands/Install.php +++ b/src/Commands/Install.php @@ -26,13 +26,12 @@ use FastyBird\Connector\Virtual\Exceptions as VirtualExceptions; use FastyBird\Connector\Virtual\Queries as VirtualQueries; use FastyBird\Connector\Virtual\Types as VirtualTypes; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; -use FastyBird\Library\Metadata\Formats as MetadataFormats; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Formats as ToolsFormats; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; -use FastyBird\Library\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; @@ -98,7 +97,7 @@ public function __construct( private readonly DevicesModels\Entities\Channels\Properties\PropertiesManager $channelsPropertiesManager, private readonly DevicesModels\Configuration\Channels\Properties\Repository $channelsPropertiesConfigurationRepository, private readonly DevicesModels\States\ChannelPropertiesManager $channelPropertiesStatesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, string|null $name = null, ) @@ -117,6 +116,7 @@ protected function configure(): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws Console\Exception\ExceptionInterface * @throws Console\Exception\InvalidArgumentException @@ -127,8 +127,6 @@ protected function configure(): void * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError @@ -148,12 +146,11 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $ } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exception - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError @@ -974,7 +971,7 @@ private function createDevice(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -1038,14 +1035,13 @@ private function createDevice(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exception * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError @@ -1569,7 +1565,7 @@ private function editDevice(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -1635,8 +1631,8 @@ private function editDevice(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteDevice(Style\SymfonyStyle $io): void { @@ -1689,7 +1685,7 @@ private function deleteDevice(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'initialize-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -1704,7 +1700,10 @@ private function deleteDevice(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping * @throws Console\Exception\ExceptionInterface * @throws DBAL\Exception * @throws DevicesExceptions\InvalidArgument @@ -1713,10 +1712,6 @@ private function deleteDevice(Style\SymfonyStyle $io): void * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError @@ -1739,7 +1734,7 @@ private function manageDevice(Style\SymfonyStyle $io): void /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -1796,12 +1791,12 @@ private function listDevices(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exception * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -1877,7 +1872,7 @@ private function createActor(Style\SymfonyStyle $io, Entities\Devices\Device $de [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -1894,12 +1889,12 @@ private function createActor(Style\SymfonyStyle $io, Entities\Devices\Device $de } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exception * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -1970,7 +1965,7 @@ private function editActor(Style\SymfonyStyle $io, Entities\Devices\Device $devi [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -2047,8 +2042,8 @@ private function listActors(Style\SymfonyStyle $io, Entities\Devices\Device $dev } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteActor(Style\SymfonyStyle $io, Entities\Devices\Device $device): void { @@ -2101,7 +2096,7 @@ private function deleteActor(Style\SymfonyStyle $io, Entities\Devices\Device $de [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -2248,7 +2243,7 @@ private function createSensor(Style\SymfonyStyle $io, Entities\Devices\Device $d [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -2408,7 +2403,7 @@ private function editSensor(Style\SymfonyStyle $io, Entities\Devices\Device $dev [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -2507,8 +2502,8 @@ private function listSensors(Style\SymfonyStyle $io, Entities\Devices\Device $de } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteSensor(Style\SymfonyStyle $io, Entities\Devices\Device $device): void { @@ -2561,7 +2556,7 @@ private function deleteSensor(Style\SymfonyStyle $io, Entities\Devices\Device $d [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -2576,16 +2571,16 @@ private function deleteSensor(Style\SymfonyStyle $io, Entities\Devices\Device $d } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -2656,7 +2651,7 @@ private function editPreset(Style\SymfonyStyle $io, Entities\Devices\Device $dev $targetTemp = $this->askTargetTemperature( $io, $preset, - Types\Unit::from(MetadataUtilities\Value::toString($unitProperty->getValue(), true)), + Types\Unit::from(ToolsUtilities\Value::toString($unitProperty->getValue(), true)), $device, ); @@ -2666,14 +2661,14 @@ private function editPreset(Style\SymfonyStyle $io, Entities\Devices\Device $dev $heatingThresholdTemp = $this->askHeatingThresholdTemperature( $io, $preset, - Types\Unit::from(MetadataUtilities\Value::toString($unitProperty->getValue(), true)), + Types\Unit::from(ToolsUtilities\Value::toString($unitProperty->getValue(), true)), $device, ); $coolingThresholdTemp = $this->askCoolingThresholdTemperature( $io, $preset, - Types\Unit::from(MetadataUtilities\Value::toString($unitProperty->getValue(), true)), + Types\Unit::from(ToolsUtilities\Value::toString($unitProperty->getValue(), true)), $device, ); } @@ -2763,7 +2758,7 @@ private function editPreset(Style\SymfonyStyle $io, Entities\Devices\Device $dev [ 'source' => MetadataTypes\Sources\Addon::VIRTUAL_THERMOSTAT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -2812,7 +2807,7 @@ private function askDeviceName(Style\SymfonyStyle $io, Entities\Devices\Device|n * @return array * * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -2825,14 +2820,14 @@ private function askThermostatModes( $property !== null && ( $property->getIdentifier() !== Types\ChannelPropertyIdentifier::HVAC_MODE->value - || !$property->getFormat() instanceof MetadataFormats\StringEnum + || !$property->getFormat() instanceof ToolsFormats\StringEnum ) ) { throw new Exceptions\InvalidArgument('Provided property is not valid'); } $format = $property?->getFormat(); - assert($format === null || $format instanceof MetadataFormats\StringEnum); + assert($format === null || $format instanceof ToolsFormats\StringEnum); $default = array_filter( array_unique(array_map(static fn ($item): int|null => match ($item) { @@ -2935,8 +2930,8 @@ private function askThermostatModes( /** * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -2949,7 +2944,7 @@ private function askThermostatUnits( $property !== null && ( $property->getIdentifier() !== Types\ChannelPropertyIdentifier::UNIT->value - || !$property->getFormat() instanceof MetadataFormats\StringEnum + || !$property->getFormat() instanceof ToolsFormats\StringEnum ) ) { throw new Exceptions\InvalidArgument('Provided property is not valid'); @@ -3029,7 +3024,7 @@ private function askThermostatUnits( * @return array * * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -3042,14 +3037,14 @@ private function askPresets( $property !== null && ( $property->getIdentifier() !== Types\ChannelPropertyIdentifier::PRESET_MODE->value - || !$property->getFormat() instanceof MetadataFormats\StringEnum + || !$property->getFormat() instanceof ToolsFormats\StringEnum ) ) { throw new Exceptions\InvalidArgument('Provided property is not valid'); } $format = $property?->getFormat(); - assert($format === null || $format instanceof MetadataFormats\StringEnum); + assert($format === null || $format instanceof ToolsFormats\StringEnum); $default = array_filter( array_unique(array_map(static fn ($item): int|null => match ($item) { @@ -3203,7 +3198,7 @@ private function askPresets( /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -3455,13 +3450,14 @@ private function askSensor( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -3540,8 +3536,8 @@ private function askTargetTemperature( /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -3592,8 +3588,8 @@ private function askMaxFloorTemperature( /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -3645,8 +3641,8 @@ private function askHeatingThresholdTemperature( /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -4181,6 +4177,7 @@ function (string|null $answer) use ($properties): DevicesEntities\Channels\Prope } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws Console\Exception\ExceptionInterface * @throws DBAL\Exception @@ -4190,8 +4187,6 @@ function (string|null $answer) use ($properties): DevicesEntities\Channels\Prope * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError @@ -4281,7 +4276,10 @@ private function askInstallAction(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping * @throws Console\Exception\InvalidArgumentException * @throws Console\Exception\ExceptionInterface * @throws DBAL\Exception @@ -4291,10 +4289,6 @@ private function askInstallAction(Style\SymfonyStyle $io): void * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError @@ -4624,7 +4618,7 @@ function (string|int|null $answer) use ($devices): Entities\Devices\Device { /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -4709,8 +4703,8 @@ function (string|int|null $answer) use ($presets): Types\Preset { } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function askWhichActor( Style\SymfonyStyle $io, @@ -4822,8 +4816,8 @@ function (string|int|null $answer) use ($channel, $actors): DevicesEntities\Chan } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function askWhichSensor( Style\SymfonyStyle $io, @@ -4968,9 +4962,9 @@ private function createOrUpdateProperty( } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function findChannelPropertyIdentifier( DevicesEntities\Channels\Channel $channel, diff --git a/src/DI/VirtualThermostatExtension.php b/src/DI/VirtualThermostatExtension.php index df0f27d..aea280b 100644 --- a/src/DI/VirtualThermostatExtension.php +++ b/src/DI/VirtualThermostatExtension.php @@ -23,9 +23,9 @@ use FastyBird\Addon\VirtualThermostat\Helpers; use FastyBird\Addon\VirtualThermostat\Hydrators; use FastyBird\Addon\VirtualThermostat\Schemas; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Metadata; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Boot as ApplicationBoot; +use FastyBird\Core\Application\DI as ApplicationDI; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use Nette\Bootstrap; use Nette\DI; use Nettrine\ORM as NettrineORM; @@ -218,7 +218,7 @@ public function beforeCompile(): void * APPLICATION DOCUMENTS */ - $services = $builder->findByTag(Metadata\DI\MetadataExtension::DRIVER_TAG); + $services = $builder->findByTag(ApplicationDI\ApplicationExtension::DRIVER_TAG); if ($services !== []) { $services = array_keys($services); @@ -233,7 +233,7 @@ public function beforeCompile(): void ); $documentAttributeDriverChainService = $builder->getDefinitionByType( - MetadataDocuments\Mapping\Driver\MappingDriverChain::class, + ApplicationDocuments\Mapping\Driver\MappingDriverChain::class, ); if ($documentAttributeDriverChainService instanceof DI\Definitions\ServiceDefinition) { diff --git a/src/Documents/Channels/Actors.php b/src/Documents/Channels/Actors.php index 8941073..7f2ffef 100644 --- a/src/Documents/Channels/Actors.php +++ b/src/Documents/Channels/Actors.php @@ -17,10 +17,10 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Documents as VirtualDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Actors::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Actors::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Actors::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Actors::TYPE)] class Actors extends VirtualDocuments\Channels\Channel { diff --git a/src/Documents/Channels/Configuration.php b/src/Documents/Channels/Configuration.php index a3847de..9d5f411 100644 --- a/src/Documents/Channels/Configuration.php +++ b/src/Documents/Channels/Configuration.php @@ -17,10 +17,10 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Documents as VirtualDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Configuration::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Configuration::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Configuration::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Configuration::TYPE)] class Configuration extends VirtualDocuments\Channels\Channel { diff --git a/src/Documents/Channels/Preset.php b/src/Documents/Channels/Preset.php index 4c6174e..ab3b035 100644 --- a/src/Documents/Channels/Preset.php +++ b/src/Documents/Channels/Preset.php @@ -17,10 +17,10 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Documents as VirtualDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Preset::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Preset::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Preset::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Preset::TYPE)] class Preset extends VirtualDocuments\Channels\Channel { diff --git a/src/Documents/Channels/Sensors.php b/src/Documents/Channels/Sensors.php index 6230376..bd4827c 100644 --- a/src/Documents/Channels/Sensors.php +++ b/src/Documents/Channels/Sensors.php @@ -17,10 +17,10 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Documents as VirtualDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Sensors::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Sensors::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Sensors::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Sensors::TYPE)] class Sensors extends VirtualDocuments\Channels\Channel { diff --git a/src/Documents/Channels/State.php b/src/Documents/Channels/State.php index 56d64e3..b6758dd 100644 --- a/src/Documents/Channels/State.php +++ b/src/Documents/Channels/State.php @@ -17,10 +17,10 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Documents as VirtualDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\State::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\State::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\State::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\State::TYPE)] class State extends VirtualDocuments\Channels\Channel { diff --git a/src/Documents/Devices/Device.php b/src/Documents/Devices/Device.php index e0e57b3..e941d48 100644 --- a/src/Documents/Devices/Device.php +++ b/src/Documents/Devices/Device.php @@ -17,10 +17,10 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Documents as VirtualDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Devices\Device::class)] -#[DOC\DiscriminatorEntry(name: Entities\Devices\Device::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Devices\Device::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Devices\Device::TYPE)] class Device extends VirtualDocuments\Devices\Device { diff --git a/src/Drivers/Thermostat.php b/src/Drivers/Thermostat.php index c5144f2..d5ec6a6 100644 --- a/src/Drivers/Thermostat.php +++ b/src/Drivers/Thermostat.php @@ -26,11 +26,11 @@ use FastyBird\Connector\Virtual\Helpers as VirtualHelpers; use FastyBird\Connector\Virtual\Queries as VirtualQueries; use FastyBird\Connector\Virtual\Queue as VirtualQueue; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\DateTimeFactory; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; -use FastyBird\Library\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -124,15 +124,16 @@ public function __construct( /** * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError * @throws VirtualExceptions\Runtime @@ -268,7 +269,7 @@ public function connect(): Promise\PromiseInterface $this->targetTemperature[$mode->value] = floatval($state->getGet()->getActualValue()); } else { $this->targetTemperature[$mode->value] = floatval( - MetadataUtilities\Value::flattenValue( + ToolsUtilities\Value::flattenValue( $property->getDefault() ?? VirtualThermostat\Entities\Devices\Device::TARGET_TEMPERATURE, ), ); @@ -282,7 +283,7 @@ public function connect(): Promise\PromiseInterface 'channel' => $property->getChannel(), 'property' => $property->getId(), 'value' => floatval( - MetadataUtilities\Value::flattenValue( + ToolsUtilities\Value::flattenValue( $property->getDefault() ?? VirtualThermostat\Entities\Devices\Device::TARGET_TEMPERATURE, ), ), @@ -311,15 +312,15 @@ public function connect(): Promise\PromiseInterface if ( $state instanceof DevicesDocuments\States\Channels\Properties\Property && Types\Preset::tryFrom( - MetadataUtilities\Value::toString($state->getGet()->getActualValue()) ?? '', + ToolsUtilities\Value::toString($state->getGet()->getActualValue()) ?? '', ) !== null ) { $this->presetMode = Types\Preset::from( - MetadataUtilities\Value::toString($state->getGet()->getActualValue(), true), + ToolsUtilities\Value::toString($state->getGet()->getActualValue(), true), ); } else { $this->presetMode = Types\Preset::from( - MetadataUtilities\Value::toString($property->getDefault() ?? Types\Preset::MANUAL->value, true), + ToolsUtilities\Value::toString($property->getDefault() ?? Types\Preset::MANUAL->value, true), ); $this->queue->append( @@ -330,7 +331,7 @@ public function connect(): Promise\PromiseInterface 'device' => $this->device->getId(), 'channel' => $property->getChannel(), 'property' => $property->getId(), - 'value' => MetadataUtilities\Value::toString( + 'value' => ToolsUtilities\Value::toString( $property->getDefault() ?? Types\Preset::MANUAL->value, true, ), @@ -358,15 +359,15 @@ public function connect(): Promise\PromiseInterface if ( $state instanceof DevicesDocuments\States\Channels\Properties\Property && Types\HvacMode::tryFrom( - MetadataUtilities\Value::toString($state->getGet()->getActualValue()) ?? '', + ToolsUtilities\Value::toString($state->getGet()->getActualValue()) ?? '', ) !== null ) { $this->hvacMode = Types\HvacMode::from( - MetadataUtilities\Value::toString($state->getGet()->getActualValue(), true), + ToolsUtilities\Value::toString($state->getGet()->getActualValue(), true), ); } else { $this->hvacMode = Types\HvacMode::from( - MetadataUtilities\Value::toString($property->getDefault() ?? Types\HvacMode::OFF->value, true), + ToolsUtilities\Value::toString($property->getDefault() ?? Types\HvacMode::OFF->value, true), ); $this->queue->append( @@ -377,7 +378,7 @@ public function connect(): Promise\PromiseInterface 'device' => $this->device->getId(), 'channel' => $property->getChannel(), 'property' => $property->getId(), - 'value' => MetadataUtilities\Value::toString( + 'value' => ToolsUtilities\Value::toString( $property->getDefault() ?? Types\HvacMode::OFF->value, true, ), @@ -403,12 +404,14 @@ public function connect(): Promise\PromiseInterface /** * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -443,12 +446,14 @@ public function getLastConnectAttempt(): DateTimeInterface|null /** * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -685,12 +690,14 @@ public function process(): Promise\PromiseInterface /** * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -844,12 +851,14 @@ public function writeState( /** * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1074,12 +1083,14 @@ public function notifyState( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1120,12 +1131,14 @@ private function setActorState(bool $heaters, bool $coolers): void } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1236,8 +1249,8 @@ private function isCooling(): bool * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1287,12 +1300,14 @@ private function isOpeningsClosed(): bool } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws VirtualExceptions\Runtime + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/Entities/Channels/Actors.php b/src/Entities/Channels/Actors.php index 910502d..c5d9270 100644 --- a/src/Entities/Channels/Actors.php +++ b/src/Entities/Channels/Actors.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Mapping as ORM; use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Entities as VirtualEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use Ramsey\Uuid; diff --git a/src/Entities/Channels/Configuration.php b/src/Entities/Channels/Configuration.php index e74250a..32b0988 100644 --- a/src/Entities/Channels/Configuration.php +++ b/src/Entities/Channels/Configuration.php @@ -19,8 +19,8 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Addon\VirtualThermostat\Types; use FastyBird\Connector\Virtual\Entities as VirtualEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use Ramsey\Uuid; @@ -67,8 +67,8 @@ public function getDevice(): Entities\Devices\Device /** * Maximum allowed temperature measured with floor sensor * - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -94,8 +94,8 @@ public function getMaximumFloorTemp(): float /** * Set a minimum amount of time that the actor will be turned on or off * - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -122,8 +122,8 @@ public function getMinimumCycleDuration(): float|null * Minimum temperature value to be cooler actor turned on (hysteresis low value) * For example, if the target temperature is 25 and the tolerance is 0.5 the heater will start when the sensor equals or goes below 24.5 * - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -150,8 +150,8 @@ public function getLowTargetTempTolerance(): float * Maximum temperature value to be cooler actor turned on (hysteresis high value) * For example, if the target temperature is 25 and the tolerance is 0.5 the heater will stop when the sensor equals or goes above 25.5 * - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/Entities/Channels/Preset.php b/src/Entities/Channels/Preset.php index cdac69e..aadad1e 100644 --- a/src/Entities/Channels/Preset.php +++ b/src/Entities/Channels/Preset.php @@ -19,8 +19,8 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Addon\VirtualThermostat\Types; use FastyBird\Connector\Virtual\Entities as VirtualEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use Ramsey\Uuid; @@ -81,8 +81,8 @@ public function getTargetTemp(): DevicesEntities\Channels\Properties\Dynamic|nul } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -106,8 +106,8 @@ public function getCoolingThresholdTemp(): float|null } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/Entities/Channels/Sensors.php b/src/Entities/Channels/Sensors.php index eff2384..b9e792a 100644 --- a/src/Entities/Channels/Sensors.php +++ b/src/Entities/Channels/Sensors.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Mapping as ORM; use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Connector\Virtual\Entities as VirtualEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use Ramsey\Uuid; diff --git a/src/Entities/Channels/State.php b/src/Entities/Channels/State.php index eabb602..f1752c8 100644 --- a/src/Entities/Channels/State.php +++ b/src/Entities/Channels/State.php @@ -19,7 +19,7 @@ use FastyBird\Addon\VirtualThermostat\Entities; use FastyBird\Addon\VirtualThermostat\Types; use FastyBird\Connector\Virtual\Entities as VirtualEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use Ramsey\Uuid; diff --git a/src/Entities/Devices/Device.php b/src/Entities/Devices/Device.php index da41d2d..7c6565f 100644 --- a/src/Entities/Devices/Device.php +++ b/src/Entities/Devices/Device.php @@ -20,9 +20,9 @@ use FastyBird\Addon\VirtualThermostat\Exceptions; use FastyBird\Addon\VirtualThermostat\Types; use FastyBird\Connector\Virtual\Entities as VirtualEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; -use FastyBird\Library\Metadata\Formats as MetadataFormats; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Formats as ToolsFormats; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use Ramsey\Uuid; @@ -196,8 +196,8 @@ public function getTargetTemp(Types\Preset $preset): DevicesEntities\Channels\Pr /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -236,8 +236,8 @@ public function getCoolingThresholdTemp(Types\Preset $preset): float|null /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -276,8 +276,8 @@ public function getHeatingThresholdTemp(Types\Preset $preset): float|null /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -288,8 +288,8 @@ public function getMaximumFloorTemp(): float /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -300,8 +300,8 @@ public function getMinimumCycleDuration(): float|null /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -312,8 +312,8 @@ public function getLowTargetTempTolerance(): float|null /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -461,8 +461,8 @@ public function hasRoomHumiditySensors(): bool /** * @return array * + * @throws ToolsExceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -472,7 +472,7 @@ public function getHvacModes(): array $format = $channel->getHvacMode()?->getFormat(); - if (!$format instanceof MetadataFormats\StringEnum) { + if (!$format instanceof ToolsFormats\StringEnum) { return []; } @@ -485,8 +485,8 @@ public function getHvacModes(): array /** * @return array * + * @throws ToolsExceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -496,7 +496,7 @@ public function getPresetModes(): array $format = $channel->getPresetMode()?->getFormat(); - if (!$format instanceof MetadataFormats\StringEnum) { + if (!$format instanceof ToolsFormats\StringEnum) { return []; } diff --git a/src/Helpers/Device.php b/src/Helpers/Device.php index 7a694b7..e747d42 100644 --- a/src/Helpers/Device.php +++ b/src/Helpers/Device.php @@ -20,8 +20,8 @@ use FastyBird\Addon\VirtualThermostat\Exceptions; use FastyBird\Addon\VirtualThermostat\Queries; use FastyBird\Addon\VirtualThermostat\Types; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; -use FastyBird\Library\Metadata\Formats as MetadataFormats; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Formats as ToolsFormats; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -216,8 +216,8 @@ public function getTargetTemp( * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -271,8 +271,8 @@ public function getCoolingThresholdTemp( * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -326,8 +326,8 @@ public function getHeatingThresholdTemp( * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -358,8 +358,8 @@ public function getMaximumFloorTemp(DevicesDocuments\Devices\Device $device): fl * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -393,8 +393,8 @@ public function getMinimumCycleDuration(DevicesDocuments\Devices\Device $device) * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -428,8 +428,8 @@ public function getLowTargetTempTolerance(DevicesDocuments\Devices\Device $devic * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -650,7 +650,7 @@ public function hasRoomHumiditySensors(DevicesDocuments\Devices\Device $device): * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -658,7 +658,7 @@ public function getHvacModes(DevicesDocuments\Devices\Device $device): array { $format = $this->getHvacMode($device)?->getFormat(); - if (!$format instanceof MetadataFormats\StringEnum) { + if (!$format instanceof ToolsFormats\StringEnum) { return []; } @@ -674,7 +674,7 @@ public function getHvacModes(DevicesDocuments\Devices\Device $device): array * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -682,7 +682,7 @@ public function getPresetModes(DevicesDocuments\Devices\Device $device): array { $format = $this->getPresetMode($device)?->getFormat(); - if (!$format instanceof MetadataFormats\StringEnum) { + if (!$format instanceof ToolsFormats\StringEnum) { return []; } diff --git a/src/Hydrators/Channels/Actors.php b/src/Hydrators/Channels/Actors.php index 526fcc2..4f4fb30 100644 --- a/src/Hydrators/Channels/Actors.php +++ b/src/Hydrators/Channels/Actors.php @@ -20,8 +20,8 @@ use FastyBird\Addon\VirtualThermostat\Schemas; use FastyBird\Connector\Virtual\Entities as VirtualEntities; use FastyBird\Connector\Virtual\Hydrators as VirtualHydrators; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use Fig\Http\Message\StatusCodeInterface; use IPub\JsonAPIDocument; use Ramsey\Uuid; @@ -46,8 +46,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateDeviceRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/Hydrators/Channels/Configuration.php b/src/Hydrators/Channels/Configuration.php index c248bf9..4e41260 100644 --- a/src/Hydrators/Channels/Configuration.php +++ b/src/Hydrators/Channels/Configuration.php @@ -20,8 +20,8 @@ use FastyBird\Addon\VirtualThermostat\Schemas; use FastyBird\Connector\Virtual\Entities as VirtualEntities; use FastyBird\Connector\Virtual\Hydrators as VirtualHydrators; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use Fig\Http\Message\StatusCodeInterface; use IPub\JsonAPIDocument; use Ramsey\Uuid; @@ -46,8 +46,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateDeviceRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/Hydrators/Channels/Preset.php b/src/Hydrators/Channels/Preset.php index d10e035..0e2b642 100644 --- a/src/Hydrators/Channels/Preset.php +++ b/src/Hydrators/Channels/Preset.php @@ -20,8 +20,8 @@ use FastyBird\Addon\VirtualThermostat\Schemas; use FastyBird\Connector\Virtual\Entities as VirtualEntities; use FastyBird\Connector\Virtual\Hydrators as VirtualHydrators; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use Fig\Http\Message\StatusCodeInterface; use IPub\JsonAPIDocument; use Ramsey\Uuid; @@ -46,8 +46,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateDeviceRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/Hydrators/Channels/Sensors.php b/src/Hydrators/Channels/Sensors.php index 397bf9c..07cceee 100644 --- a/src/Hydrators/Channels/Sensors.php +++ b/src/Hydrators/Channels/Sensors.php @@ -20,8 +20,8 @@ use FastyBird\Addon\VirtualThermostat\Schemas; use FastyBird\Connector\Virtual\Entities as VirtualEntities; use FastyBird\Connector\Virtual\Hydrators as VirtualHydrators; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use Fig\Http\Message\StatusCodeInterface; use IPub\JsonAPIDocument; use Ramsey\Uuid; @@ -46,8 +46,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateDeviceRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/Hydrators/Channels/State.php b/src/Hydrators/Channels/State.php index d2095bd..c12f272 100644 --- a/src/Hydrators/Channels/State.php +++ b/src/Hydrators/Channels/State.php @@ -20,8 +20,8 @@ use FastyBird\Addon\VirtualThermostat\Schemas; use FastyBird\Connector\Virtual\Entities as VirtualEntities; use FastyBird\Connector\Virtual\Hydrators as VirtualHydrators; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use Fig\Http\Message\StatusCodeInterface; use IPub\JsonAPIDocument; use Ramsey\Uuid; @@ -46,8 +46,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateDeviceRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/tests/cases/unit/BaseTestCase.php b/tests/cases/unit/BaseTestCase.php index 7ba63b2..3113c95 100644 --- a/tests/cases/unit/BaseTestCase.php +++ b/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Addon\VirtualThermostat\DI; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Boot as ApplicationBoot; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; use PHPUnit\Framework\TestCase; use function constant; diff --git a/tests/cases/unit/DI/VirtualThermostatExtensionTest.php b/tests/cases/unit/DI/VirtualThermostatExtensionTest.php index f5b1243..af20697 100644 --- a/tests/cases/unit/DI/VirtualThermostatExtensionTest.php +++ b/tests/cases/unit/DI/VirtualThermostatExtensionTest.php @@ -9,7 +9,7 @@ use FastyBird\Addon\VirtualThermostat\Hydrators; use FastyBird\Addon\VirtualThermostat\Schemas; use FastyBird\Addon\VirtualThermostat\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; final class VirtualThermostatExtensionTest extends Tests\Cases\Unit\BaseTestCase diff --git a/tests/cases/unit/DbTestCase.php b/tests/cases/unit/DbTestCase.php index 75ffd03..165d919 100644 --- a/tests/cases/unit/DbTestCase.php +++ b/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Addon\VirtualThermostat\DI; use FastyBird\Addon\VirtualThermostat\Exceptions; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Boot as ApplicationBoot; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use IPub\DoctrineCrud; use Nette; use Nettrine\ORM as NettrineORM; diff --git a/tests/cases/unit/Drivers/ThermostatTest.php b/tests/cases/unit/Drivers/ThermostatTest.php index 1ac3a23..87b0130 100644 --- a/tests/cases/unit/Drivers/ThermostatTest.php +++ b/tests/cases/unit/Drivers/ThermostatTest.php @@ -10,8 +10,7 @@ use FastyBird\Addon\VirtualThermostat\Types; use FastyBird\Connector\Virtual\Drivers as VirtualDrivers; use FastyBird\Connector\Virtual\Queue as VirtualQueue; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Models as DevicesModels; @@ -32,7 +31,6 @@ final class ThermostatTest extends Tests\Cases\Unit\DbTestCase * @throws Error * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument * @throws RuntimeException */ public function testConnect(): void @@ -67,7 +65,6 @@ public function testConnect(): void * @throws DI\MissingServiceException * @throws Error * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument * @throws RuntimeException * * @dataProvider processThermostatData diff --git a/tests/common.neon b/tests/common.neon index ebe2f9b..cef26c5 100644 --- a/tests/common.neon +++ b/tests/common.neon @@ -27,8 +27,8 @@ extensions: fbDateTimeFactory : FastyBird\DateTimeFactory\DI\DateTimeFactoryExtension fbJsonApi : FastyBird\JsonApi\DI\JsonApiExtension fbSimpleAuth : FastyBird\SimpleAuth\DI\SimpleAuthExtension - fbMetadataLibrary : FastyBird\Library\Metadata\DI\MetadataExtension - fbExchangeLibrary : FastyBird\Library\Exchange\DI\ExchangeExtension + fbTools : FastyBird\Core\Tools\DI\ToolsExtension + fbExchange : FastyBird\Core\Exchange\DI\ExchangeExtension fbDevicesModule : FastyBird\Module\Devices\DI\DevicesExtension fbVirtualConnector : FastyBird\Connector\Virtual\DI\VirtualExtension @@ -100,7 +100,7 @@ nettrineOrmAttributes: FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy ] -fbMetadataLibrary: +fbApplication: documents: mapping: [ FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy diff --git a/tests/fixtures/dummy/DummyChannelDocument.php b/tests/fixtures/dummy/DummyChannelDocument.php index 21740a0..06a7620 100644 --- a/tests/fixtures/dummy/DummyChannelDocument.php +++ b/tests/fixtures/dummy/DummyChannelDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents; -#[DOC\Document(entity: DummyChannelEntity::class)] -#[DOC\DiscriminatorEntry(name: DummyChannelEntity::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: DummyChannelEntity::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: DummyChannelEntity::TYPE)] class DummyChannelDocument extends Documents\Channels\Channel { diff --git a/tests/fixtures/dummy/DummyChannelEntity.php b/tests/fixtures/dummy/DummyChannelEntity.php index 791bedf..2b7acb2 100644 --- a/tests/fixtures/dummy/DummyChannelEntity.php +++ b/tests/fixtures/dummy/DummyChannelEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Module\Devices\Entities as DevicesEntities; #[ORM\Entity] diff --git a/tests/fixtures/dummy/DummyConnectorDocument.php b/tests/fixtures/dummy/DummyConnectorDocument.php index e29daa0..8f8333c 100644 --- a/tests/fixtures/dummy/DummyConnectorDocument.php +++ b/tests/fixtures/dummy/DummyConnectorDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents; -#[DOC\Document(entity: DummyConnectorEntity::class)] -#[DOC\DiscriminatorEntry(name: DummyConnectorEntity::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: DummyConnectorEntity::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: DummyConnectorEntity::TYPE)] class DummyConnectorDocument extends Documents\Connectors\Connector { diff --git a/tests/fixtures/dummy/DummyConnectorEntity.php b/tests/fixtures/dummy/DummyConnectorEntity.php index 1725f81..80fb3b7 100644 --- a/tests/fixtures/dummy/DummyConnectorEntity.php +++ b/tests/fixtures/dummy/DummyConnectorEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Module\Devices\Entities as DevicesEntities; #[ORM\Entity] diff --git a/tests/fixtures/dummy/DummyDeviceDocument.php b/tests/fixtures/dummy/DummyDeviceDocument.php index 944c4f0..ac1614d 100644 --- a/tests/fixtures/dummy/DummyDeviceDocument.php +++ b/tests/fixtures/dummy/DummyDeviceDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents; -#[DOC\Document(entity: DummyDeviceEntity::class)] -#[DOC\DiscriminatorEntry(name: DummyDeviceEntity::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: DummyDeviceEntity::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: DummyDeviceEntity::TYPE)] class DummyDeviceDocument extends Documents\Devices\Device { diff --git a/tests/fixtures/dummy/DummyDeviceEntity.php b/tests/fixtures/dummy/DummyDeviceEntity.php index 63e9500..5268ec1 100644 --- a/tests/fixtures/dummy/DummyDeviceEntity.php +++ b/tests/fixtures/dummy/DummyDeviceEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Addon\VirtualThermostat\Tests\Fixtures\Dummy; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Module\Devices\Entities as DevicesEntities; #[ORM\Entity]