diff --git a/.docker/dev/node/Dockerfile b/.docker/dev/node/Dockerfile index b71d66039..911d1913c 100644 --- a/.docker/dev/node/Dockerfile +++ b/.docker/dev/node/Dockerfile @@ -8,6 +8,7 @@ ENV NODE_OPTIONS="--max_old_space_size=4096" # Install dependencies using Yarn RUN yarn install +RUN yarn global add @rollup/rollup-linux-arm64-musl EXPOSE 3000 EXPOSE 6006 diff --git a/.github/workflows/monorepo-matrix.json b/.github/workflows/monorepo-matrix.json index 9375312ae..69d664b6b 100644 --- a/.github/workflows/monorepo-matrix.json +++ b/.github/workflows/monorepo-matrix.json @@ -1,23 +1,23 @@ [ { "organization": "FastyBird", - "name": "application-library", - "local-path": "src/FastyBird/Library/Application" + "name": "application", + "local-path": "src/FastyBird/Core/Application" }, { "organization": "FastyBird", - "name": "exchange-library", - "local-path": "src/FastyBird/Library/Exchange" + "name": "exchange", + "local-path": "src/FastyBird/Core/Exchange" }, { "organization": "FastyBird", - "name": "metadata-library", - "local-path": "src/FastyBird/Library/Metadata" + "name": "tools", + "local-path": "src/FastyBird/Core/Tools" }, { "organization": "FastyBird", - "name": "tools-library", - "local-path": "src/FastyBird/Library/Tools" + "name": "metadata-library", + "local-path": "src/FastyBird/Library/Metadata" }, { "organization": "FastyBird", diff --git a/Makefile b/Makefile index 56ac807c8..eb460612d 100644 --- a/Makefile +++ b/Makefile @@ -15,21 +15,21 @@ qa: ## Check code quality - coding style and static analysis cs: ## Check PHP files coding style mkdir -p var/tools/PHP_CodeSniffer - $(PRE_PHP) "vendor/bin/phpcs" src app --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS) + $(PRE_PHP) "vendor/bin/phpcs" src --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS) csf: ## Fix PHP files coding style mkdir -p var/tools/PHP_CodeSniffer - $(PRE_PHP) "vendor/bin/phpcbf" src app --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS) + $(PRE_PHP) "vendor/bin/phpcbf" src --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS) lint: - $(PRE_PHP) "vendor/bin/parallel-lint" src app --exclude .git --exclude vendor + $(PRE_PHP) "vendor/bin/parallel-lint" src --exclude .git --exclude vendor phpstan: ## Analyse code with PHPStan mkdir -p var/tools $(PRE_PHP) "vendor/bin/phpstan" analyse -c $(PHPSTAN_SRC_CONFIG) $(ARGS) $(PRE_PHP) "vendor/bin/phpstan" analyse -c $(PHPSTAN_TESTS_CONFIG) $(ARGS) -# Tests +# TESTS .PHONY: tests tests: ## Run all tests @@ -60,7 +60,7 @@ mutations-infection: --skip-initial-tests \ $(ARGS) -# Docker +# DOCKER up: docker-compose up -d @@ -74,7 +74,7 @@ bash: bash-root: docker-compose exec -u 0 application bash -# Utilities +# UTILITIES .SILENT: $(shell grep -h -E '^[a-zA-Z_-]+:.*?$$' $(MAKEFILE_LIST) | sort -u | awk 'BEGIN {FS = ":.*?"}; {printf "%s ", $$1}') diff --git a/app/.prettierrc b/app/.prettierrc deleted file mode 100644 index c579f3b24..000000000 --- a/app/.prettierrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "printWidth": 150, - "tabWidth": 2, - "useTabs": true, - "semi": true, - "singleQuote": true, - "quoteProps": "as-needed", - "jsxSingleQuote": false, - "trailingComma": "es5", - "bracketSpacing": true, - "arrowParens": "always", - "requirePragma": false, - "insertPragma": false, - "proseWrap": "preserve", - "htmlWhitespaceSensitivity": "css", - "vueIndentScriptAndStyle": false, - "endOfLine": "auto", - "singleAttributePerLine": true -} diff --git a/app/assets/components/app-gravatar.types.ts b/app/assets/components/app-gravatar.types.ts deleted file mode 100644 index 090f60977..000000000 --- a/app/assets/components/app-gravatar.types.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type AppGravatarRating = 'g' | 'pg' | 'r' | 'x'; - -export type AppGravatarDefaultImg = '404' | 'mp' | 'mm' | 'identicon' | 'monsterid' | 'wavatar' | 'retro' | 'robohash' | 'blank'; diff --git a/app/assets/components/app-navigation.vue b/app/assets/components/app-navigation.vue deleted file mode 100644 index e260f1387..000000000 --- a/app/assets/components/app-navigation.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - - diff --git a/app/assets/components/types.ts b/app/assets/components/types.ts deleted file mode 100644 index 246eeba03..000000000 --- a/app/assets/components/types.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-gravatar.types'; diff --git a/app/assets/composables/darkMode.ts b/app/assets/composables/darkMode.ts deleted file mode 100644 index 43763f82e..000000000 --- a/app/assets/composables/darkMode.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { useDark, useToggle } from '@vueuse/core'; - -export const isDark = useDark({ - storageKey: 'fb-theme-appearance', -}); - -export const toggleDark = useToggle(isDark); diff --git a/app/assets/composables/index.ts b/app/assets/composables/index.ts deleted file mode 100644 index 97d879a60..000000000 --- a/app/assets/composables/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './darkMode'; -export { useBreakpoints } from './useBreakpoints'; diff --git a/app/assets/composables/types.ts b/app/assets/composables/types.ts deleted file mode 100644 index f926a5737..000000000 --- a/app/assets/composables/types.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ComputedRef } from 'vue'; - -export interface UseBreakpoints { - isXSDevice: ComputedRef; - isSMDevice: ComputedRef; - isMDDevice: ComputedRef; - isLGDevice: ComputedRef; - isXLDevice: ComputedRef; - isXXLDevice: ComputedRef; -} diff --git a/app/assets/env.d.ts b/app/assets/env.d.ts deleted file mode 100644 index afcdc9938..000000000 --- a/app/assets/env.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -declare module '*.vue' { - import type { DefineComponent } from 'vue'; - // eslint-disable-next-line @typescript-eslint/ban-types - const component: DefineComponent<{}, {}, any>; - - export default component; -} diff --git a/app/assets/locales/en-US.json b/app/assets/locales/en-US.json deleted file mode 100644 index dcab6577a..000000000 --- a/app/assets/locales/en-US.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "application": { - "menu": { - "root": "MiniServer", - "dashboard": "Dashboard", - "devices": "Devices", - "connectors": "Connectors", - "triggers": "Triggers", - "administration": "Administration", - "users": "Users", - "access": "Access rights", - "roles": "Roles", - "permissions": "Permissions", - "user": "Your account" - }, - "userMenu": { - "accountSettings": "Account settings", - "passwordChange": "Password change", - "lockScreen": "Lock screen", - "signOut": "Sign out" - } - } -} diff --git a/app/assets/main.ts b/app/assets/main.ts deleted file mode 100644 index e0b7e9e9f..000000000 --- a/app/assets/main.ts +++ /dev/null @@ -1,86 +0,0 @@ -import defaultsDeep from 'lodash.defaultsdeep'; -import { createApp } from 'vue'; -import { createPinia } from 'pinia'; -import { createMetaManager, plugin as metaPlugin } from 'vue-meta'; -import get from 'lodash.get'; -import { createWampV1Client } from '@fastybird/vue-wamp-v1'; - -import { version } from './../package.json'; - -import App from './App.vue'; -import i18n from './locales'; -import router from './router'; - -import { backendPlugin, eventBusPlugin, eventBusInjectionKey } from './plugins'; - -import { createAccountsModule, IAccountsModuleOptions } from '@fastybird/accounts-module'; -import createDevicesModule, { IDevicesModuleOptions } from '@fastybird/devices-module'; - -import 'nprogress/nprogress.css'; -import '@fastybird/web-ui-theme-chalk/src/index.scss'; -import 'virtual:uno.css'; -import './styles/base.scss'; - -import homeKitLocales from '../../src/FastyBird/Connector/HomeKit/assets/locales'; - -const pinia = createPinia(); -const app = createApp(App); - -app.use(i18n); -app.use(createMetaManager()); -app.use(metaPlugin); -app.use(pinia); -app.use(createWampV1Client(), { - host: 'ws://localhost:3000/ws-exchange', - debug: true, -}); - -// Register app plugins -app.use(backendPlugin, { - apiPrefix: get(import.meta.env, 'FB_APP_PARAMETER__API_PREFIX', '/api'), - apiTarget: get(import.meta.env, 'FB_APP_PARAMETER__API_TARGET', null), - apiKey: get(import.meta.env, 'FB_APP_PARAMETER__API_KEY', null), - apiPrefixedModules: `${get(import.meta.env, 'FB_APP_PARAMETER__API_PREFIXED_MODULES', true)}`.toLowerCase() === 'true', -}); - -app.use(eventBusPlugin, {}); - -// Register app modules -app.use(createAccountsModule(), { - router, - meta: { - author: 'FastyBird s.r.o.', - website: 'https://www.fastybird.com', - version: version, - }, - configuration: { - injectionKeys: { - eventBusInjectionKey, - }, - }, - store: pinia, - i18n, -} as IAccountsModuleOptions); - -app.use(createDevicesModule(), { - router, - meta: { - author: 'FastyBird s.r.o.', - website: 'https://www.fastybird.com', - version: version, - }, - configuration: {}, - store: pinia, - i18n, -} as IDevicesModuleOptions); - -for (const [locale, translations] of Object.entries(homeKitLocales)) { - const currentMessages = i18n.global.getLocaleMessage(locale); - const mergedMessages = defaultsDeep(currentMessages, { homeKitConnector: translations }); - - i18n.global.setLocaleMessage(locale, mergedMessages); -} - -app.use(router); - -router.isReady().then(() => app.mount('#app')); diff --git a/app/assets/plugins/backend.ts b/app/assets/plugins/backend.ts deleted file mode 100644 index 2acddfb20..000000000 --- a/app/assets/plugins/backend.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { App, InjectionKey } from 'vue'; -import axios, { AxiosInstance, InternalAxiosRequestConfig, AxiosResponse } from 'axios'; -import get from 'lodash.get'; - -import { ModulePrefix } from '@fastybird/metadata-library'; - -import { useSession } from '@fastybird/accounts-module'; - -const SESSION_API_URL = '/v1/session'; - -interface IAxiosOptions { - apiPrefix: string; - apiTarget: string | null; - apiKey: string | null; - apiPrefixedModules: boolean; -} - -export const key: InjectionKey = Symbol('backend'); - -export default { - install: (app: App, options: IAxiosOptions): void => { - const baseUrl = options.apiTarget !== null ? options.apiTarget : options.apiPrefix; - - axios.defaults.baseURL = baseUrl; - - let refreshAccessTokenCall: Promise | null = null; - - let pendingRequests = 0; - - const MAX_REQUESTS_COUNT = 10; - const MAX_REQUESTS_COUNT_DELAY = 10; - - axios.interceptors.request.use((request): Promise => { - request.baseURL = baseUrl; - - if (typeof request.headers !== 'undefined') { - Object.assign(request.headers, { 'Content-Type': 'application/vnd.api+json' }); - } - - if (options.apiKey !== null) { - if (typeof request.headers !== 'undefined') { - Object.assign(request.headers, { 'X-Api-Key': options.apiKey }); - } - } - - return new Promise((resolve) => { - const interval = setInterval(() => { - if (pendingRequests < MAX_REQUESTS_COUNT) { - pendingRequests++; - - clearInterval(interval); - - resolve(request); - } - }, MAX_REQUESTS_COUNT_DELAY); - }); - }); - - // Set basic headers - axios.interceptors.request.use((request): InternalAxiosRequestConfig => { - const session = useSession(); - - const accessToken = session.data.accessToken; - - if (get(request, 'url', '').includes(SESSION_API_URL) && request.method === 'patch') { - delete request.headers?.Authorization; - } else if (accessToken !== null) { - if (typeof request.headers !== 'undefined') { - Object.assign(request.headers, { Authorization: `Bearer ${accessToken}` }); - } else { - Object.assign(request, { headers: { Authorization: `Bearer ${accessToken}` } }); - } - } - - return request; - }); - - // Modify api url prefix - axios.interceptors.request.use((request): InternalAxiosRequestConfig => { - if (!options.apiPrefixedModules && typeof request.url !== 'undefined') { - Object.values(ModulePrefix).forEach((modulePrefix) => { - request.url = request.url?.replace(new RegExp(`^/${modulePrefix}`, 'g'), ''); // Remove base path - }); - } - - return request; - }); - - // Add a response interceptor - axios.interceptors.response.use( - (response: AxiosResponse): AxiosResponse => { - pendingRequests = Math.max(0, pendingRequests - 1); - - return response; - }, - (error): Promise => { - const originalRequest = error.config; - - const session = useSession(); - - // Concurrent request check only for client side - pendingRequests = Math.max(0, pendingRequests - 1); - - if ( - parseInt(get(error, 'response.status', 200), 10) === 401 && - !originalRequest.url.includes(SESSION_API_URL) && - !get(originalRequest, '_retry', false) - ) { - if (originalRequest.url.includes(SESSION_API_URL) && originalRequest.method !== 'patch') { - return Promise.reject(error); - } - - // if the error is 401 and has sent already been retried - originalRequest._retry = true; // now it can be retried - - if (refreshAccessTokenCall === null) { - refreshAccessTokenCall = session - .refresh() - .then((): Promise => { - // Reset call instance - refreshAccessTokenCall = null; - - originalRequest.headers.Authorization = `Bearer ${session.data.accessToken}`; - - return axios(originalRequest); // retry the request that errored out - }) - .catch((): Promise => { - // Reset call instance - refreshAccessTokenCall = null; - - return Promise.reject(error); - }); - } - - if (refreshAccessTokenCall === null) { - return Promise.reject('Refresh token failed'); - } - - return refreshAccessTokenCall; - } else if ( - parseInt(get(error, 'response.status', 200), 10) >= 500 && - parseInt(get(error, 'response.status', 200), 10) < 600 && - !get(originalRequest, '_retry', false) - ) { - // if the error is 5xx and has sent already been retried - originalRequest._retry = true; // now it can be retried - - return axios(originalRequest); // retry the request that errored out - } else { - return Promise.reject(error); - } - } - ); - - app.provide(key, axios); - }, -}; - -export function useAxios(): AxiosInstance { - return axios; -} diff --git a/app/assets/plugins/eventBus.ts b/app/assets/plugins/eventBus.ts deleted file mode 100644 index 74dec034c..000000000 --- a/app/assets/plugins/eventBus.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { App, InjectionKey } from 'vue'; -import mitt, { Emitter } from 'mitt'; - -const defaultOptions = { - global: true, - inject: true, - globalPropertyName: 'eventBus', -}; - -interface IEventBusOptions { - global?: boolean; - inject?: boolean; - globalPropertyName?: string; -} - -type UserSignedEvent = 'in' | 'out'; - -type Events = { - loadingOverlay?: number | boolean; - userSigned: UserSignedEvent; - userLocked: boolean; -}; - -export const eventBus: Emitter = mitt(); -export const key: InjectionKey> = Symbol('eventBus'); - -export default { - install: (app: App, options: IEventBusOptions): void => { - const pluginOptions = { - ...defaultOptions, - ...options, - }; - - if (pluginOptions.global) { - app.config.globalProperties[pluginOptions.globalPropertyName] = eventBus; - } - - if (pluginOptions.inject) { - app.provide(key, eventBus); - } - }, -}; diff --git a/app/assets/plugins/index.ts b/app/assets/plugins/index.ts deleted file mode 100644 index 512bb1c9c..000000000 --- a/app/assets/plugins/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as backendPlugin, key as backedInjectionKey } from './backend'; -export { default as eventBusPlugin, key as eventBusInjectionKey } from './eventBus'; diff --git a/app/auto-imports.d.ts b/app/auto-imports.d.ts deleted file mode 100644 index 1d89ee8c4..000000000 --- a/app/auto-imports.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable */ -/* prettier-ignore */ -// @ts-nocheck -// noinspection JSUnusedGlobalSymbols -// Generated by unplugin-auto-import -export {} -declare global { - -} diff --git a/app/components.d.ts b/app/components.d.ts deleted file mode 100644 index 9ee2dd1f4..000000000 --- a/app/components.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable */ -// @ts-nocheck -// Generated by unplugin-vue-components -// Read more: https://github.com/vuejs/core/pull/3399 -export {} - -/* prettier-ignore */ -declare module 'vue' { - export interface GlobalComponents { - ElButton: typeof import('element-plus/es')['ElButton'] - ElDrawer: typeof import('element-plus/es')['ElDrawer'] - ElDropdown: typeof import('element-plus/es')['ElDropdown'] - ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] - ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] - ElIcon: typeof import('element-plus/es')['ElIcon'] - ElOption: typeof import('element-plus/es')['ElOption'] - ElOptionGroup: typeof import('element-plus/es')['ElOptionGroup'] - ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] - ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] - ElSelect: typeof import('element-plus/es')['ElSelect'] - RouterLink: typeof import('vue-router')['RouterLink'] - RouterView: typeof import('vue-router')['RouterView'] - } - export interface ComponentCustomProperties { - vLoading: typeof import('element-plus/es')['ElLoadingDirective'] - } -} diff --git a/app/composer.json b/app/composer.json deleted file mode 100644 index 390a3052e..000000000 --- a/app/composer.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "fastybird/application", - "description": "FastyBird IoT application", - "keywords": [ - "fastybird", - "fb", - "api", - "php", - "iot", - "vuejs", - "typescript", - "vue", - "connector", - "nette", - "vue3", - "pinia" - ], - "homepage": "https://www.fastybird.com", - "license": "Apache-2.0", - "authors": [ - { - "name": "FastyBird s.r.o.", - "email": "code@fastybird.com", - "homepage": "https://www.fastybird.com" - }, - { - "name": "Adam Kadlec", - "email": "adam.kadlec@fastybird.com" - } - ], - "support": { - "email": "code@fastybird.com", - "issues": "https://github.com/FastyBird/fastybird/issues", - "source": "https://github.com/FastyBird/application" - }, - "require": { - "php": ">=8.2.0", - "contributte/vite": "^0.2", - "fastybird/application-library": "dev-main", - "fastybird/accounts-module": "dev-main", - "fastybird/devices-module": "dev-main" - }, - "require-dev": { - "brianium/paratest": "^7.3", - "dg/bypass-finals": "^1.4", - "ipub/websockets": "^1.7", - "ipub/websockets-wamp": "^1.4", - "infection/infection": "^0.27", - "orisai/coding-standard": "^3.2", - "pds/skeleton": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-doctrine": "^1.3", - "phpstan/phpstan-nette": "^1.1", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "^10.0", - "react/http": "^1.7", - "staabm/annotate-pull-request-from-checkstyle": "^1.8", - "tracy/tracy": "^2.9" - }, - "autoload": { - "psr-4": { - "FastyBird\\App\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "FastyBird\\App\\Tests\\Cases\\Unit\\": "tests/cases/unit", - "FastyBird\\App\\Tests\\Fixtures\\": "tests/fixtures", - "FastyBird\\App\\Tests\\Fixtures\\Dummy\\": "tests/fixtures/dummy", - "FastyBird\\App\\Tests\\Tools\\": "tests/tools" - } - }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-main": "1.0-dev" - } - }, - "minimum-stability": "dev", - "prefer-stable": true -} diff --git a/app/src/DI/AppExtension.php b/app/src/DI/AppExtension.php deleted file mode 100644 index 90fe86f87..000000000 --- a/app/src/DI/AppExtension.php +++ /dev/null @@ -1,99 +0,0 @@ - - * @package FastyBird:Application! - * @subpackage DI - * @since 1.0.0 - * - * @date 16.06.24 - */ - -namespace FastyBird\App\DI; - -use FastyBird\App\Router; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Application\Router as ApplicationRouter; -use FastyBird\Library\Application\UI as ApplicationUI; -use Nette\Application; -use Nette\Bootstrap; -use Nette\DI; -use function assert; -use function is_string; -use const DIRECTORY_SEPARATOR; - -/** - * FastyBird application - * - * @package FastyBird:Application! - * @subpackage DI - * - * @author Adam Kadlec - */ -class AppExtension extends DI\CompilerExtension -{ - - public const NAME = 'fbApplication'; - - public static function register( - ApplicationBoot\Configurator $config, - string $extensionName = self::NAME, - ): void - { - $config->onCompile[] = static function ( - Bootstrap\Configurator $config, - DI\Compiler $compiler, - ) use ($extensionName): void { - $compiler->addExtension($extensionName, new self()); - }; - } - - /** - * @throws DI\MissingServiceException - */ - public function beforeCompile(): void - { - parent::beforeCompile(); - - $builder = $this->getContainerBuilder(); - - /** - * ROUTES - */ - - $appRouterServiceName = $builder->getByType(ApplicationRouter\AppRouter::class); - assert(is_string($appRouterServiceName)); - $appRouterService = $builder->getDefinition($appRouterServiceName); - assert($appRouterService instanceof DI\Definitions\ServiceDefinition); - - $appRouterService->addSetup([Router\AppRouter::class, 'createRouter'], [$appRouterService]); - - /** - * UI - */ - - $presenterFactoryService = $builder->getDefinitionByType(Application\IPresenterFactory::class); - - if ($presenterFactoryService instanceof DI\Definitions\ServiceDefinition) { - $presenterFactoryService->addSetup('setMapping', [[ - 'App' => 'FastyBird\App\Presenters\*Presenter', - ]]); - } - - $templateFactoryService = $builder->getDefinitionByType(ApplicationUI\TemplateFactory::class); - assert($templateFactoryService instanceof DI\Definitions\ServiceDefinition); - - $templateFactoryService->addSetup( - 'registerLayout', - [ - __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR - . 'templates' . DIRECTORY_SEPARATOR . '@layout.latte', - ], - ); - } - -} diff --git a/app/src/Presenters/BasePresenter.php b/app/src/Presenters/BasePresenter.php deleted file mode 100644 index f67194f20..000000000 --- a/app/src/Presenters/BasePresenter.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @package FastyBird:Application! - * @subpackage Presenters - * @since 1.0.0 - * - * @date 16.06.24 - */ - -namespace FastyBird\App\Presenters; - -use FastyBird\Library\Application\Presenters as ApplicationPresenters; -use Nette\Application; - -/** - * Base application presenter - * - * @package FastyBird:Application! - * @subpackage Presenters - * - * @author Adam Kadlec - */ -abstract class BasePresenter extends ApplicationPresenters\BasePresenter -{ - - public function formatTemplateFiles(): array - { - [, $presenter] = Application\Helpers::splitName($this->getName() ?? ''); - - $dir = __DIR__ . '/../../templates/'; - - return [ - "$dir/presenters/$presenter/$this->view.latte", - "$dir/presenters/$presenter.$this->view.latte", - "$dir/presenters/$presenter.latte", - ]; - } - -} diff --git a/app/tests/cases/unit/DI/AppExtensionTest.php b/app/tests/cases/unit/DI/AppExtensionTest.php deleted file mode 100644 index 770aae71c..000000000 --- a/app/tests/cases/unit/DI/AppExtensionTest.php +++ /dev/null @@ -1,24 +0,0 @@ -createContainer(); - } - -} diff --git a/app/tools/generateAliases.ts b/app/tools/generateAliases.ts deleted file mode 100644 index b6382a73e..000000000 --- a/app/tools/generateAliases.ts +++ /dev/null @@ -1,67 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -const skipPackages: string[] = ['@fastybird/metadata-library', '@fastybird/web-ui']; - -const findEntryFile = (dir: string): string | null => { - const files: string[] = fs.readdirSync(dir); - - for (const file of files) { - const filePath = path.join(dir, file); - const stat = fs.statSync(filePath); - - if (stat.isDirectory()) { - const entryFilePath: string = findEntryFile(filePath); - - if (entryFilePath) { - return entryFilePath; - } - } else if (file === 'entry.ts') { - return filePath; - } - } - - return null; -}; - -const findPackageJsonFiles = (dir: string): { [key: string]: string } => { - const files = fs.readdirSync(dir); - const aliases = {}; - - files.forEach((file) => { - const filePath: string = path.join(dir, file); - const stat: fs.Stats = fs.statSync(filePath); - - if (stat.isDirectory()) { - // Recursively search subdirectories - const subAliases: { [key: string]: string } = findPackageJsonFiles(filePath); - - Object.assign(aliases, subAliases); - } else if (file === 'package.json') { - // Read package.json to get entry file and package name - const packageJson = JSON.parse(fs.readFileSync(filePath, 'utf-8')); - const aliasName: string = packageJson.name; - - // Skip packages that are in the skipPackages array - if (skipPackages.includes(aliasName)) { - return; - } - - const entryFilePath: string = findEntryFile(path.dirname(filePath)); - - if (fs.existsSync(entryFilePath)) { - aliases[aliasName] = entryFilePath; - } - } - }); - - return aliases; -}; - -// Base directory for modules -const baseDir = path.resolve(__dirname, './../../src'); - -// Generate aliases -const aliases = findPackageJsonFiles(baseDir); - -export default aliases; diff --git a/bin/fb-console.php b/bin/fb-console.php index be866c818..c86127026 100644 --- a/bin/fb-console.php +++ b/bin/fb-console.php @@ -12,7 +12,7 @@ $srcPath = realpath($path . DS . 'src'); if ($srcPath !== false) { - $boostrapFile = realpath($path) . DS . 'src' . DS . 'FastyBird' . DS . 'Library' . DS . 'Application' . DS . 'bin' . DS . 'fb-console.php'; + $boostrapFile = realpath($path) . DS . 'src' . DS . 'FastyBird' . DS . 'Core' . DS . 'Application' . DS . 'bin' . DS . 'fb-console.php'; break; } diff --git a/bin/fb-supervisor.php b/bin/fb-supervisor.php index 14d82606e..bd50c3292 100644 --- a/bin/fb-supervisor.php +++ b/bin/fb-supervisor.php @@ -12,7 +12,7 @@ $srcPath = realpath($path . DS . 'src'); if ($srcPath !== false) { - $boostrapFile = realpath($path) . DS . 'src' . DS . 'FastyBird' . DS . 'Library' . DS . 'Application' . DS . 'bin' . DS . 'fb-supervisor.php'; + $boostrapFile = realpath($path) . DS . 'src' . DS . 'FastyBird' . DS . 'Core' . DS . 'Application' . DS . 'bin' . DS . 'fb-supervisor.php'; break; } diff --git a/composer.json b/composer.json index 6ec55043d..d01d77003 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ { "name": "FastyBird s.r.o.", "email": "code@fastybird.com", - "homepage": "https://www.fastybird.com" + "homepage": "https://www.fastybird.com/" }, { "name": "Adam Kadlec", @@ -48,6 +48,7 @@ "contributte/vite": "^0.2", "cweagans/composer-patches": "^1.7", "doctrine/orm": "2.15.*", + "doctrine/persistence": "^2.5 || ^3.4", "endroid/qr-code": "4.5", "evenement/evenement": "^3.0", "fastybird/datetime-factory": "^0.7.1", @@ -66,9 +67,9 @@ "mangoweb/monolog-tracy-handler": "^1.0", "mathsolver/mathsolver": "@dev", "nette/application": "^3.1", - "nette/bootstrap": "^3.1", + "nette/bootstrap": "^3.2", "nette/caching": "^3.3", - "nette/di": "^3.0", + "nette/di": "^3.2", "nette/utils": "^4.0", "nettrine/dbal": "^0.8", "nettrine/fixtures": "^0.6", @@ -84,13 +85,13 @@ "psr/http-message": "^1.0", "psr/http-server-middleware": "^1.0", "psr/log": "^3.0", - "ramsey/uuid": "^4.5", + "ramsey/uuid": "^4.7", "ratchet/pawl": "^0.4", "react/async": "^4.0", "react/datagram": "^1.8", "react/dns": "^1.10", "react/event-loop": "^1.3", - "react/http": "1.9", + "react/http": "^1.7", "react/promise": "^3", "react/socket": "^1.12", "ringcentral/psr7": "^1.3", @@ -101,6 +102,7 @@ "sunrise/http-message": "^3.0", "symfony/console": "^6.0", "symfony/event-dispatcher": "^7.0", + "symfony/event-dispatcher-contracts": "^3.5", "symfony/monolog-bridge": "^6.1", "symplify/vendor-patches": "^11.2", "vlucas/phpdotenv": "^5.4", @@ -133,13 +135,12 @@ "fastybird/accounts-module": "self.version", "fastybird/apikey-plugin": "self.version", "fastybird/application": "self.version", - "fastybird/application-library": "self.version", "fastybird/couchdb-plugin": "self.version", "fastybird/date-time-automator": "self.version", "fastybird/devices-module": "self.version", "fastybird/devices-module-automator": "self.version", "fastybird/devices-module-ui-module-bridge": "self.version", - "fastybird/exchange-library": "self.version", + "fastybird/exchange": "self.version", "fastybird/fb-mqtt-connector": "self.version", "fastybird/homekit-connector": "self.version", "fastybird/metadata-library": "self.version", @@ -153,7 +154,7 @@ "fastybird/shelly-connector": "self.version", "fastybird/shelly-connector-homekit-connector-bridge": "self.version", "fastybird/sonoff-connector": "self.version", - "fastybird/tools-library": "self.version", + "fastybird/tools": "self.version", "fastybird/triggers-module": "self.version", "fastybird/tuya-connector": "self.version", "fastybird/ui-module": "self.version", @@ -175,7 +176,6 @@ "autoload": { "psr-4": { "FastyBird\\Addon\\VirtualThermostat\\": "src/FastyBird/Addon/VirtualThermostat/src/", - "FastyBird\\App\\": "app/src/", "FastyBird\\Automator\\DateTime\\": "src/FastyBird/Automator/DateTime/src/", "FastyBird\\Automator\\DevicesModule\\": "src/FastyBird/Automator/DevicesModule/src/", "FastyBird\\Bridge\\DevicesModuleUiModule\\": "src/FastyBird/Bridge/DevicesModuleUiModule/src/", @@ -194,11 +194,10 @@ "FastyBird\\Connector\\Viera\\": "src/FastyBird/Connector/Viera/src/", "FastyBird\\Connector\\Virtual\\": "src/FastyBird/Connector/Virtual/src/", "FastyBird\\Connector\\Zigbee2Mqtt\\": "src/FastyBird/Connector/Zigbee2Mqtt/src/", - "FastyBird\\Library\\Application\\": "src/FastyBird/Library/Application/src/", - "FastyBird\\Library\\Bootstrap\\": "src/FastyBird/Library/Application/src/", - "FastyBird\\Library\\Exchange\\": "src/FastyBird/Library/Exchange/src/", + "FastyBird\\Core\\Application\\": "src/FastyBird/Core/Application/src/", + "FastyBird\\Core\\Exchange\\": "src/FastyBird/Core/Exchange/src/", + "FastyBird\\Core\\Tools\\": "src/FastyBird/Core/Tools/src/", "FastyBird\\Library\\Metadata\\": "src/FastyBird/Library/Metadata/src/", - "FastyBird\\Library\\Tools\\": "src/FastyBird/Library/Tools/src/", "FastyBird\\Module\\Accounts\\": "src/FastyBird/Module/Accounts/src/", "FastyBird\\Module\\Devices\\": "src/FastyBird/Module/Devices/src/", "FastyBird\\Module\\Triggers\\": "src/FastyBird/Module/Triggers/src/", @@ -218,10 +217,6 @@ "FastyBird\\Addon\\VirtualThermostat\\Tests\\Fixtures\\": "src/FastyBird/Addon/VirtualThermostat/tests/fixtures", "FastyBird\\Addon\\VirtualThermostat\\Tests\\Fixtures\\Dummy\\": "src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy", "FastyBird\\Addon\\VirtualThermostat\\Tests\\Tools\\": "src/FastyBird/Addon/VirtualThermostat/tests/tools", - "FastyBird\\App\\Tests\\Cases\\Unit\\": "app/tests/cases/unit", - "FastyBird\\App\\Tests\\Fixtures\\": "app/tests/fixtures", - "FastyBird\\App\\Tests\\Fixtures\\Dummy\\": "app/tests/fixtures/dummy", - "FastyBird\\App\\Tests\\Tools\\": "app/tests/tools", "FastyBird\\Automator\\DateTime\\Tests\\Cases\\Unit\\": "src/FastyBird/Automator/DateTime/tests/cases/unit", "FastyBird\\Automator\\DateTime\\Tests\\Tools\\": "src/FastyBird/Automator/DateTime/tests/tools", "FastyBird\\Automator\\DevicesModule\\Tests\\Cases\\Unit\\": "src/FastyBird/Automator/DevicesModule/tests/cases/unit", @@ -268,13 +263,15 @@ "FastyBird\\Connector\\Virtual\\Tests\\Tools\\": "src/FastyBird/Connector/Virtual/tests/tools", "FastyBird\\Connector\\Zigbee2Mqtt\\Tests\\Cases\\Unit\\": "src/FastyBird/Connector/Zigbee2Mqtt/tests/cases/unit", "FastyBird\\Connector\\Zigbee2Mqtt\\Tests\\Tools\\": "src/FastyBird/Connector/Zigbee2Mqtt/tests/tools", - "FastyBird\\Library\\Application\\Tests\\Cases\\Unit\\": "src/FastyBird/Library/Application/tests/cases/unit", - "FastyBird\\Library\\Bootstrap\\Tests\\Cases\\Unit\\": "src/FastyBird/Library/Application/tests/cases/unit", - "FastyBird\\Library\\Exchange\\Tests\\Cases\\Unit\\": "src/FastyBird/Library/Exchange/tests/cases/unit", + "FastyBird\\Core\\Application\\Tests\\Cases\\Unit\\": "src/FastyBird/Core/Application/tests/cases/unit", + "FastyBird\\Core\\Application\\Tests\\Fixtures\\": "src/FastyBird/Core/Application/tests/fixtures", + "FastyBird\\Core\\Application\\Tests\\Fixtures\\Dummy\\": "src/FastyBird/Core/Application/tests/fixtures/dummy", + "FastyBird\\Core\\Application\\Tests\\Tools\\": "src/FastyBird/Core/Application/tests/tools", + "FastyBird\\Core\\Exchange\\Tests\\Cases\\Unit\\": "src/FastyBird/Core/Exchange/tests/cases/unit", + "FastyBird\\Core\\Tools\\Tests\\Cases\\Unit\\": "src/FastyBird/Core/Tools/tests/cases/unit", "FastyBird\\Library\\Metadata\\Tests\\Cases\\Unit\\": "src/FastyBird/Library/Metadata/tests/cases/unit", "FastyBird\\Library\\Metadata\\Tests\\Fixtures\\": "src/FastyBird/Library/Metadata/tests/fixtures", "FastyBird\\Library\\Metadata\\Tests\\Fixtures\\Dummy\\": "src/FastyBird/Library/Metadata/tests/fixtures/dummy", - "FastyBird\\Library\\Tools\\Tests\\Cases\\Unit\\": "src/FastyBird/Library/Tools/tests/cases/unit", "FastyBird\\Module\\Accounts\\Tests\\Cases\\Unit\\": "src/FastyBird/Module/Accounts/tests/cases/unit", "FastyBird\\Module\\Accounts\\Tests\\Fixtures\\": "src/FastyBird/Module/Accounts/tests/fixtures", "FastyBird\\Module\\Accounts\\Tests\\Tools\\": "src/FastyBird/Module/Accounts/tests/tools", diff --git a/docker-compose.yml b/docker-compose.yml index b869709b1..6b143f93d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,7 +109,7 @@ services: networks: - fastybird - # WS SERVER + # DEVICES MODULE EXCHANGE devices-module: container_name: fastybird-devices-module build: diff --git a/lerna.json b/lerna.json index 7d7b195ec..126c01b66 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,7 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "npmClient": "yarn", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "command": { "version": { "allowBranch": "main", diff --git a/monorepo-builder.php b/monorepo-builder.php index e9b20ae8f..bfb78a805 100644 --- a/monorepo-builder.php +++ b/monorepo-builder.php @@ -15,7 +15,6 @@ return static function (MBConfig $mbConfig): void { $mbConfig->packageDirectories([ __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'FastyBird', - __DIR__ . DIRECTORY_SEPARATOR . 'app', ]); $mbConfig->defaultBranch('main'); diff --git a/package.json b/package.json index 0c2e62af0..97b2fdb29 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@fastybird/fastybird", "private": true, - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "description": "Repository for FastyBird packages development", "keywords": [ "fastybird", @@ -23,19 +23,19 @@ "url": "https://github.com/FastyBird/fastybird.git" }, "workspaces": [ - "app", "src/FastyBird/Addon/**/*", "src/FastyBird/Automator/**/*", "src/FastyBird/Bridge/**/*", "src/FastyBird/Connector/**/*", + "src/FastyBird/Core/**/*", "src/FastyBird/Library/**/*", "src/FastyBird/Module/**/*", "src/FastyBird/Plugin/**/*" ], "scripts": { "dev": "lerna run dev --stream --ignore '@fastybird/web-ui'", - "build": "lerna run build --stream --ignore '@fastybird/web-ui'", - "build:dev": "lerna run build:dev --stream --ignore '@fastybird/web-ui'", + "build": "lerna run build --stream --ignore '@fastybird/web-ui' --ignore '@fastybird/application' && yarn workspace @fastybird/application build", + "build:dev": "lerna run build:dev --stream --ignore '@fastybird/web-ui' --ignore '@fastybird/application' && yarn workspace @fastybird/application build:dev", "clean": "lerna clean && rm -rf node_modules", "fix": "lerna run fix", "graph": "nx graph", diff --git a/public/index.php b/public/index.php index 8e8543f9e..6b577f329 100644 --- a/public/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Dotenv\Dotenv; -use FastyBird\Library\Application\Boot; +use FastyBird\Core\Application\Boot; use FastyBird\Library\Metadata; use FastyBird\Plugin\WebServer\Application as WebServerApplication; use Nette\Application as NetteApplication; diff --git a/src/FastyBird/Addon/VirtualThermostat/composer.json b/src/FastyBird/Addon/VirtualThermostat/composer.json index c07ae83cd..d3007b438 100644 --- a/src/FastyBird/Addon/VirtualThermostat/composer.json +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Commands/Install.php b/src/FastyBird/Addon/VirtualThermostat/src/Commands/Install.php index fe0cb0d73..b6aeea65b 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Commands/Install.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/DI/VirtualThermostatExtension.php b/src/FastyBird/Addon/VirtualThermostat/src/DI/VirtualThermostatExtension.php index df0f27d5d..aea280b4b 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/DI/VirtualThermostatExtension.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Actors.php b/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Actors.php index 894107372..7f2ffefed 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Actors.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Configuration.php b/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Configuration.php index a3847dea3..9d5f41101 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Configuration.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Preset.php b/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Preset.php index 4c6174eb6..ab3b035cd 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Preset.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Sensors.php b/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Sensors.php index 6230376f4..bd4827c12 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/Sensors.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/State.php b/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/State.php index 56d64e389..b6758ddfd 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Documents/Channels/State.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Documents/Devices/Device.php b/src/FastyBird/Addon/VirtualThermostat/src/Documents/Devices/Device.php index e0e57b3b9..e941d486b 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Documents/Devices/Device.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Drivers/Thermostat.php b/src/FastyBird/Addon/VirtualThermostat/src/Drivers/Thermostat.php index c5144f2d6..d5ec6a6b2 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Drivers/Thermostat.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Actors.php b/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Actors.php index 910502d9e..c5d9270af 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Actors.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Configuration.php b/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Configuration.php index e74250ab5..32b0988cf 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Configuration.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Preset.php b/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Preset.php index cdac69ebc..aadad1ec0 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Preset.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Sensors.php b/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Sensors.php index eff23849f..b9e792a64 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/Sensors.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/State.php b/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/State.php index eabb60290..f1752c89f 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Entities/Channels/State.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Entities/Devices/Device.php b/src/FastyBird/Addon/VirtualThermostat/src/Entities/Devices/Device.php index da41d2d87..7c6565f3d 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Entities/Devices/Device.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Helpers/Device.php b/src/FastyBird/Addon/VirtualThermostat/src/Helpers/Device.php index 7a694b74c..e747d4232 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Helpers/Device.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Actors.php b/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Actors.php index 526fcc221..4f4fb30df 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Actors.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Configuration.php b/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Configuration.php index c248bf9ab..4e41260d5 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Configuration.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Preset.php b/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Preset.php index d10e035f0..0e2b6423a 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Preset.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Sensors.php b/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Sensors.php index 397bf9cbe..07cceeee9 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/Sensors.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/State.php b/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/State.php index d2095bd3c..c12f272db 100644 --- a/src/FastyBird/Addon/VirtualThermostat/src/Hydrators/Channels/State.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/BaseTestCase.php index 7ba63b295..3113c955b 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/DI/VirtualThermostatExtensionTest.php b/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/DI/VirtualThermostatExtensionTest.php index f5b124343..af2069753 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/DI/VirtualThermostatExtensionTest.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/DbTestCase.php b/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/DbTestCase.php index 75ffd03d8..165d919b5 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/Drivers/ThermostatTest.php b/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/Drivers/ThermostatTest.php index 1ac3a236f..87b01303a 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/cases/unit/Drivers/ThermostatTest.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/common.neon b/src/FastyBird/Addon/VirtualThermostat/tests/common.neon index ebe2f9ba9..cef26c50a 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/common.neon +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyChannelDocument.php b/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyChannelDocument.php index 21740a04e..06a762055 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyChannelDocument.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyChannelEntity.php b/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyChannelEntity.php index 791bedfde..2b7acb237 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyChannelEntity.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyConnectorDocument.php b/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyConnectorDocument.php index e29daa0c2..8f8333cc0 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyConnectorDocument.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyConnectorEntity.php b/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyConnectorEntity.php index 1725f8165..80fb3b7e9 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyConnectorEntity.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyDeviceDocument.php b/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyDeviceDocument.php index 944c4f0b2..ac1614d50 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyDeviceDocument.php +++ b/src/FastyBird/Addon/VirtualThermostat/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/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyDeviceEntity.php b/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyDeviceEntity.php index 63e9500cf..5268ec1d6 100644 --- a/src/FastyBird/Addon/VirtualThermostat/tests/fixtures/dummy/DummyDeviceEntity.php +++ b/src/FastyBird/Addon/VirtualThermostat/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] diff --git a/src/FastyBird/Automator/DateTime/composer.json b/src/FastyBird/Automator/DateTime/composer.json index b643f2d8a..7226073b5 100644 --- a/src/FastyBird/Automator/DateTime/composer.json +++ b/src/FastyBird/Automator/DateTime/composer.json @@ -34,13 +34,13 @@ "ext-pcntl": "*", "binsoul/net-mqtt": "^0.8", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/metadata-library": "dev-main", "fastybird/triggers-module": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "orisai/object-mapper": "^0.2", "psr/log": "^3.0", - "ramsey/uuid": "^4.5", + "ramsey/uuid": "^4.7", "react/async": "^4.0", "react/promise": "^3", "react/socket": "^1.12", diff --git a/src/FastyBird/Automator/DateTime/src/DI/DateTimeExtension.php b/src/FastyBird/Automator/DateTime/src/DI/DateTimeExtension.php index fe456940b..b9de2db47 100644 --- a/src/FastyBird/Automator/DateTime/src/DI/DateTimeExtension.php +++ b/src/FastyBird/Automator/DateTime/src/DI/DateTimeExtension.php @@ -18,9 +18,9 @@ use Doctrine\Persistence; use FastyBird\Automator\DateTime\Hydrators; use FastyBird\Automator\DateTime\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; @@ -115,7 +115,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); @@ -130,7 +130,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/FastyBird/Automator/DateTime/src/Documents/Conditions/DateCondition.php b/src/FastyBird/Automator/DateTime/src/Documents/Conditions/DateCondition.php index 60f0977cd..1081104c3 100644 --- a/src/FastyBird/Automator/DateTime/src/Documents/Conditions/DateCondition.php +++ b/src/FastyBird/Automator/DateTime/src/Documents/Conditions/DateCondition.php @@ -17,7 +17,7 @@ use DateTimeInterface; use FastyBird\Automator\DateTime\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Triggers\Documents as TriggersDocuments; use Orisai\ObjectMapper; use Ramsey\Uuid; @@ -31,8 +31,8 @@ * * @author Adam Kadlec */ -#[DOC\Document(entity: Entities\Conditions\DateCondition::class)] -#[DOC\DiscriminatorEntry(name: Entities\Conditions\DateCondition::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Conditions\DateCondition::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Conditions\DateCondition::TYPE)] final class DateCondition extends TriggersDocuments\Conditions\Condition { diff --git a/src/FastyBird/Automator/DateTime/src/Documents/Conditions/TimeCondition.php b/src/FastyBird/Automator/DateTime/src/Documents/Conditions/TimeCondition.php index cdbd94311..751610132 100644 --- a/src/FastyBird/Automator/DateTime/src/Documents/Conditions/TimeCondition.php +++ b/src/FastyBird/Automator/DateTime/src/Documents/Conditions/TimeCondition.php @@ -17,7 +17,7 @@ use DateTimeInterface; use FastyBird\Automator\DateTime\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Triggers\Documents as TriggersDocuments; use Orisai\ObjectMapper; use Ramsey\Uuid; @@ -31,8 +31,8 @@ * * @author Adam Kadlec */ -#[DOC\Document(entity: Entities\Conditions\TimeCondition::class)] -#[DOC\DiscriminatorEntry(name: Entities\Conditions\TimeCondition::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Conditions\TimeCondition::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Conditions\TimeCondition::TYPE)] final class TimeCondition extends TriggersDocuments\Conditions\Condition { diff --git a/src/FastyBird/Automator/DateTime/src/Entities/Conditions/DateCondition.php b/src/FastyBird/Automator/DateTime/src/Entities/Conditions/DateCondition.php index ff4a37a21..1b6ac126a 100644 --- a/src/FastyBird/Automator/DateTime/src/Entities/Conditions/DateCondition.php +++ b/src/FastyBird/Automator/DateTime/src/Entities/Conditions/DateCondition.php @@ -17,7 +17,7 @@ use DateTimeInterface; 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\Triggers\Entities as TriggersEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DateTime/src/Entities/Conditions/TimeCondition.php b/src/FastyBird/Automator/DateTime/src/Entities/Conditions/TimeCondition.php index dfce096de..9af897ee9 100644 --- a/src/FastyBird/Automator/DateTime/src/Entities/Conditions/TimeCondition.php +++ b/src/FastyBird/Automator/DateTime/src/Entities/Conditions/TimeCondition.php @@ -19,7 +19,7 @@ use DateTimeZone; use Doctrine\ORM\Mapping as ORM; use FastyBird\Automator\DateTime\Exceptions; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Module\Triggers\Entities as TriggersEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; use Nette\Utils; diff --git a/src/FastyBird/Automator/DateTime/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Automator/DateTime/tests/cases/unit/BaseTestCase.php index 998a28d74..133a595cd 100644 --- a/src/FastyBird/Automator/DateTime/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Automator/DateTime/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Automator\DateTime\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/src/FastyBird/Automator/DateTime/tests/cases/unit/DI/DateTimeExtensionTest.php b/src/FastyBird/Automator/DateTime/tests/cases/unit/DI/DateTimeExtensionTest.php index edc25955b..8d9c81bf6 100644 --- a/src/FastyBird/Automator/DateTime/tests/cases/unit/DI/DateTimeExtensionTest.php +++ b/src/FastyBird/Automator/DateTime/tests/cases/unit/DI/DateTimeExtensionTest.php @@ -6,7 +6,7 @@ use FastyBird\Automator\DateTime\Hydrators; use FastyBird\Automator\DateTime\Schemas; use FastyBird\Automator\DateTime\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; /** diff --git a/src/FastyBird/Automator/DateTime/tests/cases/unit/DbTestCase.php b/src/FastyBird/Automator/DateTime/tests/cases/unit/DbTestCase.php index 66db3888f..3fc7ea6a2 100644 --- a/src/FastyBird/Automator/DateTime/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Automator/DateTime/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Automator\DateTime\DI; use FastyBird\Automator\DateTime\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/src/FastyBird/Automator/DateTime/tests/cases/unit/Entities/Conditions/ConditionTest.php b/src/FastyBird/Automator/DateTime/tests/cases/unit/Entities/Conditions/ConditionTest.php index 547b85703..0cc8dc5a2 100644 --- a/src/FastyBird/Automator/DateTime/tests/cases/unit/Entities/Conditions/ConditionTest.php +++ b/src/FastyBird/Automator/DateTime/tests/cases/unit/Entities/Conditions/ConditionTest.php @@ -7,7 +7,7 @@ use FastyBird\Automator\DateTime\Entities; use FastyBird\Automator\DateTime\Exceptions; use FastyBird\Automator\DateTime\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Triggers\Models as TriggersModels; use FastyBird\Module\Triggers\Queries as TriggersQueries; use Nette; diff --git a/src/FastyBird/Automator/DateTime/tests/common.neon b/src/FastyBird/Automator/DateTime/tests/common.neon index 630b0c18d..5b0f1d6d3 100644 --- a/src/FastyBird/Automator/DateTime/tests/common.neon +++ b/src/FastyBird/Automator/DateTime/tests/common.neon @@ -28,8 +28,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 fbTriggersModule : FastyBird\Module\Triggers\DI\TriggersExtension services: @@ -83,10 +83,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -106,3 +102,7 @@ fbJsonApi: fbDateTimeFactory: frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] diff --git a/src/FastyBird/Automator/DevicesModule/composer.json b/src/FastyBird/Automator/DevicesModule/composer.json index d5176e501..af18c805a 100644 --- a/src/FastyBird/Automator/DevicesModule/composer.json +++ b/src/FastyBird/Automator/DevicesModule/composer.json @@ -33,14 +33,14 @@ "ext-pcntl": "*", "binsoul/net-mqtt": "^0.8", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/devices-module": "dev-main", "fastybird/metadata-library": "dev-main", "fastybird/triggers-module": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "orisai/object-mapper": "^0.2", "psr/log": "^3.0", - "ramsey/uuid": "^4.5", + "ramsey/uuid": "^4.7", "react/async": "^4.0", "react/promise": "^3", "react/socket": "^1.12", diff --git a/src/FastyBird/Automator/DevicesModule/src/DI/DevicesModuleExtension.php b/src/FastyBird/Automator/DevicesModule/src/DI/DevicesModuleExtension.php index 7e16318fa..54dc3b182 100644 --- a/src/FastyBird/Automator/DevicesModule/src/DI/DevicesModuleExtension.php +++ b/src/FastyBird/Automator/DevicesModule/src/DI/DevicesModuleExtension.php @@ -19,9 +19,9 @@ use FastyBird\Automator\DevicesModule\Hydrators; use FastyBird\Automator\DevicesModule\Schemas; use FastyBird\Automator\DevicesModule\Subscribers; -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; @@ -161,7 +161,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); @@ -176,7 +176,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/FastyBird/Automator/DevicesModule/src/Documents/Actions/ChannelPropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/ChannelPropertyAction.php index f71445288..b141ea9fd 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/ChannelPropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/ChannelPropertyAction.php @@ -16,8 +16,8 @@ namespace FastyBird\Automator\DevicesModule\Documents\Actions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Module\Triggers\Documents as TriggersDocuments; use Orisai\ObjectMapper; use Ramsey\Uuid; @@ -31,8 +31,8 @@ * * @author Adam Kadlec */ -#[DOC\Document(entity: Entities\Actions\ChannelPropertyAction::class)] -#[DOC\DiscriminatorEntry(name: Entities\Actions\ChannelPropertyAction::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Actions\ChannelPropertyAction::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Actions\ChannelPropertyAction::TYPE)] final class ChannelPropertyAction extends TriggersDocuments\Actions\Action { diff --git a/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/DevicePropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/DevicePropertyAction.php index 2b0d64a63..b9c8b1592 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/DevicePropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Documents/Actions/DevicePropertyAction.php @@ -16,8 +16,8 @@ namespace FastyBird\Automator\DevicesModule\Documents\Actions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Module\Triggers\Documents as TriggersDocuments; use Orisai\ObjectMapper; use Ramsey\Uuid; @@ -31,8 +31,8 @@ * * @author Adam Kadlec */ -#[DOC\Document(entity: Entities\Actions\DevicePropertyAction::class)] -#[DOC\DiscriminatorEntry(name: Entities\Actions\DevicePropertyAction::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Actions\DevicePropertyAction::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Actions\DevicePropertyAction::TYPE)] final class DevicePropertyAction extends TriggersDocuments\Actions\Action { diff --git a/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/ChannelPropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/ChannelPropertyCondition.php index 4715e985e..4c38370fa 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/ChannelPropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/ChannelPropertyCondition.php @@ -16,8 +16,8 @@ namespace FastyBird\Automator\DevicesModule\Documents\Conditions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Module\Triggers\Documents as TriggersDocuments; use FastyBird\Module\Triggers\Types as TriggersTypes; use Orisai\ObjectMapper; @@ -32,8 +32,8 @@ * * @author Adam Kadlec */ -#[DOC\Document(entity: Entities\Conditions\ChannelPropertyCondition::class)] -#[DOC\DiscriminatorEntry(name: Entities\Conditions\ChannelPropertyCondition::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Conditions\ChannelPropertyCondition::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Conditions\ChannelPropertyCondition::TYPE)] final class ChannelPropertyCondition extends TriggersDocuments\Conditions\Condition { diff --git a/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/DevicePropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/DevicePropertyCondition.php index 337a6ff62..749fcc48e 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/DevicePropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Documents/Conditions/DevicePropertyCondition.php @@ -16,8 +16,8 @@ namespace FastyBird\Automator\DevicesModule\Documents\Conditions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Module\Triggers\Documents as TriggersDocuments; use FastyBird\Module\Triggers\Types as TriggersTypes; use Orisai\ObjectMapper; @@ -32,8 +32,8 @@ * * @author Adam Kadlec */ -#[DOC\Document(entity: Entities\Conditions\DevicePropertyCondition::class)] -#[DOC\DiscriminatorEntry(name: Entities\Conditions\DevicePropertyCondition::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Conditions\DevicePropertyCondition::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Conditions\DevicePropertyCondition::TYPE)] final class DevicePropertyCondition extends TriggersDocuments\Conditions\Condition { diff --git a/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/ChannelPropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/ChannelPropertyAction.php index 09a22a1e8..1af5af118 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/ChannelPropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/ChannelPropertyAction.php @@ -16,7 +16,7 @@ namespace FastyBird\Automator\DevicesModule\Entities\Actions; 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\Triggers\Entities as TriggersEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/DevicePropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/DevicePropertyAction.php index c3fdab4b5..15f3753da 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/DevicePropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/DevicePropertyAction.php @@ -16,7 +16,7 @@ namespace FastyBird\Automator\DevicesModule\Entities\Actions; 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\Triggers\Entities as TriggersEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/PropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/PropertyAction.php index 53895f3bb..195f12ea3 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/PropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Entities/Actions/PropertyAction.php @@ -16,9 +16,9 @@ namespace FastyBird\Automator\DevicesModule\Entities\Actions; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Triggers\Entities as TriggersEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; use Ramsey\Uuid; @@ -85,7 +85,7 @@ public function getDevice(): Uuid\UuidInterface /** * {@inheritDoc} * - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -93,7 +93,7 @@ public function toArray(): array { return array_merge(parent::toArray(), [ 'device' => $this->getDevice()->toString(), - 'value' => MetadataUtilities\Value::toString($this->getValue()), + 'value' => ToolsUtilities\Value::toString($this->getValue()), ]); } diff --git a/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/ChannelPropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/ChannelPropertyCondition.php index bd365bb04..ee175cb78 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/ChannelPropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/ChannelPropertyCondition.php @@ -16,7 +16,7 @@ namespace FastyBird\Automator\DevicesModule\Entities\Conditions; 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\Triggers\Entities as TriggersEntities; use FastyBird\Module\Triggers\Types as TriggersTypes; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; diff --git a/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/DevicePropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/DevicePropertyCondition.php index 72484487f..3893d033f 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/DevicePropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/DevicePropertyCondition.php @@ -16,7 +16,7 @@ namespace FastyBird\Automator\DevicesModule\Entities\Conditions; 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\Triggers\Entities as TriggersEntities; use FastyBird\Module\Triggers\Types as TriggersTypes; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; diff --git a/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/PropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/PropertyCondition.php index d6ffcd650..410e27436 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/PropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Entities/Conditions/PropertyCondition.php @@ -16,9 +16,9 @@ namespace FastyBird\Automator\DevicesModule\Entities\Conditions; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Triggers\Entities as TriggersEntities; use FastyBird\Module\Triggers\Types as TriggersTypes; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; @@ -121,7 +121,7 @@ public function validate(string $value): bool /** * {@inheritDoc} * - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError */ @@ -130,7 +130,7 @@ public function toArray(): array return array_merge(parent::toArray(), [ 'device' => $this->getDevice()->toString(), 'operator' => $this->getOperator()->value, - 'operand' => MetadataUtilities\Value::toString($this->getOperand()), + 'operand' => ToolsUtilities\Value::toString($this->getOperand()), ]); } diff --git a/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/ChannelPropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/ChannelPropertyAction.php index 425ca4709..1833a8b80 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/ChannelPropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/ChannelPropertyAction.php @@ -16,9 +16,9 @@ namespace FastyBird\Automator\DevicesModule\Schemas\Actions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Triggers\Schemas as TriggersSchemas; use Neomerx\JsonApi; use TypeError; @@ -55,7 +55,7 @@ public function getEntityClass(): string /** * @return iterable * - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError * @@ -70,7 +70,7 @@ public function getAttributes( 'device' => $resource->getDevice()->toString(), 'channel' => $resource->getChannel()->toString(), 'property' => $resource->getProperty()->toString(), - 'value' => MetadataUtilities\Value::toString($resource->getValue()), + 'value' => ToolsUtilities\Value::toString($resource->getValue()), ]); } diff --git a/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/DevicePropertyAction.php b/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/DevicePropertyAction.php index 5f53e4622..07bc7aa1c 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/DevicePropertyAction.php +++ b/src/FastyBird/Automator/DevicesModule/src/Schemas/Actions/DevicePropertyAction.php @@ -16,9 +16,9 @@ namespace FastyBird\Automator\DevicesModule\Schemas\Actions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Triggers\Schemas as TriggersSchemas; use Neomerx\JsonApi; use TypeError; @@ -55,7 +55,7 @@ public function getEntityClass(): string /** * @return iterable * - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError * @@ -69,7 +69,7 @@ public function getAttributes( return array_merge((array) parent::getAttributes($resource, $context), [ 'device' => $resource->getDevice()->toString(), 'property' => $resource->getProperty()->toString(), - 'value' => MetadataUtilities\Value::toString($resource->getValue()), + 'value' => ToolsUtilities\Value::toString($resource->getValue()), ]); } diff --git a/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/ChannelPropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/ChannelPropertyCondition.php index f2c4f0810..fb2c8f793 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/ChannelPropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/ChannelPropertyCondition.php @@ -16,9 +16,9 @@ namespace FastyBird\Automator\DevicesModule\Schemas\Conditions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Triggers\Schemas as TriggersSchemas; use Neomerx\JsonApi; use TypeError; @@ -56,7 +56,7 @@ public function getEntityClass(): string /** * @return iterable|null> * - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError * @@ -72,7 +72,7 @@ public function getAttributes( 'channel' => $resource->getChannel()->toString(), 'property' => $resource->getProperty()->toString(), 'operator' => $resource->getOperator()->value, - 'operand' => MetadataUtilities\Value::toString($resource->getOperand()), + 'operand' => ToolsUtilities\Value::toString($resource->getOperand()), ]); } diff --git a/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/DevicePropertyCondition.php b/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/DevicePropertyCondition.php index 848fb5393..c1723a679 100644 --- a/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/DevicePropertyCondition.php +++ b/src/FastyBird/Automator/DevicesModule/src/Schemas/Conditions/DevicePropertyCondition.php @@ -16,9 +16,9 @@ namespace FastyBird\Automator\DevicesModule\Schemas\Conditions; use FastyBird\Automator\DevicesModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Triggers\Schemas as TriggersSchemas; use Neomerx\JsonApi; use TypeError; @@ -56,7 +56,7 @@ public function getEntityClass(): string /** * @return iterable|null> * - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument * @throws TypeError * @throws ValueError * @@ -71,7 +71,7 @@ public function getAttributes( 'device' => $resource->getDevice()->toString(), 'property' => $resource->getProperty()->toString(), 'operator' => $resource->getOperator()->value, - 'operand' => MetadataUtilities\Value::toString($resource->getOperand()), + 'operand' => ToolsUtilities\Value::toString($resource->getOperand()), ]); } diff --git a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/BaseTestCase.php index 1f6a8490e..47e73c6e7 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Automator\DevicesModule\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/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DI/DevicesModuleExtensionTest.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DI/DevicesModuleExtensionTest.php index 02b58817f..85eddeff3 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DI/DevicesModuleExtensionTest.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DI/DevicesModuleExtensionTest.php @@ -7,7 +7,7 @@ use FastyBird\Automator\DevicesModule\Schemas; use FastyBird\Automator\DevicesModule\Subscribers; use FastyBird\Automator\DevicesModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; /** diff --git a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DbTestCase.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DbTestCase.php index c753c9488..7d9ea6e14 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Automator\DevicesModule\DI; use FastyBird\Automator\DevicesModule\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/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Actions/ActionTest.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Actions/ActionTest.php index cd23645fe..c9d453d61 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Actions/ActionTest.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Actions/ActionTest.php @@ -7,7 +7,7 @@ use FastyBird\Automator\DevicesModule\Exceptions; use FastyBird\Automator\DevicesModule\Queries; use FastyBird\Automator\DevicesModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Triggers\Models as TriggersModels; use Nette; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Conditions/ConditionTest.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Conditions/ConditionTest.php index 172eae306..6e55d09ea 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Conditions/ConditionTest.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Entities/Conditions/ConditionTest.php @@ -7,7 +7,7 @@ use FastyBird\Automator\DevicesModule\Exceptions; use FastyBird\Automator\DevicesModule\Queries; use FastyBird\Automator\DevicesModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Triggers\Models as TriggersModels; use Nette; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindActionsTest.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindActionsTest.php index ee4e53775..ce046c765 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindActionsTest.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindActionsTest.php @@ -7,7 +7,7 @@ use FastyBird\Automator\DevicesModule\Exceptions; use FastyBird\Automator\DevicesModule\Queries; use FastyBird\Automator\DevicesModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Triggers\Models as TriggersModels; use Nette; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindConditionsTest.php b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindConditionsTest.php index 36c744c5e..c5a1d5216 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindConditionsTest.php +++ b/src/FastyBird/Automator/DevicesModule/tests/cases/unit/Queries/FindConditionsTest.php @@ -7,7 +7,7 @@ use FastyBird\Automator\DevicesModule\Exceptions; use FastyBird\Automator\DevicesModule\Queries; use FastyBird\Automator\DevicesModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Triggers\Models as TriggersModels; use Nette; use Ramsey\Uuid; diff --git a/src/FastyBird/Automator/DevicesModule/tests/common.neon b/src/FastyBird/Automator/DevicesModule/tests/common.neon index e4dd4df26..07bea9a98 100644 --- a/src/FastyBird/Automator/DevicesModule/tests/common.neon +++ b/src/FastyBird/Automator/DevicesModule/tests/common.neon @@ -28,8 +28,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 fbTriggersModule : FastyBird\Module\Triggers\DI\TriggersExtension fbDevicesModule : FastyBird\Module\Devices\DI\DevicesExtension @@ -84,10 +84,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -107,3 +103,7 @@ fbJsonApi: fbDateTimeFactory: frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/composer.json b/src/FastyBird/Bridge/DevicesModuleUiModule/composer.json index dac9df836..49209ac5a 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/composer.json +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/composer.json @@ -31,11 +31,11 @@ "require": { "php": ">=8.2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/devices-module": "dev-main", - "fastybird/exchange-library": "dev-main", + "fastybird/exchange": "dev-main", "fastybird/ui-module": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "orisai/object-mapper": "^0.2", "psr/log": "^3.0", "symplify/vendor-patches": "^11.2" diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Consumers/SocketsBridge.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Consumers/SocketsBridge.php index 199893152..798760eac 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Consumers/SocketsBridge.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Consumers/SocketsBridge.php @@ -18,11 +18,11 @@ use FastyBird\Bridge\DevicesModuleUiModule; use FastyBird\Bridge\DevicesModuleUiModule\Documents; use FastyBird\Bridge\DevicesModuleUiModule\Queries; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Exchange\Consumers as ExchangeConsumers; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Exchange\Consumers as ExchangeConsumers; +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\Module\Devices; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Ui; @@ -78,7 +78,7 @@ public function __construct( public function consume( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $document, + ApplicationDocuments\Document|null $document, ): void { if ( @@ -127,7 +127,7 @@ public function consume( 'data' => array_merge( $dataSource->toArray(), [ - 'value' => MetadataUtilities\Value::flattenValue($document->getRead()->getActualValue()), + 'value' => ToolsUtilities\Value::flattenValue($document->getRead()->getActualValue()), ], ), ]; @@ -200,7 +200,7 @@ private function sendMessage(array $data): bool [ 'source' => MetadataTypes\Sources\Bridge::DEVICES_MODULE_UI_MODULE->value, 'type' => 'state-entities-consumer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -210,7 +210,7 @@ private function sendMessage(array $data): bool [ 'source' => MetadataTypes\Sources\Bridge::DEVICES_MODULE_UI_MODULE->value, 'type' => 'state-entities-consumer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); } diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/DI/DevicesModuleUiModuleExtension.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/DI/DevicesModuleUiModuleExtension.php index 7d0942652..742240f5e 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/DI/DevicesModuleUiModuleExtension.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/DI/DevicesModuleUiModuleExtension.php @@ -21,11 +21,11 @@ use FastyBird\Bridge\DevicesModuleUiModule\Hydrators; use FastyBird\Bridge\DevicesModuleUiModule\Schemas; use FastyBird\Bridge\DevicesModuleUiModule\Subscribers; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Exchange\Consumers as ExchangeConsumers; -use FastyBird\Library\Exchange\DI as ExchangeDI; -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 FastyBird\Core\Exchange\Consumers as ExchangeConsumers; +use FastyBird\Core\Exchange\DI as ExchangeDI; use Nette\Bootstrap; use Nette\DI; use Nette\Schema; @@ -204,7 +204,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); @@ -219,7 +219,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/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ChannelProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ChannelProperty.php index aa7ac15dd..4ac512fbf 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ChannelProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ChannelProperty.php @@ -17,14 +17,14 @@ use DateTimeInterface; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Library\Metadata\Types as MetadataTypes; use Ramsey\Uuid; use function array_merge; -#[DOC\Document(entity: Entities\Widgets\DataSources\ChannelProperty::class)] -#[DOC\DiscriminatorEntry(name: Entities\Widgets\DataSources\ChannelProperty::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Widgets\DataSources\ChannelProperty::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Widgets\DataSources\ChannelProperty::TYPE)] class ChannelProperty extends Property { diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ConnectorProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ConnectorProperty.php index 09de8fec3..f104bcb54 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ConnectorProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/ConnectorProperty.php @@ -17,14 +17,14 @@ use DateTimeInterface; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Library\Metadata\Types as MetadataTypes; use Ramsey\Uuid; use function array_merge; -#[DOC\Document(entity: Entities\Widgets\DataSources\ConnectorProperty::class)] -#[DOC\DiscriminatorEntry(name: Entities\Widgets\DataSources\ConnectorProperty::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Widgets\DataSources\ConnectorProperty::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Widgets\DataSources\ConnectorProperty::TYPE)] class ConnectorProperty extends Property { diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/DeviceProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/DeviceProperty.php index bbd1fbf0e..700d7e20f 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/DeviceProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/DeviceProperty.php @@ -17,14 +17,14 @@ use DateTimeInterface; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use FastyBird\Library\Metadata\Types as MetadataTypes; use Ramsey\Uuid; use function array_merge; -#[DOC\Document(entity: Entities\Widgets\DataSources\DeviceProperty::class)] -#[DOC\DiscriminatorEntry(name: Entities\Widgets\DataSources\DeviceProperty::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Widgets\DataSources\DeviceProperty::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Widgets\DataSources\DeviceProperty::TYPE)] class DeviceProperty extends Property { diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/Property.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/Property.php index aedc2c5e5..8cd6fd6e2 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/Property.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Documents/Widgets/DataSources/Property.php @@ -17,16 +17,16 @@ use DateTimeInterface; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Ui\Documents as UiDocuments; use Orisai\ObjectMapper; use Ramsey\Uuid; use function array_merge; -#[DOC\MappedSuperclass] +#[ApplicationDocuments\Mapping\MappedSuperclass] abstract class Property extends UiDocuments\Widgets\DataSources\DataSource { @@ -74,7 +74,7 @@ public function toArray(): array { return array_merge(parent::toArray(), [ 'property' => $this->getProperty()->toString(), - 'value' => MetadataUtilities\Value::flattenValue($this->getValue()), + 'value' => ToolsUtilities\Value::flattenValue($this->getValue()), ]); } diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ChannelProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ChannelProperty.php index 79a3d0e0a..cf361b5af 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ChannelProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ChannelProperty.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Entities\Widgets\DataSources; 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; use FastyBird\Module\Ui\Entities as UiEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ConnectorProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ConnectorProperty.php index 04f9766d0..aacd0cd84 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ConnectorProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/ConnectorProperty.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Entities\Widgets\DataSources; 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; use FastyBird\Module\Ui\Entities as UiEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/DeviceProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/DeviceProperty.php index ed4c4090f..b40e9b91e 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/DeviceProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Entities/Widgets/DataSources/DeviceProperty.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Entities\Widgets\DataSources; 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; use FastyBird\Module\Ui\Entities as UiEntities; use IPub\DoctrineCrud\Mapping\Attribute as IPubDoctrine; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ChannelProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ChannelProperty.php index ce4d4c971..3eaef024b 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ChannelProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ChannelProperty.php @@ -18,9 +18,9 @@ use Doctrine\Persistence; use FastyBird\Bridge\DevicesModuleUiModule\Entities; use FastyBird\Bridge\DevicesModuleUiModule\Schemas; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Helpers; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Ui\Hydrators as UiHydrators; @@ -65,8 +65,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydratePropertyRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ConnectorProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ConnectorProperty.php index fda081c25..4fe09d115 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ConnectorProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/ConnectorProperty.php @@ -18,9 +18,9 @@ use Doctrine\Persistence; use FastyBird\Bridge\DevicesModuleUiModule\Entities; use FastyBird\Bridge\DevicesModuleUiModule\Schemas; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Helpers; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Ui\Hydrators as UiHydrators; @@ -65,8 +65,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydratePropertyRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/DeviceProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/DeviceProperty.php index 70deceada..2513c8112 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/DeviceProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Hydrators/Widgets/DataSources/DeviceProperty.php @@ -18,9 +18,9 @@ use Doctrine\Persistence; use FastyBird\Bridge\DevicesModuleUiModule\Entities; use FastyBird\Bridge\DevicesModuleUiModule\Schemas; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Helpers; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Ui\Hydrators as UiHydrators; @@ -65,8 +65,8 @@ public function getEntityName(): string } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydratePropertyRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ChannelProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ChannelProperty.php index 237d91e4e..f9028d240 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ChannelProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ChannelProperty.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Schemas\Widgets\DataSources; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +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; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Entities as DevicesEntities; @@ -80,13 +80,14 @@ public function getType(): string * * @return iterable * + * @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 * @@ -110,7 +111,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => $state !== null && $state->isValid() ? MetadataUtilities\Value::flattenValue( + 'value' => $state !== null && $state->isValid() ? ToolsUtilities\Value::flattenValue( $state->getRead()->getExpectedValue() ?? $state->getRead()->getActualValue(), ) : null, ], @@ -127,7 +128,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => $state !== null && $state->isValid() ? MetadataUtilities\Value::flattenValue( + 'value' => $state !== null && $state->isValid() ? ToolsUtilities\Value::flattenValue( $state->getRead()->getExpectedValue() ?? $state->getRead()->getActualValue(), ) : null, ], @@ -136,7 +137,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => MetadataUtilities\Value::flattenValue($resource->getProperty()->getValue()), + 'value' => ToolsUtilities\Value::flattenValue($resource->getProperty()->getValue()), ], ); } @@ -144,7 +145,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => MetadataUtilities\Value::flattenValue($resource->getProperty()->getValue()), + 'value' => ToolsUtilities\Value::flattenValue($resource->getProperty()->getValue()), ], ); } diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ConnectorProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ConnectorProperty.php index 1669d3e64..b7e4db6d3 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ConnectorProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/ConnectorProperty.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Schemas\Widgets\DataSources; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +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; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Entities as DevicesEntities; @@ -80,13 +80,14 @@ public function getType(): string * * @return iterable * + * @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 * @@ -110,7 +111,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => $state !== null && $state->isValid() ? MetadataUtilities\Value::flattenValue( + 'value' => $state !== null && $state->isValid() ? ToolsUtilities\Value::flattenValue( $state->getRead()->getExpectedValue() ?? $state->getRead()->getActualValue(), ) : null, ], @@ -119,7 +120,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => MetadataUtilities\Value::flattenValue($resource->getProperty()->getValue()), + 'value' => ToolsUtilities\Value::flattenValue($resource->getProperty()->getValue()), ], ); } diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/DeviceProperty.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/DeviceProperty.php index 7287368b7..beb95ea37 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/DeviceProperty.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Schemas/Widgets/DataSources/DeviceProperty.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Schemas\Widgets\DataSources; use FastyBird\Bridge\DevicesModuleUiModule\Entities; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +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; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Entities as DevicesEntities; @@ -80,13 +80,14 @@ public function getType(): string * * @return iterable * + * @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 * @@ -110,7 +111,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => $state !== null && $state->isValid() ? MetadataUtilities\Value::flattenValue( + 'value' => $state !== null && $state->isValid() ? ToolsUtilities\Value::flattenValue( $state->getRead()->getExpectedValue() ?? $state->getRead()->getActualValue(), ) : null, ], @@ -127,7 +128,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => $state !== null && $state->isValid() ? MetadataUtilities\Value::flattenValue( + 'value' => $state !== null && $state->isValid() ? ToolsUtilities\Value::flattenValue( $state->getRead()->getExpectedValue() ?? $state->getRead()->getActualValue(), ) : null, ], @@ -136,7 +137,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => MetadataUtilities\Value::flattenValue($resource->getProperty()->getValue()), + 'value' => ToolsUtilities\Value::flattenValue($resource->getProperty()->getValue()), ], ); } @@ -144,7 +145,7 @@ public function getAttributes( return array_merge( (array) $attributes, [ - 'value' => MetadataUtilities\Value::flattenValue($resource->getProperty()->getValue()), + 'value' => ToolsUtilities\Value::flattenValue($resource->getProperty()->getValue()), ], ); } diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ActionCommand.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ActionCommand.php index d3812bb5c..042c52971 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ActionCommand.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ActionCommand.php @@ -16,10 +16,9 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Subscribers; use FastyBird\Bridge\DevicesModuleUiModule\Documents; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Library\Metadata; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; -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; @@ -67,9 +66,8 @@ public static function getSubscribedEvents(): array /** * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -111,9 +109,8 @@ public function actionReceived(UiEvents\ActionCommandReceived $event): void * * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -140,9 +137,8 @@ private function handleConnectorAction( * * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -172,9 +168,8 @@ private function handleDeviceAction( * * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/DocumentsMapper.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/DocumentsMapper.php index f7062e27f..6c3f1a82a 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/DocumentsMapper.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/DocumentsMapper.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Subscribers; use FastyBird\Bridge\DevicesModuleUiModule\Documents; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; -use FastyBird\Library\Metadata\Events as MetadataEvents; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; -use FastyBird\Library\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\Events as ApplicationEvents; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\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; @@ -59,24 +59,25 @@ public function __construct( public static function getSubscribedEvents(): array { return [ - MetadataEvents\PreLoad::class => 'preLoad', + ApplicationEvents\PreLoad::class => 'preLoad', ]; } /** - * @param MetadataEvents\PreLoad $event + * @param ApplicationEvents\PreLoad $event * + * @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 */ - public function preLoad(MetadataEvents\PreLoad $event): void + public function preLoad(ApplicationEvents\PreLoad $event): void { if ( !in_array( diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ModuleEntities.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ModuleEntities.php index 00ac874bd..19d8a89b3 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ModuleEntities.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/ModuleEntities.php @@ -20,8 +20,8 @@ use Doctrine\Persistence; use FastyBird\Bridge\DevicesModuleUiModule\Documents; use FastyBird\Bridge\DevicesModuleUiModule\Queries; -use FastyBird\Library\Application\Utilities as ApplicationUtilities; -use FastyBird\Library\Exchange\Publisher as ExchangePublisher; +use FastyBird\Core\Application\EventLoop as ApplicationEventLoop; +use FastyBird\Core\Exchange\Publisher as ExchangePublisher; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Ui; @@ -51,7 +51,7 @@ public function __construct( private readonly UiModels\Configuration\Widgets\DataSources\Repository $dataSourcesRepository, private readonly UiCaching\Container $uiModuleCaching, private readonly ORM\EntityManagerInterface $entityManager, - private readonly ApplicationUtilities\EventLoopStatus $eventLoopStatus, + private readonly ApplicationEventLoop\Status $eventLoopStatus, private readonly ExchangePublisher\Publisher $publisher, private readonly ExchangePublisher\Async\Publisher $asyncPublisher, ) diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/StateEntities.php b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/StateEntities.php index bc9091b20..39c24be77 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/StateEntities.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/src/Subscribers/StateEntities.php @@ -17,8 +17,8 @@ use FastyBird\Bridge\DevicesModuleUiModule\Documents; use FastyBird\Bridge\DevicesModuleUiModule\Queries; -use FastyBird\Library\Application\Utilities as ApplicationUtilities; -use FastyBird\Library\Exchange\Publisher as ExchangePublisher; +use FastyBird\Core\Application\EventLoop as ApplicationEventLoop; +use FastyBird\Core\Exchange\Publisher as ExchangePublisher; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Events as DevicesEvents; @@ -48,7 +48,7 @@ final class StateEntities implements EventDispatcher\EventSubscriberInterface public function __construct( private readonly UiModels\Configuration\Widgets\DataSources\Repository $dataSourcesRepository, private readonly UiCaching\Container $uiModuleCaching, - private readonly ApplicationUtilities\EventLoopStatus $eventLoopStatus, + private readonly ApplicationEventLoop\Status $eventLoopStatus, private readonly ExchangePublisher\Publisher $publisher, private readonly ExchangePublisher\Async\Publisher $asyncPublisher, ) diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/BaseTestCase.php index f2274a979..f6113e8a2 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Bridge\DevicesModuleUiModule; -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 Nette\DI; use PHPUnit\Framework\TestCase; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Controllers/DataSourcesV1Test.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Controllers/DataSourcesV1Test.php index da03bdf4c..68a6cdb16 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Controllers/DataSourcesV1Test.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Controllers/DataSourcesV1Test.php @@ -4,7 +4,7 @@ use Error; use FastyBird\Bridge\DevicesModuleUiModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Library\Metadata; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DI/DevicesModuleUiModuleExtensionTest.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DI/DevicesModuleUiModuleExtensionTest.php index 707b93259..930509d1a 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DI/DevicesModuleUiModuleExtensionTest.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DI/DevicesModuleUiModuleExtensionTest.php @@ -8,7 +8,7 @@ use FastyBird\Bridge\DevicesModuleUiModule\Schemas; use FastyBird\Bridge\DevicesModuleUiModule\Subscribers; use FastyBird\Bridge\DevicesModuleUiModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; use RuntimeException; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DbTestCase.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DbTestCase.php index 99dbcdfa8..8d47b4f04 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Bridge\DevicesModuleUiModule\DI; use FastyBird\Bridge\DevicesModuleUiModule\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/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/ManagerTest.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/ManagerTest.php index 95c42db0b..ed3f81037 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/ManagerTest.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/ManagerTest.php @@ -8,7 +8,7 @@ use FastyBird\Bridge\DevicesModuleUiModule\Exceptions; use FastyBird\Bridge\DevicesModuleUiModule\Queries; use FastyBird\Bridge\DevicesModuleUiModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/RepositoryTest.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/RepositoryTest.php index 4d3a7420a..8108ac89d 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/RepositoryTest.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/cases/unit/Models/Entities/DataSources/RepositoryTest.php @@ -7,7 +7,7 @@ use FastyBird\Bridge\DevicesModuleUiModule\Exceptions; use FastyBird\Bridge\DevicesModuleUiModule\Queries; use FastyBird\Bridge\DevicesModuleUiModule\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Ui\Models as UiModels; use Nette\DI; diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/common.neon b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/common.neon index 6d06d1c8c..eec2afcaa 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/common.neon +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/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 fbUiModule : FastyBird\Module\Ui\DI\UiExtension @@ -102,10 +102,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -124,4 +120,8 @@ fbJsonApi: copyright: FastyBird s.r.o fbDateTimeFactory: - frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') \ No newline at end of file + frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] \ No newline at end of file diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/ChannelPropertyState.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/ChannelPropertyState.php index 3df61fb4e..5279247ae 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/ChannelPropertyState.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/ChannelPropertyState.php @@ -3,9 +3,9 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Tests\Fixtures\Dummy; use DateTimeInterface; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Devices\States as DevicesStates; use Orisai\ObjectMapper; use Ramsey\Uuid; @@ -123,8 +123,8 @@ public function toArray(): array { return [ 'id' => $this->getId()->toString(), - 'actual_value' => MetadataUtilities\Value::flattenValue($this->getActualValue()), - 'expected_value' => MetadataUtilities\Value::flattenValue($this->getExpectedValue()), + 'actual_value' => ToolsUtilities\Value::flattenValue($this->getActualValue()), + 'expected_value' => ToolsUtilities\Value::flattenValue($this->getExpectedValue()), 'pending' => $this->getPending() instanceof DateTimeInterface ? $this->getPending()->format(DateTimeInterface::ATOM) : $this->getPending(), diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelDocument.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelDocument.php index 56b5a4f13..6985a567d 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelDocument.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Tests\Fixtures\Dummy; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents as DevicesDocuments; -#[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 DevicesDocuments\Channels\Channel { diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelEntity.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelEntity.php index da4e5398b..5f82edc43 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelEntity.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyChannelEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\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/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorDocument.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorDocument.php index 8415ab745..d037911ff 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorDocument.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Tests\Fixtures\Dummy; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents as DevicesDocuments; -#[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 DevicesDocuments\Connectors\Connector { diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorEntity.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorEntity.php index 2bc916002..ff66703ea 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorEntity.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyConnectorEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\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/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceDocument.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceDocument.php index da84cb926..f0dfdf803 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceDocument.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\Tests\Fixtures\Dummy; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents as DevicesDocuments; -#[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 DevicesDocuments\Devices\Device { diff --git a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceEntity.php b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceEntity.php index 2aba04c95..8c195dec0 100644 --- a/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceEntity.php +++ b/src/FastyBird/Bridge/DevicesModuleUiModule/tests/fixtures/dummy/DummyDeviceEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\DevicesModuleUiModule\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/src/FastyBird/Bridge/RedisDbPluginDevicesModule/composer.json b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/composer.json index d0a795dda..2340ef588 100644 --- a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/composer.json +++ b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/composer.json @@ -31,11 +31,11 @@ "require": { "php": ">=8.2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/devices-module": "dev-main", - "fastybird/exchange-library": "dev-main", + "fastybird/exchange": "dev-main", "fastybird/redisdb-plugin": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "orisai/object-mapper": "^0.2", "psr/log": "^3.0", "symplify/vendor-patches": "^11.2" diff --git a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/DI/RedisDbPluginDevicesModuleExtension.php b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/DI/RedisDbPluginDevicesModuleExtension.php index d245dc999..be13d6653 100644 --- a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/DI/RedisDbPluginDevicesModuleExtension.php +++ b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/DI/RedisDbPluginDevicesModuleExtension.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\RedisDbPluginDevicesModule\DI; use FastyBird\Bridge\RedisDbPluginDevicesModule\Models; -use FastyBird\Library\Application\Boot as ApplicationBoot; +use FastyBird\Core\Application\Boot as ApplicationBoot; use Nette\Bootstrap; use Nette\DI; use Nette\Schema; diff --git a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/States/Property.php b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/States/Property.php index 726f18a06..ef16866ba 100644 --- a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/States/Property.php +++ b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/src/States/Property.php @@ -16,8 +16,8 @@ namespace FastyBird\Bridge\RedisDbPluginDevicesModule\States; use DateTimeInterface; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Devices\States as DevicesStates; use FastyBird\Plugin\RedisDb\States as RedisDbStates; use Orisai\ObjectMapper; @@ -157,8 +157,8 @@ public static function getUpdateFields(): array public function toArray(): array { return array_merge(parent::toArray(), [ - self::ACTUAL_VALUE_FIELD => MetadataUtilities\Value::flattenValue($this->getActualValue()), - self::EXPECTED_VALUE_FIELD => MetadataUtilities\Value::flattenValue($this->getExpectedValue()), + self::ACTUAL_VALUE_FIELD => ToolsUtilities\Value::flattenValue($this->getActualValue()), + self::EXPECTED_VALUE_FIELD => ToolsUtilities\Value::flattenValue($this->getExpectedValue()), self::PENDING_FIELD => $this->getPending() instanceof DateTimeInterface ? $this->getPending()->format(DateTimeInterface::ATOM) : $this->getPending(), diff --git a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/cases/unit/BaseTestCase.php index db81998ec..74f6f2c29 100644 --- a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Bridge\RedisDbPluginDevicesModule; -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 Nette\DI; use PHPUnit\Framework\TestCase; diff --git a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/common.neon b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/common.neon index f477345f9..83bdc7892 100644 --- a/src/FastyBird/Bridge/RedisDbPluginDevicesModule/tests/common.neon +++ b/src/FastyBird/Bridge/RedisDbPluginDevicesModule/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 fbRedisDbPlugin : FastyBird\Plugin\RedisDb\DI\RedisDbExtension @@ -83,10 +83,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -106,3 +102,7 @@ fbJsonApi: fbDateTimeFactory: frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] diff --git a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/composer.json b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/composer.json index db5cef235..9b7274be5 100644 --- a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/composer.json +++ b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/composer.json @@ -31,11 +31,11 @@ "require": { "php": ">=8.2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", - "fastybird/exchange-library": "dev-main", + "fastybird/application": "dev-main", + "fastybird/exchange": "dev-main", "fastybird/redisdb-plugin": "dev-main", "fastybird/triggers-module": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "orisai/object-mapper": "^0.2", "psr/log": "^3.0", "symplify/vendor-patches": "^11.2" diff --git a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/src/DI/RedisDbPluginTriggersModuleExtension.php b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/src/DI/RedisDbPluginTriggersModuleExtension.php index 598ae7a13..58ad8e83d 100644 --- a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/src/DI/RedisDbPluginTriggersModuleExtension.php +++ b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/src/DI/RedisDbPluginTriggersModuleExtension.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\RedisDbPluginTriggersModule\DI; use FastyBird\Bridge\RedisDbPluginTriggersModule\Models; -use FastyBird\Library\Application\Boot as ApplicationBoot; +use FastyBird\Core\Application\Boot as ApplicationBoot; use Nette\Bootstrap; use Nette\DI; use Nette\Schema; diff --git a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/cases/unit/BaseTestCase.php index 963c7e8b7..a3379ea53 100644 --- a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Bridge\RedisDbPluginTriggersModule; -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 Nette\DI; use PHPUnit\Framework\TestCase; diff --git a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/common.neon b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/common.neon index 1e2bdc1bd..c9e2b90c5 100644 --- a/src/FastyBird/Bridge/RedisDbPluginTriggersModule/tests/common.neon +++ b/src/FastyBird/Bridge/RedisDbPluginTriggersModule/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 fbTriggersModule : FastyBird\Module\Triggers\DI\TriggersExtension fbRedisDbPlugin : FastyBird\Plugin\RedisDb\DI\RedisDbExtension @@ -83,10 +83,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -106,3 +102,7 @@ fbJsonApi: fbDateTimeFactory: frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/composer.json b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/composer.json index 655e04d0b..39718c84e 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/composer.json +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/composer.json @@ -34,12 +34,12 @@ "contributte/monolog": "^0.5", "contributte/translation": "^2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/metadata-library": "dev-main", "fastybird/devices-module": "dev-main", "fastybird/homekit-connector": "dev-main", "fastybird/shelly-connector": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "psr/log": "^3.0", "symplify/vendor-patches": "^11.2" }, diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Builders/Builder.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Builders/Builder.php index 894d4ead1..aff025d5a 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Builders/Builder.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Builders/Builder.php @@ -28,12 +28,12 @@ use FastyBird\Connector\Shelly\Entities as ShellyEntities; use FastyBird\Connector\Shelly\Queries as ShellyQueries; use FastyBird\Connector\Shelly\Types as ShellyTypes; -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\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; @@ -86,7 +86,7 @@ public function __construct( private readonly DevicesModels\Entities\Channels\ChannelsManager $channelsManager, private readonly DevicesModels\Entities\Channels\Properties\PropertiesRepository $channelsPropertiesRepository, private readonly DevicesModels\Entities\Channels\Properties\PropertiesManager $channelsPropertiesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, ) { @@ -429,13 +429,13 @@ private function createAccessory( } /** - * @throws ApplicationExceptions\InvalidState * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws HomeKitExceptions\InvalidState * @throws Nette\IOException + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -680,11 +680,11 @@ function () use ($identifier, $accessory, $serviceMapping, $serviceIndex): Entit } /** - * @throws ApplicationExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws HomeKitExceptions\InvalidState * @throws Nette\IOException + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1017,9 +1017,9 @@ private function createCharacteristic( } /** - * @return MetadataFormats\StringEnum|array|null + * @return ToolsFormats\StringEnum|array|null */ - private function buildFormat(Utils\ArrayHash $characteristicMetadata): MetadataFormats\StringEnum|array|null + private function buildFormat(Utils\ArrayHash $characteristicMetadata): ToolsFormats\StringEnum|array|null { $format = null; @@ -1027,7 +1027,7 @@ private function buildFormat(Utils\ArrayHash $characteristicMetadata): MetadataF $characteristicMetadata->offsetExists('ValidValues') && $characteristicMetadata->offsetGet('ValidValues') instanceof Utils\ArrayHash ) { - $format = new MetadataFormats\StringEnum( + $format = new ToolsFormats\StringEnum( array_values((array) $characteristicMetadata->offsetGet('ValidValues')), ); } @@ -1052,11 +1052,10 @@ private function buildFormat(Utils\ArrayHash $characteristicMetadata): MetadataF /** * @return array * - * @throws ApplicationExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1092,7 +1091,7 @@ private function loadShellyMapping(ShellyEntities\Devices\Device $device): array $shelliesMapping = $this->mappingBuilder->getGen1Mapping(); return $shelliesMapping->findForModel( - MetadataUtilities\Value::toString($shellyModelProperty->getValue(), true), + ToolsUtilities\Value::toString($shellyModelProperty->getValue(), true), ); } @@ -1100,7 +1099,7 @@ private function loadShellyMapping(ShellyEntities\Devices\Device $device): array $shelliesMapping = $this->mappingBuilder->getGen2Mapping(); return $shelliesMapping->findForModel( - MetadataUtilities\Value::toString($shellyModelProperty->getValue(), true), + ToolsUtilities\Value::toString($shellyModelProperty->getValue(), true), ); } diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Commands/Build.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Commands/Build.php index 026cdcab4..f9e930791 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Commands/Build.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Commands/Build.php @@ -27,11 +27,11 @@ use FastyBird\Connector\Shelly\Entities as ShellyEntities; use FastyBird\Connector\Shelly\Queries as ShellyQueries; use FastyBird\Connector\Shelly\Types as ShellyTypes; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +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\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -79,7 +79,7 @@ public function __construct( private readonly DevicesModels\Entities\Devices\DevicesRepository $devicesRepository, private readonly DevicesModels\Entities\Devices\DevicesManager $devicesManager, private readonly DevicesModels\Entities\Devices\Properties\PropertiesRepository $devicesPropertiesRepository, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, string|null $name = null, ) @@ -98,12 +98,13 @@ protected function configure(): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -129,12 +130,11 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $ } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -201,7 +201,7 @@ private function createBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::SHELLY_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -214,12 +214,11 @@ private function createBridge(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -282,7 +281,7 @@ private function editBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::SHELLY_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -295,8 +294,8 @@ private function editBridge(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteBridge(Style\SymfonyStyle $io): void { @@ -349,7 +348,7 @@ private function deleteBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::SHELLY_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -408,12 +407,13 @@ private function listBridges(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -771,11 +771,10 @@ function (string|int|null $answer) use ($devices): Entities\Devices\Shelly { } /** - * @throws ApplicationExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -817,7 +816,7 @@ private function askWhichCategory( $shelliesMapping = $this->mappingBuilder->getGen1Mapping(); $devicesMapping = $shelliesMapping->findForModel( - MetadataUtilities\Value::toString($shellyModelProperty->getValue(), true), + ToolsUtilities\Value::toString($shellyModelProperty->getValue(), true), ); foreach ($devicesMapping as $deviceMapping) { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BaseV1.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BaseV1.php index abe30138f..e5874e051 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BaseV1.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BaseV1.php @@ -21,10 +21,10 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Exceptions; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Router; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\JsonApi\Builder as JsonApiBuilder; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Hydrators as JsonApiHydrators; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; use FastyBird\Module\Devices\Router as DevicesRouter; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; @@ -231,14 +231,14 @@ protected function getOrmConnection(): Connection } /** - * @param DoctrineCrud\Entities\IEntity|MetadataDocuments\Document|ResultSet|array $data + * @param DoctrineCrud\Entities\IEntity|ApplicationDocuments\Document|ResultSet|array $data * * @throws Exception */ protected function buildResponse( Message\ServerRequestInterface $request, ResponseInterface $response, - ResultSet|DoctrineCrud\Entities\IEntity|MetadataDocuments\Document|array $data, + ResultSet|DoctrineCrud\Entities\IEntity|ApplicationDocuments\Document|array $data, ): ResponseInterface { $totalCount = null; diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BridgesV1.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BridgesV1.php index a71b475a6..4869c09f9 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BridgesV1.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Controllers/BridgesV1.php @@ -25,11 +25,12 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Router; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Schemas; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; @@ -159,7 +160,7 @@ public function create( ); } - $category = MetadataUtilities\Value::toString($categoryProperty->getValue(), true); + $category = ToolsUtilities\Value::toString($categoryProperty->getValue(), true); $device = $this->bridgeBuilder->build( $device->getParent(), @@ -265,7 +266,7 @@ public function create( [ 'source' => MetadataTypes\Sources\Bridge::SHELLY_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -359,7 +360,7 @@ public function update( ); } - $category = MetadataUtilities\Value::toString($categoryProperty->getValue(), true); + $category = ToolsUtilities\Value::toString($categoryProperty->getValue(), true); $device = $this->bridgeBuilder->build( $device->getParent(), @@ -411,7 +412,7 @@ public function update( [ 'source' => MetadataTypes\Sources\Bridge::SHELLY_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -458,6 +459,7 @@ public function update( * @throws InvalidArgumentException * @throws JsonApiExceptions\JsonApi * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState * * @Secured * @Secured\Role(manager,administrator) @@ -493,7 +495,7 @@ public function delete( [ 'source' => MetadataTypes\Sources\Bridge::SHELLY_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -517,8 +519,8 @@ public function delete( } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApi + * @throws ToolsExceptions\InvalidState */ protected function findDevice(string $id): Entities\Devices\Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/DI/ShellyConnectorHomeKitConnectorExtension.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/DI/ShellyConnectorHomeKitConnectorExtension.php index 8dc152294..b750f429d 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/DI/ShellyConnectorHomeKitConnectorExtension.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/DI/ShellyConnectorHomeKitConnectorExtension.php @@ -26,9 +26,9 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Protocol; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Router; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\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 IPub\SlimRouter\Routing as SlimRouterRouting; use Nette\Bootstrap; use Nette\DI; @@ -268,7 +268,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); @@ -283,7 +283,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/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputButton.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputButton.php index 0b7930f11..ef900884c 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputButton.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputButton.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\InputButton::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\InputButton::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\InputButton::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\InputButton::TYPE)] class InputButton extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputSwitch.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputSwitch.php index 34539c3b9..985cb8dea 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputSwitch.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/InputSwitch.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\InputSwitch::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\InputSwitch::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\InputSwitch::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\InputSwitch::TYPE)] class InputSwitch extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Lightbulb.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Lightbulb.php index 369888c88..60f4f3a6f 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Lightbulb.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Lightbulb.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Lightbulb::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Lightbulb::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Lightbulb::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Lightbulb::TYPE)] class Lightbulb extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Outlet.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Outlet.php index 9e5caa0c4..117d458ce 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Outlet.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Outlet.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Outlet::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Outlet::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Outlet::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Outlet::TYPE)] class Outlet extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Relay.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Relay.php index 6d44e75b6..b74008ad2 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Relay.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Relay.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Relay::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Relay::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Relay::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Relay::TYPE)] class Relay extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Shelly.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Shelly.php index fc55e22a5..fadff1299 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Shelly.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Shelly.php @@ -16,9 +16,9 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Connector\HomeKit\Documents as HomeKitDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\MappedSuperclass()] +#[ApplicationDocuments\Mapping\MappedSuperclass()] abstract class Shelly extends HomeKitDocuments\Channels\Channel { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Valve.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Valve.php index b9a4ee83a..71297548e 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Valve.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/Valve.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Valve::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Valve::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Valve::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Valve::TYPE)] class Valve extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/WindowCovering.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/WindowCovering.php index 4fdf2b17a..b7e1dcbc8 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/WindowCovering.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Channels/WindowCovering.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\WindowCovering::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\WindowCovering::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\WindowCovering::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\WindowCovering::TYPE)] class WindowCovering extends Shelly { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Devices/Shelly.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Devices/Shelly.php index 747291623..e8d0fc926 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Devices/Shelly.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Documents/Devices/Shelly.php @@ -17,10 +17,10 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities; use FastyBird\Connector\HomeKit\Documents as HomeKitDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Devices\Shelly::class)] -#[DOC\DiscriminatorEntry(name: Entities\Devices\Shelly::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Devices\Shelly::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Devices\Shelly::TYPE)] class Shelly extends HomeKitDocuments\Devices\Device { diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputButton.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputButton.php index a02746ae0..1bd8c9dba 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputButton.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputButton.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputSwitch.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputSwitch.php index a27620ff1..c3d3b9120 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputSwitch.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/InputSwitch.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Lightbulb.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Lightbulb.php index 17a97489e..dfc809ef6 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Lightbulb.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Lightbulb.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Outlet.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Outlet.php index 834a30b3c..174ae22b3 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Outlet.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Outlet.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Relay.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Relay.php index 80e5d8ec5..d46d00dbd 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Relay.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Relay.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Valve.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Valve.php index 0490e006e..61f26b701 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Valve.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/Valve.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/WindowCovering.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/WindowCovering.php index d35b42070..4023fb04a 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/WindowCovering.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Channels/WindowCovering.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Devices/Shelly.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Devices/Shelly.php index 786f486b3..fcca436b8 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Devices/Shelly.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Entities/Devices/Shelly.php @@ -19,7 +19,7 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Exceptions; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\Shelly\Entities as ShellyEntities; -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 Nette\Utils; diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Hydrators/Devices/Shelly.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Hydrators/Devices/Shelly.php index 27c5f170b..41173683f 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Hydrators/Devices/Shelly.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Hydrators/Devices/Shelly.php @@ -21,10 +21,10 @@ use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\HomeKit\Hydrators as HomeKitHydrators; use FastyBird\Connector\Shelly\Entities as ShellyEntities; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Helpers; use FastyBird\JsonApi\JsonApi as JsonApiJsonApi; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Hydrators as DevicesHydrators; use FastyBird\Module\Devices\Models as DevicesModels; @@ -102,8 +102,8 @@ public function getEntityName(): string /** * @param Entities\Devices\Shelly|null $entity * - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateConnectorRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, @@ -143,8 +143,8 @@ protected function hydrateConnectorRelationship( /** * @return array * - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateParentsRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationships, diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Protocol/Services/Lightbulb.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Protocol/Services/Lightbulb.php index e4a183590..dcb59a741 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Protocol/Services/Lightbulb.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/src/Protocol/Services/Lightbulb.php @@ -17,7 +17,7 @@ use FastyBird\Connector\HomeKit\Protocol as HomeKitProtocol; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; -use FastyBird\Library\Tools\Transformers as ToolsTransformers; +use FastyBird\Core\Tools\Transformers as ToolsTransformers; use FastyBird\Module\Devices\Types as DevicesTypes; use function is_float; use function is_int; diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php index 9e057da62..fbe0ae363 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Bridge\ShellyConnectorHomeKitConnector; -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 Nette\DI; use PHPUnit\Framework\TestCase; diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php index a50da6458..47c9436bc 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php @@ -10,8 +10,8 @@ use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; use FastyBird\Connector\Shelly\Entities as ShellyEntities; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; use IPub\DoctrineCrud\Exceptions as DoctrineCrudExceptions; @@ -37,8 +37,8 @@ final class BuilderTest extends Tests\Cases\Unit\DbTestCase * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Error - * @throws MetadataExceptions\InvalidArgument * @throws RuntimeException + * @throws ToolsExceptions\InvalidArgument * * @dataProvider builder */ diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/AccessoriesTest.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/AccessoriesTest.php index 75d4602b6..861d20a92 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/AccessoriesTest.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/AccessoriesTest.php @@ -12,10 +12,9 @@ use FastyBird\Connector\HomeKit\Protocol as HomeKitProtocol; use FastyBird\Connector\HomeKit\Queries as HomeKitQueries; use FastyBird\Connector\HomeKit\Servers as HomeKitServers; -use FastyBird\Library\Application\EventLoop as ApplicationEventLoop; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; -use FastyBird\Library\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Application\EventLoop as ApplicationEventLoop; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; use Fig\Http\Message\RequestMethodInterface; @@ -41,15 +40,14 @@ final class AccessoriesTest extends Tests\Cases\Unit\DbTestCase /** * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping * @throws DBAL\Exception * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws HomeKitExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping * @throws Nette\DI\MissingServiceException * @throws SemVer\SemverException * @throws RuntimeException diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php index 9c017968f..95e497e11 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php @@ -4,7 +4,7 @@ use Error; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Library\Metadata; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DI/ShellyConnectorHomeKitConnectorExtensionTest.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DI/ShellyConnectorHomeKitConnectorExtensionTest.php index 8ec9e1d81..ae8c535f9 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DI/ShellyConnectorHomeKitConnectorExtensionTest.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DI/ShellyConnectorHomeKitConnectorExtensionTest.php @@ -11,7 +11,7 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Router; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Schemas; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; final class ShellyConnectorHomeKitConnectorExtensionTest extends Tests\Cases\Unit\BaseTestCase diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php index 797ced84d..3b5e0e420 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\DI; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php index 1babd63ae..eb64a4e95 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php @@ -6,7 +6,7 @@ use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Exceptions; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Mapping; use FastyBird\Bridge\ShellyConnectorHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette\DI; use RuntimeException; use function array_values; diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/common.neon b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/common.neon index 6af1f5190..19c6d7fa4 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/common.neon +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/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 fbHomeKitConnector : FastyBird\Connector\HomeKit\DI\HomeKitExtension fbShellyConnector : FastyBird\Connector\Shelly\DI\ShellyExtension @@ -97,7 +97,7 @@ nettrineOrmAttributes: FastyBird\Bridge\ShellyConnectorHomeKitConnector\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy ] -fbMetadataLibrary: +fbApplication: documents: mapping: [ FastyBird\Bridge\ShellyConnectorHomeKitConnector\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy diff --git a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php index a6792cce2..df122a16e 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php index 15d9d6c9c..e8d219029 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php index 3ed742541..244d76333 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php index 7bbac9776..b7285473d 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php index 324e9cfde..afd22342f 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php index 68132b69c..2f404ff05 100644 --- a/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php +++ b/src/FastyBird/Bridge/ShellyConnectorHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\ShellyConnectorHomeKitConnector\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/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/composer.json b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/composer.json index 02cc55d7b..c8ea65265 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/composer.json +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/composer.json @@ -34,12 +34,12 @@ "contributte/monolog": "^0.5", "contributte/translation": "^2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/metadata-library": "dev-main", "fastybird/devices-module": "dev-main", "fastybird/homekit-connector": "dev-main", "fastybird/viera-connector": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "psr/log": "^3.0", "symplify/vendor-patches": "^11.2" }, diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Builders/Builder.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Builders/Builder.php index 95b0cdbd0..6742bee2e 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Builders/Builder.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Builders/Builder.php @@ -30,10 +30,10 @@ use FastyBird\Connector\Viera\Exceptions as VieraExceptions; use FastyBird\Connector\Viera\Queries as VieraQueries; use FastyBird\Connector\Viera\Types as VieraTypes; -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\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; @@ -91,7 +91,7 @@ public function __construct( private readonly DevicesModels\Entities\Channels\ChannelsManager $channelsManager, private readonly DevicesModels\Entities\Channels\Properties\PropertiesRepository $channelsPropertiesRepository, private readonly DevicesModels\Entities\Channels\Properties\PropertiesManager $channelsPropertiesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, ) { @@ -366,15 +366,14 @@ private function createAccessory( } /** - * @throws ApplicationExceptions\InvalidState * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws HomeKitExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws Nette\IOException + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError * @throws VieraExceptions\InvalidArgument @@ -442,7 +441,7 @@ private function createService( throw new Exceptions\InvalidState('Viera input source channel property could not be loaded'); } - if (!$inputSourceProperty->getFormat() instanceof MetadataFormats\CombinedEnum) { + if (!$inputSourceProperty->getFormat() instanceof ToolsFormats\CombinedEnum) { throw new Exceptions\InvalidState( 'Viera input source channel property is wrongly configured. This service could not be mapped', ); @@ -459,9 +458,9 @@ private function createService( foreach ($inputSourceProperty->getFormat()->getItems() as $item) { assert( count($item) === 3 - && $item[0] instanceof MetadataFormats\CombinedEnumItem + && $item[0] instanceof ToolsFormats\CombinedEnumItem && is_string($item[0]->getValue()) - && $item[1] instanceof MetadataFormats\CombinedEnumItem + && $item[1] instanceof ToolsFormats\CombinedEnumItem && is_numeric($item[1]->getValue()), ); @@ -678,14 +677,14 @@ function () use ($identifier, $accessory, $serviceMapping, $name): Entities\Chan $inputSourcesNames = $inputSourcesValues = []; $inputIndex = 1; - assert($characteristic->getFormat() instanceof MetadataFormats\CombinedEnum); + assert($characteristic->getFormat() instanceof ToolsFormats\CombinedEnum); foreach ($characteristic->getFormat()->getItems() as $item) { assert( count($item) === 3 - && $item[0] instanceof MetadataFormats\CombinedEnumItem + && $item[0] instanceof ToolsFormats\CombinedEnumItem && is_string($item[0]->getValue()) - && $item[1] instanceof MetadataFormats\CombinedEnumItem + && $item[1] instanceof ToolsFormats\CombinedEnumItem && is_numeric($item[1]->getValue()), ); @@ -962,13 +961,12 @@ function () use ($identifier, $accessory, $serviceMapping, $name): Entities\Chan } /** - * @throws ApplicationExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws HomeKitExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws Nette\IOException + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError * @throws VieraExceptions\InvalidArgument @@ -1065,13 +1063,13 @@ private function createCharacteristic( ) && $connectProperty->getIdentifier() === VieraTypes\ChannelPropertyIdentifier::INPUT_SOURCE->value ) { $inputSourceFormat = $connectProperty->getFormat(); - assert($inputSourceFormat instanceof MetadataFormats\CombinedEnum); + assert($inputSourceFormat instanceof ToolsFormats\CombinedEnum); $format = array_map(static function (array $items): array { assert( count($items) === 3 - && $items[0] instanceof MetadataFormats\CombinedEnumItem - && $items[1] instanceof MetadataFormats\CombinedEnumItem, + && $items[0] instanceof ToolsFormats\CombinedEnumItem + && $items[1] instanceof ToolsFormats\CombinedEnumItem, ); return [$items[0]->getValue(), $items[1]->getValue(), $items[1]->getValue()]; @@ -1503,9 +1501,9 @@ private function createCharacteristic( } /** - * @return MetadataFormats\StringEnum|array|null + * @return ToolsFormats\StringEnum|array|null */ - private function buildFormat(Utils\ArrayHash $characteristicMetadata): MetadataFormats\StringEnum|array|null + private function buildFormat(Utils\ArrayHash $characteristicMetadata): ToolsFormats\StringEnum|array|null { $format = null; @@ -1513,7 +1511,7 @@ private function buildFormat(Utils\ArrayHash $characteristicMetadata): MetadataF $characteristicMetadata->offsetExists('ValidValues') && $characteristicMetadata->offsetGet('ValidValues') instanceof Utils\ArrayHash ) { - $format = new MetadataFormats\StringEnum( + $format = new ToolsFormats\StringEnum( array_values((array) $characteristicMetadata->offsetGet('ValidValues')), ); } diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Commands/Build.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Commands/Build.php index 2e7c119c5..eb827556a 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Commands/Build.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Commands/Build.php @@ -24,9 +24,9 @@ use FastyBird\Connector\HomeKit\Queries as HomeKitQueries; use FastyBird\Connector\Viera\Entities as VieraEntities; use FastyBird\Connector\Viera\Queries as VieraQueries; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -65,7 +65,7 @@ public function __construct( private readonly DevicesModels\Entities\Connectors\ConnectorsRepository $connectorsRepository, private readonly DevicesModels\Entities\Devices\DevicesRepository $devicesRepository, private readonly DevicesModels\Entities\Devices\DevicesManager $devicesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, string|null $name = null, ) @@ -84,12 +84,12 @@ protected function configure(): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -115,8 +115,8 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $ } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function createBridge(Style\SymfonyStyle $io): void { @@ -169,7 +169,7 @@ private function createBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::VIERA_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -182,8 +182,8 @@ private function createBridge(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function editBridge(Style\SymfonyStyle $io): void { @@ -228,7 +228,7 @@ private function editBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::VIERA_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -241,8 +241,8 @@ private function editBridge(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteBridge(Style\SymfonyStyle $io): void { @@ -295,7 +295,7 @@ private function deleteBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::VIERA_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -354,12 +354,12 @@ private function listBridges(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BaseV1.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BaseV1.php index 35a17bfa6..fdd06196e 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BaseV1.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BaseV1.php @@ -21,10 +21,10 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Exceptions; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Router; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\JsonApi\Builder as JsonApiBuilder; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Hydrators as JsonApiHydrators; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; use FastyBird\Module\Devices\Router as DevicesRouter; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; @@ -231,14 +231,14 @@ protected function getOrmConnection(): Connection } /** - * @param DoctrineCrud\Entities\IEntity|MetadataDocuments\Document|ResultSet|array $data + * @param DoctrineCrud\Entities\IEntity|ApplicationDocuments\Document|ResultSet|array $data * * @throws Exception */ protected function buildResponse( Message\ServerRequestInterface $request, ResponseInterface $response, - ResultSet|DoctrineCrud\Entities\IEntity|MetadataDocuments\Document|array $data, + ResultSet|DoctrineCrud\Entities\IEntity|ApplicationDocuments\Document|array $data, ): ResponseInterface { $totalCount = null; diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BridgesV1.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BridgesV1.php index 5cd8a3310..0ea2f7836 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BridgesV1.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Controllers/BridgesV1.php @@ -24,9 +24,10 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Queries; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Router; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Schemas; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; @@ -232,7 +233,7 @@ public function create( [ 'source' => MetadataTypes\Sources\Bridge::VIERA_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -350,7 +351,7 @@ public function update( [ 'source' => MetadataTypes\Sources\Bridge::VIERA_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -397,6 +398,7 @@ public function update( * @throws InvalidArgumentException * @throws JsonApiExceptions\JsonApi * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState * * @Secured * @Secured\Role(manager,administrator) @@ -432,7 +434,7 @@ public function delete( [ 'source' => MetadataTypes\Sources\Bridge::VIERA_CONNECTOR_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -456,8 +458,8 @@ public function delete( } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApi + * @throws ToolsExceptions\InvalidState */ protected function findDevice(string $id): Entities\Devices\Viera { diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/DI/VieraConnectorHomeKitConnectorExtension.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/DI/VieraConnectorHomeKitConnectorExtension.php index 7018399c1..af22380be 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/DI/VieraConnectorHomeKitConnectorExtension.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/DI/VieraConnectorHomeKitConnectorExtension.php @@ -26,9 +26,9 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Protocol; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Router; use FastyBird\Bridge\VieraConnectorHomeKitConnector\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 IPub\SlimRouter\Routing as SlimRouterRouting; use Nette\Bootstrap; use Nette\DI; @@ -229,7 +229,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); @@ -244,7 +244,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/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/InputSource.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/InputSource.php index 3103e3982..49649d7dd 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/InputSource.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/InputSource.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\InputSource::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\InputSource::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\InputSource::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\InputSource::TYPE)] class InputSource extends Viera { diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Television.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Television.php index dc96b9df2..3c5ff38e9 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Television.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Television.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Television::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Television::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Television::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Television::TYPE)] class Television extends Viera { diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/TelevisionSpeaker.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/TelevisionSpeaker.php index d758cd483..17469defb 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/TelevisionSpeaker.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/TelevisionSpeaker.php @@ -16,10 +16,10 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Documents\Channels; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\TelevisionSpeaker::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\TelevisionSpeaker::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\TelevisionSpeaker::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\TelevisionSpeaker::TYPE)] class TelevisionSpeaker extends Viera { diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Viera.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Viera.php index 74da1d83c..893c4d00c 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Viera.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Channels/Viera.php @@ -16,9 +16,9 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Documents\Channels; use FastyBird\Connector\HomeKit\Documents as HomeKitDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\MappedSuperclass()] +#[ApplicationDocuments\Mapping\MappedSuperclass()] abstract class Viera extends HomeKitDocuments\Channels\Channel { diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Devices/Viera.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Devices/Viera.php index e9504fe28..2f80df036 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Devices/Viera.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Documents/Devices/Viera.php @@ -17,10 +17,10 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities; use FastyBird\Connector\HomeKit\Documents as HomeKitDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Devices\Viera::class)] -#[DOC\DiscriminatorEntry(name: Entities\Devices\Viera::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Devices\Viera::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Devices\Viera::TYPE)] class Viera extends HomeKitDocuments\Devices\Device { diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/InputSource.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/InputSource.php index 81089321e..fb926cd6c 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/InputSource.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/InputSource.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/Television.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/Television.php index 26706858f..4c892da51 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/Television.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/Television.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/TelevisionSpeaker.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/TelevisionSpeaker.php index fd9c0ddda..79b35e03e 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/TelevisionSpeaker.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Channels/TelevisionSpeaker.php @@ -16,7 +16,7 @@ namespace FastyBird\Bridge\VieraConnectorHomeKitConnector\Entities\Channels; use Doctrine\ORM\Mapping as ORM; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; #[ORM\Entity] #[ApplicationMapping\DiscriminatorEntry(name: self::TYPE)] diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Devices/Viera.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Devices/Viera.php index bce638476..82c8390d5 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Devices/Viera.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Entities/Devices/Viera.php @@ -19,7 +19,7 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Exceptions; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\Viera\Entities as VieraEntities; -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 Nette\Utils; diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Hydrators/Devices/Viera.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Hydrators/Devices/Viera.php index 2c0f6199a..7c15a01e6 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Hydrators/Devices/Viera.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Hydrators/Devices/Viera.php @@ -21,9 +21,9 @@ use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\HomeKit\Hydrators as HomeKitHydrators; use FastyBird\Connector\Viera\Entities as VieraEntities; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Helpers; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use Fig\Http\Message\StatusCodeInterface; @@ -74,8 +74,8 @@ public function getEntityName(): string /** * @param Entities\Devices\Viera|null $entity * - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateConnectorRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, @@ -115,8 +115,8 @@ protected function hydrateConnectorRelationship( /** * @return array * - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateParentsRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationships, diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/Television.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/Television.php index 21b4c554e..8243210f9 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/Television.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/Television.php @@ -17,9 +17,9 @@ use FastyBird\Connector\HomeKit\Protocol as HomeKitProtocol; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use TypeError; use ValueError; use function array_unique; @@ -36,7 +36,7 @@ final class Television extends HomeKitProtocol\Services\Generic { /** - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument */ public function recalculateCharacteristics( HomeKitProtocol\Characteristics\Characteristic|null $characteristic = null, @@ -55,91 +55,91 @@ public function recalculateCharacteristics( } } elseif ($characteristic->getName() === HomeKitTypes\CharacteristicType::REMOTE_KEY->value) { if ($characteristic->getValue() !== null) { - if (MetadataUtilities\Value::toString($characteristic->getValue()) === '0') { + if (ToolsUtilities\Value::toString($characteristic->getValue()) === '0') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_REWIND, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '1') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '1') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_FAST_FORWARD, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '2') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '2') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_NEXT_TRACK, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '3') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '3') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_PREVIOUS_TRACK, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '4') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '4') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_ARROW_UP, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '5') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '5') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_ARROW_DOWN, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '6') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '6') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_ARROW_LEFT, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '7') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '7') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_ARROW_RIGHT, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '8') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '8') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_SELECT, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '9') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '9') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_EXIT, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '10') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '10') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_EXIT, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '11') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '11') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_PLAY_PAUSE, ); $remoteKeyCharacteristic?->setActualValue(null); $remoteKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '15') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '15') { $remoteKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_INFORMATION, ); @@ -158,8 +158,8 @@ public function recalculateCharacteristics( * * @return array|bool|float|int|string|null>|int|null>|bool|int|string|null> * - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/TelevisionSpeaker.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/TelevisionSpeaker.php index 1fb8a8b88..0c8d1d69e 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/TelevisionSpeaker.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/src/Protocol/Services/TelevisionSpeaker.php @@ -17,9 +17,9 @@ use FastyBird\Connector\HomeKit\Protocol as HomeKitProtocol; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; /** * Viera television speaker service @@ -33,7 +33,7 @@ final class TelevisionSpeaker extends HomeKitProtocol\Services\Generic { /** - * @throws MetadataExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidArgument */ public function recalculateCharacteristics( HomeKitProtocol\Characteristics\Characteristic|null $characteristic = null, @@ -45,14 +45,14 @@ public function recalculateCharacteristics( if ($characteristic->getName() === HomeKitTypes\CharacteristicType::VOLUME_SELECTOR->value) { if ($characteristic->getValue() !== null) { - if (MetadataUtilities\Value::toString($characteristic->getValue(), true) === '0') { + if (ToolsUtilities\Value::toString($characteristic->getValue(), true) === '0') { $volumeKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_VOLUME_UP, ); $volumeKeyCharacteristic?->setActualValue(null); $volumeKeyCharacteristic?->setExpectedValue(MetadataTypes\Payloads\Button::CLICKED->value); - } elseif (MetadataUtilities\Value::toString($characteristic->getValue()) === '1') { + } elseif (ToolsUtilities\Value::toString($characteristic->getValue()) === '1') { $volumeKeyCharacteristic = $this->findCharacteristic( HomeKitTypes\CharacteristicType::REMOTE_KEY_VOLUME_DOWN, ); diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php index a39ea6b33..e90d5c5b8 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Bridge\VieraConnectorHomeKitConnector; -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 Nette\DI; use PHPUnit\Framework\TestCase; diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php index 6d53663d6..22e08562d 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php @@ -9,8 +9,8 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Tests; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\Viera\Entities as VieraEntities; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; use IPub\DoctrineCrud\Exceptions as DoctrineCrudExceptions; @@ -34,9 +34,9 @@ final class BuilderTest extends Tests\Cases\Unit\DbTestCase * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Error - * @throws MetadataExceptions\InvalidArgument * @throws Utils\JsonException * @throws RuntimeException + * @throws ToolsExceptions\InvalidArgument * * @dataProvider builder */ diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php index 0faebd6b9..92b21ec5c 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php @@ -4,7 +4,7 @@ use Error; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Library\Metadata; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DI/VieraConnectorHomeKitConnectorExtensionTest.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DI/VieraConnectorHomeKitConnectorExtensionTest.php index 5473326c3..aaff45b19 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DI/VieraConnectorHomeKitConnectorExtensionTest.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DI/VieraConnectorHomeKitConnectorExtensionTest.php @@ -11,7 +11,7 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Router; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Schemas; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; final class VieraConnectorHomeKitConnectorExtensionTest extends Tests\Cases\Unit\BaseTestCase diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php index fb33fa611..f646965c4 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Bridge\VieraConnectorHomeKitConnector\DI; use FastyBird\Bridge\VieraConnectorHomeKitConnector\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/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php index b8cb18b6d..db25c8c21 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/cases/unit/Mapping/BuilderTest.php @@ -6,7 +6,7 @@ use FastyBird\Bridge\VieraConnectorHomeKitConnector\Exceptions; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Mapping; use FastyBird\Bridge\VieraConnectorHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette\DI; use RuntimeException; diff --git a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/common.neon b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/common.neon index 2b9511493..ecdd34030 100644 --- a/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/tests/common.neon +++ b/src/FastyBird/Bridge/VieraConnectorHomeKitConnector/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 fbHomeKitConnector : FastyBird\Connector\HomeKit\DI\HomeKitExtension fbVieraConnector : FastyBird\Connector\Viera\DI\VieraExtension @@ -87,10 +87,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -110,3 +106,7 @@ fbJsonApi: fbDateTimeFactory: frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/composer.json b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/composer.json index c2a646cef..948ceb10a 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/composer.json +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/composer.json @@ -34,13 +34,13 @@ "contributte/monolog": "^0.5", "contributte/translation": "^2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/metadata-library": "dev-main", "fastybird/devices-module": "dev-main", "fastybird/homekit-connector": "dev-main", "fastybird/virtual-connector": "dev-main", "fastybird/virtual-thermostat-addon": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "psr/log": "^3.0", "symplify/vendor-patches": "^11.2" }, diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Builders/Builder.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Builders/Builder.php index f82f9b00b..0ebffeff7 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Builders/Builder.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Builders/Builder.php @@ -27,10 +27,10 @@ use FastyBird\Connector\HomeKit\Helpers as HomeKitHelpers; use FastyBird\Connector\HomeKit\Queries as HomeKitQueries; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; -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\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; @@ -79,7 +79,7 @@ public function __construct( private readonly DevicesModels\Entities\Channels\ChannelsManager $channelsManager, private readonly DevicesModels\Entities\Channels\Properties\PropertiesRepository $channelsPropertiesRepository, private readonly DevicesModels\Entities\Channels\Properties\PropertiesManager $channelsPropertiesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, ) { @@ -306,13 +306,12 @@ private function createAccessory( } /** - * @throws ApplicationExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws HomeKitExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws Nette\IOException + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError * @throws VirtualThermostatExceptions\InvalidState @@ -461,13 +460,12 @@ function () use ($identifier, $accessory): Entities\Channels\Thermostat { } /** - * @throws ApplicationExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws HomeKitExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws Nette\IOException + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError * @throws VirtualThermostatExceptions\InvalidState @@ -625,7 +623,7 @@ private function createCharacteristic( $characteristicMetadata->offsetExists('ValidValues') && $characteristicMetadata->offsetGet('ValidValues') instanceof Utils\ArrayHash ) { - $format = new MetadataFormats\StringEnum( + $format = new ToolsFormats\StringEnum( array_values((array) $characteristicMetadata->offsetGet('ValidValues')), ); $default = array_values((array) $characteristicMetadata->offsetGet('ValidValues'))[0]; @@ -808,8 +806,8 @@ private function createCharacteristic( /** * @return array|null>|null * - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -822,7 +820,7 @@ private function mapPropertyFormat( $property->getIdentifier() === VirtualThermostatTypes\ChannelPropertyIdentifier::HVAC_STATE->value && $characteristicType === HomeKitTypes\CharacteristicType::CURRENT_HEATING_COOLING_STATE ) { - assert($property->getFormat() instanceof MetadataFormats\StringEnum); + assert($property->getFormat() instanceof ToolsFormats\StringEnum); $format = []; @@ -855,7 +853,7 @@ private function mapPropertyFormat( $property->getIdentifier() === VirtualThermostatTypes\ChannelPropertyIdentifier::HVAC_MODE->value && $characteristicType === HomeKitTypes\CharacteristicType::TARGET_HEATING_COOLING_STATE ) { - assert($property->getFormat() instanceof MetadataFormats\StringEnum); + assert($property->getFormat() instanceof ToolsFormats\StringEnum); $format = []; @@ -914,7 +912,7 @@ private function mapPropertyFormat( ) ) { assert( - $property->getFormat() instanceof MetadataFormats\NumberRange + $property->getFormat() instanceof ToolsFormats\NumberRange || $property->getFormat() === null, ); diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Commands/Build.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Commands/Build.php index bdfb6110e..321252682 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Commands/Build.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Commands/Build.php @@ -24,8 +24,9 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Queries; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\HomeKit\Queries as HomeKitQueries; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -62,7 +63,7 @@ public function __construct( private readonly DevicesModels\Entities\Connectors\ConnectorsRepository $connectorsRepository, private readonly DevicesModels\Entities\Devices\DevicesRepository $devicesRepository, private readonly DevicesModels\Entities\Devices\DevicesManager $devicesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, string|null $name = null, ) @@ -84,6 +85,7 @@ protected function configure(): void * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ protected function execute(Input\InputInterface $input, Output\OutputInterface $output): int { @@ -151,7 +153,7 @@ private function createBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::VIRTUAL_THERMOSTAT_ADDON_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -212,7 +214,7 @@ private function editBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::VIRTUAL_THERMOSTAT_ADDON_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -225,8 +227,8 @@ private function editBridge(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteBridge(Style\SymfonyStyle $io): void { @@ -279,7 +281,7 @@ private function deleteBridge(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Bridge::VIRTUAL_THERMOSTAT_ADDON_HOMEKIT_CONNECTOR->value, 'type' => 'build-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -341,6 +343,7 @@ private function listBridges(Style\SymfonyStyle $io): void * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function askBuildAction(Style\SymfonyStyle $io): void { diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BaseV1.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BaseV1.php index 24239524a..d2b23bc7c 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BaseV1.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BaseV1.php @@ -21,10 +21,10 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Exceptions; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Router; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\JsonApi\Builder as JsonApiBuilder; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Hydrators as JsonApiHydrators; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; use FastyBird\Module\Devices\Router as DevicesRouter; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; @@ -231,14 +231,14 @@ protected function getOrmConnection(): Connection } /** - * @param DoctrineCrud\Entities\IEntity|MetadataDocuments\Document|ResultSet|array $data + * @param DoctrineCrud\Entities\IEntity|ApplicationDocuments\Document|ResultSet|array $data * * @throws Exception */ protected function buildResponse( Message\ServerRequestInterface $request, ResponseInterface $response, - ResultSet|DoctrineCrud\Entities\IEntity|MetadataDocuments\Document|array $data, + ResultSet|DoctrineCrud\Entities\IEntity|ApplicationDocuments\Document|array $data, ): ResponseInterface { $totalCount = null; diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BridgesV1.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BridgesV1.php index 2eb9e53a5..e24ad24e3 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BridgesV1.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Controllers/BridgesV1.php @@ -24,9 +24,10 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Queries; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Router; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Schemas; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; @@ -232,7 +233,7 @@ public function create( [ 'source' => MetadataTypes\Sources\Bridge::VIRTUAL_THERMOSTAT_ADDON_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -350,7 +351,7 @@ public function update( [ 'source' => MetadataTypes\Sources\Bridge::VIRTUAL_THERMOSTAT_ADDON_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -397,6 +398,7 @@ public function update( * @throws InvalidArgumentException * @throws JsonApiExceptions\JsonApi * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState * * @Secured * @Secured\Role(manager,administrator) @@ -432,7 +434,7 @@ public function delete( [ 'source' => MetadataTypes\Sources\Bridge::VIRTUAL_THERMOSTAT_ADDON_HOMEKIT_CONNECTOR->value, 'type' => 'bridges-controller', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -456,8 +458,8 @@ public function delete( } /** - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApi + * @throws ToolsExceptions\InvalidState */ protected function findDevice(string $id): Entities\Devices\Thermostat { diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/DI/VirtualThermostatAddonHomeKitConnectorExtension.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/DI/VirtualThermostatAddonHomeKitConnectorExtension.php index 2a114bbf1..0827f42fd 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/DI/VirtualThermostatAddonHomeKitConnectorExtension.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/DI/VirtualThermostatAddonHomeKitConnectorExtension.php @@ -25,9 +25,9 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Protocol; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Router; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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 IPub\SlimRouter\Routing as SlimRouterRouting; use Nette\Bootstrap; use Nette\DI; @@ -197,7 +197,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); @@ -212,7 +212,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/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Channels/Thermostat.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Channels/Thermostat.php index 8f5edbaa4..64764be1f 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Channels/Thermostat.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Channels/Thermostat.php @@ -17,10 +17,10 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Entities; use FastyBird\Connector\HomeKit\Documents as HomeKitDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Channels\Thermostat::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Thermostat::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Thermostat::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Thermostat::TYPE)] class Thermostat extends HomeKitDocuments\Channels\Channel { diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Devices/Thermostat.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Devices/Thermostat.php index 037bdcb6b..65a92d91b 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Devices/Thermostat.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Documents/Devices/Thermostat.php @@ -17,10 +17,10 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Entities; use FastyBird\Connector\HomeKit\Documents as HomeKitDocuments; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; -#[DOC\Document(entity: Entities\Devices\Thermostat::class)] -#[DOC\DiscriminatorEntry(name: Entities\Devices\Thermostat::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Devices\Thermostat::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Devices\Thermostat::TYPE)] class Thermostat extends HomeKitDocuments\Devices\Device { diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Channels/Thermostat.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Channels/Thermostat.php index df4e25840..14c12f8fb 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Channels/Thermostat.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Channels/Thermostat.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Mapping as ORM; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Entities; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; -use FastyBird\Library\Application\Entities\Mapping as ApplicationMapping; +use FastyBird\Core\Application\Entities\Mapping as ApplicationMapping; use FastyBird\Library\Metadata\Types as MetadataTypes; use Ramsey\Uuid; use function assert; diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Devices/Thermostat.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Devices/Thermostat.php index 21b1cd9ea..969102fac 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Devices/Thermostat.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Entities/Devices/Thermostat.php @@ -19,7 +19,7 @@ use FastyBird\Addon\VirtualThermostat\Entities as VirtualThermostatEntities; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Exceptions; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; -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 Nette\Utils; diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Hydrators/Devices/Thermostat.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Hydrators/Devices/Thermostat.php index a963b158a..772514195 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Hydrators/Devices/Thermostat.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/src/Hydrators/Devices/Thermostat.php @@ -21,9 +21,9 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Schemas; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\HomeKit\Hydrators as HomeKitHydrators; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\JsonApi\Exceptions as JsonApiExceptions; use FastyBird\JsonApi\Helpers; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use Fig\Http\Message\StatusCodeInterface; @@ -64,8 +64,8 @@ public function getEntityName(): string /** * @param Entities\Devices\Thermostat|null $entity * - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateConnectorRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationship, @@ -105,8 +105,8 @@ protected function hydrateConnectorRelationship( /** * @return array * - * @throws ApplicationExceptions\InvalidState * @throws JsonApiExceptions\JsonApiError + * @throws ToolsExceptions\InvalidState */ protected function hydrateParentsRelationship( JsonAPIDocument\Objects\IRelationshipObject $relationships, diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/BaseTestCase.php index 7f0afc898..2cf298dca 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector; -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 Nette\DI; use PHPUnit\Framework\TestCase; diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php index 611408755..567664670 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Builders/BuilderTest.php @@ -10,7 +10,7 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Tests; use FastyBird\Connector\HomeKit\Entities as HomeKitEntities; use FastyBird\Connector\HomeKit\Types as HomeKitTypes; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php index 24ba67cc5..e5d555582 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/Controllers/BridgesV1Test.php @@ -4,7 +4,7 @@ use Error; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Library\Metadata; use Fig\Http\Message\RequestMethodInterface; use Fig\Http\Message\StatusCodeInterface; diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DI/VirtualThermostatAddonHomeKitConnectorExtensionTest.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DI/VirtualThermostatAddonHomeKitConnectorExtensionTest.php index 5a83960be..d9513d8ce 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DI/VirtualThermostatAddonHomeKitConnectorExtensionTest.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DI/VirtualThermostatAddonHomeKitConnectorExtensionTest.php @@ -10,7 +10,7 @@ use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Router; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Schemas; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; final class VirtualThermostatAddonHomeKitConnectorExtensionTest extends Tests\Cases\Unit\BaseTestCase diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DbTestCase.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DbTestCase.php index 8dbf59760..a759e3681 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\DI; use FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/common.neon b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/common.neon index b6806b02f..09f983930 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/common.neon +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/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 fbHomeKitConnector : FastyBird\Connector\HomeKit\DI\HomeKitExtension fbVirtualConnector : FastyBird\Connector\Virtual\DI\VirtualExtension @@ -98,7 +98,7 @@ nettrineOrmAttributes: FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy ] -fbMetadataLibrary: +fbApplication: documents: mapping: [ FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy diff --git a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php index af07e4ccc..e1c9ec422 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php index c32c78a1e..0619c58ce 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyChannelEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php index e935629c3..7f375bc27 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php index 5c9d65b2f..8572e1f68 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyConnectorEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php index cbcc2a756..55e75bcd9 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceDocument.php @@ -2,11 +2,11 @@ namespace FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php index 26bafaf0e..a47ac943f 100644 --- a/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php +++ b/src/FastyBird/Bridge/VirtualThermostatAddonHomeKitConnector/tests/fixtures/dummy/DummyDeviceEntity.php @@ -3,7 +3,7 @@ namespace FastyBird\Bridge\VirtualThermostatAddonHomeKitConnector\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/src/FastyBird/Connector/FbMqtt/composer.json b/src/FastyBird/Connector/FbMqtt/composer.json index fdc51430e..9b0a831ba 100644 --- a/src/FastyBird/Connector/FbMqtt/composer.json +++ b/src/FastyBird/Connector/FbMqtt/composer.json @@ -38,14 +38,14 @@ "contributte/monolog": "^0.5", "contributte/translation": "^2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/devices-module": "dev-main", "fastybird/metadata-library": "dev-main", - "fastybird/tools-library": "dev-main", - "nette/di": "^3.0", + "fastybird/tools": "dev-main", + "nette/di": "^3.2", "orisai/object-mapper": "^0.2", "psr/log": "^3.0", - "ramsey/uuid": "^4.5", + "ramsey/uuid": "^4.7", "react/async": "^4.0", "react/promise": "^3", "react/socket": "^1.12", diff --git a/src/FastyBird/Connector/FbMqtt/src/API/Client.php b/src/FastyBird/Connector/FbMqtt/src/API/Client.php index a8292ef52..0e9e558a0 100644 --- a/src/FastyBird/Connector/FbMqtt/src/API/Client.php +++ b/src/FastyBird/Connector/FbMqtt/src/API/Client.php @@ -20,7 +20,7 @@ use FastyBird\Connector\FbMqtt; use FastyBird\Connector\FbMqtt\Clients\Flow; use FastyBird\Connector\FbMqtt\Exceptions; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use InvalidArgumentException; use Nette; @@ -154,8 +154,8 @@ public function __construct( * * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument * @throws InvalidArgumentException - * @throws MetadataExceptions\InvalidArgument */ public function connect(int $timeout = 5): Promise\PromiseInterface { diff --git a/src/FastyBird/Connector/FbMqtt/src/API/ConnectionManager.php b/src/FastyBird/Connector/FbMqtt/src/API/ConnectionManager.php index 9d81c6207..befd85701 100644 --- a/src/FastyBird/Connector/FbMqtt/src/API/ConnectionManager.php +++ b/src/FastyBird/Connector/FbMqtt/src/API/ConnectionManager.php @@ -18,7 +18,7 @@ use FastyBird\Connector\FbMqtt\Documents; use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Helpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use Nette; use TypeError; @@ -49,8 +49,8 @@ public function __construct( /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Connector/FbMqtt/src/Clients/FbMqttV1.php b/src/FastyBird/Connector/FbMqtt/src/Clients/FbMqttV1.php index f61857774..54c3a4e54 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Clients/FbMqttV1.php +++ b/src/FastyBird/Connector/FbMqtt/src/Clients/FbMqttV1.php @@ -22,8 +22,9 @@ use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Helpers; use FastyBird\Connector\FbMqtt\Queue; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use InvalidArgumentException; @@ -72,10 +73,10 @@ public function __construct( } /** + * @throws ApplicationExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws InvalidArgumentException - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -96,8 +97,8 @@ public function connect(): void /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -111,8 +112,8 @@ public function disconnect(): void /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -143,7 +144,7 @@ function (Throwable $ex): void { [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'fb-mqtt-v1-client', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), 'connector' => [ 'id' => $this->connector->getId()->toString(), ], @@ -179,7 +180,7 @@ function (Throwable $ex): void { [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'fb-mqtt-v1-client', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), 'connector' => [ 'id' => $this->connector->getId()->toString(), ], @@ -340,7 +341,7 @@ public function onMessage(Mqtt\Message $message): void [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'fb-mqtt-v1-client', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), 'connector' => [ 'id' => $this->connector->getId()->toString(), ], diff --git a/src/FastyBird/Connector/FbMqtt/src/Commands/Execute.php b/src/FastyBird/Connector/FbMqtt/src/Commands/Execute.php index 5523f35bd..48cb624eb 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Commands/Execute.php +++ b/src/FastyBird/Connector/FbMqtt/src/Commands/Execute.php @@ -18,7 +18,7 @@ use FastyBird\Connector\FbMqtt\Documents; use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Queries; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Commands as DevicesCommands; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -82,13 +82,11 @@ protected function configure(): void } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws Console\Exception\ExceptionInterface * @throws DevicesExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidData - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\Logic - * @throws MetadataExceptions\MalformedInput */ protected function execute(Input\InputInterface $input, Output\OutputInterface $output): int { diff --git a/src/FastyBird/Connector/FbMqtt/src/Commands/Install.php b/src/FastyBird/Connector/FbMqtt/src/Commands/Install.php index a416eaeca..b084af3e0 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Commands/Install.php +++ b/src/FastyBird/Connector/FbMqtt/src/Commands/Install.php @@ -21,9 +21,9 @@ use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Types; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; @@ -68,7 +68,7 @@ public function __construct( private readonly DevicesModels\Entities\Connectors\Properties\PropertiesManager $connectorsPropertiesManager, private readonly DevicesModels\Entities\Devices\DevicesRepository $devicesRepository, private readonly DevicesModels\Entities\Devices\DevicesManager $devicesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, private readonly Localization\Translator $translator, string|null $name = null, ) @@ -87,14 +87,15 @@ protected function configure(): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -112,9 +113,8 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $ } /** - * @throws ApplicationExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -269,7 +269,7 @@ private function createConnector(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -300,13 +300,14 @@ private function createConnector(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -537,7 +538,7 @@ private function editConnector(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -570,8 +571,8 @@ private function editConnector(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteConnector(Style\SymfonyStyle $io): void { @@ -623,7 +624,7 @@ private function deleteConnector(Style\SymfonyStyle $io): void [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -638,13 +639,13 @@ private function deleteConnector(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function manageConnector(Style\SymfonyStyle $io): void { @@ -662,8 +663,8 @@ private function manageConnector(Style\SymfonyStyle $io): void /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -712,7 +713,7 @@ private function listConnectors(Style\SymfonyStyle $io): void } /** - * @throws ApplicationExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function createDevice(Style\SymfonyStyle $io, Entities\Connectors\Connector $connector): void { @@ -800,7 +801,7 @@ private function createDevice(Style\SymfonyStyle $io, Entities\Connectors\Connec [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -813,8 +814,8 @@ private function createDevice(Style\SymfonyStyle $io, Entities\Connectors\Connec } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function editDevice(Style\SymfonyStyle $io, Entities\Connectors\Connector $connector): void { @@ -863,7 +864,7 @@ private function editDevice(Style\SymfonyStyle $io, Entities\Connectors\Connecto [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -876,8 +877,8 @@ private function editDevice(Style\SymfonyStyle $io, Entities\Connectors\Connecto } /** - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function deleteDevice(Style\SymfonyStyle $io, Entities\Connectors\Connector $connector): void { @@ -929,7 +930,7 @@ private function deleteDevice(Style\SymfonyStyle $io, Entities\Connectors\Connec [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'install-cmd', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -976,14 +977,15 @@ private function listDevices(Style\SymfonyStyle $io, Entities\Connectors\Connect } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1061,13 +1063,13 @@ private function askInstallAction(Style\SymfonyStyle $io): void } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function askManageConnectorAction( Style\SymfonyStyle $io, @@ -1197,8 +1199,8 @@ private function askConnectorName( } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1230,8 +1232,8 @@ private function askConnectorServerAddress( } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1261,8 +1263,8 @@ private function askConnectorServerPort( } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1294,8 +1296,8 @@ private function askConnectorServerSecuredPort( } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -1317,8 +1319,8 @@ private function askConnectorUsername( } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Connector/FbMqtt/src/Connector/Connector.php b/src/FastyBird/Connector/FbMqtt/src/Connector/Connector.php index 78e58a344..b8cdc66c7 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Connector/Connector.php +++ b/src/FastyBird/Connector/FbMqtt/src/Connector/Connector.php @@ -22,8 +22,9 @@ use FastyBird\Connector\FbMqtt\Helpers; use FastyBird\Connector\FbMqtt\Queue; use FastyBird\Connector\FbMqtt\Writers; -use FastyBird\Library\Exchange\Exceptions as ExchangeExceptions; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Exchange\Exceptions as ExchangeExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Connectors as DevicesConnectors; use FastyBird\Module\Devices\Documents as DevicesDocuments; @@ -81,14 +82,15 @@ public function __construct( /** * @return Promise\PromiseInterface * + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidState * @throws Exceptions\Runtime * @throws ExchangeExceptions\InvalidArgument * @throws InvalidArgumentException - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Connector/FbMqtt/src/DI/FbMqttExtension.php b/src/FastyBird/Connector/FbMqtt/src/DI/FbMqttExtension.php index a91e829f7..4d2d5e9e8 100644 --- a/src/FastyBird/Connector/FbMqtt/src/DI/FbMqttExtension.php +++ b/src/FastyBird/Connector/FbMqtt/src/DI/FbMqttExtension.php @@ -29,10 +29,10 @@ use FastyBird\Connector\FbMqtt\Schemas; use FastyBird\Connector\FbMqtt\Subscribers; use FastyBird\Connector\FbMqtt\Writers; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Exchange\DI as ExchangeDI; -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 FastyBird\Core\Exchange\DI as ExchangeDI; use FastyBird\Module\Devices\DI as DevicesDI; use Nette\Bootstrap; use Nette\DI; @@ -331,7 +331,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); @@ -346,7 +346,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/FastyBird/Connector/FbMqtt/src/Documents/Channels/Channel.php b/src/FastyBird/Connector/FbMqtt/src/Documents/Channels/Channel.php index e752edec7..8f33ce3df 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Documents/Channels/Channel.php +++ b/src/FastyBird/Connector/FbMqtt/src/Documents/Channels/Channel.php @@ -16,11 +16,11 @@ namespace FastyBird\Connector\FbMqtt\Documents\Channels; use FastyBird\Connector\FbMqtt\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents as DevicesDocuments; -#[DOC\Document(entity: Entities\Channels\Channel::class)] -#[DOC\DiscriminatorEntry(name: Entities\Channels\Channel::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Channels\Channel::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Channels\Channel::TYPE)] class Channel extends DevicesDocuments\Channels\Channel { diff --git a/src/FastyBird/Connector/FbMqtt/src/Documents/Connectors/Connector.php b/src/FastyBird/Connector/FbMqtt/src/Documents/Connectors/Connector.php index f98a09f99..2cf0e2446 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Documents/Connectors/Connector.php +++ b/src/FastyBird/Connector/FbMqtt/src/Documents/Connectors/Connector.php @@ -16,11 +16,11 @@ namespace FastyBird\Connector\FbMqtt\Documents\Connectors; use FastyBird\Connector\FbMqtt\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents as DevicesDocuments; -#[DOC\Document(entity: Entities\Connectors\Connector::class)] -#[DOC\DiscriminatorEntry(name: Entities\Connectors\Connector::TYPE)] +#[ApplicationDocuments\Mapping\Document(entity: Entities\Connectors\Connector::class)] +#[ApplicationDocuments\Mapping\DiscriminatorEntry(name: Entities\Connectors\Connector::TYPE)] class Connector extends DevicesDocuments\Connectors\Connector { diff --git a/src/FastyBird/Connector/FbMqtt/src/Documents/Devices/Device.php b/src/FastyBird/Connector/FbMqtt/src/Documents/Devices/Device.php index 8f4ca7f2d..259ce6a7c 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Documents/Devices/Device.php +++ b/src/FastyBird/Connector/FbMqtt/src/Documents/Devices/Device.php @@ -16,11 +16,11 @@ namespace FastyBird\Connector\FbMqtt\Documents\Devices; use FastyBird\Connector\FbMqtt\Entities; -use FastyBird\Library\Metadata\Documents\Mapping as DOC; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Module\Devices\Documents as DevicesDocuments; -#[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 DevicesDocuments\Devices\Device { diff --git a/src/FastyBird/Connector/FbMqtt/src/Entities/Channels/Channel.php b/src/FastyBird/Connector/FbMqtt/src/Entities/Channels/Channel.php index a08c90f36..4a63f7e2d 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Entities/Channels/Channel.php +++ b/src/FastyBird/Connector/FbMqtt/src/Entities/Channels/Channel.php @@ -17,7 +17,7 @@ use Doctrine\ORM\Mapping as ORM; use FastyBird\Connector\FbMqtt\Entities; -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/FastyBird/Connector/FbMqtt/src/Entities/Connectors/Connector.php b/src/FastyBird/Connector/FbMqtt/src/Entities/Connectors/Connector.php index a5096f10c..2a87af54b 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Entities/Connectors/Connector.php +++ b/src/FastyBird/Connector/FbMqtt/src/Entities/Connectors/Connector.php @@ -20,8 +20,8 @@ use FastyBird\Connector\FbMqtt\Entities; use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Types; -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 TypeError; @@ -76,8 +76,8 @@ public function addDevice(DevicesEntities\Devices\Device $device): void /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -102,8 +102,8 @@ public function getProtocolVersion(): Types\ProtocolVersion } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -127,8 +127,8 @@ public function getServerAddress(): string } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -152,8 +152,8 @@ public function getServerPort(): int } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -177,8 +177,8 @@ public function getServerSecuredPort(): int } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -202,8 +202,8 @@ public function getUsername(): string|null } /** - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Connector/FbMqtt/src/Entities/Devices/Device.php b/src/FastyBird/Connector/FbMqtt/src/Entities/Devices/Device.php index 30bef0be9..124d97fe5 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Entities/Devices/Device.php +++ b/src/FastyBird/Connector/FbMqtt/src/Entities/Devices/Device.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Mapping as ORM; use FastyBird\Connector\FbMqtt\Entities; use FastyBird\Connector\FbMqtt\Exceptions; -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/FastyBird/Connector/FbMqtt/src/Helpers/Connector.php b/src/FastyBird/Connector/FbMqtt/src/Helpers/Connector.php index 114d51dc6..8bfba9d44 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Helpers/Connector.php +++ b/src/FastyBird/Connector/FbMqtt/src/Helpers/Connector.php @@ -20,7 +20,7 @@ use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Types; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\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; @@ -51,8 +51,8 @@ public function __construct( * @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 */ @@ -81,8 +81,8 @@ public function getProtocolVersion( /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -110,8 +110,8 @@ public function getServerAddress(Documents\Connectors\Connector $connector): str /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -139,8 +139,8 @@ public function getServerPort(Documents\Connectors\Connector $connector): int /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -168,8 +168,8 @@ public function getServerSecuredPort(Documents\Connectors\Connector $connector): /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ @@ -197,8 +197,8 @@ public function getUsername(Documents\Connectors\Connector $connector): string|n /** * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState + * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState * @throws TypeError * @throws ValueError */ diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelAttribute.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelAttribute.php index ec1941528..689ee0c88 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelAttribute.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelAttribute.php @@ -20,8 +20,8 @@ use FastyBird\Connector\FbMqtt\Entities; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; @@ -56,15 +56,15 @@ public function __construct( private readonly DevicesModels\Entities\Channels\Properties\PropertiesManager $channelPropertiesManager, private readonly DevicesModels\Entities\Channels\Controls\ControlsRepository $channelControlsRepository, private readonly DevicesModels\Entities\Channels\Controls\ControlsManager $channelControlsManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, ) { } /** - * @throws ApplicationExceptions\InvalidState - * @throws ApplicationExceptions\Runtime * @throws DBAL\Exception + * @throws ToolsExceptions\InvalidState + * @throws ToolsExceptions\Runtime */ public function consume(Queue\Messages\Message $message): bool { @@ -170,12 +170,12 @@ public function consume(Queue\Messages\Message $message): bool /** * @param Utils\ArrayHash $properties * - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws DBAL\Exception\UniqueConstraintViolationException * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function setChannelProperties( DevicesEntities\Channels\Channel $channel, @@ -213,12 +213,12 @@ private function setChannelProperties( /** * @param Utils\ArrayHash $controls * - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws DBAL\Exception\UniqueConstraintViolationException * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function setChannelControls( DevicesEntities\Channels\Channel $channel, diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelProperty.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelProperty.php index bc8150031..5c0531930 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelProperty.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ChannelProperty.php @@ -21,11 +21,10 @@ use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; -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; @@ -62,20 +61,19 @@ public function __construct( private readonly DevicesModels\Configuration\Channels\Repository $channelsConfigurationRepository, private readonly DevicesModels\Configuration\Channels\Properties\Repository $channelsPropertiesConfigurationRepository, private readonly DevicesModels\States\Async\ChannelPropertiesManager $channelPropertiesStatesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, ) { } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws ApplicationExceptions\Runtime * @throws DBAL\Exception * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\ParseMessage - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument * @throws Throwable */ diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceAttribute.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceAttribute.php index c01050318..3fc0b0788 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceAttribute.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceAttribute.php @@ -22,11 +22,10 @@ use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; use FastyBird\Connector\FbMqtt\Types; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Entities as DevicesEntities; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; use FastyBird\Module\Devices\Models as DevicesModels; @@ -66,25 +65,25 @@ public function __construct( private readonly DevicesModels\Entities\Devices\Controls\ControlsManager $deviceControlsManager, private readonly DevicesModels\Entities\Channels\ChannelsManager $channelsManager, private readonly DevicesUtilities\DeviceConnection $deviceConnectionManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, ) { } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState - * @throws ApplicationExceptions\Runtime + * @throws ApplicationExceptions\Mapping + * @throws ApplicationExceptions\MalformedInput * @throws DBAL\Exception * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\Mapping - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState + * @throws ToolsExceptions\Runtime * @throws TypeError * @throws ValueError */ @@ -186,8 +185,10 @@ public function consume(Queue\Messages\Message $message): bool /** * @param Utils\ArrayHash $properties * + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState - * @throws ApplicationExceptions\Runtime + * @throws ApplicationExceptions\Mapping + * @throws ApplicationExceptions\MalformedInput * @throws DBAL\Exception * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState @@ -195,11 +196,9 @@ public function consume(Queue\Messages\Message $message): bool * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState * @throws Exceptions\InvalidArgument - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\Mapping - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState + * @throws ToolsExceptions\Runtime * @throws TypeError * @throws ValueError */ @@ -279,12 +278,12 @@ private function setDeviceProperties( /** * @param Utils\ArrayHash $extensions * - * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception\UniqueConstraintViolationException * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState * @throws Exceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState */ private function setDeviceExtensions( DevicesEntities\Devices\Device $device, @@ -338,12 +337,12 @@ private function setDeviceExtensions( /** * @param Utils\ArrayHash $controls * - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws DBAL\Exception\UniqueConstraintViolationException * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function setDeviceControls( DevicesEntities\Devices\Device $device, @@ -379,12 +378,12 @@ private function setDeviceControls( /** * @param Utils\ArrayHash $channels * - * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws DBAL\Exception\UniqueConstraintViolationException * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ private function setDeviceChannels( DevicesEntities\Devices\Device $device, diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceProperty.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceProperty.php index 088a927ba..5ea5f46e0 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceProperty.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/DeviceProperty.php @@ -22,11 +22,10 @@ use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; use FastyBird\Connector\FbMqtt\Types; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; -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; @@ -61,20 +60,19 @@ public function __construct( private readonly DevicesModels\Configuration\Devices\Repository $devicesConfigurationRepository, private readonly DevicesModels\Configuration\Devices\Properties\Repository $devicesPropertiesConfigurationRepository, private readonly DevicesModels\States\Async\DevicePropertiesManager $devicePropertiesStatesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, ) { } /** + * @throws ApplicationExceptions\InvalidArgument * @throws ApplicationExceptions\InvalidState * @throws ApplicationExceptions\Runtime * @throws DBAL\Exception * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\ParseMessage - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws ToolsExceptions\InvalidArgument * @throws Throwable */ diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ExtensionAttribute.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ExtensionAttribute.php index b483162d3..b505d979f 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ExtensionAttribute.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/ExtensionAttribute.php @@ -22,8 +22,8 @@ use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; use FastyBird\Connector\FbMqtt\Types; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Models as DevicesModels; use Nette; @@ -48,16 +48,16 @@ public function __construct( private readonly DevicesModels\Entities\Devices\DevicesRepository $deviceRepository, private readonly DevicesModels\Entities\Devices\Properties\PropertiesRepository $propertiesRepository, private readonly DevicesModels\Entities\Devices\Properties\PropertiesManager $propertiesManager, - private readonly ApplicationHelpers\Database $databaseHelper, + private readonly ToolsHelpers\Database $databaseHelper, ) { } /** - * @throws ApplicationExceptions\InvalidState - * @throws ApplicationExceptions\Runtime * @throws DBAL\Exception * @throws Exceptions\InvalidArgument + * @throws ToolsExceptions\InvalidState + * @throws ToolsExceptions\Runtime */ public function consume(Queue\Messages\Message $message): bool { diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1ChannelPropertyState.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1ChannelPropertyState.php index 14f180861..0775422ab 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1ChannelPropertyState.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1ChannelPropertyState.php @@ -24,12 +24,12 @@ use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; use FastyBird\Connector\FbMqtt\Types; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\DateTimeFactory; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -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; @@ -73,12 +73,12 @@ public function __construct( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws RuntimeException * @throws ToolsExceptions\InvalidArgument * @throws TypeError @@ -260,7 +260,7 @@ public function consume(Queue\Messages\Message $message): bool return true; } - $expectedValue = MetadataUtilities\Value::flattenValue($state->getExpectedValue()); + $expectedValue = ToolsUtilities\Value::flattenValue($state->getExpectedValue()); if ($expectedValue === null) { await($this->channelPropertiesStatesManager->setPendingState( @@ -342,7 +342,7 @@ public function consume(Queue\Messages\Message $message): bool [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'write-v1-channel-property-state-message-consumer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), 'connector' => [ 'id' => $connector->getId()->toString(), ], diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1DevicePropertyState.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1DevicePropertyState.php index 773b4159d..7607b0e51 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1DevicePropertyState.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Consumers/WriteV1DevicePropertyState.php @@ -24,12 +24,12 @@ use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; use FastyBird\Connector\FbMqtt\Types; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\DateTimeFactory; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -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; @@ -72,12 +72,12 @@ public function __construct( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState * @throws DevicesExceptions\InvalidState * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState * @throws RuntimeException * @throws ToolsExceptions\InvalidArgument * @throws TypeError @@ -213,7 +213,7 @@ public function consume(Queue\Messages\Message $message): bool return true; } - $expectedValue = MetadataUtilities\Value::flattenValue($state->getExpectedValue()); + $expectedValue = ToolsUtilities\Value::flattenValue($state->getExpectedValue()); if ($expectedValue === null) { await($this->devicePropertiesStatesManager->setPendingState( @@ -292,7 +292,7 @@ public function consume(Queue\Messages\Message $message): bool [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'write-v1-property-state-message-consumer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), 'connector' => [ 'id' => $connector->getId()->toString(), ], diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Attribute.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Attribute.php index 4b7cbfb7d..26be24fdf 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Attribute.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Attribute.php @@ -16,7 +16,7 @@ namespace FastyBird\Connector\FbMqtt\Queue\Messages; use FastyBird\Connector\FbMqtt\Helpers; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use Orisai\ObjectMapper; use Ramsey\Uuid; use function array_filter; diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/ExtensionAttribute.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/ExtensionAttribute.php index 4c0b1cfc6..b0b96210f 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/ExtensionAttribute.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/ExtensionAttribute.php @@ -16,7 +16,7 @@ namespace FastyBird\Connector\FbMqtt\Queue\Messages; use FastyBird\Connector\FbMqtt\Types; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use Orisai\ObjectMapper; use Ramsey\Uuid; diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Property.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Property.php index 517b3cce1..6a7d96e45 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Property.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/Property.php @@ -17,7 +17,7 @@ use FastyBird\Connector\FbMqtt; use FastyBird\Connector\FbMqtt\Exceptions; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use Orisai\ObjectMapper; use Ramsey\Uuid; use TypeError; diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/State.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/State.php index 93c23b9a9..d2efbddfe 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/State.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/State.php @@ -16,8 +16,8 @@ namespace FastyBird\Connector\FbMqtt\Queue\Messages; use DateTimeInterface; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use FastyBird\Module\Devices\States as DevicesStates; use Orisai\ObjectMapper; use Ramsey\Uuid; @@ -111,10 +111,10 @@ public function isValid(): bool public function toArray(): array { return [ - DevicesStates\Property::ACTUAL_VALUE_FIELD => MetadataUtilities\Value::flattenValue( + DevicesStates\Property::ACTUAL_VALUE_FIELD => ToolsUtilities\Value::flattenValue( $this->getActualValue(), ), - DevicesStates\Property::EXPECTED_VALUE_FIELD => MetadataUtilities\Value::flattenValue( + DevicesStates\Property::EXPECTED_VALUE_FIELD => ToolsUtilities\Value::flattenValue( $this->getExpectedValue(), ), DevicesStates\Property::PENDING_FIELD => $this->getPending() instanceof DateTimeInterface diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteChannelPropertyState.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteChannelPropertyState.php index 97535faca..5b71ed216 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteChannelPropertyState.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteChannelPropertyState.php @@ -15,7 +15,7 @@ namespace FastyBird\Connector\FbMqtt\Queue\Messages; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use Orisai\ObjectMapper; use Ramsey\Uuid; diff --git a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteDevicePropertyState.php b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteDevicePropertyState.php index b684d8906..21a7deba1 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteDevicePropertyState.php +++ b/src/FastyBird/Connector/FbMqtt/src/Queue/Messages/WriteDevicePropertyState.php @@ -15,7 +15,7 @@ namespace FastyBird\Connector\FbMqtt\Queue\Messages; -use FastyBird\Library\Application\ObjectMapper as ApplicationObjectMapper; +use FastyBird\Core\Application\ObjectMapper as ApplicationObjectMapper; use Orisai\ObjectMapper; use Ramsey\Uuid; diff --git a/src/FastyBird/Connector/FbMqtt/src/Subscribers/Controls.php b/src/FastyBird/Connector/FbMqtt/src/Subscribers/Controls.php index ed25c3159..91f5f50e4 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Subscribers/Controls.php +++ b/src/FastyBird/Connector/FbMqtt/src/Subscribers/Controls.php @@ -20,7 +20,7 @@ use Doctrine\ORM; use Doctrine\Persistence; use FastyBird\Connector\FbMqtt\Entities; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Models as DevicesModels; use FastyBird\Module\Devices\Queries as DevicesQueries; use FastyBird\Module\Devices\Types as DevicesTypes; @@ -58,11 +58,11 @@ public function getSubscribedEvents(): array /** * @param Persistence\Event\LifecycleEventArgs $eventArgs * - * @throws ApplicationExceptions\InvalidState * @throws DBAL\Exception\UniqueConstraintViolationException * @throws DoctrineCrudExceptions\EntityCreation * @throws DoctrineCrudExceptions\InvalidArgument * @throws DoctrineCrudExceptions\InvalidState + * @throws ToolsExceptions\InvalidState */ public function postPersist(Persistence\Event\LifecycleEventArgs $eventArgs): void { diff --git a/src/FastyBird/Connector/FbMqtt/src/Writers/Event.php b/src/FastyBird/Connector/FbMqtt/src/Writers/Event.php index 4a385d026..81494380a 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Writers/Event.php +++ b/src/FastyBird/Connector/FbMqtt/src/Writers/Event.php @@ -18,7 +18,7 @@ use FastyBird\Connector\FbMqtt\Documents; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\Library\Metadata\Types as MetadataTypes; use FastyBird\Module\Devices\Events as DevicesEvents; use Symfony\Component\EventDispatcher; @@ -134,7 +134,7 @@ public function stateChanged( [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'event-writer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); } diff --git a/src/FastyBird/Connector/FbMqtt/src/Writers/Exchange.php b/src/FastyBird/Connector/FbMqtt/src/Writers/Exchange.php index 8ecfeb124..6089566a9 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Writers/Exchange.php +++ b/src/FastyBird/Connector/FbMqtt/src/Writers/Exchange.php @@ -21,14 +21,14 @@ use FastyBird\Connector\FbMqtt\Helpers; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Exchange\Consumers as ExchangeConsumers; +use FastyBird\Core\Exchange\Exceptions as ExchangeExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\DateTimeFactory; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Exchange\Consumers as ExchangeConsumers; -use FastyBird\Library\Exchange\Exceptions as ExchangeExceptions; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Tools\Exceptions as ToolsExceptions; use FastyBird\Module\Devices\Constants as DevicesConstants; use FastyBird\Module\Devices\Documents as DevicesDocuments; use FastyBird\Module\Devices\Exceptions as DevicesExceptions; @@ -86,13 +86,13 @@ public function __construct( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws ExchangeExceptions\InvalidArgument * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ public function connect(): void @@ -115,7 +115,7 @@ public function disconnect(): void public function consume( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $document, + ApplicationDocuments\Document|null $document, ): void { try { @@ -227,7 +227,7 @@ public function consume( [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'exchange-writer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); } diff --git a/src/FastyBird/Connector/FbMqtt/src/Writers/Periodic.php b/src/FastyBird/Connector/FbMqtt/src/Writers/Periodic.php index 9b33bdbc7..45f92d2d9 100644 --- a/src/FastyBird/Connector/FbMqtt/src/Writers/Periodic.php +++ b/src/FastyBird/Connector/FbMqtt/src/Writers/Periodic.php @@ -22,11 +22,11 @@ use FastyBird\Connector\FbMqtt\Helpers; use FastyBird\Connector\FbMqtt\Queries; use FastyBird\Connector\FbMqtt\Queue; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Tools\Exceptions as ToolsExceptions; +use FastyBird\Core\Tools\Helpers as ToolsHelpers; use FastyBird\DateTimeFactory; -use FastyBird\Library\Application\Helpers as ApplicationHelpers; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; -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; @@ -94,12 +94,12 @@ public function __construct( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ public function connect(): void @@ -177,12 +177,12 @@ public function disconnect(): void } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ private function handleCommunication(): void @@ -205,12 +205,12 @@ private function handleCommunication(): void } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ private function writeProperty(Documents\Devices\Device $device): bool @@ -250,12 +250,12 @@ private function writeProperty(Documents\Devices\Device $device): bool } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ private function writeDeviceProperty( @@ -320,7 +320,7 @@ private function writeDeviceProperty( [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'periodic-writer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -332,12 +332,12 @@ private function writeDeviceProperty( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ private function writeChannelProperty( @@ -403,7 +403,7 @@ private function writeChannelProperty( [ 'source' => MetadataTypes\Sources\Connector::FB_MQTT->value, 'type' => 'periodic-writer', - 'exception' => ApplicationHelpers\Logger::buildException($ex), + 'exception' => ToolsHelpers\Logger::buildException($ex), ], ); @@ -415,12 +415,12 @@ private function writeChannelProperty( } /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput * @throws DevicesExceptions\InvalidArgument * @throws DevicesExceptions\InvalidState * @throws Exceptions\Runtime - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput * @throws ToolsExceptions\InvalidArgument */ private function registerLoopHandler(): void diff --git a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/BaseTestCase.php index 59e52af08..cbbf8ad99 100644 --- a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/BaseTestCase.php @@ -4,8 +4,8 @@ use Error; use FastyBird\Connector\FbMqtt\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/src/FastyBird/Connector/FbMqtt/tests/cases/unit/Connector/ConnectorFactoryTest.php b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/Connector/ConnectorFactoryTest.php index 1596be6aa..e9db8f310 100644 --- a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/Connector/ConnectorFactoryTest.php +++ b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/Connector/ConnectorFactoryTest.php @@ -7,7 +7,7 @@ use FastyBird\Connector\FbMqtt\Documents; use FastyBird\Connector\FbMqtt\Exceptions; use FastyBird\Connector\FbMqtt\Tests; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use FastyBird\Module\Devices\Models as DevicesModels; use Nette; use Ramsey\Uuid; diff --git a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DI/FbMqttExtensionTest.php b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DI/FbMqttExtensionTest.php index d2e5e7bef..a2f4128bf 100644 --- a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DI/FbMqttExtensionTest.php +++ b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DI/FbMqttExtensionTest.php @@ -14,7 +14,7 @@ use FastyBird\Connector\FbMqtt\Subscribers; use FastyBird\Connector\FbMqtt\Tests; use FastyBird\Connector\FbMqtt\Writers; -use FastyBird\Library\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; use Nette; final class FbMqttExtensionTest extends Tests\Cases\Unit\BaseTestCase diff --git a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DbTestCase.php b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DbTestCase.php index 7bc0c696c..7026fdbf0 100644 --- a/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Connector/FbMqtt/tests/cases/unit/DbTestCase.php @@ -7,8 +7,8 @@ use Error; use FastyBird\Connector\FbMqtt\DI; use FastyBird\Connector\FbMqtt\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/src/FastyBird/Connector/FbMqtt/tests/common.neon b/src/FastyBird/Connector/FbMqtt/tests/common.neon index 2c981f3b2..702ae7ca6 100644 --- a/src/FastyBird/Connector/FbMqtt/tests/common.neon +++ b/src/FastyBird/Connector/FbMqtt/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 services: @@ -82,10 +82,6 @@ nettrineOrm: nettrineOrmAttributes: mapping: [] -fbMetadataLibrary: - documents: - mapping: [] - fbSimpleAuth: token: issuer: com.fastybird.auth-module @@ -105,3 +101,7 @@ fbJsonApi: fbDateTimeFactory: frozen: DateTimeImmutable('2020-04-01T12:00:00+00:00') + +fbApplication: + documents: + mapping: [] diff --git a/src/FastyBird/Connector/HomeKit/.gitattributes b/src/FastyBird/Connector/HomeKit/.gitattributes index 646311297..1a3ff71ff 100644 --- a/src/FastyBird/Connector/HomeKit/.gitattributes +++ b/src/FastyBird/Connector/HomeKit/.gitattributes @@ -4,6 +4,8 @@ /tests export-ignore /tools export-ignore .editorconfig export-ignore +.eslintrc export-ignore .gitattributes export-ignore .gitignore export-ignore +.npmignore export-ignore Makefile export-ignore diff --git a/src/FastyBird/Connector/HomeKit/.prettierrc b/src/FastyBird/Connector/HomeKit/.prettierrc deleted file mode 100644 index c579f3b24..000000000 --- a/src/FastyBird/Connector/HomeKit/.prettierrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "printWidth": 150, - "tabWidth": 2, - "useTabs": true, - "semi": true, - "singleQuote": true, - "quoteProps": "as-needed", - "jsxSingleQuote": false, - "trailingComma": "es5", - "bracketSpacing": true, - "arrowParens": "always", - "requirePragma": false, - "insertPragma": false, - "proseWrap": "preserve", - "htmlWhitespaceSensitivity": "css", - "vueIndentScriptAndStyle": false, - "endOfLine": "auto", - "singleAttributePerLine": true -} diff --git a/src/FastyBird/Connector/HomeKit/.stylelintrc.json b/src/FastyBird/Connector/HomeKit/.stylelintrc.json index 5821ace8c..c598b289b 100644 --- a/src/FastyBird/Connector/HomeKit/.stylelintrc.json +++ b/src/FastyBird/Connector/HomeKit/.stylelintrc.json @@ -12,6 +12,12 @@ "at-rule-no-unknown": null, "scss/at-rule-no-unknown": true, "no-empty-source": null, - "prettier/prettier": [true, {"singleQuote": true, "tabWidth": 2}] + "prettier/prettier": [true, {"singleQuote": true, "tabWidth": 2}], + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": ["deep"] + } + ] } } diff --git a/src/FastyBird/Connector/HomeKit/assets/components/connector-detail.vue b/src/FastyBird/Connector/HomeKit/assets/components/connector-detail.vue index a22ee3fc2..7b9e4709e 100644 --- a/src/FastyBird/Connector/HomeKit/assets/components/connector-detail.vue +++ b/src/FastyBird/Connector/HomeKit/assets/components/connector-detail.vue @@ -11,8 +11,9 @@ {{ pinCodeProperty?.value }} + {{ pinCodeProperty?.value }} + @@ -140,12 +141,12 @@ diff --git a/app/assets/assets/images/fb_bird.svg b/src/FastyBird/Core/Application/assets/assets/images/fb_bird.svg similarity index 100% rename from app/assets/assets/images/fb_bird.svg rename to src/FastyBird/Core/Application/assets/assets/images/fb_bird.svg diff --git a/app/assets/assets/images/fb_fastybird.svg b/src/FastyBird/Core/Application/assets/assets/images/fb_fastybird.svg similarity index 100% rename from app/assets/assets/images/fb_fastybird.svg rename to src/FastyBird/Core/Application/assets/assets/images/fb_fastybird.svg diff --git a/app/assets/assets/images/fb_row.svg b/src/FastyBird/Core/Application/assets/assets/images/fb_row.svg similarity index 100% rename from app/assets/assets/images/fb_row.svg rename to src/FastyBird/Core/Application/assets/assets/images/fb_row.svg diff --git a/src/FastyBird/Core/Application/assets/components/app-gravatar.types.ts b/src/FastyBird/Core/Application/assets/components/app-gravatar.types.ts new file mode 100644 index 000000000..c2d34606a --- /dev/null +++ b/src/FastyBird/Core/Application/assets/components/app-gravatar.types.ts @@ -0,0 +1,14 @@ +export type AppGravatarRating = 'g' | 'pg' | 'r' | 'x'; + +export type AppGravatarDefaultImg = '404' | 'mp' | 'mm' | 'identicon' | 'monsterid' | 'wavatar' | 'retro' | 'robohash' | 'blank'; + +export interface IAppGravatarProps { + email: string; + hash?: string | null; + size?: number; + defaultImg?: AppGravatarDefaultImg; + rating?: AppGravatarRating; + alt?: string; + protocol?: string | null; + hostname?: string; +} diff --git a/app/assets/components/app-gravatar.vue b/src/FastyBird/Core/Application/assets/components/app-gravatar.vue similarity index 74% rename from app/assets/components/app-gravatar.vue rename to src/FastyBird/Core/Application/assets/components/app-gravatar.vue index 85d9b86c1..d5942ba69 100644 --- a/app/assets/components/app-gravatar.vue +++ b/src/FastyBird/Core/Application/assets/components/app-gravatar.vue @@ -9,20 +9,10 @@ + + diff --git a/app/assets/components/app-sidebar.scss b/src/FastyBird/Core/Application/assets/components/app-sidebar.scss similarity index 100% rename from app/assets/components/app-sidebar.scss rename to src/FastyBird/Core/Application/assets/components/app-sidebar.scss diff --git a/src/FastyBird/Core/Application/assets/components/app-sidebar.types.ts b/src/FastyBird/Core/Application/assets/components/app-sidebar.types.ts new file mode 100644 index 000000000..8ae36ee1e --- /dev/null +++ b/src/FastyBird/Core/Application/assets/components/app-sidebar.types.ts @@ -0,0 +1,3 @@ +export interface IAppSidebarProps { + menuCollapsed: boolean; +} diff --git a/app/assets/components/app-sidebar.vue b/src/FastyBird/Core/Application/assets/components/app-sidebar.vue similarity index 92% rename from app/assets/components/app-sidebar.vue rename to src/FastyBird/Core/Application/assets/components/app-sidebar.vue index 7e947402c..35b9949f8 100644 --- a/app/assets/components/app-sidebar.vue +++ b/src/FastyBird/Core/Application/assets/components/app-sidebar.vue @@ -31,10 +31,7 @@ import LogoBird from '../assets/images/fb_bird.svg?component'; import LogoFastyBird from '../assets/images/fb_fastybird.svg?component'; import AppNavigation from './app-navigation.vue'; - -interface IAppSidebarProps { - menuCollapsed: boolean; -} +import { IAppSidebarProps } from './app-sidebar.types'; defineOptions({ name: 'AppSidebar', @@ -48,5 +45,5 @@ const ns = useNamespace('app-sidebar'); diff --git a/app/assets/components/app-topbar.scss b/src/FastyBird/Core/Application/assets/components/app-topbar.scss similarity index 100% rename from app/assets/components/app-topbar.scss rename to src/FastyBird/Core/Application/assets/components/app-topbar.scss diff --git a/src/FastyBird/Core/Application/assets/components/app-topbar.types.ts b/src/FastyBird/Core/Application/assets/components/app-topbar.types.ts new file mode 100644 index 000000000..2fa19fd77 --- /dev/null +++ b/src/FastyBird/Core/Application/assets/components/app-topbar.types.ts @@ -0,0 +1,3 @@ +export interface IAppTopbarProps { + menuCollapsed: boolean; +} diff --git a/app/assets/components/app-topbar.vue b/src/FastyBird/Core/Application/assets/components/app-topbar.vue similarity index 60% rename from app/assets/components/app-topbar.vue rename to src/FastyBird/Core/Application/assets/components/app-topbar.vue index 742bf818e..a0e29e349 100644 --- a/app/assets/components/app-topbar.vue +++ b/src/FastyBird/Core/Application/assets/components/app-topbar.vue @@ -36,26 +36,27 @@
- {{ account?.name }} + {{ userDetails?.name }}
@@ -65,22 +66,19 @@ diff --git a/app/assets/components/index.ts b/src/FastyBird/Core/Application/assets/components/index.ts similarity index 100% rename from app/assets/components/index.ts rename to src/FastyBird/Core/Application/assets/components/index.ts diff --git a/src/FastyBird/Core/Application/assets/components/types.ts b/src/FastyBird/Core/Application/assets/components/types.ts new file mode 100644 index 000000000..1b86f426f --- /dev/null +++ b/src/FastyBird/Core/Application/assets/components/types.ts @@ -0,0 +1,4 @@ +export * from './app-gravatar.types'; +export * from './app-navigation.types'; +export * from './app-sidebar.types'; +export * from './app-topbar.types'; diff --git a/src/FastyBird/Core/Application/assets/composables/index.ts b/src/FastyBird/Core/Application/assets/composables/index.ts new file mode 100644 index 000000000..e136f8cc9 --- /dev/null +++ b/src/FastyBird/Core/Application/assets/composables/index.ts @@ -0,0 +1 @@ +export { useMenu } from './useMenu'; diff --git a/src/FastyBird/Core/Application/assets/composables/types.ts b/src/FastyBird/Core/Application/assets/composables/types.ts new file mode 100644 index 000000000..901817487 --- /dev/null +++ b/src/FastyBird/Core/Application/assets/composables/types.ts @@ -0,0 +1,4 @@ +export interface UseMenu { + mainMenuItems: any; + userMenuItems: any; +} diff --git a/src/FastyBird/Core/Application/assets/composables/useMenu.ts b/src/FastyBird/Core/Application/assets/composables/useMenu.ts new file mode 100644 index 000000000..bfadefe82 --- /dev/null +++ b/src/FastyBird/Core/Application/assets/composables/useMenu.ts @@ -0,0 +1,75 @@ +import { RouteRecordRaw, useRouter } from 'vue-router'; + +declare type RouteRecord = Omit & { + children: { [key: string]: RouteRecord }; +}; + +const getRouteName = (record: RouteRecordRaw): string => { + if (typeof record.name === 'string') { + return record.name; + } else if (typeof record.name === 'symbol') { + return record.name.toString(); + } + + return record.path; +}; + +const buildRouteTree = (routes: RouteRecordRaw[]): { [key: string]: RouteRecord } => { + const routeMap: { [key: string]: RouteRecord } = {}; + + for (const route of routes) { + routeMap[getRouteName(route)] = { ...route, children: {} }; + + if (route.children && Array.isArray(route.children)) { + routeMap[getRouteName(route)].children = buildRouteTree(route.children); + } + } + + return routeMap; +}; + +const filterRouteTree = (routes: { [key: string]: RouteRecord }): { [key: string]: RouteRecord } => { + const routeMap: { [key: string]: RouteRecord } = {}; + + mainLoop: for (const search of Object.keys(routes)) { + for (const name of Object.keys(routes)) { + if (name !== search && routes[name].children && findRoute(search, routes[name].children)) { + continue mainLoop; + } + } + + routeMap[search] = routes[search]; + } + + return routeMap; +}; + +const findRoute = (search: string, routes: { [key: string]: RouteRecord }): boolean => { + for (const route of Object.keys(routes)) { + if (route === search) { + return true; + } + + if (routes[route].children) { + if (findRoute(search, routes[route].children)) { + return true; + } + } + } + + return false; +}; + +export function useMenu(): { + mainMenuItems: { [key: string]: RouteRecord }; + userMenuItems: { [key: string]: RouteRecord }; +} { + const router = useRouter(); + + const routesTree = filterRouteTree(buildRouteTree(router.getRoutes())); + + return { + mainMenuItems: routesTree, + userMenuItems: routesTree, + }; +} diff --git a/app/assets/layouts/layout-default.vue b/src/FastyBird/Core/Application/assets/layouts/layout-default.vue similarity index 100% rename from app/assets/layouts/layout-default.vue rename to src/FastyBird/Core/Application/assets/layouts/layout-default.vue diff --git a/src/FastyBird/Core/Application/assets/locales/en-US.json b/src/FastyBird/Core/Application/assets/locales/en-US.json new file mode 100644 index 000000000..88a8954c8 --- /dev/null +++ b/src/FastyBird/Core/Application/assets/locales/en-US.json @@ -0,0 +1,8 @@ +{ + "application": { + "menu": { + "root": "MiniServer", + "dashboard": "Dashboard" + } + } +} diff --git a/app/assets/locales/index.ts b/src/FastyBird/Core/Application/assets/locales/index.ts similarity index 88% rename from app/assets/locales/index.ts rename to src/FastyBird/Core/Application/assets/locales/index.ts index cb37c0fc1..6e65d0292 100644 --- a/app/assets/locales/index.ts +++ b/src/FastyBird/Core/Application/assets/locales/index.ts @@ -2,7 +2,7 @@ import { createI18n } from 'vue-i18n'; import enUS from './en-US.json'; -type MessageSchema = typeof enUS; +export type MessageSchema = typeof enUS; const i18n = createI18n<[MessageSchema], 'en-US'>({ legacy: false, diff --git a/src/FastyBird/Core/Application/assets/main.ts b/src/FastyBird/Core/Application/assets/main.ts new file mode 100644 index 000000000..da13531c9 --- /dev/null +++ b/src/FastyBird/Core/Application/assets/main.ts @@ -0,0 +1,66 @@ +import { createApp } from 'vue'; +import { createMetaManager, plugin as metaPlugin } from 'vue-meta'; + +import { createPinia } from 'pinia'; + +import get from 'lodash.get'; +import 'nprogress/nprogress.css'; +import 'virtual:uno.css'; + +import { IExtensionsOptions, backendPlugin, eventBusPlugin, extensionsPlugin, storesPlugin } from '@fastybird/tools'; +import { createWampV1Client } from '@fastybird/vue-wamp-v1'; +import '@fastybird/web-ui-theme-chalk/src/index.scss'; + +import { extensions } from '../../../../../var/config/extensions'; + +import { version } from './../package.json'; +import App from './App.vue'; +import i18n from './locales'; +import router from './router'; +import './styles/base.scss'; + +const pinia = createPinia(); + +const app = createApp(App); + +app.use(i18n); + +app.use(createMetaManager()); + +app.use(metaPlugin); + +app.use(pinia); + +app.use(createWampV1Client(), { + host: 'ws://localhost:3000/ws-exchange', + debug: true, +}); + +app.use(eventBusPlugin); + +app.use(storesPlugin); + +app.use(backendPlugin, { + apiPrefix: get(import.meta.env, 'FB_APP_PARAMETER__API_PREFIX', '/api'), + apiTarget: get(import.meta.env, 'FB_APP_PARAMETER__API_TARGET', null), + apiKey: get(import.meta.env, 'FB_APP_PARAMETER__API_KEY', null), + apiPrefixedModules: `${get(import.meta.env, 'FB_APP_PARAMETER__API_PREFIXED_MODULES', true)}`.toLowerCase() === 'true', +}); + +app.use(extensionsPlugin, { + extensions, + options: { + router, + meta: { + author: 'FastyBird s.r.o.', + website: 'https://www.fastybird.com', + version: version, + }, + store: pinia, + i18n, + }, +} as IExtensionsOptions); + +app.use(router); + +router.isReady().then(() => app.mount('#app')); diff --git a/app/assets/router/index.ts b/src/FastyBird/Core/Application/assets/router/index.ts similarity index 74% rename from app/assets/router/index.ts rename to src/FastyBird/Core/Application/assets/router/index.ts index a043336ab..e63261b31 100644 --- a/app/assets/router/index.ts +++ b/src/FastyBird/Core/Application/assets/router/index.ts @@ -1,11 +1,17 @@ -import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; +import { RouteRecordRaw, createRouter, createWebHistory } from 'vue-router'; + import NProgress from 'nprogress'; +import { FasGaugeHigh } from '@fastybird/web-ui-icons'; + const routes: RouteRecordRaw[] = [ { path: '/', name: 'root', component: () => import('../layouts/layout-default.vue'), + meta: { + title: 'MiniServer', + }, redirect: () => ({ name: 'application-home' }), children: [ { @@ -14,6 +20,8 @@ const routes: RouteRecordRaw[] = [ component: () => import('../views/view-home.vue'), meta: { guards: ['authenticated'], + title: 'Dashboard', + icon: FasGaugeHigh, }, }, ], diff --git a/app/assets/styles/base.scss b/src/FastyBird/Core/Application/assets/styles/base.scss similarity index 100% rename from app/assets/styles/base.scss rename to src/FastyBird/Core/Application/assets/styles/base.scss diff --git a/app/assets/views/view-home.vue b/src/FastyBird/Core/Application/assets/views/view-home.vue similarity index 100% rename from app/assets/views/view-home.vue rename to src/FastyBird/Core/Application/assets/views/view-home.vue diff --git a/src/FastyBird/Library/Application/bin/fb-console b/src/FastyBird/Core/Application/bin/fb-console similarity index 100% rename from src/FastyBird/Library/Application/bin/fb-console rename to src/FastyBird/Core/Application/bin/fb-console diff --git a/src/FastyBird/Library/Application/bin/fb-console.php b/src/FastyBird/Core/Application/bin/fb-console.php similarity index 94% rename from src/FastyBird/Library/Application/bin/fb-console.php rename to src/FastyBird/Core/Application/bin/fb-console.php index 0b82613f0..5aa5465d1 100644 --- a/src/FastyBird/Library/Application/bin/fb-console.php +++ b/src/FastyBird/Core/Application/bin/fb-console.php @@ -1,6 +1,6 @@ =8.2.0", "contributte/cache": "^0.6", "contributte/console": "^0.9", "contributte/monolog": "^0.5", + "contributte/vite": "^0.2", "cweagans/composer-patches": "^1.7", "doctrine/orm": "2.15.*", "fastybird/datetime-factory": "^0.7.1", "fastybird/metadata-library": "dev-main", "fastybird/simple-auth": "^0.14", "ipub/doctrine-timestampable": "^2.0", - "nette/bootstrap": "^3.1", + "nette/bootstrap": "^3.2", "nette/application": "^3.1", - "nette/di": "^3.0", + "nette/caching": "^3.3", + "nette/di": "^3.2", "nette/utils": "^4.0", "orisai/nette-object-mapper": "^0.1", "orisai/object-mapper": "^0.2", + "psr/event-dispatcher": "^1.0", + "ramsey/uuid": "^4.7", "react/event-loop": "^1.3", - "sentry/sdk": "^3.1", + "symfony/event-dispatcher-contracts": "^3.5", "symfony/monolog-bridge": "^6.1", "symplify/vendor-patches": "^11.2" }, "require-dev": { "brianium/paratest": "^7.3", "dg/bypass-finals": "^1.4", + "ipub/websockets": "^1.7", + "ipub/websockets-wamp": "^1.4", "infection/infection": "^0.27", - "latte/latte": "^3.0", "orisai/coding-standard": "^3.2", "pds/skeleton": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.10", "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-doctrine": "^1.3", "phpstan/phpstan-nette": "^1.1", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.4", "phpunit/phpunit": "^10.0", + "react/http": "^1.7", "staabm/annotate-pull-request-from-checkstyle": "^1.8", "tracy/tracy": "^2.9" }, "autoload": { "psr-4": { - "FastyBird\\Library\\Application\\": "src/" + "FastyBird\\Core\\Application\\": "src/" } }, "autoload-dev": { "psr-4": { - "FastyBird\\Library\\Application\\Tests\\Cases\\Unit\\": "tests/cases/unit" + "FastyBird\\Core\\Application\\Tests\\Cases\\Unit\\": "tests/cases/unit", + "FastyBird\\Core\\Application\\Tests\\Fixtures\\": "tests/fixtures", + "FastyBird\\Core\\Application\\Tests\\Fixtures\\Dummy\\": "tests/fixtures/dummy", + "FastyBird\\Core\\Application\\Tests\\Tools\\": "tests/tools" } }, "config": { diff --git a/src/FastyBird/Library/Application/config/common.neon b/src/FastyBird/Core/Application/config/common.neon similarity index 81% rename from src/FastyBird/Library/Application/config/common.neon rename to src/FastyBird/Core/Application/config/common.neon index 83c081cf1..31c316b4a 100644 --- a/src/FastyBird/Library/Application/config/common.neon +++ b/src/FastyBird/Core/Application/config/common.neon @@ -4,7 +4,7 @@ # @license More in LICENSE.md # @copyright https://www.fastybird.com # @author Adam Kadlec -# @package FastyBird:ApplicationLibrary! +# @package FastyBird:Application! # @subpackage config # @since 1.0.0 # @@ -20,7 +20,7 @@ extensions: contributteCacheFactory : Contributte\Cache\DI\CacheFactoryExtension # contributteCacheDebug : Contributte\Cache\DI\DebugStorageExtension orisaiObjectMapper : OriNette\ObjectMapper\DI\ObjectMapperExtension - fbApplicationLibrary : FastyBird\Library\Application\DI\ApplicationExtension + fbApplication : FastyBird\Core\Application\DI\ApplicationExtension fbDateTimeFactory : FastyBird\DateTimeFactory\DI\DateTimeFactoryExtension ################################## @@ -28,14 +28,14 @@ extensions: ################################## services: - # cache.storage: FastyBird\Library\Application\Caching\MemoryAdapterStorage(Nette\Caching\Storages\FileStorage(%tempDir%/cache, Nette\Caching\Storages\SQLiteJournal(%tempDir%/cache/journal.s3db))) + # cache.storage: FastyBird\Core\Application\Caching\MemoryAdapterStorage(Nette\Caching\Storages\FileStorage(%tempDir%/cache, Nette\Caching\Storages\SQLiteJournal(%tempDir%/cache/journal.s3db))) # cache.storage: Nette\Caching\Storages\FileStorage(%tempDir%/cache, Nette\Caching\Storages\SQLiteJournal(%tempDir%/cache/journal.s3db)) # cache.storage: Nette\Caching\Storages\FileStorage(%tempDir%/cache) # Symfony console support extension ################################### contributteConsole: - name: "FastyBird:ApplicationLibrary!" + name: "FastyBird:Application!" version: "1.0" catchExceptions: true autoExit: true @@ -67,11 +67,11 @@ contributteMonolog: orisaiObjectMapper: debug: %debugMode% rules: - - FastyBird\Library\Application\ObjectMapper\Rules\UuidRule() + - FastyBird\Core\Application\ObjectMapper\Rules\UuidRule() # Core application extension ############################ -fbApplicationLibrary: +fbApplication: logging: rotatingFile: enabled: %logger.rotatingFile.enabled% @@ -84,10 +84,6 @@ fbApplicationLibrary: enabled: %logger.console.enabled% level: %logger.console.level% - sentry: - dsn: %sentry.dsn% - level: %sentry.level% - # Application extension ####################### application: diff --git a/src/FastyBird/Library/Application/config/defaults.neon b/src/FastyBird/Core/Application/config/defaults.neon similarity index 84% rename from src/FastyBird/Library/Application/config/defaults.neon rename to src/FastyBird/Core/Application/config/defaults.neon index 6ca7096a7..f5d822759 100644 --- a/src/FastyBird/Library/Application/config/defaults.neon +++ b/src/FastyBird/Core/Application/config/defaults.neon @@ -4,7 +4,7 @@ # @license More in LICENSE.md # @copyright https://www.fastybird.com # @author Adam Kadlec -# @package FastyBird:ApplicationLibrary! +# @package FastyBird:Application! # @subpackage config # @since 1.0.0 # @@ -22,7 +22,3 @@ parameters: console: enabled: false level: 200 - - sentry: - dsn: - level: 300 diff --git a/src/FastyBird/Library/Application/docs/Home.md b/src/FastyBird/Core/Application/docs/Home.md similarity index 92% rename from src/FastyBird/Library/Application/docs/Home.md rename to src/FastyBird/Core/Application/docs/Home.md index 1e3068142..d28a3f5b9 100644 --- a/src/FastyBird/Library/Application/docs/Home.md +++ b/src/FastyBird/Core/Application/docs/Home.md @@ -16,7 +16,7 @@ This library has some services divided into namespaces. All services are preconf container automatically. ``` -\FastyBird\Library\Application +\FastyBird\Core\Application \Boot - Application bootstrap related services \Caching - Cache related services \Helpers - Useful helpers for working with database, logger etc. @@ -111,13 +111,13 @@ You can copy & paste it to your project, for example to `/www/index.ph require __DIR__ . '/../vendor/autoload.php'; -exit(FastyBird\Library\Application\Boot\Bootstrap::boot() +exit(\FastyBird\Core\Application\Boot\Bootstrap::boot() ->createContainer() ->getByType(Nette\Application\Application::class) ->run()); ``` -When a call `FastyBird\Library\Application\Boot\Bootstrap::boot()` is made, application will try to configure application and +When a call `FastyBird\Core\Application\Boot\Bootstrap::boot()` is made, application will try to configure application and prepare everything for building container. ## Default Extensions @@ -155,13 +155,3 @@ parameters: level: 400 # Levels: DEBUG = 100, INFO = 200, NOTICE = 250, WARNING = 300, ERROR = 400, CRITICAL = 500, ALERT = 550, EMERGENCY = 600 ``` -### Sentry Bug Tracking - -If you would like to track bugs in [Sentry](https://sentry.io/), all what you have to do, is to configure you Sentry -DSN - -```neon -parameters: - sentry: - dsn: yourSecretSentryDSNstring -``` diff --git a/src/FastyBird/Library/Tools/docs/_Footer.md b/src/FastyBird/Core/Application/docs/_Footer.md similarity index 80% rename from src/FastyBird/Library/Tools/docs/_Footer.md rename to src/FastyBird/Core/Application/docs/_Footer.md index b4cb53599..742e3fa0f 100644 --- a/src/FastyBird/Library/Tools/docs/_Footer.md +++ b/src/FastyBird/Core/Application/docs/_Footer.md @@ -5,4 +5,4 @@ Thank you for testing, reporting and contributing. *** Homepage [https://www.fastybird.com](https://www.fastybird.com) and -repository [https://github.com/fastybird/tools-library](https://github.com/fastybird/tools-library). +repository [https://github.com/fastybird/application](https://github.com/fastybird/application). diff --git a/src/FastyBird/Core/Application/eslint.config.mjs b/src/FastyBird/Core/Application/eslint.config.mjs new file mode 100644 index 000000000..3140caf10 --- /dev/null +++ b/src/FastyBird/Core/Application/eslint.config.mjs @@ -0,0 +1,55 @@ +import pluginPrettier from 'eslint-plugin-prettier'; +import pluginVue from 'eslint-plugin-vue'; +import ts from 'typescript-eslint'; + +import js from '@eslint/js'; + +export default [ + js.configs.recommended, + ...ts.configs.recommended, + ...pluginVue.configs['flat/essential'], + ...pluginVue.configs['flat/strongly-recommended'], + ...pluginVue.configs['flat/recommended'], + { + plugins: { + prettier: pluginPrettier, + }, + languageOptions: { + parserOptions: { + parser: '@typescript-eslint/parser', + }, + globals: { + GlobalEventHandlers: 'readonly', + ScrollToOptions: 'readonly', + }, + }, + rules: { + 'lines-between-class-members': [ + 'error', + 'always', + { + exceptAfterSingleLine: true, + }, + ], + 'no-useless-computed-key': 'off', + 'vue/no-setup-props-destructure': 'off', + 'vue/no-v-html': 'off', + 'vue/no-v-text-v-html-on-component': 'off', + 'vue/prefer-import-from-vue': 'off', + 'vue/html-indent': 'off', + 'vue/html-self-closing': [ + 'error', + { + html: { + void: 'always', + normal: 'always', + }, + }, + ], + '@typescript-eslint/explicit-function-return-type': ['error'], + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'prettier/prettier': ['error'], + }, + }, +]; diff --git a/app/favicon.ico b/src/FastyBird/Core/Application/favicon.ico similarity index 100% rename from app/favicon.ico rename to src/FastyBird/Core/Application/favicon.ico diff --git a/app/index.html b/src/FastyBird/Core/Application/index.html similarity index 100% rename from app/index.html rename to src/FastyBird/Core/Application/index.html diff --git a/app/jest.config.mjs b/src/FastyBird/Core/Application/jest.config.mjs similarity index 100% rename from app/jest.config.mjs rename to src/FastyBird/Core/Application/jest.config.mjs diff --git a/app/migrations/.gitignore b/src/FastyBird/Core/Application/migrations/.gitignore similarity index 100% rename from app/migrations/.gitignore rename to src/FastyBird/Core/Application/migrations/.gitignore diff --git a/app/package.json b/src/FastyBird/Core/Application/package.json similarity index 59% rename from app/package.json rename to src/FastyBird/Core/Application/package.json index 31469934e..ddaa3abb2 100644 --- a/app/package.json +++ b/src/FastyBird/Core/Application/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/application", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FastyBird IoT application user interface", "keywords": [ @@ -37,83 +37,72 @@ "preview": "vue-tsc --noEmit && vite build && vite preview --host" }, "dependencies": { - "@fastybird/accounts-module": "1.0.0-dev.23", - "@fastybird/devices-module": "1.0.0-dev.23", - "@fastybird/homekit-connector": "1.0.0-dev.23", - "@fastybird/metadata-library": "1.0.0-dev.23", + "@fastybird/metadata-library": "1.0.0-dev.24", + "@fastybird/tools": "1.0.0-dev.24", "@fastybird/vue-wamp-v1": "^1.2", - "@fastybird/web-ui-library": "1.0.0-dev.23", - "@fastybird/web-ui-icons": "1.0.0-dev.23", + "@fastybird/web-ui-icons": "1.0.0-dev.24", + "@fastybird/web-ui-library": "1.0.0-dev.24", "@iconify/iconify": "^3.1", "@iconify/vue": "^4.1", - "@sentry/tracing": "^7.113", - "@sentry/vue": "^7.113", - "@vueuse/core": "^10.9", - "axios": "^1.6", - "element-plus": "^2.7", - "jsona": "^1.12", + "element-plus": "^2.8", "lodash.get": "^4.4", "md5": "^2.3", - "mitt": "^3.0", "nprogress": "^0.2", - "pinia": "^2.1", - "vee-validate": "^4.12", - "vue": "^3.4", - "vue-i18n": "^9.13", + "pinia": "^2.2", + "unocss": "^0.64", + "vue": "^3.5", + "vue-i18n": "^10.0", "vue-meta": "^3.0.0-alpha.10", - "vue-router": "^4.3", - "yup": "^1.4" + "vue-router": "^4.4" }, "devDependencies": { - "@commitlint/cli": "^19.3", - "@commitlint/config-conventional": "^19.2", - "@eslint/js": "^9.1", - "@intlify/unplugin-vue-i18n": "^4.0", + "@commitlint/cli": "^19.6", + "@commitlint/config-conventional": "^19.6", + "@eslint/js": "^9.15", + "@intlify/unplugin-vue-i18n": "^6.0", "@nabla/vite-plugin-eslint": "^2.0", + "@trivago/prettier-plugin-sort-imports": "^4.3", "@types/lodash.get": "^4.4", "@types/md5": "^2.3", - "@types/node": "^20.12", + "@types/node": "^20.17", "@types/nprogress": "^0.2", - "@typescript-eslint/eslint-plugin": "^7.8", - "@typescript-eslint/parser": "^7.8", - "@unocss/transformer-variant-group": "^0.59", - "@vitejs/plugin-vue": "^5.0", - "@vue/eslint-config-prettier": "^9.0", - "@vue/eslint-config-typescript": "^13.0", - "babel-loader": "^9.1", + "@typescript-eslint/eslint-plugin": "^8.15", + "@typescript-eslint/parser": "^8.15", + "@unocss/transformer-variant-group": "^0.64", + "@vitejs/plugin-vue": "^5.2", + "@vue/eslint-config-prettier": "^10.1", + "@vue/eslint-config-typescript": "^14.1", + "babel-loader": "^9.2", "cross-env": "^7.0", "dotenv": "^16.4", - "eslint": "^9.2", + "eslint": "^9.15", "eslint-config-prettier": "^9.1", - "eslint-plugin-json": "^3.1", - "eslint-plugin-markdown": "^5.0", - "eslint-plugin-prettier": "^5.1", - "eslint-plugin-vue": "^9.25", + "eslint-plugin-prettier": "^5.2", + "eslint-plugin-vue": "^9.31", "minimist": "^1.2", "postcss": "^8.4", "postcss-scss": "^4.0", - "prettier": "^3.2", - "rimraf": "^5.0", - "sass": "^1.76", - "sass-loader": "^14.2", - "stylelint": "^16.5", + "prettier": "^3.3", + "rimraf": "^6.0", + "sass": "^1.81", + "sass-loader": "^16.0", + "stylelint": "^16.10", "stylelint-config-prettier": "^9.0", "stylelint-config-recommended-vue": "^1.5", "stylelint-config-standard": "^36.0", "stylelint-config-standard-scss": "^13.1", "stylelint-order": "^6.0", "stylelint-prettier": "^5.0", - "typescript": "^5.4", - "typescript-eslint": "^7.8", - "unocss": "^0.59", + "typescript": "5.6.2", + "typescript-eslint": "^8.15", "vconsole": "^3.15", - "vite": "^5.2", + "vite": "^5.4", "vite-plugin-eslint": "^1.8", "vite-plugin-vconsole": "^2.1", "vite-plugin-vue-type-imports": "^0.2", "vite-svg-loader": "^5.1", "vue-loader": "^17.4", - "vue-tsc": "^2.0" + "vue-tsc": "^2.1" }, "engines": { "node": ">=20" diff --git a/src/FastyBird/Core/Application/prettier.config.mjs b/src/FastyBird/Core/Application/prettier.config.mjs new file mode 100644 index 000000000..8ead1ad65 --- /dev/null +++ b/src/FastyBird/Core/Application/prettier.config.mjs @@ -0,0 +1,34 @@ +import pluginSortImports from '@trivago/prettier-plugin-sort-imports'; + +export default { + plugins: [pluginSortImports], + printWidth: 150, + tabWidth: 2, + useTabs: true, + semi: true, + singleQuote: true, + quoteProps: 'as-needed', + jsxSingleQuote: false, + trailingComma: 'es5', + bracketSpacing: true, + arrowParens: 'always', + requirePragma: false, + insertPragma: false, + proseWrap: 'preserve', + htmlWhitespaceSensitivity: 'ignore', // Ensures no conflict with template whitespace + vueIndentScriptAndStyle: false, + endOfLine: 'auto', + singleAttributePerLine: true, + importOrder: [ + // First external imports + '^vue', + '^pinia', + '^[^@\\/.]', + '^@?\\w', + // Now internal imports, separated by space + '^../(.*)$', // Relative imports like `../` + '^./(.*)$', // Relative imports like `./` + ], + importOrderSeparation: true, + importOrderSortSpecifiers: true, +}; diff --git a/src/FastyBird/Library/Application/src/Boot/Bootstrap.php b/src/FastyBird/Core/Application/src/Boot/Bootstrap.php similarity index 97% rename from src/FastyBird/Library/Application/src/Boot/Bootstrap.php rename to src/FastyBird/Core/Application/src/Boot/Bootstrap.php index 7415b2a97..cea95382f 100644 --- a/src/FastyBird/Library/Application/src/Boot/Bootstrap.php +++ b/src/FastyBird/Core/Application/src/Boot/Bootstrap.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Boot * @since 1.0.0 * * @date 08.03.20 */ -namespace FastyBird\Library\Application\Boot; +namespace FastyBird\Core\Application\Boot; -use FastyBird\Library\Application\Exceptions; +use FastyBird\Core\Application\Exceptions; use Tester; use function array_key_exists; use function array_merge; @@ -46,7 +46,7 @@ /** * Service application configurator * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Boot * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Boot/Configurator.php b/src/FastyBird/Core/Application/src/Boot/Configurator.php similarity index 94% rename from src/FastyBird/Library/Application/src/Boot/Configurator.php rename to src/FastyBird/Core/Application/src/Boot/Configurator.php index 2a2f17b2b..6822c6361 100644 --- a/src/FastyBird/Library/Application/src/Boot/Configurator.php +++ b/src/FastyBird/Core/Application/src/Boot/Configurator.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Boot * @since 1.0.0 * * @date 25.10.22 */ -namespace FastyBird\Library\Application\Boot; +namespace FastyBird\Core\Application\Boot; use Composer\Autoload\ClassLoader; use Nette\Bootstrap; @@ -37,7 +37,7 @@ /** * Extended container configurator * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Boot * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Caching/MemoryAdapterStorage.php b/src/FastyBird/Core/Application/src/Caching/MemoryAdapterStorage.php similarity index 95% rename from src/FastyBird/Library/Application/src/Caching/MemoryAdapterStorage.php rename to src/FastyBird/Core/Application/src/Caching/MemoryAdapterStorage.php index 12768d7a3..70edd4d93 100644 --- a/src/FastyBird/Library/Application/src/Caching/MemoryAdapterStorage.php +++ b/src/FastyBird/Core/Application/src/Caching/MemoryAdapterStorage.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Caching * @since 1.0.0 * * @date 08.03.20 */ -namespace FastyBird\Library\Application\Caching; +namespace FastyBird\Core\Application\Caching; use Nette\Caching; diff --git a/src/FastyBird/Library/Application/src/Caching/MemoryStorage.php b/src/FastyBird/Core/Application/src/Caching/MemoryStorage.php similarity index 95% rename from src/FastyBird/Library/Application/src/Caching/MemoryStorage.php rename to src/FastyBird/Core/Application/src/Caching/MemoryStorage.php index befc19306..8fae4cad3 100644 --- a/src/FastyBird/Library/Application/src/Caching/MemoryStorage.php +++ b/src/FastyBird/Core/Application/src/Caching/MemoryStorage.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Caching * @since 1.0.0 * * @date 23.02.24 */ -namespace FastyBird\Library\Application\Caching; +namespace FastyBird\Core\Application\Caching; use Nette; use Nette\Caching; diff --git a/src/FastyBird/Library/Application/src/DI/ApplicationExtension.php b/src/FastyBird/Core/Application/src/DI/ApplicationExtension.php similarity index 60% rename from src/FastyBird/Library/Application/src/DI/ApplicationExtension.php rename to src/FastyBird/Core/Application/src/DI/ApplicationExtension.php index 1088857cb..532cdcf1b 100644 --- a/src/FastyBird/Library/Application/src/DI/ApplicationExtension.php +++ b/src/FastyBird/Core/Application/src/DI/ApplicationExtension.php @@ -6,41 +6,43 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage DI * @since 1.0.0 * - * @date 08.03.20 + * @date 16.06.24 */ -namespace FastyBird\Library\Application\DI; +namespace FastyBird\Core\Application\DI; -use FastyBird\Library\Application\Boot; -use FastyBird\Library\Application\EventLoop; -use FastyBird\Library\Application\Helpers; -use FastyBird\Library\Application\Router; -use FastyBird\Library\Application\Subscribers; -use FastyBird\Library\Application\UI; -use FastyBird\Library\Application\Utilities; +use FastyBird\Core\Application\Boot; +use FastyBird\Core\Application\Documents; +use FastyBird\Core\Application\EventLoop; +use FastyBird\Core\Application\Exceptions; +use FastyBird\Core\Application\Router; +use FastyBird\Core\Application\Subscribers; +use FastyBird\Core\Application\UI; use Monolog; use Nette; +use Nette\Application; use Nette\Bootstrap; +use Nette\Caching; use Nette\DI; use Nette\Schema; -use Sentry; use stdClass; use Symfony\Bridge\Monolog as SymfonyMonolog; +use function array_values; use function assert; use function class_exists; -use function getenv; -use function interface_exists; +use function is_dir; use function is_string; +use function sprintf; use const DIRECTORY_SEPARATOR; /** - * App application extension container + * FastyBird application * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage DI * * @author Adam Kadlec @@ -48,7 +50,9 @@ class ApplicationExtension extends DI\CompilerExtension { - public const NAME = 'fbApplicationLibrary'; + public const NAME = 'fbApplication'; + + public const DRIVER_TAG = 'fastybird.application.attribute.driver'; public static function register( Boot\Configurator $config, @@ -89,15 +93,16 @@ public function getConfigSchema(): Schema\Schema ), ], ), - 'sentry' => Schema\Expect::structure( - [ - 'dsn' => Schema\Expect::string()->nullable(), - 'level' => Schema\Expect::int(Monolog\Level::Warning), - ], - ), + 'documents' => Schema\Expect::structure([ + 'mapping' => Schema\Expect::arrayOf(Schema\Expect::string(), Schema\Expect::string())->required(), + 'excludePaths' => Schema\Expect::arrayOf(Schema\Expect::string(), Schema\Expect::string()), + ]), ]); } + /** + * @throws Exceptions\InvalidState + */ public function loadConfiguration(): void { $builder = $this->getContainerBuilder(); @@ -144,13 +149,11 @@ public function loadConfiguration(): void * HELPERS */ - $builder->addDefinition($this->prefix('helpers.eventLoop'), new DI\Definitions\ServiceDefinition()) + $builder->addDefinition($this->prefix('eventLoop.wrapper'), new DI\Definitions\ServiceDefinition()) ->setType(EventLoop\Wrapper::class); - if (class_exists('\Doctrine\DBAL\Connection') && class_exists('\Doctrine\ORM\EntityManager')) { - $builder->addDefinition($this->prefix('helpers.database'), new DI\Definitions\ServiceDefinition()) - ->setType(Helpers\Database::class); - } + $builder->addDefinition($this->prefix('eventLoop.status'), new DI\Definitions\ServiceDefinition()) + ->setType(EventLoop\Status::class); /** * SUBSCRIBERS @@ -174,56 +177,7 @@ public function loadConfiguration(): void } $builder->addDefinition($this->prefix('subscribers.eventLoop'), new DI\Definitions\ServiceDefinition()) - ->setType(Subscribers\EventLoop::class); - - /** - * SENTRY ISSUES LOGGER - */ - - if (interface_exists('\Sentry\ClientInterface')) { - $builder->addDefinition($this->prefix('helpers.sentry'), new DI\Definitions\ServiceDefinition()) - ->setType(Helpers\Sentry::class); - } - - if ( - isset($_ENV['FB_APP_PARAMETER__SENTRY_DSN']) - && is_string($_ENV['FB_APP_PARAMETER__SENTRY_DSN']) - && $_ENV['FB_APP_PARAMETER__SENTRY_DSN'] !== '' - ) { - $sentryDSN = $_ENV['FB_APP_PARAMETER__SENTRY_DSN']; - - } elseif ( - getenv('FB_APP_PARAMETER__SENTRY_DSN') !== false - && getenv('FB_APP_PARAMETER__SENTRY_DSN') !== '' - ) { - $sentryDSN = getenv('FB_APP_PARAMETER__SENTRY_DSN'); - - } elseif ($configuration->sentry->dsn !== null) { - $sentryDSN = $configuration->sentry->dsn; - - } else { - $sentryDSN = null; - } - - if (is_string($sentryDSN) && $sentryDSN !== '') { - $builder->addDefinition($this->prefix('sentry.handler'), new DI\Definitions\ServiceDefinition()) - ->setType(Sentry\Monolog\Handler::class) - ->setArgument('level', $configuration->logging->sentry->level); - - $sentryClientBuilderService = $builder->addDefinition( - $this->prefix('sentry.clientBuilder'), - new DI\Definitions\ServiceDefinition(), - ) - ->setFactory('Sentry\ClientBuilder::create') - ->setArguments([['dsn' => $sentryDSN]]); - - $builder->addDefinition($this->prefix('sentry.client'), new DI\Definitions\ServiceDefinition()) - ->setType(Sentry\ClientInterface::class) - ->setFactory([$sentryClientBuilderService, 'getClient']); - - $builder->addDefinition($this->prefix('sentry.hub'), new DI\Definitions\ServiceDefinition()) - ->setType(Sentry\State\Hub::class); - } + ->setType(Subscribers\EventLoopLifeCycle::class); /** * UI @@ -233,17 +187,57 @@ public function loadConfiguration(): void ->setType(UI\TemplateFactory::class); $builder->addDefinition($this->prefix('ui.routes'), new DI\Definitions\ServiceDefinition()) - ->setType(Router\AppRouter::class); + ->setType(Nette\Application\Routers\RouteList::class); /** - * Utilities + * DOCUMENTS SERVICES */ - $builder->addDefinition($this->prefix('utilities.doctrineDateProvider'), new DI\Definitions\ServiceDefinition()) - ->setType(Utilities\DateTimeProvider::class); + $metadataCache = $builder->addDefinition( + $this->prefix('document.cache'), + new DI\Definitions\ServiceDefinition(), + ) + ->setType(Caching\Cache::class) + ->setArguments([ + 'namespace' => 'metadata_class_metadata', + ]) + ->setAutowired(false); + + $builder->addDefinition('document.factory', new DI\Definitions\ServiceDefinition()) + ->setType(Documents\DocumentFactory::class); + + $attributeDriver = $builder->addDefinition( + 'document.mapping.attributeDriver', + new DI\Definitions\ServiceDefinition(), + ) + ->setType(Documents\Mapping\Driver\AttributeDriver::class) + ->setArguments([ + 'paths' => array_values($configuration->documents->mapping), + ]) + ->addSetup('addExcludePaths', [$configuration->documents->excludePaths]) + ->addTag(self::DRIVER_TAG) + ->setAutowired(false); + + $mappingDriver = $builder->addDefinition( + 'document.mapping.mappingDriver', + new DI\Definitions\ServiceDefinition(), + ) + ->setType(Documents\Mapping\Driver\MappingDriverChain::class); + + $builder->addDefinition('document.mapping.classMetadataFactory', new DI\Definitions\ServiceDefinition()) + ->setType(Documents\Mapping\ClassMetadataFactory::class) + ->setArguments([ + 'driver' => $mappingDriver, + 'cache' => $metadataCache, + ]); + + foreach ($configuration->documents->mapping as $namespace => $path) { + if (!is_dir($path)) { + throw new Exceptions\InvalidState(sprintf('Given mapping path "%s" does not exist', $path)); + } - $builder->addDefinition($this->prefix('utilities.eventLoop.status'), new DI\Definitions\ServiceDefinition()) - ->setType(Utilities\EventLoopStatus::class); + $mappingDriver->addSetup('addDriver', [$attributeDriver, $namespace]); + } } /** @@ -284,25 +278,6 @@ public function beforeCompile(): void } } - /** - * SENTRY - */ - - $sentryHandlerServiceName = $builder->getByType(Sentry\Monolog\Handler::class); - - if ($sentryHandlerServiceName !== null) { - $monologLoggerServiceName = $builder->getByType(Monolog\Logger::class); - assert(is_string($monologLoggerServiceName)); - - $monologLoggerService = $builder->getDefinition($monologLoggerServiceName); - assert($monologLoggerService instanceof DI\Definitions\ServiceDefinition); - - $sentryHandlerService = $builder->getDefinition($this->prefix('sentry.handler')); - assert($sentryHandlerService instanceof DI\Definitions\ServiceDefinition); - - $monologLoggerService->addSetup('?->pushHandler(?)', ['@self', $sentryHandlerService]); - } - /** * DOCTRINE */ @@ -321,6 +296,40 @@ class_exists('\Doctrine\DBAL\Connection') $builder->getDefinitionByType(Subscribers\EntityDiscriminator::class), ]); } + + /** + * ROUTES + */ + + $appRouterServiceName = $builder->getByType(Application\Routers\RouteList::class); + assert(is_string($appRouterServiceName)); + $appRouterService = $builder->getDefinition($appRouterServiceName); + assert($appRouterService instanceof DI\Definitions\ServiceDefinition); + + $appRouterService->addSetup([Router\AppRouter::class, 'createRouter'], [$appRouterService]); + + /** + * UI + */ + + $presenterFactoryService = $builder->getDefinitionByType(Application\IPresenterFactory::class); + + if ($presenterFactoryService instanceof DI\Definitions\ServiceDefinition) { + $presenterFactoryService->addSetup('setMapping', [[ + 'App' => 'FastyBird\Core\Application\Presenters\*Presenter', + ]]); + } + + $templateFactoryService = $builder->getDefinitionByType(UI\TemplateFactory::class); + assert($templateFactoryService instanceof DI\Definitions\ServiceDefinition); + + $templateFactoryService->addSetup( + 'registerLayout', + [ + __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR + . 'templates' . DIRECTORY_SEPARATOR . '@layout.latte', + ], + ); } } diff --git a/src/FastyBird/Library/Metadata/src/Documents/CreatedAt.php b/src/FastyBird/Core/Application/src/Documents/CreatedAt.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Documents/CreatedAt.php rename to src/FastyBird/Core/Application/src/Documents/CreatedAt.php index 50d723dff..733110131 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/CreatedAt.php +++ b/src/FastyBird/Core/Application/src/Documents/CreatedAt.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 03.01.23 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use DateTimeInterface; /** * Data document created at interface * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/Document.php b/src/FastyBird/Core/Application/src/Documents/Document.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Documents/Document.php rename to src/FastyBird/Core/Application/src/Documents/Document.php index 914e137e1..50a2a8bcb 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Document.php +++ b/src/FastyBird/Core/Application/src/Documents/Document.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 31.05.22 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use Orisai\ObjectMapper; /** * Data document interface * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/DocumentFactory.php b/src/FastyBird/Core/Application/src/Documents/DocumentFactory.php similarity index 88% rename from src/FastyBird/Library/Metadata/src/Documents/DocumentFactory.php rename to src/FastyBird/Core/Application/src/Documents/DocumentFactory.php index 82c0d4a3e..c7f7bf599 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/DocumentFactory.php +++ b/src/FastyBird/Core/Application/src/Documents/DocumentFactory.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 02.06.22 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; -use FastyBird\Library\Metadata\Documents; -use FastyBird\Library\Metadata\Events; -use FastyBird\Library\Metadata\Exceptions; +use FastyBird\Core\Application\Documents; +use FastyBird\Core\Application\Events; +use FastyBird\Core\Application\Exceptions; use Nette\Utils; use Orisai\ObjectMapper; use Psr\EventDispatcher; @@ -31,7 +31,7 @@ /** * Data document factory * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -40,9 +40,9 @@ { public function __construct( - private readonly Mapping\ClassMetadataFactory $classMetadataFactory, - private readonly ObjectMapper\Processing\Processor $documentMapper, - private readonly EventDispatcher\EventDispatcherInterface|null $dispatcher = null, + private Documents\Mapping\ClassMetadataFactory $classMetadataFactory, + private ObjectMapper\Processing\Processor $documentMapper, + private EventDispatcher\EventDispatcherInterface|null $dispatcher = null, ) { } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/ClassMetadata.php b/src/FastyBird/Core/Application/src/Documents/Mapping/ClassMetadata.php similarity index 96% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/ClassMetadata.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/ClassMetadata.php index 0ed80bfec..a865510c4 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/ClassMetadata.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/ClassMetadata.php @@ -6,17 +6,17 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; -use FastyBird\Library\Metadata\Documents; -use FastyBird\Library\Metadata\Exceptions; +use FastyBird\Core\Application\Documents; +use FastyBird\Core\Application\Exceptions; use ReflectionClass; use function array_pop; use function assert; @@ -287,7 +287,7 @@ public function addSubClasses(array $classes): void public function addSubClass(string $className): void { // By ignoring classes that are not subclasses of the current class, we simplify inheriting - // the subclass list from a parent class at the beginning of \FastyBird\Metadata\Documents\DocumentFactory::doLoadMetadata + // the subclass list from a parent class at the beginning of Documents\DocumentFactory::doLoadMetadata if (is_subclass_of($className, $this->name) && !in_array($className, $this->subClasses, true)) { $this->subClasses[] = $className; } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/ClassMetadataFactory.php b/src/FastyBird/Core/Application/src/Documents/Mapping/ClassMetadataFactory.php similarity index 88% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/ClassMetadataFactory.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/ClassMetadataFactory.php index 7a9db7cca..9eb46812f 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/ClassMetadataFactory.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/ClassMetadataFactory.php @@ -6,19 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 02.06.22 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; -use FastyBird\Library\Metadata\Documents; -use FastyBird\Library\Metadata\Documents\Mapping; -use FastyBird\Library\Metadata\Events; -use FastyBird\Library\Metadata\Exceptions; +use FastyBird\Core\Application\Documents; +use FastyBird\Core\Application\Events; +use FastyBird\Core\Application\Exceptions; use Nette\Caching; use Psr\EventDispatcher; use ReflectionClass; @@ -39,13 +38,12 @@ use function sprintf; use function str_contains; use function str_replace; -use function strpos; use function strtolower; /** * Class metadata factory * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -53,13 +51,13 @@ final class ClassMetadataFactory { - /** @var array, Mapping\ClassMetadata> */ + /** @var array, Documents\Mapping\ClassMetadata> */ private array $loadedMetadata = []; private string $cacheSalt = '__CLASS_METADATA__'; public function __construct( - private readonly Mapping\Driver\MappingDriver $driver, + private readonly Documents\Mapping\Driver\MappingDriver $driver, private readonly Caching\Cache $cache, private readonly EventDispatcher\EventDispatcherInterface|null $dispatcher = null, ) @@ -71,12 +69,12 @@ public function __construct( * * @param class-string $className * - * @return Mapping\ClassMetadata + * @return Documents\Mapping\ClassMetadata * * @throws Exceptions\InvalidArgument * @throws Exceptions\Mapping */ - public function getMetadataFor(string $className): Mapping\ClassMetadata + public function getMetadataFor(string $className): Documents\Mapping\ClassMetadata { $className = $this->normalizeClassName($className); @@ -91,11 +89,11 @@ public function getMetadataFor(string $className): Mapping\ClassMetadata throw new Exceptions\InvalidArgument(sprintf('Provided document class: "%s" is anonymous', $className)); } - if (!class_exists($className, false) && strpos($className, ':') !== false) { + if (!class_exists($className, false) && str_contains($className, ':')) { throw new Exceptions\InvalidArgument(sprintf('Provided document class: "%s" is non existing', $className)); } - /** @var array, Mapping\ClassMetadata> $loadedMetadata */ + /** @var array, Documents\Mapping\ClassMetadata> $loadedMetadata */ $loadedMetadata = $this->cache->load( $this->getCacheKey($className), fn () => $this->loadMetadata($className), @@ -117,7 +115,7 @@ public function getMetadataFor(string $className): Mapping\ClassMetadata * * @param class-string $name * - * @return array, Mapping\ClassMetadata> + * @return array, Documents\Mapping\ClassMetadata> * * @throws Exceptions\InvalidArgument * @throws Exceptions\Mapping @@ -147,7 +145,7 @@ private function loadMetadata(string $name): array continue; } - $class = new Mapping\ClassMetadata($className); + $class = new Documents\Mapping\ClassMetadata($className); $this->doLoadMetadata($class, $parent, $rootDocumentFound, $visited); @@ -169,16 +167,16 @@ private function loadMetadata(string $name): array /** * @template T of Documents\Document * - * @param Mapping\ClassMetadata $class - * @param Mapping\ClassMetadata|null $parent + * @param Documents\Mapping\ClassMetadata $class + * @param Documents\Mapping\ClassMetadata|null $parent * @param array> $nonSuperclassParents * * @throws Exceptions\InvalidArgument * @throws Exceptions\Mapping */ private function doLoadMetadata( - Mapping\ClassMetadata $class, - Mapping\ClassMetadata|null $parent, + Documents\Mapping\ClassMetadata $class, + Documents\Mapping\ClassMetadata|null $parent, bool $rootDocumentFound, array $nonSuperclassParents, ): void @@ -239,12 +237,12 @@ private function doLoadMetadata( * * @template T of Documents\Document * - * @param Mapping\ClassMetadata $class + * @param Documents\Mapping\ClassMetadata $class * * @throws Exceptions\InvalidArgument * @throws Exceptions\Mapping */ - private function addDefaultDiscriminatorMap(Mapping\ClassMetadata $class): void + private function addDefaultDiscriminatorMap(Documents\Mapping\ClassMetadata $class): void { $allClasses = $this->driver->getAllClassNames(); $fqcn = $class->getName(); @@ -289,7 +287,7 @@ private function addDefaultDiscriminatorMap(Mapping\ClassMetadata $class): void /** * @template T of Documents\Document * - * @param Mapping\ClassMetadata $class + * @param Documents\Mapping\ClassMetadata $class * * @throws Exceptions\Mapping */ @@ -336,10 +334,10 @@ private function tryToFindDiscriminators(ClassMetadata $class): void /** * @template T of Documents\Document * - * @param Mapping\ClassMetadata $rootDocumentClass + * @param Documents\Mapping\ClassMetadata $rootDocumentClass */ private function findAbstractDocumentClassesNotListedInDiscriminatorMap( - Mapping\ClassMetadata $rootDocumentClass, + Documents\Mapping\ClassMetadata $rootDocumentClass, ): void { // Only root classes in inheritance hierarchies need contain a discriminator map, @@ -390,7 +388,7 @@ private function findAbstractDocumentClassesNotListedInDiscriminatorMap( */ private function peekIfIsMappedSuperclass(string $className): bool { - $class = new Mapping\ClassMetadata($className); + $class = new Documents\Mapping\ClassMetadata($className); $this->driver->loadMetadataForClass($class); @@ -402,14 +400,14 @@ private function peekIfIsMappedSuperclass(string $className): bool * * @template T of Documents\Document * - * @param Mapping\ClassMetadata $class - * @param Mapping\ClassMetadata|null $parent + * @param Documents\Mapping\ClassMetadata $class + * @param Documents\Mapping\ClassMetadata|null $parent * * @throws Exceptions\Mapping */ private function validateRuntimeMetadata( - Mapping\ClassMetadata $class, - Mapping\ClassMetadata|null $parent, + Documents\Mapping\ClassMetadata $class, + Documents\Mapping\ClassMetadata|null $parent, ): void { // Verify inheritance diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorColumn.php b/src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorColumn.php similarity index 70% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorColumn.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorColumn.php index 90db5a753..f02db817a 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorColumn.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorColumn.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; use Attribute; /** * Document discriminator column definition * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -29,7 +29,7 @@ final readonly class DiscriminatorColumn implements MappingAttribute { - public function __construct(public readonly string $name, public string|null $type = null) + public function __construct(public string $name, public string|null $type = null) { } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorEntry.php b/src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorEntry.php similarity index 73% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorEntry.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorEntry.php index 2e3f4cc22..6dc6494d0 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorEntry.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorEntry.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; use Attribute; /** * Document discriminator item attribute * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -29,7 +29,7 @@ final readonly class DiscriminatorEntry implements MappingAttribute { - public function __construct(public readonly string $name) + public function __construct(public string $name) { } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorMap.php b/src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorMap.php similarity index 72% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorMap.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorMap.php index 1092ac8d2..969cf5338 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/DiscriminatorMap.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/DiscriminatorMap.php @@ -6,24 +6,24 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; use Attribute; -use FastyBird\Library\Metadata\Documents; +use FastyBird\Core\Application\Documents; /** * Document discriminator map definition * * @template T of Documents\Document * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @author Adam Kadlec */ @@ -34,7 +34,7 @@ /** * @param array> $value */ - public function __construct(public readonly array $value) + public function __construct(public array $value) { } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Document.php b/src/FastyBird/Core/Application/src/Documents/Mapping/Document.php similarity index 72% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/Document.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/Document.php index f5aabff51..083a86600 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Document.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/Document.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; use Attribute; /** * Document definition * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -32,7 +32,7 @@ /** * @param class-string|null $entity */ - public function __construct(public readonly string|null $entity = null) + public function __construct(public string|null $entity = null) { } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/AttributeDriver.php b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/AttributeDriver.php similarity index 96% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/AttributeDriver.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/Driver/AttributeDriver.php index 4ad2fba1c..7bddb6d92 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/AttributeDriver.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/AttributeDriver.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping\Driver; +namespace FastyBird\Core\Application\Documents\Mapping\Driver; use Error; -use FastyBird\Library\Metadata\Documents; -use FastyBird\Library\Metadata\Exceptions; +use FastyBird\Core\Application\Documents; +use FastyBird\Core\Application\Exceptions; use FilesystemIterator; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; @@ -44,7 +44,7 @@ /** * Document mapping attribute driver * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -287,7 +287,7 @@ public function loadMetadataForClass(Documents\Mapping\ClassMetadata $metadata): try { $inheritanceType = constant( - 'FastyBird\Library\Metadata\Documents\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceTypeAttribute->type, + 'FastyBird\Core\Application\Documents\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceTypeAttribute->type, ); assert(is_int($inheritanceType)); } catch (Error $ex) { diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/AttributeReader.php b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/AttributeReader.php similarity index 91% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/AttributeReader.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/Driver/AttributeReader.php index abcaca64e..5d9e49c09 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/AttributeReader.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/AttributeReader.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping\Driver; +namespace FastyBird\Core\Application\Documents\Mapping\Driver; -use FastyBird\Library\Metadata\Documents; +use FastyBird\Core\Application\Documents; use ReflectionAttribute; use ReflectionClass; use ReflectionMethod; @@ -27,7 +27,7 @@ * * @template T of Documents\Mapping\MappingAttribute * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @author Adam Kadlec * @interal diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/MappingDriver.php b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/MappingDriver.php similarity index 86% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/MappingDriver.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/Driver/MappingDriver.php index 400e765f7..bdec89642 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/MappingDriver.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/MappingDriver.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping\Driver; +namespace FastyBird\Core\Application\Documents\Mapping\Driver; -use FastyBird\Library\Metadata\Documents; +use FastyBird\Core\Application\Documents; /** * Contract for metadata drivers * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/MappingDriverChain.php b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/MappingDriverChain.php similarity index 93% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/MappingDriverChain.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/Driver/MappingDriverChain.php index 8b6304998..e6b17fd63 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/Driver/MappingDriverChain.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/Driver/MappingDriverChain.php @@ -6,17 +6,17 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping\Driver; +namespace FastyBird\Core\Application\Documents\Mapping\Driver; -use FastyBird\Library\Metadata\Documents; -use FastyBird\Library\Metadata\Exceptions; +use FastyBird\Core\Application\Documents; +use FastyBird\Core\Application\Exceptions; use function array_keys; use function implode; use function spl_object_hash; @@ -26,7 +26,7 @@ /** * Document mapping attribute driver * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/InheritanceType.php b/src/FastyBird/Core/Application/src/Documents/Mapping/InheritanceType.php similarity index 72% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/InheritanceType.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/InheritanceType.php index 423f0b674..aeb1b96ba 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/InheritanceType.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/InheritanceType.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; use Attribute; /** * Document definition * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec @@ -29,7 +29,7 @@ final readonly class InheritanceType implements MappingAttribute { - public function __construct(public readonly string $type) + public function __construct(public string $type) { } diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/MappedSuperclass.php b/src/FastyBird/Core/Application/src/Documents/Mapping/MappedSuperclass.php similarity index 78% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/MappedSuperclass.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/MappedSuperclass.php index 86a7e2a16..3701990b9 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/MappedSuperclass.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/MappedSuperclass.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; use Attribute; /** * Document definition * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/Mapping/MappingAttribute.php b/src/FastyBird/Core/Application/src/Documents/Mapping/MappingAttribute.php similarity index 76% rename from src/FastyBird/Library/Metadata/src/Documents/Mapping/MappingAttribute.php rename to src/FastyBird/Core/Application/src/Documents/Mapping/MappingAttribute.php index 5f80a3e92..9faadab8d 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Mapping/MappingAttribute.php +++ b/src/FastyBird/Core/Application/src/Documents/Mapping/MappingAttribute.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 10.02.24 */ -namespace FastyBird\Library\Metadata\Documents\Mapping; +namespace FastyBird\Core\Application\Documents\Mapping; interface MappingAttribute { diff --git a/src/FastyBird/Library/Metadata/src/Documents/Owner.php b/src/FastyBird/Core/Application/src/Documents/Owner.php similarity index 78% rename from src/FastyBird/Library/Metadata/src/Documents/Owner.php rename to src/FastyBird/Core/Application/src/Documents/Owner.php index 1123738df..dd48fa45b 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/Owner.php +++ b/src/FastyBird/Core/Application/src/Documents/Owner.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 05.06.22 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use Ramsey\Uuid; /** * Data document owner interface * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/TCreatedAt.php b/src/FastyBird/Core/Application/src/Documents/TCreatedAt.php similarity index 81% rename from src/FastyBird/Library/Metadata/src/Documents/TCreatedAt.php rename to src/FastyBird/Core/Application/src/Documents/TCreatedAt.php index 52de716e0..ff4a7e6bf 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/TCreatedAt.php +++ b/src/FastyBird/Core/Application/src/Documents/TCreatedAt.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 03.01.23 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use DateTimeInterface; /** * Document created date trait * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/TOwner.php b/src/FastyBird/Core/Application/src/Documents/TOwner.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Documents/TOwner.php rename to src/FastyBird/Core/Application/src/Documents/TOwner.php index 9bd1e6596..c3c27c5b0 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/TOwner.php +++ b/src/FastyBird/Core/Application/src/Documents/TOwner.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 05.06.22 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use Ramsey\Uuid; /** * Document owner trait * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/TUpdatedAt.php b/src/FastyBird/Core/Application/src/Documents/TUpdatedAt.php similarity index 81% rename from src/FastyBird/Library/Metadata/src/Documents/TUpdatedAt.php rename to src/FastyBird/Core/Application/src/Documents/TUpdatedAt.php index c22abc6ed..3da05d4ab 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/TUpdatedAt.php +++ b/src/FastyBird/Core/Application/src/Documents/TUpdatedAt.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 03.01.23 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use DateTimeInterface; /** * Document updated date trait * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Documents/UpdatedAt.php b/src/FastyBird/Core/Application/src/Documents/UpdatedAt.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Documents/UpdatedAt.php rename to src/FastyBird/Core/Application/src/Documents/UpdatedAt.php index 615609a5e..e1463eeba 100644 --- a/src/FastyBird/Library/Metadata/src/Documents/UpdatedAt.php +++ b/src/FastyBird/Core/Application/src/Documents/UpdatedAt.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * @since 1.0.0 * * @date 03.01.23 */ -namespace FastyBird\Library\Metadata\Documents; +namespace FastyBird\Core\Application\Documents; use DateTimeInterface; /** * Data document updated at interface * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Documents * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Entities/Mapping/DiscriminatorEntry.php b/src/FastyBird/Core/Application/src/Entities/Mapping/DiscriminatorEntry.php similarity index 81% rename from src/FastyBird/Library/Application/src/Entities/Mapping/DiscriminatorEntry.php rename to src/FastyBird/Core/Application/src/Entities/Mapping/DiscriminatorEntry.php index c139b9cc3..4fcb1a88f 100644 --- a/src/FastyBird/Library/Application/src/Entities/Mapping/DiscriminatorEntry.php +++ b/src/FastyBird/Core/Application/src/Entities/Mapping/DiscriminatorEntry.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Doctrine * @since 1.0.0 * * @date 06.02.24 */ -namespace FastyBird\Library\Application\Entities\Mapping; +namespace FastyBird\Core\Application\Entities\Mapping; use Attribute; use Doctrine\ORM\Mapping as ORMMapping; @@ -21,7 +21,7 @@ /** * Entity discriminator item attribute for Doctrine2 * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Doctrine * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Utilities/EventLoopStatus.php b/src/FastyBird/Core/Application/src/EventLoop/Status.php similarity index 75% rename from src/FastyBird/Library/Application/src/Utilities/EventLoopStatus.php rename to src/FastyBird/Core/Application/src/EventLoop/Status.php index 7a8012091..bbd218d1c 100644 --- a/src/FastyBird/Library/Application/src/Utilities/EventLoopStatus.php +++ b/src/FastyBird/Core/Application/src/EventLoop/Status.php @@ -1,31 +1,31 @@ - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Utilities * @since 1.0.0 * * @date 12.09.24 */ -namespace FastyBird\Library\Application\Utilities; +namespace FastyBird\Core\Application\EventLoop; use Nette; /** * Event loop status helper * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Utilities * * @author Adam Kadlec */ -final class EventLoopStatus +final class Status { use Nette\SmartObject; diff --git a/src/FastyBird/Library/Application/src/EventLoop/Wrapper.php b/src/FastyBird/Core/Application/src/EventLoop/Wrapper.php similarity index 94% rename from src/FastyBird/Library/Application/src/EventLoop/Wrapper.php rename to src/FastyBird/Core/Application/src/EventLoop/Wrapper.php index fe3ec8144..3d04c348f 100644 --- a/src/FastyBird/Library/Application/src/EventLoop/Wrapper.php +++ b/src/FastyBird/Core/Application/src/EventLoop/Wrapper.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Helpers * @since 1.0.0 * * @date 02.01.24 */ -namespace FastyBird\Library\Application\EventLoop; +namespace FastyBird\Core\Application\EventLoop; -use FastyBird\Library\Application\Events; +use FastyBird\Core\Application\Events; use Psr\EventDispatcher; use React\EventLoop as ReactEventLoop; use function error_get_last; @@ -31,7 +31,7 @@ /** * React event loop wrapper * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Helpers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Events/EventLoopStarted.php b/src/FastyBird/Core/Application/src/Events/EventLoopStarted.php similarity index 78% rename from src/FastyBird/Library/Application/src/Events/EventLoopStarted.php rename to src/FastyBird/Core/Application/src/Events/EventLoopStarted.php index a18cdb5c0..676166245 100644 --- a/src/FastyBird/Library/Application/src/Events/EventLoopStarted.php +++ b/src/FastyBird/Core/Application/src/Events/EventLoopStarted.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Events * @since 1.0.0 * * @date 19.01.24 */ -namespace FastyBird\Library\Application\Events; +namespace FastyBird\Core\Application\Events; use Symfony\Contracts\EventDispatcher; /** * Event loop was started event * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Events * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Events/EventLoopStopped.php b/src/FastyBird/Core/Application/src/Events/EventLoopStopped.php similarity index 78% rename from src/FastyBird/Library/Application/src/Events/EventLoopStopped.php rename to src/FastyBird/Core/Application/src/Events/EventLoopStopped.php index afa0d2e12..db60c02d7 100644 --- a/src/FastyBird/Library/Application/src/Events/EventLoopStopped.php +++ b/src/FastyBird/Core/Application/src/Events/EventLoopStopped.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Events * @since 1.0.0 * * @date 19.01.24 */ -namespace FastyBird\Library\Application\Events; +namespace FastyBird\Core\Application\Events; use Symfony\Contracts\EventDispatcher; /** * Event loop was stopped event * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Events * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Events/EventLoopStopping.php b/src/FastyBird/Core/Application/src/Events/EventLoopStopping.php similarity index 78% rename from src/FastyBird/Library/Application/src/Events/EventLoopStopping.php rename to src/FastyBird/Core/Application/src/Events/EventLoopStopping.php index 9cd847e5c..7b7d1cbfd 100644 --- a/src/FastyBird/Library/Application/src/Events/EventLoopStopping.php +++ b/src/FastyBird/Core/Application/src/Events/EventLoopStopping.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Events * @since 1.0.0 * * @date 20.01.24 */ -namespace FastyBird\Library\Application\Events; +namespace FastyBird\Core\Application\Events; use Symfony\Contracts\EventDispatcher; /** * Event loop is going to be stopped event * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Events * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Events/LoadClassMetadata.php b/src/FastyBird/Core/Application/src/Events/LoadClassMetadata.php similarity index 83% rename from src/FastyBird/Library/Metadata/src/Events/LoadClassMetadata.php rename to src/FastyBird/Core/Application/src/Events/LoadClassMetadata.php index bcf2c6a73..e666d8e54 100644 --- a/src/FastyBird/Library/Metadata/src/Events/LoadClassMetadata.php +++ b/src/FastyBird/Core/Application/src/Events/LoadClassMetadata.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Events * @since 1.0.0 * * @date 12.02.24 */ -namespace FastyBird\Library\Metadata\Events; +namespace FastyBird\Core\Application\Events; -use FastyBird\Library\Metadata\Documents; +use FastyBird\Core\Application\Documents; use Symfony\Contracts\EventDispatcher; /** @@ -23,7 +23,7 @@ * * @template T of Documents\Document * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Events * @author Adam Kadlec */ diff --git a/src/FastyBird/Library/Metadata/src/Events/PostLoad.php b/src/FastyBird/Core/Application/src/Events/PostLoad.php similarity index 81% rename from src/FastyBird/Library/Metadata/src/Events/PostLoad.php rename to src/FastyBird/Core/Application/src/Events/PostLoad.php index 4f32edfcf..e285db4c3 100644 --- a/src/FastyBird/Library/Metadata/src/Events/PostLoad.php +++ b/src/FastyBird/Core/Application/src/Events/PostLoad.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Events * @since 1.0.0 * * @date 09.08.24 */ -namespace FastyBird\Library\Metadata\Events; +namespace FastyBird\Core\Application\Events; -use FastyBird\Library\Metadata\Documents; +use FastyBird\Core\Application\Documents; use Symfony\Contracts\EventDispatcher; /** @@ -23,7 +23,7 @@ * * @template T of Documents\Document * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Events * @author Adam Kadlec */ diff --git a/src/FastyBird/Library/Metadata/src/Events/PreLoad.php b/src/FastyBird/Core/Application/src/Events/PreLoad.php similarity index 85% rename from src/FastyBird/Library/Metadata/src/Events/PreLoad.php rename to src/FastyBird/Core/Application/src/Events/PreLoad.php index e81d1297f..cc9bcc7bc 100644 --- a/src/FastyBird/Library/Metadata/src/Events/PreLoad.php +++ b/src/FastyBird/Core/Application/src/Events/PreLoad.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Events * @since 1.0.0 * * @date 09.08.24 */ -namespace FastyBird\Library\Metadata\Events; +namespace FastyBird\Core\Application\Events; -use FastyBird\Library\Metadata\Documents; +use FastyBird\Core\Application\Documents; use Symfony\Contracts\EventDispatcher; /** @@ -23,7 +23,7 @@ * * @template T of Documents\Document * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Events * @author Adam Kadlec */ diff --git a/app/src/Exceptions/Exception.php b/src/FastyBird/Core/Application/src/Exceptions/Exception.php similarity index 88% rename from app/src/Exceptions/Exception.php rename to src/FastyBird/Core/Application/src/Exceptions/Exception.php index 8fd4f3ae3..5ec7b08b2 100644 --- a/app/src/Exceptions/Exception.php +++ b/src/FastyBird/Core/Application/src/Exceptions/Exception.php @@ -13,7 +13,7 @@ * @date 16.06.24 */ -namespace FastyBird\App\Exceptions; +namespace FastyBird\Core\Application\Exceptions; use Throwable; diff --git a/app/src/Exceptions/InvalidArgument.php b/src/FastyBird/Core/Application/src/Exceptions/InvalidArgument.php similarity index 90% rename from app/src/Exceptions/InvalidArgument.php rename to src/FastyBird/Core/Application/src/Exceptions/InvalidArgument.php index 147cde582..0260934aa 100644 --- a/app/src/Exceptions/InvalidArgument.php +++ b/src/FastyBird/Core/Application/src/Exceptions/InvalidArgument.php @@ -13,7 +13,7 @@ * @date 16.06.24 */ -namespace FastyBird\App\Exceptions; +namespace FastyBird\Core\Application\Exceptions; use InvalidArgumentException as PHPInvalidArgumentException; diff --git a/src/FastyBird/Library/Application/src/Exceptions/InvalidState.php b/src/FastyBird/Core/Application/src/Exceptions/InvalidState.php similarity index 79% rename from src/FastyBird/Library/Application/src/Exceptions/InvalidState.php rename to src/FastyBird/Core/Application/src/Exceptions/InvalidState.php index 0986580b4..d191e9f2b 100644 --- a/src/FastyBird/Library/Application/src/Exceptions/InvalidState.php +++ b/src/FastyBird/Core/Application/src/Exceptions/InvalidState.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Exceptions * @since 1.0.0 * * @date 08.03.20 */ -namespace FastyBird\Library\Application\Exceptions; +namespace FastyBird\Core\Application\Exceptions; use RuntimeException; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/MalformedInput.php b/src/FastyBird/Core/Application/src/Exceptions/MalformedInput.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Exceptions/MalformedInput.php rename to src/FastyBird/Core/Application/src/Exceptions/MalformedInput.php index db71a46cc..3e1f44694 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/MalformedInput.php +++ b/src/FastyBird/Core/Application/src/Exceptions/MalformedInput.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Exceptions * @since 1.0.0 * * @date 24.06.20 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Application\Exceptions; use RuntimeException; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/Mapping.php b/src/FastyBird/Core/Application/src/Exceptions/Mapping.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Exceptions/Mapping.php rename to src/FastyBird/Core/Application/src/Exceptions/Mapping.php index a915c682c..adbd688e9 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/Mapping.php +++ b/src/FastyBird/Core/Application/src/Exceptions/Mapping.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Application! * @subpackage Exceptions * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Application\Exceptions; use LogicException; diff --git a/src/FastyBird/Library/Application/src/Exceptions/Runtime.php b/src/FastyBird/Core/Application/src/Exceptions/Runtime.php similarity index 80% rename from src/FastyBird/Library/Application/src/Exceptions/Runtime.php rename to src/FastyBird/Core/Application/src/Exceptions/Runtime.php index 043a1026d..641b895f8 100644 --- a/src/FastyBird/Library/Application/src/Exceptions/Runtime.php +++ b/src/FastyBird/Core/Application/src/Exceptions/Runtime.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Exceptions * @since 1.0.0 * * @date 20.01.24 */ -namespace FastyBird\Library\Application\Exceptions; +namespace FastyBird\Core\Application\Exceptions; use RuntimeException as PHPRuntimeException; diff --git a/src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidArgs.php b/src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidArgs.php similarity index 77% rename from src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidArgs.php rename to src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidArgs.php index eb5febace..99c765b2f 100644 --- a/src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidArgs.php +++ b/src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidArgs.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage ObjectMapper * @since 1.0.0 * * @date 02.08.23 */ -namespace FastyBird\Library\Application\ObjectMapper\Rules; +namespace FastyBird\Core\Application\ObjectMapper\Rules; use Orisai\ObjectMapper\Args\Args; diff --git a/src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidRule.php b/src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidRule.php similarity index 93% rename from src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidRule.php rename to src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidRule.php index 13dbfe4e4..8610caa44 100644 --- a/src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidRule.php +++ b/src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidRule.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage ObjectMapper * @since 1.0.0 * * @date 02.08.23 */ -namespace FastyBird\Library\Application\ObjectMapper\Rules; +namespace FastyBird\Core\Application\ObjectMapper\Rules; use Orisai\ObjectMapper; use Ramsey\Uuid; diff --git a/src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidValue.php b/src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidValue.php similarity index 83% rename from src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidValue.php rename to src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidValue.php index 095b571ef..e7ced172f 100644 --- a/src/FastyBird/Library/Application/src/ObjectMapper/Rules/UuidValue.php +++ b/src/FastyBird/Core/Application/src/ObjectMapper/Rules/UuidValue.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage ObjectMapper * @since 1.0.0 * * @date 02.08.23 */ -namespace FastyBird\Library\Application\ObjectMapper\Rules; +namespace FastyBird\Core\Application\ObjectMapper\Rules; use Attribute; use Orisai\ObjectMapper; diff --git a/src/FastyBird/Library/Application/src/Presenters/BasePresenter.php b/src/FastyBird/Core/Application/src/Presenters/BasePresenter.php similarity index 70% rename from src/FastyBird/Library/Application/src/Presenters/BasePresenter.php rename to src/FastyBird/Core/Application/src/Presenters/BasePresenter.php index 55b316246..44f06e2b4 100644 --- a/src/FastyBird/Library/Application/src/Presenters/BasePresenter.php +++ b/src/FastyBird/Core/Application/src/Presenters/BasePresenter.php @@ -6,17 +6,17 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Presenters * @since 1.0.0 * * @date 16.06.24 */ -namespace FastyBird\Library\Application\Presenters; +namespace FastyBird\Core\Application\Presenters; -use FastyBird\Library\Application\Exceptions; -use FastyBird\Library\Application\UI; +use FastyBird\Core\Application\Exceptions; +use FastyBird\Core\Application\UI; use FastyBird\SimpleAuth\Application as SimpleAuthApplication; use Nette\Application; use function preg_match; @@ -24,7 +24,7 @@ /** * Base application presenter * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Presenters * * @author Adam Kadlec @@ -61,4 +61,17 @@ public function formatLayoutTemplateFiles(): array return $this->templateFactory?->getLayouts() ?? []; } + public function formatTemplateFiles(): array + { + [, $presenter] = Application\Helpers::splitName($this->getName() ?? ''); + + $dir = __DIR__ . '/../../templates/'; + + return [ + "$dir/presenters/$presenter/$this->view.latte", + "$dir/presenters/$presenter.$this->view.latte", + "$dir/presenters/$presenter.latte", + ]; + } + } diff --git a/app/src/Presenters/DefaultPresenter.php b/src/FastyBird/Core/Application/src/Presenters/DefaultPresenter.php similarity index 92% rename from app/src/Presenters/DefaultPresenter.php rename to src/FastyBird/Core/Application/src/Presenters/DefaultPresenter.php index 2cc238389..46f710d9c 100644 --- a/app/src/Presenters/DefaultPresenter.php +++ b/src/FastyBird/Core/Application/src/Presenters/DefaultPresenter.php @@ -13,7 +13,7 @@ * @date 16.06.24 */ -namespace FastyBird\App\Presenters; +namespace FastyBird\Core\Application\Presenters; /** * Default application presenter diff --git a/app/src/Router/AppRouter.php b/src/FastyBird/Core/Application/src/Router/AppRouter.php similarity index 78% rename from app/src/Router/AppRouter.php rename to src/FastyBird/Core/Application/src/Router/AppRouter.php index b79bdf4e1..c9e30e37f 100644 --- a/app/src/Router/AppRouter.php +++ b/src/FastyBird/Core/Application/src/Router/AppRouter.php @@ -13,9 +13,9 @@ * @date 16.06.24 */ -namespace FastyBird\App\Router; +namespace FastyBird\Core\Application\Router; -use FastyBird\Library\Application\Router as ApplicationRouter; +use Nette\Application; /** * Application router @@ -28,7 +28,7 @@ final class AppRouter { - public static function createRouter(ApplicationRouter\AppRouter $router): void + public static function createRouter(Application\Routers\RouteList $router): void { $list = $router->withModule('App'); diff --git a/src/FastyBird/Library/Application/src/Subscribers/Console.php b/src/FastyBird/Core/Application/src/Subscribers/Console.php similarity index 89% rename from src/FastyBird/Library/Application/src/Subscribers/Console.php rename to src/FastyBird/Core/Application/src/Subscribers/Console.php index c8c5add74..6427987e3 100644 --- a/src/FastyBird/Library/Application/src/Subscribers/Console.php +++ b/src/FastyBird/Core/Application/src/Subscribers/Console.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Subscribers * @since 1.0.0 * * @date 06.10.22 */ -namespace FastyBird\Library\Application\Subscribers; +namespace FastyBird\Core\Application\Subscribers; use Monolog; use Psr\Log\LogLevel; @@ -24,7 +24,7 @@ /** * Console subscriber * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Subscribers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Subscribers/EntityDiscriminator.php b/src/FastyBird/Core/Application/src/Subscribers/EntityDiscriminator.php similarity index 93% rename from src/FastyBird/Library/Application/src/Subscribers/EntityDiscriminator.php rename to src/FastyBird/Core/Application/src/Subscribers/EntityDiscriminator.php index b660d6b2b..c2ab107c8 100644 --- a/src/FastyBird/Library/Application/src/Subscribers/EntityDiscriminator.php +++ b/src/FastyBird/Core/Application/src/Subscribers/EntityDiscriminator.php @@ -6,19 +6,19 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Subscribers * @since 1.0.0 * * @date 06.02.24 */ -namespace FastyBird\Library\Application\Subscribers; +namespace FastyBird\Core\Application\Subscribers; use Doctrine\Common; use Doctrine\ORM; -use FastyBird\Library\Application\Entities\Mapping\DiscriminatorEntry; -use FastyBird\Library\Application\Exceptions; +use FastyBird\Core\Application\Entities; +use FastyBird\Core\Application\Exceptions; use ReflectionClass; use function array_keys; use function end; @@ -29,7 +29,7 @@ use function strtolower; /** - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Subscribers * * @author Adam Kadlec @@ -145,7 +145,7 @@ private function getDiscriminatorForClass(ReflectionClass $rc): string|null return null; } - $attributes = $rc->getAttributes(DiscriminatorEntry::class); + $attributes = $rc->getAttributes(Entities\Mapping\DiscriminatorEntry::class); if ($attributes !== []) { $discriminatorEntry = $attributes[0]->newInstance(); diff --git a/src/FastyBird/Library/Application/src/Subscribers/EventLoop.php b/src/FastyBird/Core/Application/src/Subscribers/EventLoopLifeCycle.php similarity index 68% rename from src/FastyBird/Library/Application/src/Subscribers/EventLoop.php rename to src/FastyBird/Core/Application/src/Subscribers/EventLoopLifeCycle.php index 909aff272..34d65a8b0 100644 --- a/src/FastyBird/Library/Application/src/Subscribers/EventLoop.php +++ b/src/FastyBird/Core/Application/src/Subscribers/EventLoopLifeCycle.php @@ -1,39 +1,39 @@ - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Subscribers * @since 1.0.0 * * @date 11.09.24 */ -namespace FastyBird\Library\Application\Subscribers; +namespace FastyBird\Core\Application\Subscribers; -use FastyBird\Library\Application\Events; -use FastyBird\Library\Application\Utilities; +use FastyBird\Core\Application\EventLoop; +use FastyBird\Core\Application\Events; use Nette; use Symfony\Component\EventDispatcher; /** * Event loop events * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage Subscribers * * @author Adam Kadlec */ -final class EventLoop implements EventDispatcher\EventSubscriberInterface +final class EventLoopLifeCycle implements EventDispatcher\EventSubscriberInterface { use Nette\SmartObject; - public function __construct(private readonly Utilities\EventLoopStatus $eventLoopStatus) + public function __construct(private readonly EventLoop\Status $eventLoopStatus) { } diff --git a/app/src/Translations/application.en_us.neon b/src/FastyBird/Core/Application/src/Translations/application.en_us.neon similarity index 100% rename from app/src/Translations/application.en_us.neon rename to src/FastyBird/Core/Application/src/Translations/application.en_us.neon diff --git a/src/FastyBird/Library/Application/src/UI/TemplateFactory.php b/src/FastyBird/Core/Application/src/UI/TemplateFactory.php similarity index 85% rename from src/FastyBird/Library/Application/src/UI/TemplateFactory.php rename to src/FastyBird/Core/Application/src/UI/TemplateFactory.php index a5c781613..db2ddd853 100644 --- a/src/FastyBird/Library/Application/src/UI/TemplateFactory.php +++ b/src/FastyBird/Core/Application/src/UI/TemplateFactory.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Application! * @subpackage UI * @since 1.0.0 * * @date 08.03.20 */ -namespace FastyBird\Library\Application\UI; +namespace FastyBird\Core\Application\UI; -use FastyBird\Library\Application\Exceptions; +use FastyBird\Core\Application\Exceptions; use function file_exists; use function sprintf; diff --git a/app/templates/@layout.latte b/src/FastyBird/Core/Application/templates/@layout.latte similarity index 85% rename from app/templates/@layout.latte rename to src/FastyBird/Core/Application/templates/@layout.latte index b4b73ff4d..b38d0c925 100644 --- a/app/templates/@layout.latte +++ b/src/FastyBird/Core/Application/templates/@layout.latte @@ -3,7 +3,7 @@ - + {ifset title}{include title|stripHtml} | {/ifset}FastyBird IoT @@ -19,7 +19,7 @@ {include content} - + {block scripts}{/block} diff --git a/app/templates/presenters/default.latte b/src/FastyBird/Core/Application/templates/presenters/default.latte similarity index 100% rename from app/templates/presenters/default.latte rename to src/FastyBird/Core/Application/templates/presenters/default.latte diff --git a/app/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Core/Application/tests/cases/unit/BaseTestCase.php similarity index 78% rename from app/tests/cases/unit/BaseTestCase.php rename to src/FastyBird/Core/Application/tests/cases/unit/BaseTestCase.php index 825810c66..8cff8b96f 100644 --- a/app/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Core/Application/tests/cases/unit/BaseTestCase.php @@ -1,11 +1,10 @@ setForceReloadContainer(); $config->setTempDirectory(FB_TEMP_DIR); @@ -59,8 +58,6 @@ protected function createContainer(string|null $additionalConfig = null): Nette\ $config->setTimeZone('Europe/Prague'); - DI\AppExtension::register($config); - return $config->createContainer(); } diff --git a/src/FastyBird/Core/Application/tests/cases/unit/DI/ApplicationExtensionTest.php b/src/FastyBird/Core/Application/tests/cases/unit/DI/ApplicationExtensionTest.php new file mode 100644 index 000000000..78e976f11 --- /dev/null +++ b/src/FastyBird/Core/Application/tests/cases/unit/DI/ApplicationExtensionTest.php @@ -0,0 +1,44 @@ +createContainer(); + + self::assertNotNull($container->getByType(Monolog\Handler\RotatingFileHandler::class, false)); + self::assertNull($container->getByType(SymfonyMonolog\Handler\ConsoleHandler::class, false)); + + self::assertNotNull($this->container->getByType(Documents\DocumentFactory::class, false)); + } + + /** + * @throws Exceptions\InvalidArgument + * @throws Exceptions\InvalidState + * @throws Error + * + * @doesNotPerformAssertions + */ + public function testServicesRegistration(): void + { + $this->createContainer(); + } + +} diff --git a/app/tests/cases/unit/DbTestCase.php b/src/FastyBird/Core/Application/tests/cases/unit/DbTestCase.php similarity index 89% rename from app/tests/cases/unit/DbTestCase.php rename to src/FastyBird/Core/Application/tests/cases/unit/DbTestCase.php index 54cc128a4..53b77199f 100644 --- a/app/tests/cases/unit/DbTestCase.php +++ b/src/FastyBird/Core/Application/tests/cases/unit/DbTestCase.php @@ -1,14 +1,12 @@ setForceReloadContainer(); $config->setTempDirectory(FB_TEMP_DIR); @@ -125,8 +123,6 @@ private function createContainer(): Nette\DI\Container $config->setTimeZone('Europe/Prague'); - DI\AppExtension::register($config); - $this->container = $config->createContainer(); $this->setupDatabase(); @@ -137,7 +133,7 @@ private function createContainer(): Nette\DI\Container } /** - * @throws ApplicationExceptions\InvalidArgument + * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidArgument * @throws Nette\DI\MissingServiceException * @throws RuntimeException @@ -171,7 +167,7 @@ private function setupDatabase(): void } /** - * @throws ApplicationExceptions\InvalidArgument + * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidArgument * @throws Nette\DI\MissingServiceException * @throws RuntimeException @@ -183,7 +179,7 @@ protected function getDb(): DBAL\Connection } /** - * @throws ApplicationExceptions\InvalidArgument + * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidArgument * @throws Nette\DI\MissingServiceException * @throws RuntimeException @@ -245,7 +241,7 @@ private function loadFromFile(DBAL\Connection $db, string $file): void } /** - * @throws ApplicationExceptions\InvalidArgument + * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidArgument * @throws Nette\DI\MissingServiceException * @throws RuntimeException @@ -267,7 +263,7 @@ protected function registerNeonConfigurationFile(string $file): void } /** - * @throws ApplicationExceptions\InvalidArgument + * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidArgument * @throws RuntimeException * @throws Error diff --git a/src/FastyBird/Library/Metadata/tests/cases/unit/Documents/DocumentTest.php b/src/FastyBird/Core/Application/tests/cases/unit/Documents/DocumentTest.php similarity index 95% rename from src/FastyBird/Library/Metadata/tests/cases/unit/Documents/DocumentTest.php rename to src/FastyBird/Core/Application/tests/cases/unit/Documents/DocumentTest.php index 3d22f366c..ebf592ab1 100644 --- a/src/FastyBird/Library/Metadata/tests/cases/unit/Documents/DocumentTest.php +++ b/src/FastyBird/Core/Application/tests/cases/unit/Documents/DocumentTest.php @@ -1,11 +1,11 @@ - - - - + + + + diff --git a/src/FastyBird/Library/Application/tools/phpstan-bootstrap.php b/src/FastyBird/Core/Application/tools/phpstan-bootstrap.php similarity index 100% rename from src/FastyBird/Library/Application/tools/phpstan-bootstrap.php rename to src/FastyBird/Core/Application/tools/phpstan-bootstrap.php diff --git a/app/tools/phpstan.base.neon b/src/FastyBird/Core/Application/tools/phpstan.base.neon similarity index 100% rename from app/tools/phpstan.base.neon rename to src/FastyBird/Core/Application/tools/phpstan.base.neon diff --git a/src/FastyBird/Library/Application/tools/phpstan.config.src.neon b/src/FastyBird/Core/Application/tools/phpstan.config.src.neon similarity index 79% rename from src/FastyBird/Library/Application/tools/phpstan.config.src.neon rename to src/FastyBird/Core/Application/tools/phpstan.config.src.neon index cb0f43f4e..52be64087 100644 --- a/src/FastyBird/Library/Application/tools/phpstan.config.src.neon +++ b/src/FastyBird/Core/Application/tools/phpstan.config.src.neon @@ -10,4 +10,4 @@ parameters: excludePaths: analyseAndScan: - - ../src/EventLoop/Wrapper.php \ No newline at end of file + - ../src/EventLoop/Wrapper.php diff --git a/app/tools/phpstan.config.tests.neon b/src/FastyBird/Core/Application/tools/phpstan.config.tests.neon similarity index 100% rename from app/tools/phpstan.config.tests.neon rename to src/FastyBird/Core/Application/tools/phpstan.config.tests.neon diff --git a/app/tools/phpstan.src.neon b/src/FastyBird/Core/Application/tools/phpstan.src.neon similarity index 100% rename from app/tools/phpstan.src.neon rename to src/FastyBird/Core/Application/tools/phpstan.src.neon diff --git a/app/tools/phpstan.tests.neon b/src/FastyBird/Core/Application/tools/phpstan.tests.neon similarity index 100% rename from app/tools/phpstan.tests.neon rename to src/FastyBird/Core/Application/tools/phpstan.tests.neon diff --git a/src/FastyBird/Library/Application/tools/phpunit-bootstrap.php b/src/FastyBird/Core/Application/tools/phpunit-bootstrap.php similarity index 100% rename from src/FastyBird/Library/Application/tools/phpunit-bootstrap.php rename to src/FastyBird/Core/Application/tools/phpunit-bootstrap.php diff --git a/app/tools/phpunit.xml b/src/FastyBird/Core/Application/tools/phpunit.xml similarity index 100% rename from app/tools/phpunit.xml rename to src/FastyBird/Core/Application/tools/phpunit.xml diff --git a/app/tsconfig.json b/src/FastyBird/Core/Application/tsconfig.json similarity index 92% rename from app/tsconfig.json rename to src/FastyBird/Core/Application/tsconfig.json index c82822bde..92e8c4945 100644 --- a/app/tsconfig.json +++ b/src/FastyBird/Core/Application/tsconfig.json @@ -17,8 +17,7 @@ "skipLibCheck": true, "resolveJsonModule": true, "types": [ - "@fastybird/accounts-module", - "@fastybird/devices-module", + "@fastybird/tools", "@fastybird/metadata-library", "@fastybird/web-ui-library", "@intlify/unplugin-vue-i18n/messages", @@ -29,7 +28,7 @@ "vite-plugin-vue-type-imports", "vite-svg-loader", "vue-meta", - "unocss", + "unocss" ], "lib": [ "esnext", diff --git a/app/uno.config.ts b/src/FastyBird/Core/Application/uno.config.ts similarity index 100% rename from app/uno.config.ts rename to src/FastyBird/Core/Application/uno.config.ts diff --git a/app/vite.config.ts b/src/FastyBird/Core/Application/vite.config.ts similarity index 60% rename from app/vite.config.ts rename to src/FastyBird/Core/Application/vite.config.ts index 62eb2d417..ce9aa29a5 100644 --- a/app/vite.config.ts +++ b/src/FastyBird/Core/Application/vite.config.ts @@ -1,12 +1,12 @@ -import { defineConfig } from 'vite'; import { resolve } from 'path'; +import UnoCSS from 'unocss/vite'; +import { defineConfig } from 'vite'; import { viteVConsole } from 'vite-plugin-vconsole'; import svgLoader from 'vite-svg-loader'; -import vue from '@vitejs/plugin-vue'; -import vueI18n from '@intlify/unplugin-vue-i18n/vite'; -import UnoCSS from 'unocss/vite'; -import packageAliases from './tools/generateAliases'; +import vueI18n from '@intlify/unplugin-vue-i18n/vite'; +import eslint from '@nabla/vite-plugin-eslint'; +import vue from '@vitejs/plugin-vue'; // https://vitejs.dev/config/ export default defineConfig({ @@ -17,6 +17,7 @@ export default defineConfig({ vueI18n({ include: [resolve(__dirname, './assets/locales/**.json')], }), + eslint(), viteVConsole({ entry: resolve('assets/main.ts'), // entry file localEnabled: true, // dev environment @@ -29,10 +30,15 @@ export default defineConfig({ UnoCSS(), ], resolve: { + dedupe: ['pinia', 'vue', 'vue-router', 'vue-i18n', 'vue-meta', 'nprogress', 'element-plus'], alias: { - ...packageAliases, + '@fastybird/accounts-module': + process.env.NODE_ENV === 'production' ? '@fastybird/accounts-module' : resolve(__dirname, '../../Module/Accounts/assets/entry.ts'), + '@fastybird/devices-module': + process.env.NODE_ENV === 'production' ? '@fastybird/devices-module' : resolve(__dirname, '../../Module/Devices/assets/entry.ts'), + '@fastybird/homekit-connector': + process.env.NODE_ENV === 'production' ? '@fastybird/homekit-connector' : resolve(__dirname, '../../Connector/HomeKit/assets/entry.ts'), }, - dedupe: ['vue', 'pinia', 'vue-router', 'vue-i18n', 'vue-meta', 'nprogress', '@vueuse/core', 'element-plus'], }, css: { modules: { @@ -40,11 +46,11 @@ export default defineConfig({ }, }, optimizeDeps: { - include: ['vue', 'pinia', 'vue-router', 'vue-i18n', 'vue-meta', 'nprogress', '@vueuse/core', 'element-plus'], + include: ['pinia', 'vue', 'vue-router', 'vue-i18n', 'vue-meta', 'nprogress', 'element-plus'], }, build: { manifest: true, - outDir: resolve(__dirname, './../public'), + outDir: resolve(__dirname, './../../../../public'), }, server: { watch: { @@ -61,21 +67,13 @@ export default defineConfig({ timeout: 60000, }, '/ws-exchange': { - target: process.env.FB_APP_PARAMETER__WEBSOCKETS_TARGET || 'ws://ws-server:8888', + target: process.env.FB_APP_PARAMETER__WEBSOCKETS_TARGET || 'ws://localhost:8888', rewrite: (path: string): string => { - const wsPrefix = '/ws-exchange'; - - return path.replace(new RegExp(`^${wsPrefix}`, 'g'), ''); // Remove base path + return path.replace(new RegExp(`^/ws-exchange`, 'g'), ''); // Remove base path }, secure: true, changeOrigin: true, ws: true, - configure: (proxy) => { - console.log('CONFIGURE'); - proxy.on('proxyReq', function (): void { - console.log('EVENT'); - }); - }, }, }, port: 3000, diff --git a/src/FastyBird/Library/Application/.editorconfig b/src/FastyBird/Core/Exchange/.editorconfig similarity index 100% rename from src/FastyBird/Library/Application/.editorconfig rename to src/FastyBird/Core/Exchange/.editorconfig diff --git a/src/FastyBird/Library/Application/.gitattributes b/src/FastyBird/Core/Exchange/.gitattributes similarity index 100% rename from src/FastyBird/Library/Application/.gitattributes rename to src/FastyBird/Core/Exchange/.gitattributes diff --git a/src/FastyBird/Library/Exchange/.github/FUNDING.yml b/src/FastyBird/Core/Exchange/.github/FUNDING.yml similarity index 100% rename from src/FastyBird/Library/Exchange/.github/FUNDING.yml rename to src/FastyBird/Core/Exchange/.github/FUNDING.yml diff --git a/src/FastyBird/Library/Exchange/.github/workflows/lint.yaml b/src/FastyBird/Core/Exchange/.github/workflows/lint.yaml similarity index 100% rename from src/FastyBird/Library/Exchange/.github/workflows/lint.yaml rename to src/FastyBird/Core/Exchange/.github/workflows/lint.yaml diff --git a/src/FastyBird/Library/Exchange/.github/workflows/qa.yaml b/src/FastyBird/Core/Exchange/.github/workflows/qa.yaml similarity index 100% rename from src/FastyBird/Library/Exchange/.github/workflows/qa.yaml rename to src/FastyBird/Core/Exchange/.github/workflows/qa.yaml diff --git a/src/FastyBird/Library/Exchange/.github/workflows/static-analysis.yaml b/src/FastyBird/Core/Exchange/.github/workflows/static-analysis.yaml similarity index 100% rename from src/FastyBird/Library/Exchange/.github/workflows/static-analysis.yaml rename to src/FastyBird/Core/Exchange/.github/workflows/static-analysis.yaml diff --git a/src/FastyBird/Library/Exchange/.github/workflows/tests.yaml b/src/FastyBird/Core/Exchange/.github/workflows/tests.yaml similarity index 100% rename from src/FastyBird/Library/Exchange/.github/workflows/tests.yaml rename to src/FastyBird/Core/Exchange/.github/workflows/tests.yaml diff --git a/src/FastyBird/Library/Exchange/.github/workflows/wiki.yml b/src/FastyBird/Core/Exchange/.github/workflows/wiki.yml similarity index 100% rename from src/FastyBird/Library/Exchange/.github/workflows/wiki.yml rename to src/FastyBird/Core/Exchange/.github/workflows/wiki.yml diff --git a/src/FastyBird/Library/Application/.gitignore b/src/FastyBird/Core/Exchange/.gitignore similarity index 100% rename from src/FastyBird/Library/Application/.gitignore rename to src/FastyBird/Core/Exchange/.gitignore diff --git a/src/FastyBird/Library/Application/CHANGELOG-1.0.md b/src/FastyBird/Core/Exchange/CHANGELOG-1.0.md similarity index 100% rename from src/FastyBird/Library/Application/CHANGELOG-1.0.md rename to src/FastyBird/Core/Exchange/CHANGELOG-1.0.md diff --git a/src/FastyBird/Library/Application/LICENSE.md b/src/FastyBird/Core/Exchange/LICENSE.md similarity index 100% rename from src/FastyBird/Library/Application/LICENSE.md rename to src/FastyBird/Core/Exchange/LICENSE.md diff --git a/src/FastyBird/Library/Application/Makefile b/src/FastyBird/Core/Exchange/Makefile similarity index 100% rename from src/FastyBird/Library/Application/Makefile rename to src/FastyBird/Core/Exchange/Makefile diff --git a/src/FastyBird/Library/Exchange/README.md b/src/FastyBird/Core/Exchange/README.md similarity index 95% rename from src/FastyBird/Library/Exchange/README.md rename to src/FastyBird/Core/Exchange/README.md index e9f63aac8..34489a2f8 100644 --- a/src/FastyBird/Library/Exchange/README.md +++ b/src/FastyBird/Core/Exchange/README.md @@ -16,9 +16,9 @@ *** -## What is FastyBird exchange library? +## What is FastyBird exchange? -This is library for [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem which is +This is extension for [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem which is implementing data exchange services. ### Features @@ -40,7 +40,7 @@ This extension is part of the [FastyBird](https://www.fastybird.com) [IoT](https In case you want to create you own distribution of [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem you could install this extension with [Composer](http://getcomposer.org/): ```sh -composer require fastybird/exchange-library +composer require fastybird/exchange ``` ## Documentation diff --git a/src/FastyBird/Library/Exchange/composer.json b/src/FastyBird/Core/Exchange/composer.json similarity index 87% rename from src/FastyBird/Library/Exchange/composer.json rename to src/FastyBird/Core/Exchange/composer.json index 3df300604..01b12b659 100644 --- a/src/FastyBird/Library/Exchange/composer.json +++ b/src/FastyBird/Core/Exchange/composer.json @@ -1,6 +1,6 @@ { - "name": "fastybird/exchange-library", - "type": "fastybird-library", + "name": "fastybird/exchange", + "type": "fastybird", "description": "FastyBird IoT application exchange services", "keywords": [ "exchange", @@ -28,14 +28,14 @@ "support": { "email": "code@fastybird.com", "issues": "https://github.com/FastyBird/fastybird/issues", - "source": "https://github.com/FastyBird/exchange-library" + "source": "https://github.com/FastyBird/exchange" }, "require": { "php": ">=8.2.0", "cweagans/composer-patches": "^1.7", - "fastybird/application-library": "dev-main", + "fastybird/application": "dev-main", "fastybird/metadata-library": "dev-main", - "nette/di": "^3.0", + "nette/di": "^3.2", "nette/utils": "^4.0", "psr/event-dispatcher": "^1.0", "react/promise": "^3", @@ -61,12 +61,12 @@ }, "autoload": { "psr-4": { - "FastyBird\\Library\\Exchange\\": "src/" + "FastyBird\\Core\\Exchange\\": "src/" } }, "autoload-dev": { "psr-4": { - "FastyBird\\Library\\Exchange\\Tests\\Cases\\Unit\\": "tests/cases/unit" + "FastyBird\\Core\\Exchange\\Tests\\Cases\\Unit\\": "tests/cases/unit" } }, "config": { diff --git a/src/FastyBird/Library/Exchange/docs/Home.md b/src/FastyBird/Core/Exchange/docs/Home.md similarity index 70% rename from src/FastyBird/Library/Exchange/docs/Home.md rename to src/FastyBird/Core/Exchange/docs/Home.md index 7241a675d..c9d5c7cc9 100644 --- a/src/FastyBird/Library/Exchange/docs/Home.md +++ b/src/FastyBird/Core/Exchange/docs/Home.md @@ -9,7 +9,7 @@ please use FastyBird IoT documentation which is available on [docs.fastybird.com # Quick start When a service within your extension requires the publication of messages to the data exchange bus for other extensions, -a recommended approach is to implement the `FastyBird\Library\Exchange\Publisher\Publisher` interface. This allows seamless +a recommended approach is to implement the `FastyBird\Core\Exchange\Publisher\Publisher` interface. This allows seamless integration with the data exchange bus. Following this implementation, you can register your custom publisher as a service. This structured approach ensures that @@ -21,20 +21,22 @@ the [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/I ## Creating custom publisher If some service of your extension have to publish messages to data exchange bus for other extensions, you could just -implement `FastyBird\Library\Exchange\Publisher\Publisher` interface and register your publisher as service +implement `FastyBird\Core\Exchange\Publisher\Publisher` interface and register your publisher as service ```php namespace Your\CoolApp\Publishers; -use FastyBird\Library\Exchange\Publisher\Publisher;use FastyBird\Library\Metadata\Documents as MetadataDocuments;use FastyBird\Library\Metadata\Types as MetadataTypes; +use FastyBird\Core\Exchange\Publisher\Publisher; +use FastyBird\Core\Application\Documents; +use FastyBird\Library\Metadata\Types; class ModuleDataPublisher implements Publisher { public function publish( - MetadataTypes\Sources\Module|MetadataTypes\Sources\Plugin|MetadataTypes\Sources\Connector $source, + Types\Sources\Module|Types\Sources\Plugin|Types\Sources\Connector $source, string $routingKey, - MetadataDocuments\Document|null $entity, + Documents\Document|null $entity, ) : void { // Service logic here, e.g. publish message to RabbitMQ or Redis etc. } @@ -53,7 +55,11 @@ that code processing remains unblocked. These publishers have to follow a Promis ```php namespace Your\CoolApp\Publishers; -use FastyBird\Library\Exchange\Publisher\Async\Publisher;use FastyBird\Library\Metadata\Documents as MetadataDocuments;use FastyBird\Library\Metadata\Types as MetadataTypes;use React\Promise\Deferred;use React\Promise\PromiseInterface; +use FastyBird\Core\Exchange\Publisher\Async\Publisher; +use FastyBird\Core\Application\Documents; +use FastyBird\Library\Metadata\Types; +use React\Promise\Deferred; +use React\Promise\PromiseInterface; class ModuleDataPublisher implements Publisher { @@ -62,9 +68,9 @@ class ModuleDataPublisher implements Publisher * @return PromiseInterface */ public function publish( - MetadataTypes\Sources\Module|MetadataTypes\Sources\Plugin|MetadataTypes\Sources\Connector $source, + Types\Sources\Module|Types\Sources\Plugin|Types\Sources\Connector $source, string $routingKey, - MetadataDocuments\Document|null $entity, + Documents\Document|null $entity, ) : PromiseInterface { $deferred = new Deferred(); @@ -83,7 +89,7 @@ In your code you could just import one publisher - proxy publisher. ```php namespace Your\CoolApp\Actions; -use FastyBird\Library\Exchange\Publisher\Container; +use FastyBird\Core\Exchange\Publisher\Container; class SomeHandler { @@ -117,20 +123,22 @@ And that is it, global publisher will call all your publishers and publish messa One part is done, message is published. Now have to be consumed. If some service of your extension have is waiting for messages from data exchange bus from other extensions, you could just -implement `FastyBird\Library\Exchange\Consumer\Consumer` interface and register your consumer as service +implement `FastyBird\Core\Exchange\Consumer\Consumer` interface and register your consumer as service ```php namespace Your\CoolApp\Publishers; -use FastyBird\Library\Exchange\Consumers\Consumer;use FastyBird\Library\Metadata\Documents as MetadataDocuments;use FastyBird\Library\Metadata\Types as MetadataTypes; +use FastyBird\Core\Exchange\Consumers\Consumer; +use FastyBird\Core\Application\Documents; +use FastyBird\Library\Metadata\Types; class DataConsumer implements Consumer { public function consume( - MetadataTypes\Sources\Module|MetadataTypes\Sources\Plugin|MetadataTypes\Sources\Connector $source, + Types\Sources\Module|Types\Sources\Plugin|Types\Sources\Connector $source, string $routingKey, - MetadataDocuments\Document|null $entity, + Documents\Document|null $entity, ) : void { // Do your data processing logic here } diff --git a/src/FastyBird/Library/Exchange/docs/_Footer.md b/src/FastyBird/Core/Exchange/docs/_Footer.md similarity index 79% rename from src/FastyBird/Library/Exchange/docs/_Footer.md rename to src/FastyBird/Core/Exchange/docs/_Footer.md index 1ea002234..bbed209c2 100644 --- a/src/FastyBird/Library/Exchange/docs/_Footer.md +++ b/src/FastyBird/Core/Exchange/docs/_Footer.md @@ -5,4 +5,4 @@ Thank you for testing, reporting and contributing. *** Homepage [https://www.fastybird.com](https://www.fastybird.com) and -repository [https://github.com/fastybird/exchange-library](https://github.com/fastybird/exchange-library). +repository [https://github.com/fastybird/exchange](https://github.com/fastybird/exchange). diff --git a/src/FastyBird/Library/Exchange/src/Consumers/Consumer.php b/src/FastyBird/Core/Exchange/src/Consumers/Consumer.php similarity index 70% rename from src/FastyBird/Library/Exchange/src/Consumers/Consumer.php rename to src/FastyBird/Core/Exchange/src/Consumers/Consumer.php index ddbb9a84d..d1961d25d 100644 --- a/src/FastyBird/Library/Exchange/src/Consumers/Consumer.php +++ b/src/FastyBird/Core/Exchange/src/Consumers/Consumer.php @@ -6,22 +6,22 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Consumers * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Exchange\Consumers; +namespace FastyBird\Core\Exchange\Consumers; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; /** * Exchange consumer interface * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Consumers * * @author Adam Kadlec @@ -32,7 +32,7 @@ interface Consumer public function consume( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $document, + ApplicationDocuments\Document|null $document, ): void; } diff --git a/src/FastyBird/Library/Exchange/src/Consumers/Container.php b/src/FastyBird/Core/Exchange/src/Consumers/Container.php similarity index 90% rename from src/FastyBird/Library/Exchange/src/Consumers/Container.php rename to src/FastyBird/Core/Exchange/src/Consumers/Container.php index 9bb98775a..bb6410bf6 100644 --- a/src/FastyBird/Library/Exchange/src/Consumers/Container.php +++ b/src/FastyBird/Core/Exchange/src/Consumers/Container.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Consumers * @since 1.0.0 * * @date 09.01.22 */ -namespace FastyBird\Library\Exchange\Consumers; +namespace FastyBird\Core\Exchange\Consumers; -use FastyBird\Library\Exchange\Events; -use FastyBird\Library\Exchange\Exceptions; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Exchange\Events; +use FastyBird\Core\Exchange\Exceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use Psr\EventDispatcher as PsrEventDispatcher; use SplObjectStorage; @@ -25,7 +25,7 @@ /** * Exchange consumer proxy * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Consumers * * @author Adam Kadlec @@ -46,7 +46,7 @@ public function __construct( public function consume( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $document, + ApplicationDocuments\Document|null $document, ): void { $this->dispatcher?->dispatch(new Events\BeforeMessageConsumed($source, $routingKey, $document)); diff --git a/src/FastyBird/Library/Exchange/src/Consumers/Info.php b/src/FastyBird/Core/Exchange/src/Consumers/Info.php similarity index 84% rename from src/FastyBird/Library/Exchange/src/Consumers/Info.php rename to src/FastyBird/Core/Exchange/src/Consumers/Info.php index fa6b0d9bf..964d0d68d 100644 --- a/src/FastyBird/Library/Exchange/src/Consumers/Info.php +++ b/src/FastyBird/Core/Exchange/src/Consumers/Info.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Consumers * @since 1.0.0 * * @date 09.01.22 */ -namespace FastyBird\Library\Exchange\Consumers; +namespace FastyBird\Core\Exchange\Consumers; use Nette; /** * Consumer configuration * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Consumers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Exchange/src/DI/ExchangeExtension.php b/src/FastyBird/Core/Exchange/src/DI/ExchangeExtension.php similarity index 92% rename from src/FastyBird/Library/Exchange/src/DI/ExchangeExtension.php rename to src/FastyBird/Core/Exchange/src/DI/ExchangeExtension.php index 1a0ce9e50..271bcd743 100644 --- a/src/FastyBird/Library/Exchange/src/DI/ExchangeExtension.php +++ b/src/FastyBird/Core/Exchange/src/DI/ExchangeExtension.php @@ -6,19 +6,19 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage DI * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Exchange\DI; +namespace FastyBird\Core\Exchange\DI; -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Exchange\Consumers; -use FastyBird\Library\Exchange\Documents; -use FastyBird\Library\Exchange\Publisher; +use FastyBird\Core\Application\Boot as ApplicationBoot; +use FastyBird\Core\Exchange\Consumers; +use FastyBird\Core\Exchange\Documents; +use FastyBird\Core\Exchange\Publisher; use Nette; use Nette\Bootstrap; use Nette\DI; @@ -29,7 +29,7 @@ /** * Exchange plugin extension container * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage DI * * @author Adam Kadlec @@ -43,7 +43,7 @@ class ExchangeExtension extends DI\CompilerExtension public static function register( ApplicationBoot\Configurator $config, - string $extensionName = 'fbExchangeLibrary', + string $extensionName = 'fbExchange', ): void { $config->onCompile[] = static function ( diff --git a/src/FastyBird/Library/Exchange/src/Documents/DocumentFactory.php b/src/FastyBird/Core/Exchange/src/Documents/DocumentFactory.php similarity index 69% rename from src/FastyBird/Library/Exchange/src/Documents/DocumentFactory.php rename to src/FastyBird/Core/Exchange/src/Documents/DocumentFactory.php index 50e7a58fe..d2d89cc26 100644 --- a/src/FastyBird/Library/Exchange/src/Documents/DocumentFactory.php +++ b/src/FastyBird/Core/Exchange/src/Documents/DocumentFactory.php @@ -6,19 +6,19 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Documents * @since 1.0.0 * * @date 13.06.22 */ -namespace FastyBird\Library\Exchange\Documents; +namespace FastyBird\Core\Exchange\Documents; -use FastyBird\Library\Exchange\Documents; -use FastyBird\Library\Exchange\Exceptions; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; -use FastyBird\Library\Metadata\Exceptions as MetadataExceptions; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Application\Exceptions as ApplicationExceptions; +use FastyBird\Core\Exchange\Documents; +use FastyBird\Core\Exchange\Exceptions; use Nette\Utils; use ReflectionClass; use function array_key_exists; @@ -29,7 +29,7 @@ /** * Exchange document factory * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Documents * * @author Adam Kadlec @@ -37,15 +37,15 @@ final class DocumentFactory { - /** @var array>|null */ + /** @var array>|null */ private array|null $routingMap = null; - /** @var Mapping\Driver\AttributeReader */ + /** @var Documents\Mapping\Driver\AttributeReader */ private Documents\Mapping\Driver\AttributeReader $reader; public function __construct( - private readonly MetadataDocuments\Mapping\Driver\MappingDriver $mappingDriver, - private readonly MetadataDocuments\DocumentFactory $documentFactory, + private readonly ApplicationDocuments\Mapping\Driver\MappingDriver $mappingDriver, + private readonly ApplicationDocuments\DocumentFactory $documentFactory, ) { $this->reader = new Documents\Mapping\Driver\AttributeReader(); @@ -53,15 +53,15 @@ public function __construct( /** * @throws Exceptions\InvalidState - * @throws MetadataExceptions\InvalidArgument - * @throws MetadataExceptions\InvalidState - * @throws MetadataExceptions\MalformedInput - * @throws MetadataExceptions\Mapping + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws ApplicationExceptions\MalformedInput + * @throws ApplicationExceptions\Mapping */ public function create( Utils\ArrayHash $data, string $routingKey, - ): MetadataDocuments\Document + ): ApplicationDocuments\Document { return $this->documentFactory->create( $this->loadDocument($routingKey), @@ -70,7 +70,7 @@ public function create( } /** - * @return class-string + * @return class-string * * @throws Exceptions\InvalidState */ @@ -97,7 +97,7 @@ private function initialize(): void $this->routingMap = []; foreach ($this->mappingDriver->getAllClassNames() as $className) { - if (!is_subclass_of($className, MetadataDocuments\Document::class)) { + if (!is_subclass_of($className, ApplicationDocuments\Document::class)) { continue; } diff --git a/src/FastyBird/Library/Exchange/src/Documents/Mapping/Driver/AttributeReader.php b/src/FastyBird/Core/Exchange/src/Documents/Mapping/Driver/AttributeReader.php similarity index 93% rename from src/FastyBird/Library/Exchange/src/Documents/Mapping/Driver/AttributeReader.php rename to src/FastyBird/Core/Exchange/src/Documents/Mapping/Driver/AttributeReader.php index 73b080b1c..70a1b062e 100644 --- a/src/FastyBird/Library/Exchange/src/Documents/Mapping/Driver/AttributeReader.php +++ b/src/FastyBird/Core/Exchange/src/Documents/Mapping/Driver/AttributeReader.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Documents * @since 1.0.0 * * @date 13.02.24 */ -namespace FastyBird\Library\Exchange\Documents\Mapping\Driver; +namespace FastyBird\Core\Exchange\Documents\Mapping\Driver; -use FastyBird\Library\Exchange\Documents; +use FastyBird\Core\Exchange\Documents; use ReflectionAttribute; use ReflectionClass; use ReflectionMethod; diff --git a/src/FastyBird/Library/Exchange/src/Documents/Mapping/MappingAttribute.php b/src/FastyBird/Core/Exchange/src/Documents/Mapping/MappingAttribute.php similarity index 76% rename from src/FastyBird/Library/Exchange/src/Documents/Mapping/MappingAttribute.php rename to src/FastyBird/Core/Exchange/src/Documents/Mapping/MappingAttribute.php index 2db75443d..7a2bd4106 100644 --- a/src/FastyBird/Library/Exchange/src/Documents/Mapping/MappingAttribute.php +++ b/src/FastyBird/Core/Exchange/src/Documents/Mapping/MappingAttribute.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Documents * @since 1.0.0 * * @date 13.02.24 */ -namespace FastyBird\Library\Exchange\Documents\Mapping; +namespace FastyBird\Core\Exchange\Documents\Mapping; interface MappingAttribute { diff --git a/src/FastyBird/Library/Exchange/src/Documents/Mapping/RoutingMap.php b/src/FastyBird/Core/Exchange/src/Documents/Mapping/RoutingMap.php similarity index 87% rename from src/FastyBird/Library/Exchange/src/Documents/Mapping/RoutingMap.php rename to src/FastyBird/Core/Exchange/src/Documents/Mapping/RoutingMap.php index 8ee4e2cd5..a14ebc848 100644 --- a/src/FastyBird/Library/Exchange/src/Documents/Mapping/RoutingMap.php +++ b/src/FastyBird/Core/Exchange/src/Documents/Mapping/RoutingMap.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Documents * @since 1.0.0 * * @date 13.02.24 */ -namespace FastyBird\Library\Exchange\Documents\Mapping; +namespace FastyBird\Core\Exchange\Documents\Mapping; use Attribute; diff --git a/src/FastyBird/Library/Exchange/src/Events/AfterMessageConsumed.php b/src/FastyBird/Core/Exchange/src/Events/AfterMessageConsumed.php similarity index 74% rename from src/FastyBird/Library/Exchange/src/Events/AfterMessageConsumed.php rename to src/FastyBird/Core/Exchange/src/Events/AfterMessageConsumed.php index 121d55ea8..1b9187db8 100644 --- a/src/FastyBird/Library/Exchange/src/Events/AfterMessageConsumed.php +++ b/src/FastyBird/Core/Exchange/src/Events/AfterMessageConsumed.php @@ -6,23 +6,23 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * @since 1.0.0 * * @date 19.06.22 */ -namespace FastyBird\Library\Exchange\Events; +namespace FastyBird\Core\Exchange\Events; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; use Symfony\Contracts\EventDispatcher; /** * After message consumed event * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * * @author Adam Kadlec @@ -33,7 +33,7 @@ class AfterMessageConsumed extends EventDispatcher\Event public function __construct( private readonly MetadataTypes\Sources\Source $source, private readonly string $routingKey, - private readonly MetadataDocuments\Document|null $entity, + private readonly ApplicationDocuments\Document|null $entity, ) { } @@ -48,7 +48,7 @@ public function getRoutingKey(): string return $this->routingKey; } - public function getEntity(): MetadataDocuments\Document|null + public function getEntity(): ApplicationDocuments\Document|null { return $this->entity; } diff --git a/src/FastyBird/Library/Exchange/src/Events/AfterMessagePublished.php b/src/FastyBird/Core/Exchange/src/Events/AfterMessagePublished.php similarity index 74% rename from src/FastyBird/Library/Exchange/src/Events/AfterMessagePublished.php rename to src/FastyBird/Core/Exchange/src/Events/AfterMessagePublished.php index 0b2d3086d..71a0a6d53 100644 --- a/src/FastyBird/Library/Exchange/src/Events/AfterMessagePublished.php +++ b/src/FastyBird/Core/Exchange/src/Events/AfterMessagePublished.php @@ -6,23 +6,23 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * @since 1.0.0 * * @date 19.06.22 */ -namespace FastyBird\Library\Exchange\Events; +namespace FastyBird\Core\Exchange\Events; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; use Symfony\Contracts\EventDispatcher; /** * After message published event * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * * @author Adam Kadlec @@ -33,7 +33,7 @@ class AfterMessagePublished extends EventDispatcher\Event public function __construct( private readonly MetadataTypes\Sources\Source $source, private readonly string $routingKey, - private readonly MetadataDocuments\Document|null $entity, + private readonly ApplicationDocuments\Document|null $entity, ) { } @@ -48,7 +48,7 @@ public function getRoutingKey(): string return $this->routingKey; } - public function getEntity(): MetadataDocuments\Document|null + public function getEntity(): ApplicationDocuments\Document|null { return $this->entity; } diff --git a/src/FastyBird/Library/Exchange/src/Events/BeforeMessageConsumed.php b/src/FastyBird/Core/Exchange/src/Events/BeforeMessageConsumed.php similarity index 74% rename from src/FastyBird/Library/Exchange/src/Events/BeforeMessageConsumed.php rename to src/FastyBird/Core/Exchange/src/Events/BeforeMessageConsumed.php index dc981a21d..bfd19bc7d 100644 --- a/src/FastyBird/Library/Exchange/src/Events/BeforeMessageConsumed.php +++ b/src/FastyBird/Core/Exchange/src/Events/BeforeMessageConsumed.php @@ -6,23 +6,23 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * @since 1.0.0 * * @date 19.06.22 */ -namespace FastyBird\Library\Exchange\Events; +namespace FastyBird\Core\Exchange\Events; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; use Symfony\Contracts\EventDispatcher; /** * Before message consumed event * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * * @author Adam Kadlec @@ -33,7 +33,7 @@ class BeforeMessageConsumed extends EventDispatcher\Event public function __construct( private readonly MetadataTypes\Sources\Source $source, private readonly string $routingKey, - private readonly MetadataDocuments\Document|null $entity, + private readonly ApplicationDocuments\Document|null $entity, ) { } @@ -48,7 +48,7 @@ public function getRoutingKey(): string return $this->routingKey; } - public function getEntity(): MetadataDocuments\Document|null + public function getEntity(): ApplicationDocuments\Document|null { return $this->entity; } diff --git a/src/FastyBird/Library/Exchange/src/Events/BeforeMessagePublished.php b/src/FastyBird/Core/Exchange/src/Events/BeforeMessagePublished.php similarity index 74% rename from src/FastyBird/Library/Exchange/src/Events/BeforeMessagePublished.php rename to src/FastyBird/Core/Exchange/src/Events/BeforeMessagePublished.php index 4e04fad68..c1ce7eb33 100644 --- a/src/FastyBird/Library/Exchange/src/Events/BeforeMessagePublished.php +++ b/src/FastyBird/Core/Exchange/src/Events/BeforeMessagePublished.php @@ -6,23 +6,23 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * @since 1.0.0 * * @date 19.06.22 */ -namespace FastyBird\Library\Exchange\Events; +namespace FastyBird\Core\Exchange\Events; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; use Symfony\Contracts\EventDispatcher; /** * Before message published event * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * * @author Adam Kadlec @@ -33,7 +33,7 @@ class BeforeMessagePublished extends EventDispatcher\Event public function __construct( private readonly MetadataTypes\Sources\Source $source, private readonly string $routingKey, - private readonly MetadataDocuments\Document|null $entity, + private readonly ApplicationDocuments\Document|null $entity, ) { } @@ -48,7 +48,7 @@ public function getRoutingKey(): string return $this->routingKey; } - public function getEntity(): MetadataDocuments\Document|null + public function getEntity(): ApplicationDocuments\Document|null { return $this->entity; } diff --git a/src/FastyBird/Library/Exchange/src/Events/ExchangeError.php b/src/FastyBird/Core/Exchange/src/Events/ExchangeError.php similarity index 83% rename from src/FastyBird/Library/Exchange/src/Events/ExchangeError.php rename to src/FastyBird/Core/Exchange/src/Events/ExchangeError.php index 3f2c0282c..eba6ef468 100644 --- a/src/FastyBird/Library/Exchange/src/Events/ExchangeError.php +++ b/src/FastyBird/Core/Exchange/src/Events/ExchangeError.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * @since 1.0.0 * * @date 20.01.24 */ -namespace FastyBird\Library\Exchange\Events; +namespace FastyBird\Core\Exchange\Events; use Symfony\Contracts\EventDispatcher; use Throwable; @@ -21,7 +21,7 @@ /** * Exchange service occurred and error * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Events * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Exchange/src/Exceptions/Exception.php b/src/FastyBird/Core/Exchange/src/Exceptions/Exception.php similarity index 78% rename from src/FastyBird/Library/Exchange/src/Exceptions/Exception.php rename to src/FastyBird/Core/Exchange/src/Exceptions/Exception.php index c2dd9f01f..3ee9eaac5 100644 --- a/src/FastyBird/Library/Exchange/src/Exceptions/Exception.php +++ b/src/FastyBird/Core/Exchange/src/Exceptions/Exception.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Exceptions * @since 1.0.0 * * @date 13.06.22 */ -namespace FastyBird\Library\Exchange\Exceptions; +namespace FastyBird\Core\Exchange\Exceptions; use Throwable; diff --git a/src/FastyBird/Library/Exchange/src/Exceptions/InvalidArgument.php b/src/FastyBird/Core/Exchange/src/Exceptions/InvalidArgument.php similarity index 82% rename from src/FastyBird/Library/Exchange/src/Exceptions/InvalidArgument.php rename to src/FastyBird/Core/Exchange/src/Exceptions/InvalidArgument.php index 70345f219..f8f30699d 100644 --- a/src/FastyBird/Library/Exchange/src/Exceptions/InvalidArgument.php +++ b/src/FastyBird/Core/Exchange/src/Exceptions/InvalidArgument.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Exceptions * @since 1.0.0 * * @date 13.10.23 */ -namespace FastyBird\Library\Exchange\Exceptions; +namespace FastyBird\Core\Exchange\Exceptions; use InvalidArgumentException as PHPInvalidArgumentException; diff --git a/src/FastyBird/Library/Exchange/src/Exceptions/InvalidState.php b/src/FastyBird/Core/Exchange/src/Exceptions/InvalidState.php similarity index 80% rename from src/FastyBird/Library/Exchange/src/Exceptions/InvalidState.php rename to src/FastyBird/Core/Exchange/src/Exceptions/InvalidState.php index 1a7c42f9b..4e7948a30 100644 --- a/src/FastyBird/Library/Exchange/src/Exceptions/InvalidState.php +++ b/src/FastyBird/Core/Exchange/src/Exceptions/InvalidState.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Exceptions * @since 1.0.0 * * @date 13.06.22 */ -namespace FastyBird\Library\Exchange\Exceptions; +namespace FastyBird\Core\Exchange\Exceptions; use RuntimeException; diff --git a/src/FastyBird/Library/Exchange/src/Exchange/Factory.php b/src/FastyBird/Core/Exchange/src/Exchange/Factory.php similarity index 77% rename from src/FastyBird/Library/Exchange/src/Exchange/Factory.php rename to src/FastyBird/Core/Exchange/src/Exchange/Factory.php index f601880e9..7ead63ba9 100644 --- a/src/FastyBird/Library/Exchange/src/Exchange/Factory.php +++ b/src/FastyBird/Core/Exchange/src/Exchange/Factory.php @@ -6,19 +6,19 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Exchange * @since 1.0.0 * * @date 28.03.23 */ -namespace FastyBird\Library\Exchange\Exchange; +namespace FastyBird\Core\Exchange\Exchange; /** * Exchange factory interface * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Exchange * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Exchange/src/Publisher/Async/Container.php b/src/FastyBird/Core/Exchange/src/Publisher/Async/Container.php similarity index 87% rename from src/FastyBird/Library/Exchange/src/Publisher/Async/Container.php rename to src/FastyBird/Core/Exchange/src/Publisher/Async/Container.php index 07f37cb84..f2c0808a5 100644 --- a/src/FastyBird/Library/Exchange/src/Publisher/Async/Container.php +++ b/src/FastyBird/Core/Exchange/src/Publisher/Async/Container.php @@ -6,17 +6,17 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Exchange\Publisher\Async; +namespace FastyBird\Core\Exchange\Publisher\Async; -use FastyBird\Library\Exchange\Events; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Exchange\Events; use FastyBird\Library\Metadata\Types as MetadataTypes; use Psr\EventDispatcher as PsrEventDispatcher; use React\Promise; @@ -26,7 +26,7 @@ /** * Exchange async publishers proxy * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * * @author Adam Kadlec @@ -50,7 +50,7 @@ public function __construct( public function publish( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $entity, + ApplicationDocuments\Document|null $entity, ): Promise\PromiseInterface { $deferred = new Promise\Deferred(); diff --git a/src/FastyBird/Library/Exchange/src/Publisher/Async/Publisher.php b/src/FastyBird/Core/Exchange/src/Publisher/Async/Publisher.php similarity index 73% rename from src/FastyBird/Library/Exchange/src/Publisher/Async/Publisher.php rename to src/FastyBird/Core/Exchange/src/Publisher/Async/Publisher.php index 543945add..439edc476 100644 --- a/src/FastyBird/Library/Exchange/src/Publisher/Async/Publisher.php +++ b/src/FastyBird/Core/Exchange/src/Publisher/Async/Publisher.php @@ -6,23 +6,23 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Exchange\Publisher\Async; +namespace FastyBird\Core\Exchange\Publisher\Async; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; use React\Promise; /** * Exchange asynchronous publisher interface * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * * @author Adam Kadlec @@ -36,7 +36,7 @@ interface Publisher public function publish( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $entity, + ApplicationDocuments\Document|null $entity, ): Promise\PromiseInterface; } diff --git a/src/FastyBird/Library/Exchange/src/Publisher/Container.php b/src/FastyBird/Core/Exchange/src/Publisher/Container.php similarity index 84% rename from src/FastyBird/Library/Exchange/src/Publisher/Container.php rename to src/FastyBird/Core/Exchange/src/Publisher/Container.php index 9839823d0..3ddc544dd 100644 --- a/src/FastyBird/Library/Exchange/src/Publisher/Container.php +++ b/src/FastyBird/Core/Exchange/src/Publisher/Container.php @@ -6,17 +6,17 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Exchange\Publisher; +namespace FastyBird\Core\Exchange\Publisher; -use FastyBird\Library\Exchange\Events; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; +use FastyBird\Core\Exchange\Events; use FastyBird\Library\Metadata\Types as MetadataTypes; use Psr\EventDispatcher as PsrEventDispatcher; use SplObjectStorage; @@ -24,7 +24,7 @@ /** * Exchange publishers proxy * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * * @author Adam Kadlec @@ -45,7 +45,7 @@ public function __construct( public function publish( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $entity, + ApplicationDocuments\Document|null $entity, ): bool { $this->dispatcher?->dispatch(new Events\BeforeMessagePublished($source, $routingKey, $entity)); diff --git a/src/FastyBird/Library/Exchange/src/Publisher/Publisher.php b/src/FastyBird/Core/Exchange/src/Publisher/Publisher.php similarity index 71% rename from src/FastyBird/Library/Exchange/src/Publisher/Publisher.php rename to src/FastyBird/Core/Exchange/src/Publisher/Publisher.php index c8bcc2f98..224b255f3 100644 --- a/src/FastyBird/Library/Exchange/src/Publisher/Publisher.php +++ b/src/FastyBird/Core/Exchange/src/Publisher/Publisher.php @@ -6,22 +6,22 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * @since 1.0.0 * * @date 19.12.20 */ -namespace FastyBird\Library\Exchange\Publisher; +namespace FastyBird\Core\Exchange\Publisher; -use FastyBird\Library\Metadata\Documents as MetadataDocuments; +use FastyBird\Core\Application\Documents as ApplicationDocuments; use FastyBird\Library\Metadata\Types as MetadataTypes; /** * Exchange publisher interface * - * @package FastyBird:ExchangeLibrary! + * @package FastyBird:Exchange! * @subpackage Publishers * * @author Adam Kadlec @@ -32,7 +32,7 @@ interface Publisher public function publish( MetadataTypes\Sources\Source $source, string $routingKey, - MetadataDocuments\Document|null $entity, + ApplicationDocuments\Document|null $entity, ): bool; } diff --git a/src/FastyBird/Library/Exchange/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Core/Exchange/tests/cases/unit/BaseTestCase.php similarity index 90% rename from src/FastyBird/Library/Exchange/tests/cases/unit/BaseTestCase.php rename to src/FastyBird/Core/Exchange/tests/cases/unit/BaseTestCase.php index eb57e106d..d2dea9d76 100644 --- a/src/FastyBird/Library/Exchange/tests/cases/unit/BaseTestCase.php +++ b/src/FastyBird/Core/Exchange/tests/cases/unit/BaseTestCase.php @@ -1,11 +1,11 @@ -# @package FastyBird:ExchangeLibrary! +# @package FastyBird:Exchange! # @subpackage config # @since 1.0.0 # @@ -15,8 +15,8 @@ php: extensions: ipubPhone : IPub\Phone\DI\PhoneExtension - fbMetadataLibrary : FastyBird\Library\Metadata\DI\MetadataExtension + fbTools : FastyBird\Core\Tools\DI\ToolsExtension -fbMetadataLibrary: +fbApplication: documents: mapping: [] diff --git a/src/FastyBird/Library/Application/tools/.coveralls.yml b/src/FastyBird/Core/Exchange/tools/.coveralls.yml similarity index 100% rename from src/FastyBird/Library/Application/tools/.coveralls.yml rename to src/FastyBird/Core/Exchange/tools/.coveralls.yml diff --git a/src/FastyBird/Library/Application/tools/infection.json b/src/FastyBird/Core/Exchange/tools/infection.json similarity index 100% rename from src/FastyBird/Library/Application/tools/infection.json rename to src/FastyBird/Core/Exchange/tools/infection.json diff --git a/src/FastyBird/Library/Tools/tools/phpcs.xml b/src/FastyBird/Core/Exchange/tools/phpcs.xml similarity index 91% rename from src/FastyBird/Library/Tools/tools/phpcs.xml rename to src/FastyBird/Core/Exchange/tools/phpcs.xml index 4c7aa894a..79deb32be 100644 --- a/src/FastyBird/Library/Tools/tools/phpcs.xml +++ b/src/FastyBird/Core/Exchange/tools/phpcs.xml @@ -17,8 +17,8 @@ - - + + diff --git a/app/tools/phpstan-bootstrap.php b/src/FastyBird/Core/Exchange/tools/phpstan-bootstrap.php similarity index 100% rename from app/tools/phpstan-bootstrap.php rename to src/FastyBird/Core/Exchange/tools/phpstan-bootstrap.php diff --git a/src/FastyBird/Library/Application/tools/phpstan.base.neon b/src/FastyBird/Core/Exchange/tools/phpstan.base.neon similarity index 100% rename from src/FastyBird/Library/Application/tools/phpstan.base.neon rename to src/FastyBird/Core/Exchange/tools/phpstan.base.neon diff --git a/app/tools/phpstan.config.src.neon b/src/FastyBird/Core/Exchange/tools/phpstan.config.src.neon similarity index 100% rename from app/tools/phpstan.config.src.neon rename to src/FastyBird/Core/Exchange/tools/phpstan.config.src.neon diff --git a/src/FastyBird/Library/Application/tools/phpstan.config.tests.neon b/src/FastyBird/Core/Exchange/tools/phpstan.config.tests.neon similarity index 100% rename from src/FastyBird/Library/Application/tools/phpstan.config.tests.neon rename to src/FastyBird/Core/Exchange/tools/phpstan.config.tests.neon diff --git a/src/FastyBird/Library/Application/tools/phpstan.src.neon b/src/FastyBird/Core/Exchange/tools/phpstan.src.neon similarity index 100% rename from src/FastyBird/Library/Application/tools/phpstan.src.neon rename to src/FastyBird/Core/Exchange/tools/phpstan.src.neon diff --git a/src/FastyBird/Library/Application/tools/phpstan.tests.neon b/src/FastyBird/Core/Exchange/tools/phpstan.tests.neon similarity index 100% rename from src/FastyBird/Library/Application/tools/phpstan.tests.neon rename to src/FastyBird/Core/Exchange/tools/phpstan.tests.neon diff --git a/app/tools/phpunit-bootstrap.php b/src/FastyBird/Core/Exchange/tools/phpunit-bootstrap.php similarity index 100% rename from app/tools/phpunit-bootstrap.php rename to src/FastyBird/Core/Exchange/tools/phpunit-bootstrap.php diff --git a/src/FastyBird/Library/Application/tools/phpunit.xml b/src/FastyBird/Core/Exchange/tools/phpunit.xml similarity index 100% rename from src/FastyBird/Library/Application/tools/phpunit.xml rename to src/FastyBird/Core/Exchange/tools/phpunit.xml diff --git a/src/FastyBird/Library/Exchange/.editorconfig b/src/FastyBird/Core/Tools/.editorconfig similarity index 100% rename from src/FastyBird/Library/Exchange/.editorconfig rename to src/FastyBird/Core/Tools/.editorconfig diff --git a/src/FastyBird/Library/Metadata/.eslintrc b/src/FastyBird/Core/Tools/.eslintrc similarity index 100% rename from src/FastyBird/Library/Metadata/.eslintrc rename to src/FastyBird/Core/Tools/.eslintrc diff --git a/src/FastyBird/Library/Exchange/.gitattributes b/src/FastyBird/Core/Tools/.gitattributes similarity index 63% rename from src/FastyBird/Library/Exchange/.gitattributes rename to src/FastyBird/Core/Tools/.gitattributes index 646311297..cc79ff0b7 100644 --- a/src/FastyBird/Library/Exchange/.gitattributes +++ b/src/FastyBird/Core/Tools/.gitattributes @@ -6,4 +6,8 @@ .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore +.npmignore export-ignore +.prettierrc export-ignore +commitlint.config.mjs export-ignore +eslint.config.mjs export-ignore Makefile export-ignore diff --git a/src/FastyBird/Library/Tools/.github/FUNDING.yml b/src/FastyBird/Core/Tools/.github/FUNDING.yml similarity index 100% rename from src/FastyBird/Library/Tools/.github/FUNDING.yml rename to src/FastyBird/Core/Tools/.github/FUNDING.yml diff --git a/src/FastyBird/Core/Tools/.github/workflows/ci.yaml b/src/FastyBird/Core/Tools/.github/workflows/ci.yaml new file mode 100644 index 000000000..7775978eb --- /dev/null +++ b/src/FastyBird/Core/Tools/.github/workflows/ci.yaml @@ -0,0 +1,179 @@ +name: "build" + +on: + pull_request: + paths-ignore: + - "docs/**" + push: + branches: + - "main" + tags: + - v* + schedule: + - cron: "0 8 * * 1" # At 08:00 on Monday + +jobs: + build: + name: "Build code for distribution" + runs-on: "${{ matrix.operating-system }}" + + strategy: + matrix: + node-version: [ "20" ] + operating-system: [ "ubuntu-latest" ] + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Install node" + uses: "actions/setup-node@v4" + with: + node-version: "${{ matrix.node-version }}" + registry-url: "https://registry.npmjs.org" + + - name: "Install package dependencies" + run: "yarn install" + + - name: "Build the project" + run: "yarn build" + + - name: "Upload build result" + uses: "actions/upload-artifact@v4" + with: + name: js-dist + path: dist + + publish-npmjs: + name: "Publish code distribution to NPM" + runs-on: "${{ matrix.operating-system }}" + needs: [ "build" ] + + strategy: + matrix: + node-version: [ "20" ] + operating-system: [ "ubuntu-latest" ] + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Install node" + uses: "actions/setup-node@v4" + with: + node-version: "${{ matrix.node-version }}" + registry-url: "https://registry.npmjs.org" + + - name: "Extract version" + uses: "battila7/get-version-action@v2" + id: "get_version" + + - name: "Set up git since we will later push to the repo" + run: | + git config --global user.name "GitHub CD bot" + git config --global user.email "code@fastybird.com" + + - name: "Upgrade npm version in package.json to the tag used in the release" + if: contains(github.ref, 'refs/tags/') + run: npm version ${{ steps.get_version.outputs.version-without-v }} --allow-same-version + + - name: "Download build result" + uses: "actions/download-artifact@v4" + with: + name: js-dist + path: dist + + - name: "Publish to NPM" + uses: "JS-DevTools/npm-publish@v3" + id: "npm_publish" + if: contains(github.ref, 'refs/tags/') + with: + token: ${{ secrets.NPMJS_TOKEN }} + access: "public" + + - name: "Publish to NPM result" + if: contains(github.ref, 'refs/tags/') && steps.npm_publish.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" + + - name: "Publish to NPM" + uses: "JS-DevTools/npm-publish@v3" + id: "npm_publish_dev" + if: contains(github.ref, 'refs/tags/') == false + with: + token: ${{ secrets.NPMJS_TOKEN }} + access: "public" + tag: "dev" + + - name: "Publish to NPM result" + if: contains(github.ref, 'refs/tags/') == false && steps.npm_publish_dev.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" + + publish-github: + name: "Publish code distribution to Github packages" + runs-on: "${{ matrix.operating-system }}" + needs: [ "build" ] + + strategy: + matrix: + node-version: [ "20" ] + operating-system: [ "ubuntu-latest" ] + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Install node" + uses: "actions/setup-node@v4" + with: + node-version: "${{ matrix.node-version }}" + registry-url: "https://npm.pkg.github.com" + + - name: "Extract version" + uses: "battila7/get-version-action@v2" + id: "get_version" + + - name: "Set up git since we will later push to the repo" + run: | + git config --global user.name "GitHub CD bot" + git config --global user.email "code@fastybird.com" + + - name: "Upgrade npm version in package.json to the tag used in the release" + if: contains(github.ref, 'refs/tags/') + run: npm version ${{ steps.get_version.outputs.version-without-v }} --allow-same-version + + - name: "Download build result" + uses: "actions/download-artifact@v4" + with: + name: js-dist + path: dist + + - name: "Publish to NPM" + uses: "JS-DevTools/npm-publish@v3" + id: "npm_publish" + if: contains(github.ref, 'refs/tags/') + with: + token: ${{ secrets.GITHUB_TOKEN }} + access: "public" + registry: "https://npm.pkg.github.com" + + - name: "Publish to NPM result" + if: contains(github.ref, 'refs/tags/') && steps.npm_publish.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" + + - name: "Publish to NPM" + uses: "JS-DevTools/npm-publish@v3" + id: "npm_publish_dev" + if: contains(github.ref, 'refs/tags/') == false + with: + token: ${{ secrets.GITHUB_TOKEN }} + access: "public" + tag: "dev" + registry: "https://npm.pkg.github.com" + + - name: "Publish to NPM result" + if: contains(github.ref, 'refs/tags/') == false && steps.npm_publish_dev.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" diff --git a/src/FastyBird/Library/Tools/.github/workflows/lint.yaml b/src/FastyBird/Core/Tools/.github/workflows/lint.yaml similarity index 66% rename from src/FastyBird/Library/Tools/.github/workflows/lint.yaml rename to src/FastyBird/Core/Tools/.github/workflows/lint.yaml index cd3fef8e6..bb9d3ba11 100644 --- a/src/FastyBird/Library/Tools/.github/workflows/lint.yaml +++ b/src/FastyBird/Core/Tools/.github/workflows/lint.yaml @@ -29,3 +29,17 @@ jobs: matrix: php-version: [ "8.2" ] operating-system: [ "ubuntu-latest" ] + + js: + name: "JS Lint" + + uses: "fastybird/.github/.github/workflows/js-lint.yaml@main" + secrets: inherit + with: + node: "${{ matrix.node-version }}" + + strategy: + fail-fast: false + matrix: + node-version: [ "20" ] + operating-system: [ "ubuntu-latest" ] diff --git a/src/FastyBird/Library/Tools/.github/workflows/qa.yaml b/src/FastyBird/Core/Tools/.github/workflows/qa.yaml similarity index 66% rename from src/FastyBird/Library/Tools/.github/workflows/qa.yaml rename to src/FastyBird/Core/Tools/.github/workflows/qa.yaml index c3b2e0e8e..3a9b06db4 100644 --- a/src/FastyBird/Library/Tools/.github/workflows/qa.yaml +++ b/src/FastyBird/Core/Tools/.github/workflows/qa.yaml @@ -29,3 +29,17 @@ jobs: matrix: php-version: [ "8.2" ] operating-system: [ "ubuntu-latest" ] + + js: + name: "JS Code quality assurance" + + uses: "fastybird/.github/.github/workflows/prettier.yaml@main" + secrets: inherit + with: + node: "${{ matrix.node-version }}" + + strategy: + fail-fast: false + matrix: + node-version: [ "20" ] + operating-system: [ "ubuntu-latest" ] diff --git a/src/FastyBird/Library/Tools/.github/workflows/static-analysis.yaml b/src/FastyBird/Core/Tools/.github/workflows/static-analysis.yaml similarity index 67% rename from src/FastyBird/Library/Tools/.github/workflows/static-analysis.yaml rename to src/FastyBird/Core/Tools/.github/workflows/static-analysis.yaml index d1e02d6b5..0fca2e4e7 100644 --- a/src/FastyBird/Library/Tools/.github/workflows/static-analysis.yaml +++ b/src/FastyBird/Core/Tools/.github/workflows/static-analysis.yaml @@ -29,3 +29,17 @@ jobs: matrix: php-version: [ "8.2" ] operating-system: [ "ubuntu-latest" ] + + js: + name: "JS Lint" + + uses: "fastybird/.github/.github/workflows/js-types.yaml@main" + secrets: inherit + with: + node: "${{ matrix.node-version }}" + + strategy: + fail-fast: false + matrix: + node-version: [ "20" ] + operating-system: [ "ubuntu-latest" ] diff --git a/src/FastyBird/Library/Tools/.github/workflows/tests.yaml b/src/FastyBird/Core/Tools/.github/workflows/tests.yaml similarity index 100% rename from src/FastyBird/Library/Tools/.github/workflows/tests.yaml rename to src/FastyBird/Core/Tools/.github/workflows/tests.yaml diff --git a/src/FastyBird/Library/Tools/.github/workflows/wiki.yml b/src/FastyBird/Core/Tools/.github/workflows/wiki.yml similarity index 100% rename from src/FastyBird/Library/Tools/.github/workflows/wiki.yml rename to src/FastyBird/Core/Tools/.github/workflows/wiki.yml diff --git a/src/FastyBird/Core/Tools/.gitignore b/src/FastyBird/Core/Tools/.gitignore new file mode 100644 index 000000000..efa58cf83 --- /dev/null +++ b/src/FastyBird/Core/Tools/.gitignore @@ -0,0 +1,14 @@ +.idea +/dist +/node_modules +/vendor +/var +.editorconfig +.DS_Store +.gitattributes +.gitignore +.npmignore +composer.lock +yarn.lock +tsconfig.tsbuildinfo +Makefile diff --git a/src/FastyBird/Core/Tools/.npmignore b/src/FastyBird/Core/Tools/.npmignore new file mode 100644 index 000000000..43f2f1d0f --- /dev/null +++ b/src/FastyBird/Core/Tools/.npmignore @@ -0,0 +1,14 @@ +.idea +/node_modules +/src +/vendor +/var +.editorconfig +.DS_Store +.gitattributes +.gitignore +.npmignore +composer.lock +yarn.lock +tsconfig.tsbuildinfo +Makefile export-ignore diff --git a/src/FastyBird/Library/Tools/CHANGELOG-1.0.md b/src/FastyBird/Core/Tools/CHANGELOG-1.0.md similarity index 100% rename from src/FastyBird/Library/Tools/CHANGELOG-1.0.md rename to src/FastyBird/Core/Tools/CHANGELOG-1.0.md diff --git a/src/FastyBird/Library/Exchange/LICENSE.md b/src/FastyBird/Core/Tools/LICENSE.md similarity index 100% rename from src/FastyBird/Library/Exchange/LICENSE.md rename to src/FastyBird/Core/Tools/LICENSE.md diff --git a/src/FastyBird/Library/Exchange/Makefile b/src/FastyBird/Core/Tools/Makefile similarity index 100% rename from src/FastyBird/Library/Exchange/Makefile rename to src/FastyBird/Core/Tools/Makefile diff --git a/src/FastyBird/Library/Tools/README.md b/src/FastyBird/Core/Tools/README.md similarity index 90% rename from src/FastyBird/Library/Tools/README.md rename to src/FastyBird/Core/Tools/README.md index bc53aa37e..17148c85c 100644 --- a/src/FastyBird/Library/Tools/README.md +++ b/src/FastyBird/Core/Tools/README.md @@ -16,9 +16,9 @@ *** -## What is FastyBird tools library? +## What is FastyBird tools? -The library comprises versatile and valuable tools designed for utilization within the [FastyBird](https://www.fastybird.com) application. These tools +The extension comprises versatile and valuable tools designed for utilization within the [FastyBird](https://www.fastybird.com) application. These tools serve various universal functions, enhancing the overall capabilities and functionality of the application. Tools library is a distributed extension that is developed in [PHP](https://www.php.net), built on the [Nette](https://nette.org) and [Symfony](https://symfony.com) frameworks, @@ -34,7 +34,19 @@ This library is part of the [FastyBird](https://www.fastybird.com) [IoT](https:/ In case you want to create you own distribution of [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem you could install this extension with [Composer](http://getcomposer.org/): ```sh -composer require fastybird/tools-library +composer require fastybird/tools +``` + +And for user interface is the best way to install **@fastybird/tools** with [Yarn](https://yarnpkg.com/): + +```sh +yarn add @fastybird/tools +``` + +or if you prefer npm: + +```sh +npm install @fastybird/tools ``` ## Documentation diff --git a/src/FastyBird/Core/Tools/assets/account/index.ts b/src/FastyBird/Core/Tools/assets/account/index.ts new file mode 100644 index 000000000..9db95c01c --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/account/index.ts @@ -0,0 +1,23 @@ +import { App, InjectionKey, inject as _inject, hasInjectionContext } from 'vue'; + +import { IAccountManager } from './types'; + +export * from './types'; + +const accountManagerKey: InjectionKey = Symbol('Tools-AccountManager'); + +export function injectAccountManager(app?: App): IAccountManager | undefined { + if (app && app._context && app._context.provides && app._context.provides[accountManagerKey]) { + return app._context.provides[accountManagerKey]; + } + + if (hasInjectionContext()) { + return _inject(accountManagerKey, undefined); + } + + return undefined; +} + +export function provideAccountManager(app: App, manager: IAccountManager): void { + app.provide(accountManagerKey, manager); +} diff --git a/src/FastyBird/Core/Tools/assets/account/types.ts b/src/FastyBird/Core/Tools/assets/account/types.ts new file mode 100644 index 000000000..f180a22b8 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/account/types.ts @@ -0,0 +1,17 @@ +import { ComputedRef } from 'vue'; + +export interface IAccountDetails { + name: string; + email: string; + avatar?: string; +} + +export interface IAccountManager { + isSignedIn: ComputedRef; + isLocked: ComputedRef; + details: ComputedRef; + signIn: (credentials: { username: string; password: string }) => Promise; + signOut: () => Promise; + lock?: () => Promise; + canAccess: (resource: string, action: string) => Promise; +} diff --git a/src/FastyBird/Core/Tools/assets/backend/index.ts b/src/FastyBird/Core/Tools/assets/backend/index.ts new file mode 100644 index 000000000..b596f16f9 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/backend/index.ts @@ -0,0 +1,25 @@ +import { App, InjectionKey, inject as _inject, hasInjectionContext } from 'vue'; + +import { AxiosInstance } from 'axios'; + +const backendKey: InjectionKey = Symbol('Tools-Backend'); + +export function injectBackend(app?: App): AxiosInstance { + if (app && app._context && app._context.provides && app._context.provides[backendKey]) { + return app._context.provides[backendKey]; + } + + if (hasInjectionContext()) { + const axios = _inject(backendKey, undefined); + + if (axios) { + return axios; + } + } + + throw new Error('A backend instance has not been provided.'); +} + +export function provideBackend(app: App, axios: AxiosInstance): void { + app.provide(backendKey, axios); +} diff --git a/src/FastyBird/Core/Tools/assets/composables/index.ts b/src/FastyBird/Core/Tools/assets/composables/index.ts new file mode 100644 index 000000000..cc22b8f39 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/composables/index.ts @@ -0,0 +1,5 @@ +export { useBackend } from './useBackend'; +export { useBreakpoints } from './useBreakpoints'; +export { useDarkMode } from './useDarkMode'; +export { useEventBus } from './useEventBus'; +export { useFlashMessage } from './useFlashMessage'; diff --git a/src/FastyBird/Core/Tools/assets/composables/types.ts b/src/FastyBird/Core/Tools/assets/composables/types.ts new file mode 100644 index 000000000..bf7c696a2 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/composables/types.ts @@ -0,0 +1,40 @@ +import { ComputedRef, Ref } from 'vue'; + +import { AxiosInstance, AxiosResponse } from 'axios'; +import { Emitter, Handler } from 'mitt'; + +import { Events } from '../eventBus'; + +export interface UseBackend { + pendingRequests: Ref; + axios: AxiosInstance; +} + +export interface UseBreakpoints { + isXSDevice: ComputedRef; + isSMDevice: ComputedRef; + isMDDevice: ComputedRef; + isLGDevice: ComputedRef; + isXLDevice: ComputedRef; + isXXLDevice: ComputedRef; +} + +export interface UseDarkMode { + isDark: ComputedRef; + toggleDark: (mode?: boolean) => boolean; +} + +export interface UseEventBus { + eventBus: Emitter; + register: (event: Key, listener: Handler) => void; + unregister: (event: Key, listener: Handler) => void; + emit: (event: Key, payload: Events[Key]) => void; +} + +export interface UseFlashMessage { + success: (message: string) => void; + info: (message: string) => void; + error: (message: string) => void; + exception: (exception: Error, errorMessage: string) => void; + requestError: (response: AxiosResponse, errorMessage: string) => void; +} diff --git a/src/FastyBird/Core/Tools/assets/composables/useBackend.ts b/src/FastyBird/Core/Tools/assets/composables/useBackend.ts new file mode 100644 index 000000000..289846c1b --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/composables/useBackend.ts @@ -0,0 +1,14 @@ +import { ref } from 'vue'; + +import axios from 'axios'; + +import { UseBackend } from './types'; + +export function useBackend(): UseBackend { + const pendingRequests = ref(0); + + return { + pendingRequests, + axios, + }; +} diff --git a/app/assets/composables/useBreakpoints.ts b/src/FastyBird/Core/Tools/assets/composables/useBreakpoints.ts similarity index 100% rename from app/assets/composables/useBreakpoints.ts rename to src/FastyBird/Core/Tools/assets/composables/useBreakpoints.ts diff --git a/src/FastyBird/Core/Tools/assets/composables/useDarkMode.ts b/src/FastyBird/Core/Tools/assets/composables/useDarkMode.ts new file mode 100644 index 000000000..b2a39fa8b --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/composables/useDarkMode.ts @@ -0,0 +1,22 @@ +import { computed } from 'vue'; + +import { useDark, useToggle } from '@vueuse/core'; + +import { UseDarkMode } from './types'; + +export function useDarkMode(): UseDarkMode { + const darkMode = useDark({ + storageKey: 'fb-theme-appearance', + }); + + const isDark = computed((): boolean => { + return darkMode.value; + }); + + const toggleDark = useToggle(darkMode); + + return { + isDark, + toggleDark, + }; +} diff --git a/src/FastyBird/Core/Tools/assets/composables/useEventBus.ts b/src/FastyBird/Core/Tools/assets/composables/useEventBus.ts new file mode 100644 index 000000000..e84e07bc8 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/composables/useEventBus.ts @@ -0,0 +1,28 @@ +import { Handler } from 'mitt'; + +import { Events, injectEventBus } from '../eventBus'; + +import { UseEventBus } from './types'; + +export function useEventBus(): UseEventBus { + const eventBus = injectEventBus(); + + const register = (event: Key, listener: Handler): void => { + eventBus.on(event, listener); + }; + + const unregister = (event: Key, listener: Handler): void => { + eventBus.off(event, listener); + }; + + const emit = (event: Key, payload: Events[Key]): void => { + eventBus.emit(event, payload); + }; + + return { + eventBus, + register, + unregister, + emit, + }; +} diff --git a/src/FastyBird/Module/Devices/assets/composables/useFlashMessage.ts b/src/FastyBird/Core/Tools/assets/composables/useFlashMessage.ts similarity index 100% rename from src/FastyBird/Module/Devices/assets/composables/useFlashMessage.ts rename to src/FastyBird/Core/Tools/assets/composables/useFlashMessage.ts index 9689f24b1..5bfb96b53 100644 --- a/src/FastyBird/Module/Devices/assets/composables/useFlashMessage.ts +++ b/src/FastyBird/Core/Tools/assets/composables/useFlashMessage.ts @@ -1,6 +1,6 @@ import { AxiosResponse } from 'axios'; -import get from 'lodash.get'; import { ElNotification } from 'element-plus'; +import get from 'lodash.get'; import { UseFlashMessage } from './types'; diff --git a/src/FastyBird/Core/Tools/assets/entry.ts b/src/FastyBird/Core/Tools/assets/entry.ts new file mode 100644 index 000000000..7eac7b632 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/entry.ts @@ -0,0 +1,9 @@ +export * from './account'; +export * from './backend'; +export * from './composables'; +export * from './eventBus'; +export * from './plugins'; +export * from './stores'; +export * from './utilities'; + +export * from './types'; diff --git a/src/FastyBird/Core/Tools/assets/eventBus/index.ts b/src/FastyBird/Core/Tools/assets/eventBus/index.ts new file mode 100644 index 000000000..5a9896ba9 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/eventBus/index.ts @@ -0,0 +1,29 @@ +import { App, InjectionKey, inject as _inject, hasInjectionContext } from 'vue'; + +import { Emitter } from 'mitt'; + +import { Events } from './types'; + +export * from './types'; + +const eventBusKey: InjectionKey | undefined> = Symbol('Tools-EventBus'); + +export function injectEventBus(app?: App): Emitter { + if (app && app._context && app._context.provides && app._context.provides[eventBusKey]) { + return app._context.provides[eventBusKey]; + } + + if (hasInjectionContext()) { + const eventBus = _inject(eventBusKey, undefined); + + if (eventBus) { + return eventBus; + } + } + + throw new Error('A event bus has not been provided.'); +} + +export function provideEventBus(app: App, eventBus: Emitter): void { + app.provide(eventBusKey, eventBus); +} diff --git a/src/FastyBird/Core/Tools/assets/eventBus/types.ts b/src/FastyBird/Core/Tools/assets/eventBus/types.ts new file mode 100644 index 000000000..dfd2ef514 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/eventBus/types.ts @@ -0,0 +1,6 @@ +export type Events = { + loadingOverlay?: number | boolean; + userSigned: 'in' | 'out'; + userLocked: boolean; + [key: string]: any; +}; diff --git a/src/FastyBird/Core/Tools/assets/plugins/backend.ts b/src/FastyBird/Core/Tools/assets/plugins/backend.ts new file mode 100644 index 000000000..f0e9fdfd8 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/plugins/backend.ts @@ -0,0 +1,69 @@ +import { App } from 'vue'; + +import axios, { InternalAxiosRequestConfig } from 'axios'; + +import { ModulePrefix } from '@fastybird/metadata-library'; + +import { provideBackend } from '../backend'; +import { useBackend } from '../composables'; + +interface IAxiosOptions { + apiPrefix: string; + apiTarget: string | null; + apiKey: string | null; + apiPrefixedModules: boolean; +} + +export default { + install: (app: App, options: IAxiosOptions): void => { + const baseUrl = options.apiTarget !== null ? options.apiTarget : options.apiPrefix; + + axios.defaults.baseURL = baseUrl; + + const MAX_REQUESTS_COUNT = 10; + const MAX_REQUESTS_COUNT_DELAY = 10; + + axios.interceptors.request.use((request): Promise => { + const { pendingRequests } = useBackend(); + + request.baseURL = baseUrl; + + if (typeof request.headers !== 'undefined') { + Object.assign(request.headers, { 'Content-Type': 'application/vnd.api+json' }); + } + + if (options.apiKey !== null) { + if (typeof request.headers !== 'undefined') { + Object.assign(request.headers, { 'X-Api-Key': options.apiKey }); + } + } + + return new Promise((resolve) => { + const interval = setInterval(() => { + if (pendingRequests.value < MAX_REQUESTS_COUNT) { + pendingRequests.value++; + + clearInterval(interval); + + resolve(request); + } + }, MAX_REQUESTS_COUNT_DELAY); + }); + }); + + // Modify api url prefix + axios.interceptors.request.use((request): InternalAxiosRequestConfig => { + if (!options.apiPrefixedModules && typeof request.url !== 'undefined') { + Object.values(ModulePrefix).forEach((modulePrefix) => { + request.url = request.url?.replace(new RegExp(`^/${modulePrefix}`, 'g'), ''); // Remove base path + }); + } + + return request; + }); + + app.config.globalProperties['backend'] = axios; + + provideBackend(app, axios); + }, +}; diff --git a/src/FastyBird/Core/Tools/assets/plugins/eventBus.ts b/src/FastyBird/Core/Tools/assets/plugins/eventBus.ts new file mode 100644 index 000000000..52e5ed12e --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/plugins/eventBus.ts @@ -0,0 +1,15 @@ +import { App } from 'vue'; + +import mitt, { Emitter } from 'mitt'; + +import { Events, provideEventBus } from '../eventBus'; + +export default { + install: (app: App): void => { + const eventBus: Emitter = mitt(); + + app.config.globalProperties['eventBus'] = eventBus; + + provideEventBus(app, eventBus); + }, +}; diff --git a/src/FastyBird/Core/Tools/assets/plugins/extensions.ts b/src/FastyBird/Core/Tools/assets/plugins/extensions.ts new file mode 100644 index 000000000..df0566b18 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/plugins/extensions.ts @@ -0,0 +1,15 @@ +import { App } from 'vue'; + +import { IExtensionsOptions } from '../types'; + +export default { + install: async (app: App, options: IExtensionsOptions): Promise => { + for (const extension of options.extensions) { + if (typeof extension.module.install === 'function') { + app.use(extension.module, options.options); + } else { + console.error(`The module for ${extension.name} does not export a valid Vue plugin.`); + } + } + }, +}; diff --git a/src/FastyBird/Core/Tools/assets/plugins/index.ts b/src/FastyBird/Core/Tools/assets/plugins/index.ts new file mode 100644 index 000000000..5f08f3a9e --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/plugins/index.ts @@ -0,0 +1,4 @@ +export { default as backendPlugin } from './backend'; +export { default as eventBusPlugin } from './eventBus'; +export { default as extensionsPlugin } from './extensions'; +export { default as storesPlugin } from './stores'; diff --git a/src/FastyBird/Core/Tools/assets/plugins/stores.ts b/src/FastyBird/Core/Tools/assets/plugins/stores.ts new file mode 100644 index 000000000..fe9c92c2d --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/plugins/stores.ts @@ -0,0 +1,13 @@ +import { App } from 'vue'; + +import { StoresManager, provideStoresManager } from '../stores'; + +export default { + install: async (app: App): Promise => { + const manager = new StoresManager(); + + app.config.globalProperties['storesManager'] = manager; + + provideStoresManager(app, manager); + }, +}; diff --git a/src/FastyBird/Core/Tools/assets/stores/index.ts b/src/FastyBird/Core/Tools/assets/stores/index.ts new file mode 100644 index 000000000..acd0281c7 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/stores/index.ts @@ -0,0 +1,28 @@ +import { App, InjectionKey, inject as _inject, hasInjectionContext } from 'vue'; + +import { StoresManager } from './manager'; + +export * from './manager'; +export * from './types'; + +const storesManagerKey: InjectionKey = Symbol('Tools-StoresManager'); + +export function injectStoresManager(app?: App): StoresManager { + if (app && app._context && app._context.provides && app._context.provides[storesManagerKey]) { + return app._context.provides[storesManagerKey]; + } + + if (hasInjectionContext()) { + const manager = _inject(storesManagerKey, undefined); + + if (manager) { + return manager; + } + } + + throw new Error('A stores manager has not been provided.'); +} + +export function provideStoresManager(app: App, manager: StoresManager): void { + app.provide(storesManagerKey, manager); +} diff --git a/src/FastyBird/Core/Tools/assets/stores/manager.ts b/src/FastyBird/Core/Tools/assets/stores/manager.ts new file mode 100644 index 000000000..9e0106753 --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/stores/manager.ts @@ -0,0 +1,24 @@ +import { StateTree, Store } from 'pinia'; + +import { IStoresManager, StoreInjectionKey } from './types'; + +export class StoresManager implements IStoresManager { + private stores: Map, Store> = new Map(); + + public addStore( + key: StoreInjectionKey, + store: Store + ): void { + this.stores.set(key, store); + } + + public getStore( + key: StoreInjectionKey + ): Store { + if (!this.stores.has(key)) { + throw new Error('Something went wrong, store is not registered'); + } + + return this.stores.get(key) as Store; + } +} diff --git a/src/FastyBird/Core/Tools/assets/stores/types.ts b/src/FastyBird/Core/Tools/assets/stores/types.ts new file mode 100644 index 000000000..55f2c686e --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/stores/types.ts @@ -0,0 +1,14 @@ +import { InjectionKey } from 'vue'; + +import { StateTree, Store } from 'pinia'; + +export type StoreInjectionKey = InjectionKey>; + +export interface IStoresManager { + addStore( + key: StoreInjectionKey, + store: Store + ): void; + + getStore(key: StoreInjectionKey): Store; +} diff --git a/src/FastyBird/Core/Tools/assets/types/index.ts b/src/FastyBird/Core/Tools/assets/types/index.ts new file mode 100644 index 000000000..fb4123b9b --- /dev/null +++ b/src/FastyBird/Core/Tools/assets/types/index.ts @@ -0,0 +1,32 @@ +import { App } from 'vue'; +import { I18n } from 'vue-i18n'; +import { Router } from 'vue-router'; + +import { Pinia } from 'pinia'; + +export * from '../composables/types'; + +export interface IExtensionOptions> { + router: Router; + meta: { + author: string; + website: string; + version: string; + }; + store: Pinia; + i18n: I18n; +} + +export interface IExtensionsOptions> { + extensions: IExtension[]; + options: IExtensionOptions; +} + +type ExtensionModule = { + install: (app: App, options: IExtensionOptions) => void; +}; + +export interface IExtension { + name: string; + module: ExtensionModule; +} diff --git a/src/FastyBird/Library/Metadata/assets/utilities/index.ts b/src/FastyBird/Core/Tools/assets/utilities/index.ts similarity index 100% rename from src/FastyBird/Library/Metadata/assets/utilities/index.ts rename to src/FastyBird/Core/Tools/assets/utilities/index.ts diff --git a/src/FastyBird/Library/Metadata/assets/utilities/value.ts b/src/FastyBird/Core/Tools/assets/utilities/value.ts similarity index 87% rename from src/FastyBird/Library/Metadata/assets/utilities/value.ts rename to src/FastyBird/Core/Tools/assets/utilities/value.ts index ff4dfd083..301590685 100644 --- a/src/FastyBird/Library/Metadata/assets/utilities/value.ts +++ b/src/FastyBird/Core/Tools/assets/utilities/value.ts @@ -1,4 +1,4 @@ -import { ButtonPayload, CoverPayload, SwitchPayload } from '@/types/metadata-library'; +import { ButtonPayload, CoverPayload, SwitchPayload } from '@fastybird/metadata-library'; export const flattenValue = ( value: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null diff --git a/src/FastyBird/Library/Metadata/babel.config.js b/src/FastyBird/Core/Tools/babel.config.js similarity index 100% rename from src/FastyBird/Library/Metadata/babel.config.js rename to src/FastyBird/Core/Tools/babel.config.js diff --git a/src/FastyBird/Core/Tools/commitlint.config.mjs b/src/FastyBird/Core/Tools/commitlint.config.mjs new file mode 100644 index 000000000..acf7912f0 --- /dev/null +++ b/src/FastyBird/Core/Tools/commitlint.config.mjs @@ -0,0 +1,5 @@ +import conventional from '@commitlint/config-conventional'; + +export default { + extends: [conventional], +}; diff --git a/src/FastyBird/Library/Tools/composer.json b/src/FastyBird/Core/Tools/composer.json similarity index 75% rename from src/FastyBird/Library/Tools/composer.json rename to src/FastyBird/Core/Tools/composer.json index 3d36b20c3..d8681838a 100644 --- a/src/FastyBird/Library/Tools/composer.json +++ b/src/FastyBird/Core/Tools/composer.json @@ -1,6 +1,6 @@ { - "name": "fastybird/tools-library", - "type": "fastybird-library", + "name": "fastybird/tools", + "type": "fastybird", "description": "FastyBird IoT application tools & utilities", "keywords": [ "tools", @@ -28,12 +28,23 @@ "support": { "email": "code@fastybird.com", "issues": "https://github.com/FastyBird/fastybird/issues", - "source": "https://github.com/FastyBird/tools-library" + "source": "https://github.com/FastyBird/tools" }, "require": { "php": ">=8.2.0", + "contributte/monolog": "^0.5", + "doctrine/orm": "2.15.*", + "doctrine/persistence": "^2.5 || ^3.4", + "fastybird/datetime-factory": "^0.7.1", "fastybird/metadata-library": "dev-main", - "mathsolver/mathsolver": "@dev" + "mathsolver/mathsolver": "@dev", + "nette/bootstrap": "^3.2", + "nette/di": "^3.2", + "nette/utils": "^4.0", + "opis/json-schema": "^2.3", + "psr/event-dispatcher": "^1.0", + "sentry/sdk": "^3.1", + "symfony/event-dispatcher-contracts": "^3.5" }, "require-dev": { "brianium/paratest": "^7.3", @@ -55,12 +66,12 @@ }, "autoload": { "psr-4": { - "FastyBird\\Library\\Tools\\": "src/" + "FastyBird\\Core\\Tools\\": "src/" } }, "autoload-dev": { "psr-4": { - "FastyBird\\Library\\Tools\\Tests\\Cases\\Unit\\": "tests/cases/unit" + "FastyBird\\Core\\Tools\\Tests\\Cases\\Unit\\": "tests/cases/unit" } }, "config": { diff --git a/src/FastyBird/Library/Tools/docs/Home.md b/src/FastyBird/Core/Tools/docs/Home.md similarity index 100% rename from src/FastyBird/Library/Tools/docs/Home.md rename to src/FastyBird/Core/Tools/docs/Home.md diff --git a/src/FastyBird/Library/Application/docs/_Footer.md b/src/FastyBird/Core/Tools/docs/_Footer.md similarity index 78% rename from src/FastyBird/Library/Application/docs/_Footer.md rename to src/FastyBird/Core/Tools/docs/_Footer.md index f6153c463..103b7b739 100644 --- a/src/FastyBird/Library/Application/docs/_Footer.md +++ b/src/FastyBird/Core/Tools/docs/_Footer.md @@ -5,4 +5,4 @@ Thank you for testing, reporting and contributing. *** Homepage [https://www.fastybird.com](https://www.fastybird.com) and -repository [https://github.com/fastybird/application-library](https://github.com/fastybird/application-library). +repository [https://github.com/fastybird/tools](https://github.com/fastybird/tools). diff --git a/app/eslint.config.mjs b/src/FastyBird/Core/Tools/eslint.config.mjs similarity index 74% rename from app/eslint.config.mjs rename to src/FastyBird/Core/Tools/eslint.config.mjs index 8a5285df3..57448fef4 100644 --- a/app/eslint.config.mjs +++ b/src/FastyBird/Core/Tools/eslint.config.mjs @@ -1,23 +1,27 @@ -import js from '@eslint/js'; -import ts from 'typescript-eslint'; -import pluginPrettier from 'eslint-plugin-prettier/recommended'; +import pluginPrettier from 'eslint-plugin-prettier'; import pluginVue from 'eslint-plugin-vue'; +import ts from 'typescript-eslint'; + +import js from '@eslint/js'; export default [ + // Base configuration js.configs.recommended, ...ts.configs.recommended, ...pluginVue.configs['flat/essential'], ...pluginVue.configs['flat/strongly-recommended'], ...pluginVue.configs['flat/recommended'], - pluginPrettier, { + plugins: { + prettier: pluginPrettier, + }, languageOptions: { parserOptions: { - parser: '@typescript-eslint/parser' + parser: '@typescript-eslint/parser', // Use the TypeScript parser }, globals: { - 'GlobalEventHandlers': 'readonly', - 'ScrollToOptions': 'readonly' + GlobalEventHandlers: 'readonly', + ScrollToOptions: 'readonly', }, }, rules: { @@ -29,7 +33,6 @@ export default [ }, ], 'no-useless-computed-key': 'off', - 'vue/no-setup-props-destructure': 'off', '@typescript-eslint/explicit-function-return-type': ['error'], '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-explicit-any': 'off', diff --git a/src/FastyBird/Core/Tools/package.json b/src/FastyBird/Core/Tools/package.json new file mode 100644 index 000000000..7ef7b095b --- /dev/null +++ b/src/FastyBird/Core/Tools/package.json @@ -0,0 +1,94 @@ +{ + "name": "@fastybird/tools", + "version": "1.0.0-dev.24", + "type": "module", + "description": "FastyBird IoT useful tools", + "keywords": [ + "fastybird", + "fb", + "libs", + "library", + "tools", + "composables" + ], + "homepage": "https://www.fastybird.com", + "bugs": "https://github.com/FastyBird/fastybird/issues", + "license": "Apache-2.0", + "author": { + "name": "FastyBird s.r.o.", + "email": "code@fastybird.com", + "url": "https://www.fastybird.com/" + }, + "repository": { + "type": "git", + "url": "https://github.com/FastyBird/tools.git" + }, + "main": "dist/tools.umd.js", + "module": "dist/tools.es.js", + "types": "dist/tools.d.ts", + "exports": { + ".": { + "import": "./dist/tools.es.js", + "require": "./dist/tools.umd.js" + } + }, + "files": [ + "dist/*", + "resources/*" + ], + "scripts": { + "clean": "rimraf dist && rimraf tsconfig.tsbuildinfo", + "build": "yarn clean && vue-tsc --noEmit --composite false && vite build", + "build:dev": "vue-tsc --noEmit --composite false && vite build --watch --mode development", + "build:only": "yarn clean && vite build", + "types": "vue-tsc --noEmit --composite false", + "lint:js": "eslint assets", + "lint:js:fix": "eslint assets --fix", + "pretty": "yarn pretty:write && yarn pretty:check", + "pretty:check": "prettier assets --check", + "pretty:write": "prettier assets --write" + }, + "dependencies": { + "@fastybird/metadata-library": "1.0.0-dev.24", + "@vueuse/core": "^11.2", + "axios": "^1.6", + "element-plus": "^2.8", + "lodash.get": "^4.4", + "mitt": "^3.0" + }, + "devDependencies": { + "@commitlint/cli": "^19.6", + "@commitlint/config-conventional": "^19.6", + "@nabla/vite-plugin-eslint": "^2.0", + "@trivago/prettier-plugin-sort-imports": "^4.3", + "@types/lodash.get": "^4.4", + "@types/node": "^20.17", + "@typescript-eslint/eslint-plugin": "^8.15", + "@typescript-eslint/parser": "^8.15", + "@vitejs/plugin-vue": "^5.2", + "@vue/eslint-config-prettier": "^10.1", + "@vue/eslint-config-typescript": "^14.1", + "eslint": "^9.15", + "eslint-config-prettier": "^9.1", + "eslint-plugin-prettier": "^5.2", + "eslint-plugin-vue": "^9.31", + "prettier": "^3.3", + "rimraf": "^6.0", + "rollup-plugin-delete": "^2.1", + "typescript": "5.6.2", + "vite": "^5.4", + "vite-plugin-dts": "^4.3", + "vue": "^3.5", + "vue-loader": "^17.4", + "vue-tsc": "^2.1" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "pinia": "^2.2", + "vue": "^3.5", + "vue-i18n": "^10.0", + "vue-router": "^4.4" + } +} diff --git a/src/FastyBird/Core/Tools/prettier.config.mjs b/src/FastyBird/Core/Tools/prettier.config.mjs new file mode 100644 index 000000000..51b92358a --- /dev/null +++ b/src/FastyBird/Core/Tools/prettier.config.mjs @@ -0,0 +1,34 @@ +import pluginSortImports from '@trivago/prettier-plugin-sort-imports'; + +export default { + plugins: [pluginSortImports], + printWidth: 150, + tabWidth: 2, + useTabs: true, + semi: true, + singleQuote: true, + quoteProps: 'as-needed', + jsxSingleQuote: false, + trailingComma: 'es5', + bracketSpacing: true, + arrowParens: 'always', + requirePragma: false, + insertPragma: false, + proseWrap: 'preserve', + htmlWhitespaceSensitivity: 'css', + vueIndentScriptAndStyle: false, + endOfLine: 'auto', + singleAttributePerLine: true, + importOrder: [ + // First external imports + '^vue', + '^pinia', + '^[^@\\/.]', + '^@?\\w', + // Now internal imports, separated by space + '^../(.*)$', // Relative imports like `../` + '^./(.*)$', // Relative imports like `./` + ], + importOrderSeparation: true, + importOrderSortSpecifiers: true, +}; diff --git a/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php b/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php new file mode 100644 index 000000000..51315e341 --- /dev/null +++ b/src/FastyBird/Core/Tools/src/DI/ToolsExtension.php @@ -0,0 +1,181 @@ + + * @package FastyBird:Tools! + * @subpackage DI + * @since 1.0.0 + * + * @date 21.10.22 + */ + +namespace FastyBird\Core\Tools\DI; + +use FastyBird\Core\Application\Boot as ApplicationBoot; +use FastyBird\Core\Tools\Helpers; +use FastyBird\Core\Tools\Schemas; +use FastyBird\Core\Tools\Utilities; +use Monolog; +use Nette; +use Nette\Bootstrap; +use Nette\DI; +use Nette\Schema; +use Sentry; +use stdClass; +use function assert; +use function class_exists; +use function getenv; +use function interface_exists; +use function is_string; + +/** + * API key plugin + * + * @package FastyBird:Tools! + * @subpackage DI + * + * @author Adam Kadlec + */ +class ToolsExtension extends DI\CompilerExtension +{ + + public const NAME = 'fbTools'; + + public static function register( + ApplicationBoot\Configurator $config, + string $extensionName = self::NAME, + ): void + { + $config->onCompile[] = static function ( + Bootstrap\Configurator $config, + DI\Compiler $compiler, + ) use ($extensionName): void { + $compiler->addExtension($extensionName, new self()); + }; + } + + public function getConfigSchema(): Schema\Schema + { + return Schema\Expect::structure([ + 'sentry' => Schema\Expect::structure( + [ + 'dsn' => Schema\Expect::string()->nullable(), + 'level' => Schema\Expect::int(Monolog\Level::Warning), + ], + ), + ]); + } + + public function loadConfiguration(): void + { + $builder = $this->getContainerBuilder(); + $configuration = $this->getConfig(); + assert($configuration instanceof stdClass); + + /** + * HELPERS + */ + + if (class_exists('\Doctrine\DBAL\Connection') && class_exists('\Doctrine\ORM\EntityManager')) { + $builder->addDefinition($this->prefix('helpers.database'), new DI\Definitions\ServiceDefinition()) + ->setType(Helpers\Database::class); + } + + /** + * UTILITIES + */ + + $builder->addDefinition($this->prefix('utilities.doctrineDateProvider'), new DI\Definitions\ServiceDefinition()) + ->setType(Utilities\DateTimeProvider::class); + + /** + * JSON SCHEMAS TOOLS + */ + + $builder->addDefinition($this->prefix('schemas.validator'), new DI\Definitions\ServiceDefinition()) + ->setType(Schemas\Validator::class); + + /** + * SENTRY ISSUES LOGGER + */ + + if (interface_exists('\Sentry\ClientInterface')) { + $builder->addDefinition($this->prefix('helpers.sentry'), new DI\Definitions\ServiceDefinition()) + ->setType(Helpers\Sentry::class); + } + + if ( + isset($_ENV['FB_APP_PARAMETER__SENTRY_DSN']) + && is_string($_ENV['FB_APP_PARAMETER__SENTRY_DSN']) + && $_ENV['FB_APP_PARAMETER__SENTRY_DSN'] !== '' + ) { + $sentryDSN = $_ENV['FB_APP_PARAMETER__SENTRY_DSN']; + + } elseif ( + getenv('FB_APP_PARAMETER__SENTRY_DSN') !== false + && getenv('FB_APP_PARAMETER__SENTRY_DSN') !== '' + ) { + $sentryDSN = getenv('FB_APP_PARAMETER__SENTRY_DSN'); + + } elseif ($configuration->sentry->dsn !== null) { + $sentryDSN = $configuration->sentry->dsn; + + } else { + $sentryDSN = null; + } + + if (is_string($sentryDSN) && $sentryDSN !== '') { + $builder->addDefinition($this->prefix('sentry.handler'), new DI\Definitions\ServiceDefinition()) + ->setType(Sentry\Monolog\Handler::class) + ->setArgument('level', $configuration->logging->sentry->level); + + $sentryClientBuilderService = $builder->addDefinition( + $this->prefix('sentry.clientBuilder'), + new DI\Definitions\ServiceDefinition(), + ) + ->setFactory('Sentry\ClientBuilder::create') + ->setArguments([['dsn' => $sentryDSN]]); + + $builder->addDefinition($this->prefix('sentry.client'), new DI\Definitions\ServiceDefinition()) + ->setType(Sentry\ClientInterface::class) + ->setFactory([$sentryClientBuilderService, 'getClient']); + + $builder->addDefinition($this->prefix('sentry.hub'), new DI\Definitions\ServiceDefinition()) + ->setType(Sentry\State\Hub::class); + } + } + + /** + * @throws Nette\DI\MissingServiceException + */ + public function beforeCompile(): void + { + parent::beforeCompile(); + + $builder = $this->getContainerBuilder(); + + /** + * SENTRY + */ + + $sentryHandlerServiceName = $builder->getByType(Sentry\Monolog\Handler::class); + + if ($sentryHandlerServiceName !== null) { + $monologLoggerServiceName = $builder->getByType(Monolog\Logger::class); + assert(is_string($monologLoggerServiceName)); + + $monologLoggerService = $builder->getDefinition($monologLoggerServiceName); + assert($monologLoggerService instanceof DI\Definitions\ServiceDefinition); + + $sentryHandlerService = $builder->getDefinition($this->prefix('sentry.handler')); + assert($sentryHandlerService instanceof DI\Definitions\ServiceDefinition); + + $monologLoggerService->addSetup('?->pushHandler(?)', ['@self', $sentryHandlerService]); + } + } + +} diff --git a/src/FastyBird/Library/Application/src/Events/DbTransactionFinished.php b/src/FastyBird/Core/Tools/src/Events/DbTransactionFinished.php similarity index 78% rename from src/FastyBird/Library/Application/src/Events/DbTransactionFinished.php rename to src/FastyBird/Core/Tools/src/Events/DbTransactionFinished.php index be1dd8880..e9bcab0cf 100644 --- a/src/FastyBird/Library/Application/src/Events/DbTransactionFinished.php +++ b/src/FastyBird/Core/Tools/src/Events/DbTransactionFinished.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Events * @since 1.0.0 * * @date 11.09.24 */ -namespace FastyBird\Library\Application\Events; +namespace FastyBird\Core\Tools\Events; use Symfony\Contracts\EventDispatcher; /** * Database transaction finished event * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Events * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Events/DbTransactionStarted.php b/src/FastyBird/Core/Tools/src/Events/DbTransactionStarted.php similarity index 78% rename from src/FastyBird/Library/Application/src/Events/DbTransactionStarted.php rename to src/FastyBird/Core/Tools/src/Events/DbTransactionStarted.php index fb8c172cd..dbb3088e4 100644 --- a/src/FastyBird/Library/Application/src/Events/DbTransactionStarted.php +++ b/src/FastyBird/Core/Tools/src/Events/DbTransactionStarted.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Events * @since 1.0.0 * * @date 11.09.24 */ -namespace FastyBird\Library\Application\Events; +namespace FastyBird\Core\Tools\Events; use Symfony\Contracts\EventDispatcher; /** * Database transaction started event * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Events * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Exceptions/Exception.php b/src/FastyBird/Core/Tools/src/Exceptions/Exception.php similarity index 79% rename from src/FastyBird/Library/Tools/src/Exceptions/Exception.php rename to src/FastyBird/Core/Tools/src/Exceptions/Exception.php index bac37c3da..a151dabd3 100644 --- a/src/FastyBird/Library/Tools/src/Exceptions/Exception.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/Exception.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 18.01.24 */ -namespace FastyBird\Library\Tools\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; use Throwable; diff --git a/src/FastyBird/Library/Tools/src/Exceptions/InvalidArgument.php b/src/FastyBird/Core/Tools/src/Exceptions/InvalidArgument.php similarity index 83% rename from src/FastyBird/Library/Tools/src/Exceptions/InvalidArgument.php rename to src/FastyBird/Core/Tools/src/Exceptions/InvalidArgument.php index 2001bd822..6a8393d9a 100644 --- a/src/FastyBird/Library/Tools/src/Exceptions/InvalidArgument.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/InvalidArgument.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 18.01.24 */ -namespace FastyBird\Library\Tools\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; use InvalidArgumentException as PHPInvalidArgumentException; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidData.php b/src/FastyBird/Core/Tools/src/Exceptions/InvalidData.php similarity index 89% rename from src/FastyBird/Library/Metadata/src/Exceptions/InvalidData.php rename to src/FastyBird/Core/Tools/src/Exceptions/InvalidData.php index c51e358be..f2ee496d8 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidData.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/InvalidData.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 24.06.20 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; use RuntimeException; use Throwable; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidState.php b/src/FastyBird/Core/Tools/src/Exceptions/InvalidState.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Exceptions/InvalidState.php rename to src/FastyBird/Core/Tools/src/Exceptions/InvalidState.php index 2a0618763..60bd7e0fd 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidState.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/InvalidState.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 01.06.22 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; use RuntimeException; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidValue.php b/src/FastyBird/Core/Tools/src/Exceptions/InvalidValue.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Exceptions/InvalidValue.php rename to src/FastyBird/Core/Tools/src/Exceptions/InvalidValue.php index 6efdf63c2..3de259c2b 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidValue.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/InvalidValue.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 15.01.24 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; use RuntimeException; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/Logic.php b/src/FastyBird/Core/Tools/src/Exceptions/Logic.php similarity index 80% rename from src/FastyBird/Library/Metadata/src/Exceptions/Logic.php rename to src/FastyBird/Core/Tools/src/Exceptions/Logic.php index c0e48c652..346c54714 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/Logic.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/Logic.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 24.06.20 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; use LogicException as PHPLogicException; diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/Exception.php b/src/FastyBird/Core/Tools/src/Exceptions/MalformedInput.php similarity index 59% rename from src/FastyBird/Library/Metadata/src/Exceptions/Exception.php rename to src/FastyBird/Core/Tools/src/Exceptions/MalformedInput.php index 2c7598e88..23cc12c44 100644 --- a/src/FastyBird/Library/Metadata/src/Exceptions/Exception.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/MalformedInput.php @@ -1,23 +1,23 @@ - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * * @date 24.06.20 */ -namespace FastyBird\Library\Metadata\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; -use Throwable; +use RuntimeException; -interface Exception extends Throwable +class MalformedInput extends RuntimeException implements Exception { } diff --git a/src/FastyBird/Library/Application/src/Exceptions/Exception.php b/src/FastyBird/Core/Tools/src/Exceptions/Runtime.php similarity index 52% rename from src/FastyBird/Library/Application/src/Exceptions/Exception.php rename to src/FastyBird/Core/Tools/src/Exceptions/Runtime.php index 87c6a2013..2330acbb0 100644 --- a/src/FastyBird/Library/Application/src/Exceptions/Exception.php +++ b/src/FastyBird/Core/Tools/src/Exceptions/Runtime.php @@ -1,23 +1,23 @@ - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Exceptions * @since 1.0.0 * - * @date 08.03.20 + * @date 20.01.24 */ -namespace FastyBird\Library\Application\Exceptions; +namespace FastyBird\Core\Tools\Exceptions; -use Throwable; +use RuntimeException as PHPRuntimeException; -interface Exception extends Throwable +class Runtime extends PHPRuntimeException implements Exception { } diff --git a/src/FastyBird/Library/Metadata/src/Formats/CombinedEnum.php b/src/FastyBird/Core/Tools/src/Formats/CombinedEnum.php similarity index 94% rename from src/FastyBird/Library/Metadata/src/Formats/CombinedEnum.php rename to src/FastyBird/Core/Tools/src/Formats/CombinedEnum.php index 26e6879d8..5a690269c 100644 --- a/src/FastyBird/Library/Metadata/src/Formats/CombinedEnum.php +++ b/src/FastyBird/Core/Tools/src/Formats/CombinedEnum.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Formats * @since 1.0.0 * * @date 05.08.22 */ -namespace FastyBird\Library\Metadata\Formats; +namespace FastyBird\Core\Tools\Formats; use ArrayIterator; -use FastyBird\Library\Metadata\Exceptions; -use FastyBird\Library\Metadata\Utilities; +use FastyBird\Core\Tools\Exceptions; +use FastyBird\Core\Tools\Utilities; use IteratorAggregate; use Nette; use Traversable; @@ -35,7 +35,7 @@ * * @implements IteratorAggregate> * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Formats * * @author Adam Kadlec @@ -101,8 +101,8 @@ public function getItems(): array /** * @return array|null>> * - * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState + * @throws Exceptions\InvalidArgument * @throws ValueError * @throws TypeError */ @@ -133,8 +133,8 @@ public function getIterator(): Traversable /** * @return array|null>> * - * @throws Exceptions\InvalidArgument * @throws Exceptions\InvalidState + * @throws Exceptions\InvalidArgument * @throws ValueError * @throws TypeError */ diff --git a/src/FastyBird/Library/Metadata/src/Formats/CombinedEnumItem.php b/src/FastyBird/Core/Tools/src/Formats/CombinedEnumItem.php similarity index 56% rename from src/FastyBird/Library/Metadata/src/Formats/CombinedEnumItem.php rename to src/FastyBird/Core/Tools/src/Formats/CombinedEnumItem.php index f8488d22f..e326c2130 100644 --- a/src/FastyBird/Library/Metadata/src/Formats/CombinedEnumItem.php +++ b/src/FastyBird/Core/Tools/src/Formats/CombinedEnumItem.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Formats * @since 1.0.0 * * @date 05.08.22 */ -namespace FastyBird\Library\Metadata\Formats; +namespace FastyBird\Core\Tools\Formats; use BackedEnum; -use FastyBird\Library\Metadata\Exceptions; -use FastyBird\Library\Metadata\Types; +use FastyBird\Core\Tools\Exceptions; +use FastyBird\Library\Metadata\Types as MetadataTypes; use Nette; use Nette\Utils; use TypeError; @@ -36,7 +36,7 @@ /** * Combined enum value format item * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Formats * * @author Adam Kadlec @@ -46,7 +46,7 @@ final class CombinedEnumItem use Nette\SmartObject; - private Types\DataTypeShort|null $dataType; + private MetadataTypes\DataTypeShort|null $dataType; private string|int|float|bool $value; @@ -65,22 +65,32 @@ public function __construct(string|array $item) if (str_contains($item, '|')) { $parts = explode('|', $item) + [null, null]; - if ($parts[0] === null || Types\DataTypeShort::tryFrom(Utils\Strings::lower($parts[0])) === null) { + if ( + $parts[0] === null + || MetadataTypes\DataTypeShort::tryFrom( + Utils\Strings::lower($parts[0]), + ) === null + ) { throw new Exceptions\InvalidArgument('Provided format is not valid for combined enum format'); } - $dataType = Types\DataTypeShort::from(Utils\Strings::lower($parts[0])); + $dataType = MetadataTypes\DataTypeShort::from(Utils\Strings::lower($parts[0])); $this->value = trim(strval($parts[1])); } else { $this->value = trim($item); } } elseif (count($item) === 2) { if ($item[0] !== null) { - if (!is_string($item[0]) || Types\DataTypeShort::tryFrom(Utils\Strings::lower($item[0])) === null) { + if ( + !is_string($item[0]) + || MetadataTypes\DataTypeShort::tryFrom( + Utils\Strings::lower($item[0]), + ) === null + ) { throw new Exceptions\InvalidArgument('Provided format is not valid for combined enum format'); } - $dataType = Types\DataTypeShort::from(Utils\Strings::lower($item[0])); + $dataType = MetadataTypes\DataTypeShort::from(Utils\Strings::lower($item[0])); } if ($item[1] === null) { @@ -108,42 +118,42 @@ public function __construct(string|array $item) * @throws TypeError * @throws ValueError */ - public function getValue(): float|bool|int|string|Types\Payloads\Payload + public function getValue(): float|bool|int|string|MetadataTypes\Payloads\Payload { if ($this->dataType === null) { return $this->value; } if ( - $this->dataType === Types\DataTypeShort::CHAR - || $this->dataType === Types\DataTypeShort::UCHAR - || $this->dataType === Types\DataTypeShort::SHORT - || $this->dataType === Types\DataTypeShort::USHORT - || $this->dataType === Types\DataTypeShort::INT - || $this->dataType === Types\DataTypeShort::UINT + $this->dataType === MetadataTypes\DataTypeShort::CHAR + || $this->dataType === MetadataTypes\DataTypeShort::UCHAR + || $this->dataType === MetadataTypes\DataTypeShort::SHORT + || $this->dataType === MetadataTypes\DataTypeShort::USHORT + || $this->dataType === MetadataTypes\DataTypeShort::INT + || $this->dataType === MetadataTypes\DataTypeShort::UINT ) { return intval($this->value); - } elseif ($this->dataType === Types\DataTypeShort::FLOAT) { + } elseif ($this->dataType === MetadataTypes\DataTypeShort::FLOAT) { return floatval($this->value); - } elseif ($this->dataType === Types\DataTypeShort::STRING) { + } elseif ($this->dataType === MetadataTypes\DataTypeShort::STRING) { return strval($this->value); - } elseif ($this->dataType === Types\DataTypeShort::BOOLEAN) { + } elseif ($this->dataType === MetadataTypes\DataTypeShort::BOOLEAN) { return in_array(Utils\Strings::lower(strval($this->value)), ['true', 't', 'yes', 'y', '1', 'on'], true); - } elseif ($this->dataType === Types\DataTypeShort::BUTTON) { - if (Types\Payloads\Button::tryFrom(Utils\Strings::lower(strval($this->value))) !== null) { - return Types\Payloads\Button::from(Utils\Strings::lower(strval($this->value))); + } elseif ($this->dataType === MetadataTypes\DataTypeShort::BUTTON) { + if (MetadataTypes\Payloads\Button::tryFrom(Utils\Strings::lower(strval($this->value))) !== null) { + return MetadataTypes\Payloads\Button::from(Utils\Strings::lower(strval($this->value))); } throw new Exceptions\InvalidState('Combined enum value is not valid'); - } elseif ($this->dataType === Types\DataTypeShort::SWITCH) { - if (Types\Payloads\Switcher::tryFrom(Utils\Strings::lower(strval($this->value))) !== null) { - return Types\Payloads\Switcher::from(Utils\Strings::lower(strval($this->value))); + } elseif ($this->dataType === MetadataTypes\DataTypeShort::SWITCH) { + if (MetadataTypes\Payloads\Switcher::tryFrom(Utils\Strings::lower(strval($this->value))) !== null) { + return MetadataTypes\Payloads\Switcher::from(Utils\Strings::lower(strval($this->value))); } throw new Exceptions\InvalidState('Combined enum value is not valid'); - } elseif ($this->dataType === Types\DataTypeShort::COVER) { - if (Types\Payloads\Cover::tryFrom(Utils\Strings::lower(strval($this->value))) !== null) { - return Types\Payloads\Cover::from(Utils\Strings::lower(strval($this->value))); + } elseif ($this->dataType === MetadataTypes\DataTypeShort::COVER) { + if (MetadataTypes\Payloads\Cover::tryFrom(Utils\Strings::lower(strval($this->value))) !== null) { + return MetadataTypes\Payloads\Cover::from(Utils\Strings::lower(strval($this->value))); } throw new Exceptions\InvalidState('Combined enum value is not valid'); @@ -152,7 +162,7 @@ public function getValue(): float|bool|int|string|Types\Payloads\Payload throw new Exceptions\InvalidState('Combined enum value is not valid'); } - public function getDataType(): Types\DataTypeShort|null + public function getDataType(): MetadataTypes\DataTypeShort|null { return $this->dataType; } @@ -182,21 +192,21 @@ public function toArray(): array ]; } - private function validateDataType(Types\DataTypeShort $dataType): bool + private function validateDataType(MetadataTypes\DataTypeShort $dataType): bool { return in_array($dataType, [ - Types\DataTypeShort::CHAR, - Types\DataTypeShort::UCHAR, - Types\DataTypeShort::SHORT, - Types\DataTypeShort::USHORT, - Types\DataTypeShort::INT, - Types\DataTypeShort::UINT, - Types\DataTypeShort::FLOAT, - Types\DataTypeShort::BOOLEAN, - Types\DataTypeShort::STRING, - Types\DataTypeShort::BUTTON, - Types\DataTypeShort::SWITCH, - Types\DataTypeShort::COVER, + MetadataTypes\DataTypeShort::CHAR, + MetadataTypes\DataTypeShort::UCHAR, + MetadataTypes\DataTypeShort::SHORT, + MetadataTypes\DataTypeShort::USHORT, + MetadataTypes\DataTypeShort::INT, + MetadataTypes\DataTypeShort::UINT, + MetadataTypes\DataTypeShort::FLOAT, + MetadataTypes\DataTypeShort::BOOLEAN, + MetadataTypes\DataTypeShort::STRING, + MetadataTypes\DataTypeShort::BUTTON, + MetadataTypes\DataTypeShort::SWITCH, + MetadataTypes\DataTypeShort::COVER, ], true); } diff --git a/src/FastyBird/Library/Metadata/src/Formats/NumberRange.php b/src/FastyBird/Core/Tools/src/Formats/NumberRange.php similarity index 71% rename from src/FastyBird/Library/Metadata/src/Formats/NumberRange.php rename to src/FastyBird/Core/Tools/src/Formats/NumberRange.php index 7e2d1f201..d5b51c5f0 100644 --- a/src/FastyBird/Library/Metadata/src/Formats/NumberRange.php +++ b/src/FastyBird/Core/Tools/src/Formats/NumberRange.php @@ -6,17 +6,17 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Formats * @since 1.0.0 * * @date 05.08.22 */ -namespace FastyBird\Library\Metadata\Formats; +namespace FastyBird\Core\Tools\Formats; -use FastyBird\Library\Metadata\Exceptions; -use FastyBird\Library\Metadata\Types; +use FastyBird\Core\Tools\Exceptions; +use FastyBird\Library\Metadata\Types as MetadataTypes; use Nette; use Nette\Utils; use TypeError; @@ -37,7 +37,7 @@ /** * String enum value format * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Formats * * @author Adam Kadlec @@ -51,9 +51,9 @@ final class NumberRange private int|float|null $max = null; - private Types\DataTypeShort|null $minDataType = null; + private MetadataTypes\DataTypeShort|null $minDataType = null; - private Types\DataTypeShort|null $maxDataType = null; + private MetadataTypes\DataTypeShort|null $maxDataType = null; /** * @param string|array|null> $format @@ -73,13 +73,13 @@ public function __construct(string|array $format) if ( $parts[0] === null - || Types\DataTypeShort::tryFrom(Utils\Strings::lower($parts[0])) === null + || MetadataTypes\DataTypeShort::tryFrom(Utils\Strings::lower($parts[0])) === null ) { throw new Exceptions\InvalidArgument('Provided format is not valid for number range format'); } $this->min = $parts[1] !== null && trim($parts[1]) !== '' ? floatval($parts[1]) : null; - $this->minDataType = Types\DataTypeShort::from(Utils\Strings::lower($parts[0])); + $this->minDataType = MetadataTypes\DataTypeShort::from(Utils\Strings::lower($parts[0])); } elseif (trim($items[0]) !== '') { $this->min = floatval($items[0]); @@ -99,13 +99,13 @@ public function __construct(string|array $format) if ( $parts[0] === null - || Types\DataTypeShort::tryFrom(Utils\Strings::lower($parts[0])) === null + || MetadataTypes\DataTypeShort::tryFrom(Utils\Strings::lower($parts[0])) === null ) { throw new Exceptions\InvalidArgument('Provided format is not valid for number range format'); } $this->max = $parts[1] !== null && trim($parts[1]) !== '' ? floatval($parts[1]) : null; - $this->maxDataType = Types\DataTypeShort::from(Utils\Strings::lower($parts[0])); + $this->maxDataType = MetadataTypes\DataTypeShort::from(Utils\Strings::lower($parts[0])); } elseif (trim($items[1]) !== '') { $this->max = floatval($items[1]); @@ -126,14 +126,14 @@ public function __construct(string|array $format) } if (is_array($format[0]) && count($format[0]) === 2) { - $this->minDataType = Types\DataTypeShort::from(Utils\Strings::lower(strval($format[0][0]))); + $this->minDataType = MetadataTypes\DataTypeShort::from(Utils\Strings::lower(strval($format[0][0]))); $this->min = is_numeric($format[0][1]) ? floatval($format[0][1]) : null; } else { $this->min = is_numeric($format[0]) ? floatval($format[0]) : null; } if (is_array($format[1]) && count($format[1]) === 2) { - $this->maxDataType = Types\DataTypeShort::from(Utils\Strings::lower(strval($format[1][0]))); + $this->maxDataType = MetadataTypes\DataTypeShort::from(Utils\Strings::lower(strval($format[1][0]))); $this->max = is_numeric($format[1][1]) ? floatval($format[1][1]) : null; } else { $this->max = is_numeric($format[1]) ? floatval($format[1]) : null; @@ -150,15 +150,15 @@ public function getMin(): float|int|null { if ($this->getMinDataType() !== null) { if ( - $this->getMinDataType() === Types\DataTypeShort::CHAR - || $this->getMinDataType() === Types\DataTypeShort::UCHAR - || $this->getMinDataType() === Types\DataTypeShort::SHORT - || $this->getMinDataType() === Types\DataTypeShort::USHORT - || $this->getMinDataType() === Types\DataTypeShort::INT - || $this->getMinDataType() === Types\DataTypeShort::UINT + $this->getMinDataType() === MetadataTypes\DataTypeShort::CHAR + || $this->getMinDataType() === MetadataTypes\DataTypeShort::UCHAR + || $this->getMinDataType() === MetadataTypes\DataTypeShort::SHORT + || $this->getMinDataType() === MetadataTypes\DataTypeShort::USHORT + || $this->getMinDataType() === MetadataTypes\DataTypeShort::INT + || $this->getMinDataType() === MetadataTypes\DataTypeShort::UINT ) { return intval($this->min); - } elseif ($this->getMinDataType() === Types\DataTypeShort::FLOAT) { + } elseif ($this->getMinDataType() === MetadataTypes\DataTypeShort::FLOAT) { return floatval($this->min); } @@ -175,15 +175,15 @@ public function getMax(): float|int|null { if ($this->getMaxDataType() !== null) { if ( - $this->getMaxDataType() === Types\DataTypeShort::CHAR - || $this->getMaxDataType() === Types\DataTypeShort::UCHAR - || $this->getMaxDataType() === Types\DataTypeShort::SHORT - || $this->getMaxDataType() === Types\DataTypeShort::USHORT - || $this->getMaxDataType() === Types\DataTypeShort::INT - || $this->getMaxDataType() === Types\DataTypeShort::UINT + $this->getMaxDataType() === MetadataTypes\DataTypeShort::CHAR + || $this->getMaxDataType() === MetadataTypes\DataTypeShort::UCHAR + || $this->getMaxDataType() === MetadataTypes\DataTypeShort::SHORT + || $this->getMaxDataType() === MetadataTypes\DataTypeShort::USHORT + || $this->getMaxDataType() === MetadataTypes\DataTypeShort::INT + || $this->getMaxDataType() === MetadataTypes\DataTypeShort::UINT ) { return intval($this->max); - } elseif ($this->getMaxDataType() === Types\DataTypeShort::FLOAT) { + } elseif ($this->getMaxDataType() === MetadataTypes\DataTypeShort::FLOAT) { return floatval($this->max); } @@ -193,12 +193,12 @@ public function getMax(): float|int|null return $this->max; } - public function getMinDataType(): Types\DataTypeShort|null + public function getMinDataType(): MetadataTypes\DataTypeShort|null { return $this->min !== null ? $this->minDataType : null; } - public function getMaxDataType(): Types\DataTypeShort|null + public function getMaxDataType(): MetadataTypes\DataTypeShort|null { return $this->max !== null ? $this->maxDataType : null; } @@ -241,7 +241,7 @@ private function checkItem(string|int|float|array|null $item): bool is_array($item) && count($item) === 2 && is_string($item[0]) - && Types\DataTypeShort::tryFrom(Utils\Strings::lower($item[0])) !== null + && MetadataTypes\DataTypeShort::tryFrom(Utils\Strings::lower($item[0])) !== null && is_numeric($item[1]) ) || is_numeric($item) diff --git a/src/FastyBird/Library/Metadata/src/Formats/StringEnum.php b/src/FastyBird/Core/Tools/src/Formats/StringEnum.php similarity index 93% rename from src/FastyBird/Library/Metadata/src/Formats/StringEnum.php rename to src/FastyBird/Core/Tools/src/Formats/StringEnum.php index e29abc4e3..d8d780f5d 100644 --- a/src/FastyBird/Library/Metadata/src/Formats/StringEnum.php +++ b/src/FastyBird/Core/Tools/src/Formats/StringEnum.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage ValueObjects * @since 1.0.0 * * @date 05.08.22 */ -namespace FastyBird\Library\Metadata\Formats; +namespace FastyBird\Core\Tools\Formats; use ArrayIterator; use IteratorAggregate; @@ -35,7 +35,7 @@ * * @implements IteratorAggregate * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage ValueObjects * @author Adam Kadlec */ diff --git a/src/FastyBird/Library/Application/src/Helpers/Database.php b/src/FastyBird/Core/Tools/src/Helpers/Database.php similarity index 96% rename from src/FastyBird/Library/Application/src/Helpers/Database.php rename to src/FastyBird/Core/Tools/src/Helpers/Database.php index 06eede760..7f3ab73ff 100644 --- a/src/FastyBird/Library/Application/src/Helpers/Database.php +++ b/src/FastyBird/Core/Tools/src/Helpers/Database.php @@ -6,20 +6,20 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Helpers * @since 1.0.0 * * @date 15.04.20 */ -namespace FastyBird\Library\Application\Helpers; +namespace FastyBird\Core\Tools\Helpers; use Doctrine\DBAL; use Doctrine\ORM; use Doctrine\Persistence; -use FastyBird\Library\Application\Events; -use FastyBird\Library\Application\Exceptions; +use FastyBird\Core\Tools\Events; +use FastyBird\Core\Tools\Exceptions; use FastyBird\Library\Metadata\Types as MetadataTypes; use Nette; use Psr\EventDispatcher; @@ -31,7 +31,7 @@ /** * Database connection helpers * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Helpers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Helpers/Logger.php b/src/FastyBird/Core/Tools/src/Helpers/Logger.php similarity index 94% rename from src/FastyBird/Library/Application/src/Helpers/Logger.php rename to src/FastyBird/Core/Tools/src/Helpers/Logger.php index 4e5f59b7a..22ae32cbe 100644 --- a/src/FastyBird/Library/Application/src/Helpers/Logger.php +++ b/src/FastyBird/Core/Tools/src/Helpers/Logger.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Helpers * @since 1.0.0 * * @date 08.04.23 */ -namespace FastyBird\Library\Application\Helpers; +namespace FastyBird\Core\Tools\Helpers; use DirectoryIterator; use Nette; @@ -34,7 +34,7 @@ /** * Logger helpers * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Helpers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Application/src/Helpers/Sentry.php b/src/FastyBird/Core/Tools/src/Helpers/Sentry.php similarity index 81% rename from src/FastyBird/Library/Application/src/Helpers/Sentry.php rename to src/FastyBird/Core/Tools/src/Helpers/Sentry.php index 81c635135..d33e1f6e1 100644 --- a/src/FastyBird/Library/Application/src/Helpers/Sentry.php +++ b/src/FastyBird/Core/Tools/src/Helpers/Sentry.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Helpers * @since 1.0.0 * * @date 07.04.23 */ -namespace FastyBird\Library\Application\Helpers; +namespace FastyBird\Core\Tools\Helpers; use Nette; use Sentry\ClientInterface; @@ -21,7 +21,7 @@ /** * Sentry connection helpers * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Helpers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Schemas/Validator.php b/src/FastyBird/Core/Tools/src/Schemas/Validator.php similarity index 93% rename from src/FastyBird/Library/Metadata/src/Schemas/Validator.php rename to src/FastyBird/Core/Tools/src/Schemas/Validator.php index f47c289d9..1504433f2 100644 --- a/src/FastyBird/Library/Metadata/src/Schemas/Validator.php +++ b/src/FastyBird/Core/Tools/src/Schemas/Validator.php @@ -6,16 +6,16 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Schemas * @since 1.0.0 * * @date 24.06.20 */ -namespace FastyBird\Library\Metadata\Schemas; +namespace FastyBird\Core\Tools\Schemas; -use FastyBird\Library\Metadata\Exceptions; +use FastyBird\Core\Tools\Exceptions; use Nette; use Nette\Utils; use Opis\JsonSchema; @@ -27,7 +27,7 @@ /** * JSON schema validator * - * @package FastyBird:MetadataLibrary! + * @package FastyBird:Tools! * @subpackage Schemas * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Transformers/DataTypeTransformer.php b/src/FastyBird/Core/Tools/src/Transformers/DataTypeTransformer.php similarity index 93% rename from src/FastyBird/Library/Tools/src/Transformers/DataTypeTransformer.php rename to src/FastyBird/Core/Tools/src/Transformers/DataTypeTransformer.php index 7f734e28c..db8fc7fb9 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/DataTypeTransformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/DataTypeTransformer.php @@ -6,26 +6,26 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 17.01.24 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; use Contributte\Monolog; use DateTimeInterface; +use FastyBird\Core\Tools\Utilities as ToolsUtilities; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Metadata\Utilities as MetadataUtilities; use function boolval; use function in_array; /** * Compatible data type value transformer * - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * * @author Adam Kadlec @@ -129,7 +129,7 @@ public function convert(): bool|float|int|string|DateTimeInterface|MetadataTypes 'type' => 'data-type-transformer', 'source_data_type' => $this->source, 'destination_data_type' => $this->destination, - 'value' => MetadataUtilities\Value::flattenValue($this->value), + 'value' => ToolsUtilities\Value::flattenValue($this->value), ], ); diff --git a/src/FastyBird/Library/Tools/src/Transformers/EquationTransformer.php b/src/FastyBird/Core/Tools/src/Transformers/EquationTransformer.php similarity index 94% rename from src/FastyBird/Library/Tools/src/Transformers/EquationTransformer.php rename to src/FastyBird/Core/Tools/src/Transformers/EquationTransformer.php index 45b9a624d..df06c1647 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/EquationTransformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/EquationTransformer.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 26.04.23 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; +use FastyBird\Core\Tools\Exceptions; use FastyBird\Library\Metadata; use FastyBird\Library\Metadata\Types as MetadataTypes; -use FastyBird\Library\Tools\Exceptions; use MathSolver\Math; use function array_key_exists; use function floatval; @@ -30,7 +30,7 @@ /** * Equation value transformer * - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Transformers/HsbTransformer.php b/src/FastyBird/Core/Tools/src/Transformers/HsbTransformer.php similarity index 96% rename from src/FastyBird/Library/Tools/src/Transformers/HsbTransformer.php rename to src/FastyBird/Core/Tools/src/Transformers/HsbTransformer.php index 27fdbbe2e..fb644c3da 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/HsbTransformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/HsbTransformer.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 12.04.23 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; use function abs; use function floor; @@ -25,7 +25,7 @@ /** * HSB value object * - * @package FastyBird:Transformers! + * @package FastyBird:Tools! * @subpackage ValueObjects * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Transformers/HsiTransformer.php b/src/FastyBird/Core/Tools/src/Transformers/HsiTransformer.php similarity index 96% rename from src/FastyBird/Library/Tools/src/Transformers/HsiTransformer.php rename to src/FastyBird/Core/Tools/src/Transformers/HsiTransformer.php index 56649ae55..0256a5e56 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/HsiTransformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/HsiTransformer.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 12.04.23 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; use function cos; use function floatval; @@ -23,7 +23,7 @@ /** * HSI value object * - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Transformers/MiredTransformer.php b/src/FastyBird/Core/Tools/src/Transformers/MiredTransformer.php similarity index 98% rename from src/FastyBird/Library/Tools/src/Transformers/MiredTransformer.php rename to src/FastyBird/Core/Tools/src/Transformers/MiredTransformer.php index d7f189f13..7ff9f1e09 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/MiredTransformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/MiredTransformer.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 31.01.24 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; use function array_key_exists; use function round; @@ -21,7 +21,7 @@ /** * Light temperature in mired transformer * - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Transformers/RgbTransformer.php b/src/FastyBird/Core/Tools/src/Transformers/RgbTransformer.php similarity index 95% rename from src/FastyBird/Library/Tools/src/Transformers/RgbTransformer.php rename to src/FastyBird/Core/Tools/src/Transformers/RgbTransformer.php index ee57d16f8..c06515013 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/RgbTransformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/RgbTransformer.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 12.04.23 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; use function abs; use function floatval; @@ -24,7 +24,7 @@ /** * RGB value object * - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Tools/src/Transformers/Transformer.php b/src/FastyBird/Core/Tools/src/Transformers/Transformer.php similarity index 80% rename from src/FastyBird/Library/Tools/src/Transformers/Transformer.php rename to src/FastyBird/Core/Tools/src/Transformers/Transformer.php index 104d728e6..b2c021580 100644 --- a/src/FastyBird/Library/Tools/src/Transformers/Transformer.php +++ b/src/FastyBird/Core/Tools/src/Transformers/Transformer.php @@ -6,19 +6,19 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * @since 1.0.0 * * @date 03.02.23 */ -namespace FastyBird\Library\Tools\Transformers; +namespace FastyBird\Core\Tools\Transformers; /** * Transformer base value object interface * - * @package FastyBird:ToolsLibrary! + * @package FastyBird:Tools! * @subpackage Transformers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Utilities/DataType.php b/src/FastyBird/Core/Tools/src/Utilities/DataType.php similarity index 58% rename from src/FastyBird/Library/Metadata/src/Utilities/DataType.php rename to src/FastyBird/Core/Tools/src/Utilities/DataType.php index 7540f6c8f..eb3be3965 100644 --- a/src/FastyBird/Library/Metadata/src/Utilities/DataType.php +++ b/src/FastyBird/Core/Tools/src/Utilities/DataType.php @@ -6,18 +6,18 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:Metadata! + * @package FastyBird:Tools! * @subpackage Utilities * @since 1.0.0 * * @date 05.12.20 */ -namespace FastyBird\Library\Metadata\Utilities; +namespace FastyBird\Core\Tools\Utilities; -use FastyBird\Library\Metadata\Exceptions; -use FastyBird\Library\Metadata\Formats; -use FastyBird\Library\Metadata\Types; +use FastyBird\Core\Tools\Exceptions; +use FastyBird\Core\Tools\Formats; +use FastyBird\Library\Metadata\Types as MetadataTypes; use Throwable; use function floatval; use function intval; @@ -26,7 +26,7 @@ /** * Data type helpers * - * @package FastyBird:Metadata! + * @package FastyBird:Tools! * @subpackage Utilities * * @author Adam Kadlec @@ -40,22 +40,22 @@ final class DataType public static function inferNumberDataType( Formats\NumberRange $format, float|int|null $step = null, - Types\DataType|null $fallback = null, - ): Types\DataType + MetadataTypes\DataType|null $fallback = null, + ): MetadataTypes\DataType { if ( $format->getMinDataType() !== null || $format->getMaxDataType() !== null ) { return match ($format->getMinDataType() ?? $format->getMaxDataType()) { - Types\DataTypeShort::CHAR => Types\DataType::CHAR, - Types\DataTypeShort::UCHAR => Types\DataType::UCHAR, - Types\DataTypeShort::SHORT => Types\DataType::SHORT, - Types\DataTypeShort::USHORT => Types\DataType::USHORT, - Types\DataTypeShort::INT => Types\DataType::INT, - Types\DataTypeShort::UINT => Types\DataType::UINT, - Types\DataTypeShort::FLOAT => Types\DataType::FLOAT, - default => Types\DataType::UNKNOWN, + MetadataTypes\DataTypeShort::CHAR => MetadataTypes\DataType::CHAR, + MetadataTypes\DataTypeShort::UCHAR => MetadataTypes\DataType::UCHAR, + MetadataTypes\DataTypeShort::SHORT => MetadataTypes\DataType::SHORT, + MetadataTypes\DataTypeShort::USHORT => MetadataTypes\DataType::USHORT, + MetadataTypes\DataTypeShort::INT => MetadataTypes\DataType::INT, + MetadataTypes\DataTypeShort::UINT => MetadataTypes\DataType::UINT, + MetadataTypes\DataTypeShort::FLOAT => MetadataTypes\DataType::FLOAT, + default => MetadataTypes\DataType::UNKNOWN, }; } @@ -64,7 +64,7 @@ public static function inferNumberDataType( // If step is defined and is float number, data type have to be float && floatval(intval($step)) !== $step ) { - return Types\DataType::FLOAT; + return MetadataTypes\DataType::FLOAT; } if ( @@ -78,17 +78,17 @@ public static function inferNumberDataType( && floatval(intval($format->getMax())) !== $format->getMax() ) ) { - return Types\DataType::FLOAT; + return MetadataTypes\DataType::FLOAT; } if ($format->getMin() !== null || $format->getMax() !== null) { $dataTypeRanges = [ - Types\DataType::CHAR->value => [-128, 127], - Types\DataType::UCHAR->value => [0, 255], - Types\DataType::SHORT->value => [-32_768, 32_767], - Types\DataType::USHORT->value => [0, 65_535], - Types\DataType::INT->value => [-2_147_483_648, 2_147_483_647], - Types\DataType::UINT->value => [0, 4_294_967_295], + MetadataTypes\DataType::CHAR->value => [-128, 127], + MetadataTypes\DataType::UCHAR->value => [0, 255], + MetadataTypes\DataType::SHORT->value => [-32_768, 32_767], + MetadataTypes\DataType::USHORT->value => [0, 65_535], + MetadataTypes\DataType::INT->value => [-2_147_483_648, 2_147_483_647], + MetadataTypes\DataType::UINT->value => [0, 4_294_967_295], ]; foreach ($dataTypeRanges as $dataType => $ranges) { @@ -108,17 +108,17 @@ public static function inferNumberDataType( ) ) { try { - return Types\DataType::from($dataType); + return MetadataTypes\DataType::from($dataType); } catch (Throwable) { throw new Exceptions\InvalidState(sprintf('Data type: %s could not be initialized', $dataType)); } } } - return Types\DataType::FLOAT; + return MetadataTypes\DataType::FLOAT; } - return $fallback ?? Types\DataType::UNKNOWN; + return $fallback ?? MetadataTypes\DataType::UNKNOWN; } } diff --git a/src/FastyBird/Library/Application/src/Utilities/DateTimeProvider.php b/src/FastyBird/Core/Tools/src/Utilities/DateTimeProvider.php similarity index 86% rename from src/FastyBird/Library/Application/src/Utilities/DateTimeProvider.php rename to src/FastyBird/Core/Tools/src/Utilities/DateTimeProvider.php index 32d87a1a2..b279da2d3 100644 --- a/src/FastyBird/Library/Application/src/Utilities/DateTimeProvider.php +++ b/src/FastyBird/Core/Tools/src/Utilities/DateTimeProvider.php @@ -6,14 +6,14 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Utilities * @since 1.0.0 * * @date 29.08.24 */ -namespace FastyBird\Library\Application\Utilities; +namespace FastyBird\Core\Tools\Utilities; use DateTimeInterface; use FastyBird\DateTimeFactory; @@ -22,7 +22,7 @@ /** * Date provider for doctrine timestampable * - * @package FastyBird:ApplicationLibrary! + * @package FastyBird:Tools! * @subpackage Subscribers * * @author Adam Kadlec diff --git a/src/FastyBird/Library/Metadata/src/Utilities/Value.php b/src/FastyBird/Core/Tools/src/Utilities/Value.php similarity index 63% rename from src/FastyBird/Library/Metadata/src/Utilities/Value.php rename to src/FastyBird/Core/Tools/src/Utilities/Value.php index 3d6d70cb0..2643d469f 100644 --- a/src/FastyBird/Library/Metadata/src/Utilities/Value.php +++ b/src/FastyBird/Core/Tools/src/Utilities/Value.php @@ -6,21 +6,21 @@ * @license More in LICENSE.md * @copyright https://www.fastybird.com * @author Adam Kadlec - * @package FastyBird:Metadata! + * @package FastyBird:Tools! * @subpackage Utilities * @since 1.0.0 * * @date 05.12.20 */ -namespace FastyBird\Library\Metadata\Utilities; +namespace FastyBird\Core\Tools\Utilities; use BackedEnum; use DateTime; use DateTimeInterface; -use FastyBird\Library\Metadata\Exceptions; -use FastyBird\Library\Metadata\Formats; -use FastyBird\Library\Metadata\Types; +use FastyBird\Core\Tools\Exceptions; +use FastyBird\Core\Tools\Formats; +use FastyBird\Library\Metadata\Types as MetadataTypes; use Nette\Utils; use TypeError; use ValueError; @@ -44,8 +44,8 @@ /** * Value helpers * - * @package FastyBird:Metadata! - * @subpackage Utilities + * @package FastyBird:Tools! + * @package FastyBird:Tools! * * @author Adam Kadlec */ @@ -68,22 +68,22 @@ final class Value * @throws ValueError */ public static function normalizeValue( - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $value, - Types\DataType $dataType, + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $value, + MetadataTypes\DataType $dataType, Formats\StringEnum|Formats\NumberRange|Formats\CombinedEnum|null $format, - ): bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null + ): bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null { if ($value === null) { return null; } if ( - $dataType === Types\DataType::CHAR - || $dataType === Types\DataType::UCHAR - || $dataType === Types\DataType::SHORT - || $dataType === Types\DataType::USHORT - || $dataType === Types\DataType::INT - || $dataType === Types\DataType::UINT + $dataType === MetadataTypes\DataType::CHAR + || $dataType === MetadataTypes\DataType::UCHAR + || $dataType === MetadataTypes\DataType::SHORT + || $dataType === MetadataTypes\DataType::USHORT + || $dataType === MetadataTypes\DataType::INT + || $dataType === MetadataTypes\DataType::UINT ) { $value = intval(self::flattenValue($value)); @@ -108,7 +108,7 @@ public static function normalizeValue( } return $value; - } elseif ($dataType === Types\DataType::FLOAT) { + } elseif ($dataType === MetadataTypes\DataType::FLOAT) { $value = floatval(self::flattenValue($value)); if ( @@ -132,15 +132,15 @@ public static function normalizeValue( } return $value; - } elseif ($dataType === Types\DataType::STRING) { + } elseif ($dataType === MetadataTypes\DataType::STRING) { return self::toString($value); - } elseif ($dataType === Types\DataType::BOOLEAN) { + } elseif ($dataType === MetadataTypes\DataType::BOOLEAN) { return in_array( Utils\Strings::lower(self::toString($value, true)), self::BOOL_TRUE_VALUES, true, ); - } elseif ($dataType === Types\DataType::DATE) { + } elseif ($dataType === MetadataTypes\DataType::DATE) { if ($value instanceof DateTime) { return $value; } @@ -148,7 +148,7 @@ public static function normalizeValue( $value = Utils\DateTime::createFromFormat(self::DATE_FORMAT, self::toString($value, true)); return $value === false ? null : $value; - } elseif ($dataType === Types\DataType::TIME) { + } elseif ($dataType === MetadataTypes\DataType::TIME) { if ($value instanceof DateTime) { return $value; } @@ -156,7 +156,7 @@ public static function normalizeValue( $value = Utils\DateTime::createFromFormat(self::TIME_FORMAT, self::toString($value, true)); return $value === false ? null : $value; - } elseif ($dataType === Types\DataType::DATETIME) { + } elseif ($dataType === MetadataTypes\DataType::DATETIME) { if ($value instanceof DateTime) { return $value; } @@ -172,20 +172,20 @@ public static function normalizeValue( return $formatted === false ? null : $formatted; } elseif ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER - || $dataType === Types\DataType::ENUM + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER + || $dataType === MetadataTypes\DataType::ENUM ) { - /** @var class-string|null $payloadClass */ + /** @var class-string|null $payloadClass */ $payloadClass = null; - if ($dataType === Types\DataType::BUTTON) { - $payloadClass = Types\Payloads\Button::class; - } elseif ($dataType === Types\DataType::SWITCH) { - $payloadClass = Types\Payloads\Switcher::class; - } elseif ($dataType === Types\DataType::COVER) { - $payloadClass = Types\Payloads\Cover::class; + if ($dataType === MetadataTypes\DataType::BUTTON) { + $payloadClass = MetadataTypes\Payloads\Button::class; + } elseif ($dataType === MetadataTypes\DataType::SWITCH) { + $payloadClass = MetadataTypes\Payloads\Switcher::class; + } elseif ($dataType === MetadataTypes\DataType::COVER) { + $payloadClass = MetadataTypes\Payloads\Cover::class; } if ($format instanceof Formats\StringEnum) { @@ -197,9 +197,9 @@ public static function normalizeValue( if (count($filtered) === 1) { return $payloadClass !== null && ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER ) ? $payloadClass::from(self::toString($value, true)) : self::toString($value, true); } @@ -233,9 +233,9 @@ static function (array $item) use ($value): bool { if ( $payloadClass !== null && ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER ) ) { return $payloadClass::from(self::toString($filtered[0][0]->getValue(), true)); @@ -266,9 +266,9 @@ static function (array $item) use ($value): bool { if ( $payloadClass !== null && ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER ) ) { if ($payloadClass::tryFrom(self::toString($value, true)) !== null) { @@ -282,7 +282,7 @@ static function (array $item) use ($value): bool { implode( ', ', array_map( - static fn (Types\Payloads\Payload $enum): string => strval($enum->value), + static fn (MetadataTypes\Payloads\Payload $enum): string => strval($enum->value), $payloadClass::cases(), ), ), @@ -305,52 +305,52 @@ static function (array $item) use ($value): bool { */ public static function transformValueFromDevice( bool|int|float|string|null $value, - Types\DataType $dataType, + MetadataTypes\DataType $dataType, Formats\StringEnum|Formats\NumberRange|Formats\CombinedEnum|null $format, - ): bool|int|float|string|Types\Payloads\Payload|null + ): bool|int|float|string|MetadataTypes\Payloads\Payload|null { if ($value === null) { return null; } - if ($dataType === Types\DataType::BOOLEAN) { + if ($dataType === MetadataTypes\DataType::BOOLEAN) { return in_array(Utils\Strings::lower(strval($value)), self::BOOL_TRUE_VALUES, true); } - if ($dataType === Types\DataType::FLOAT) { + if ($dataType === MetadataTypes\DataType::FLOAT) { return floatval($value); } if ( - $dataType === Types\DataType::UCHAR - || $dataType === Types\DataType::CHAR - || $dataType === Types\DataType::USHORT - || $dataType === Types\DataType::SHORT - || $dataType === Types\DataType::UINT - || $dataType === Types\DataType::INT + $dataType === MetadataTypes\DataType::UCHAR + || $dataType === MetadataTypes\DataType::CHAR + || $dataType === MetadataTypes\DataType::USHORT + || $dataType === MetadataTypes\DataType::SHORT + || $dataType === MetadataTypes\DataType::UINT + || $dataType === MetadataTypes\DataType::INT ) { return intval($value); } - if ($dataType === Types\DataType::STRING) { + if ($dataType === MetadataTypes\DataType::STRING) { return strval($value); } if ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER - || $dataType === Types\DataType::ENUM + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER + || $dataType === MetadataTypes\DataType::ENUM ) { - /** @var class-string|null $payloadClass */ + /** @var class-string|null $payloadClass */ $payloadClass = null; - if ($dataType === Types\DataType::BUTTON) { - $payloadClass = Types\Payloads\Button::class; - } elseif ($dataType === Types\DataType::SWITCH) { - $payloadClass = Types\Payloads\Switcher::class; - } elseif ($dataType === Types\DataType::COVER) { - $payloadClass = Types\Payloads\Cover::class; + if ($dataType === MetadataTypes\DataType::BUTTON) { + $payloadClass = MetadataTypes\Payloads\Button::class; + } elseif ($dataType === MetadataTypes\DataType::SWITCH) { + $payloadClass = MetadataTypes\Payloads\Switcher::class; + } elseif ($dataType === MetadataTypes\DataType::COVER) { + $payloadClass = MetadataTypes\Payloads\Cover::class; } if ($format instanceof Formats\StringEnum) { @@ -363,9 +363,9 @@ public static function transformValueFromDevice( if ( $payloadClass !== null && ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER ) ) { return $payloadClass::from(self::toString($value, true)); @@ -397,9 +397,9 @@ static function (array $item) use ($value): bool { if ( $payloadClass !== null && ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER ) ) { return $payloadClass::from(self::toString($filtered[0][0]->getValue(), true)); @@ -426,8 +426,8 @@ static function (array $item) use ($value): bool { * @throws ValueError */ public static function transformValueToDevice( - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $value, - Types\DataType $dataType, + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $value, + MetadataTypes\DataType $dataType, Formats\StringEnum|Formats\NumberRange|Formats\CombinedEnum|null $format, ): bool|int|float|string|null { @@ -435,7 +435,7 @@ public static function transformValueToDevice( return null; } - if ($dataType === Types\DataType::BOOLEAN) { + if ($dataType === MetadataTypes\DataType::BOOLEAN) { if (is_bool($value)) { return $value; } @@ -443,7 +443,7 @@ public static function transformValueToDevice( return null; } - if ($dataType === Types\DataType::FLOAT) { + if ($dataType === MetadataTypes\DataType::FLOAT) { if (is_numeric($value)) { return floatval($value); } @@ -452,12 +452,12 @@ public static function transformValueToDevice( } if ( - $dataType === Types\DataType::UCHAR - || $dataType === Types\DataType::CHAR - || $dataType === Types\DataType::USHORT - || $dataType === Types\DataType::SHORT - || $dataType === Types\DataType::UINT - || $dataType === Types\DataType::INT + $dataType === MetadataTypes\DataType::UCHAR + || $dataType === MetadataTypes\DataType::CHAR + || $dataType === MetadataTypes\DataType::USHORT + || $dataType === MetadataTypes\DataType::SHORT + || $dataType === MetadataTypes\DataType::UINT + || $dataType === MetadataTypes\DataType::INT ) { if (is_numeric($value)) { return intval($value); @@ -466,7 +466,7 @@ public static function transformValueToDevice( return null; } - if ($dataType === Types\DataType::STRING) { + if ($dataType === MetadataTypes\DataType::STRING) { if (is_string($value)) { return $value; } @@ -474,7 +474,7 @@ public static function transformValueToDevice( return null; } - if ($dataType === Types\DataType::DATE) { + if ($dataType === MetadataTypes\DataType::DATE) { if ($value instanceof DateTime) { return $value->format(self::DATE_FORMAT); } @@ -484,7 +484,7 @@ public static function transformValueToDevice( return $value === false ? null : $value->format(self::DATE_FORMAT); } - if ($dataType === Types\DataType::TIME) { + if ($dataType === MetadataTypes\DataType::TIME) { if ($value instanceof DateTime) { return $value->format(self::TIME_FORMAT); } @@ -494,7 +494,7 @@ public static function transformValueToDevice( return $value === false ? null : $value->format(self::TIME_FORMAT); } - if ($dataType === Types\DataType::DATETIME) { + if ($dataType === MetadataTypes\DataType::DATETIME) { if ($value instanceof DateTime) { return $value->format(DateTimeInterface::ATOM); } @@ -512,20 +512,20 @@ public static function transformValueToDevice( } if ( - $dataType === Types\DataType::BUTTON - || $dataType === Types\DataType::SWITCH - || $dataType === Types\DataType::COVER - || $dataType === Types\DataType::ENUM + $dataType === MetadataTypes\DataType::BUTTON + || $dataType === MetadataTypes\DataType::SWITCH + || $dataType === MetadataTypes\DataType::COVER + || $dataType === MetadataTypes\DataType::ENUM ) { - /** @var class-string|null $payloadClass */ + /** @var class-string|null $payloadClass */ $payloadClass = null; - if ($dataType === Types\DataType::BUTTON) { - $payloadClass = Types\Payloads\Button::class; - } elseif ($dataType === Types\DataType::SWITCH) { - $payloadClass = Types\Payloads\Switcher::class; - } elseif ($dataType === Types\DataType::COVER) { - $payloadClass = Types\Payloads\Cover::class; + if ($dataType === MetadataTypes\DataType::BUTTON) { + $payloadClass = MetadataTypes\Payloads\Button::class; + } elseif ($dataType === MetadataTypes\DataType::SWITCH) { + $payloadClass = MetadataTypes\Payloads\Switcher::class; + } elseif ($dataType === MetadataTypes\DataType::COVER) { + $payloadClass = MetadataTypes\Payloads\Cover::class; } if ($format instanceof Formats\StringEnum) { @@ -579,10 +579,10 @@ static function (array $item) use ($value): bool { } public static function transformToScale( - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $value, - Types\DataType $dataType, + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $value, + MetadataTypes\DataType $dataType, int|null $scale = null, - ): bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null + ): bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null { if ($value === null) { return null; @@ -592,13 +592,13 @@ public static function transformToScale( in_array( $dataType, [ - Types\DataType::CHAR, - Types\DataType::UCHAR, - Types\DataType::SHORT, - Types\DataType::USHORT, - Types\DataType::INT, - Types\DataType::UINT, - Types\DataType::FLOAT, + MetadataTypes\DataType::CHAR, + MetadataTypes\DataType::UCHAR, + MetadataTypes\DataType::SHORT, + MetadataTypes\DataType::USHORT, + MetadataTypes\DataType::INT, + MetadataTypes\DataType::UINT, + MetadataTypes\DataType::FLOAT, ], true, ) @@ -616,7 +616,7 @@ public static function transformToScale( $value = round(floatval($value), $scale); - $value = $dataType === Types\DataType::FLOAT + $value = $dataType === MetadataTypes\DataType::FLOAT ? $value : intval($value); } @@ -626,10 +626,10 @@ public static function transformToScale( } public static function transformFromScale( - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $value, - Types\DataType $dataType, + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $value, + MetadataTypes\DataType $dataType, int|null $scale = null, - ): bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null + ): bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null { if ($value === null) { return null; @@ -639,13 +639,13 @@ public static function transformFromScale( in_array( $dataType, [ - Types\DataType::CHAR, - Types\DataType::UCHAR, - Types\DataType::SHORT, - Types\DataType::USHORT, - Types\DataType::INT, - Types\DataType::UINT, - Types\DataType::FLOAT, + MetadataTypes\DataType::CHAR, + MetadataTypes\DataType::UCHAR, + MetadataTypes\DataType::SHORT, + MetadataTypes\DataType::USHORT, + MetadataTypes\DataType::INT, + MetadataTypes\DataType::UINT, + MetadataTypes\DataType::FLOAT, ], true, ) @@ -663,7 +663,7 @@ public static function transformFromScale( $value = round(floatval($value)); - $value = $dataType === Types\DataType::FLOAT + $value = $dataType === MetadataTypes\DataType::FLOAT ? $value : intval($value); } @@ -706,36 +706,32 @@ public static function toString( public static function transformDataType( bool|int|float|string|null $value, - Types\DataType $dataType, + MetadataTypes\DataType $dataType, ): bool|int|float|string|null { if ($value === null) { return null; } - if ($dataType === Types\DataType::BOOLEAN) { + if ($dataType === MetadataTypes\DataType::BOOLEAN) { return in_array(Utils\Strings::lower(strval($value)), self::BOOL_TRUE_VALUES, true); } - if ($dataType === Types\DataType::FLOAT) { + if ($dataType === MetadataTypes\DataType::FLOAT) { return floatval($value); } if ( - $dataType === Types\DataType::UCHAR - || $dataType === Types\DataType::CHAR - || $dataType === Types\DataType::USHORT - || $dataType === Types\DataType::SHORT - || $dataType === Types\DataType::UINT - || $dataType === Types\DataType::INT + $dataType === MetadataTypes\DataType::UCHAR + || $dataType === MetadataTypes\DataType::CHAR + || $dataType === MetadataTypes\DataType::USHORT + || $dataType === MetadataTypes\DataType::SHORT + || $dataType === MetadataTypes\DataType::UINT + || $dataType === MetadataTypes\DataType::INT ) { return intval($value); } - if ($dataType === Types\DataType::STRING) { - return strval($value); - } - return strval($value); } @@ -743,52 +739,52 @@ public static function transformDataType( * @throws Exceptions\InvalidArgument */ private static function normalizeEnumItemValue( - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $value, - Types\DataTypeShort|null $dataType, - ): bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $value, + MetadataTypes\DataTypeShort|null $dataType, + ): bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null { if ($dataType === null) { return $value; } if ( - $dataType === Types\DataTypeShort::CHAR - || $dataType === Types\DataTypeShort::UCHAR - || $dataType === Types\DataTypeShort::SHORT - || $dataType === Types\DataTypeShort::USHORT - || $dataType === Types\DataTypeShort::INT - || $dataType === Types\DataTypeShort::UINT + $dataType === MetadataTypes\DataTypeShort::CHAR + || $dataType === MetadataTypes\DataTypeShort::UCHAR + || $dataType === MetadataTypes\DataTypeShort::SHORT + || $dataType === MetadataTypes\DataTypeShort::USHORT + || $dataType === MetadataTypes\DataTypeShort::INT + || $dataType === MetadataTypes\DataTypeShort::UINT ) { return intval(self::flattenValue($value)); - } elseif ($dataType === Types\DataTypeShort::FLOAT) { + } elseif ($dataType === MetadataTypes\DataTypeShort::FLOAT) { return floatval(self::flattenValue($value)); - } elseif ($dataType === Types\DataTypeShort::STRING) { + } elseif ($dataType === MetadataTypes\DataTypeShort::STRING) { return self::toString($value); - } elseif ($dataType === Types\DataTypeShort::BOOLEAN) { + } elseif ($dataType === MetadataTypes\DataTypeShort::BOOLEAN) { return in_array( Utils\Strings::lower(self::toString($value, true)), self::BOOL_TRUE_VALUES, true, ); - } elseif ($dataType === Types\DataTypeShort::BUTTON) { - if ($value instanceof Types\Payloads\Button) { + } elseif ($dataType === MetadataTypes\DataTypeShort::BUTTON) { + if ($value instanceof MetadataTypes\Payloads\Button) { return $value; } - return Types\Payloads\Button::tryFrom(self::toString($value, true)) ?? false; - } elseif ($dataType === Types\DataTypeShort::SWITCH) { - if ($value instanceof Types\Payloads\Switcher) { + return MetadataTypes\Payloads\Button::tryFrom(self::toString($value, true)) ?? false; + } elseif ($dataType === MetadataTypes\DataTypeShort::SWITCH) { + if ($value instanceof MetadataTypes\Payloads\Switcher) { return $value; } - return Types\Payloads\Switcher::tryFrom(self::toString($value, true)) ?? false; - } elseif ($dataType === Types\DataTypeShort::COVER) { - if ($value instanceof Types\Payloads\Cover) { + return MetadataTypes\Payloads\Switcher::tryFrom(self::toString($value, true)) ?? false; + } elseif ($dataType === MetadataTypes\DataTypeShort::COVER) { + if ($value instanceof MetadataTypes\Payloads\Cover) { return $value; } - return Types\Payloads\Cover::tryFrom(self::toString($value, true)) ?? false; - } elseif ($dataType === Types\DataTypeShort::DATE) { + return MetadataTypes\Payloads\Cover::tryFrom(self::toString($value, true)) ?? false; + } elseif ($dataType === MetadataTypes\DataTypeShort::DATE) { if ($value instanceof DateTime) { return $value; } @@ -796,7 +792,7 @@ private static function normalizeEnumItemValue( $value = Utils\DateTime::createFromFormat(self::DATE_FORMAT, self::toString($value, true)); return $value === false ? null : $value; - } elseif ($dataType === Types\DataTypeShort::TIME) { + } elseif ($dataType === MetadataTypes\DataTypeShort::TIME) { if ($value instanceof DateTime) { return $value; } @@ -804,7 +800,7 @@ private static function normalizeEnumItemValue( $value = Utils\DateTime::createFromFormat(self::TIME_FORMAT, self::toString($value, true)); return $value === false ? null : $value; - } elseif ($dataType === Types\DataTypeShort::DATETIME) { + } elseif ($dataType === MetadataTypes\DataTypeShort::DATETIME) { if ($value instanceof DateTime) { return $value; } @@ -828,8 +824,8 @@ private static function normalizeEnumItemValue( * @throws Exceptions\InvalidArgument */ private static function compareValues( - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $left, - bool|int|float|string|DateTimeInterface|Types\Payloads\Payload|null $right, + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $left, + bool|int|float|string|DateTimeInterface|MetadataTypes\Payloads\Payload|null $right, ): bool { if ($left === $right) { diff --git a/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php new file mode 100644 index 000000000..ad17e3130 --- /dev/null +++ b/src/FastyBird/Core/Tools/tests/cases/unit/BaseTestCase.php @@ -0,0 +1,119 @@ + */ + protected array $neonFiles = []; + + /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws Error + */ + protected function mockContainerService( + string $serviceType, + object $serviceMock, + ): void + { + $container = $this->getContainer(); + $foundServiceNames = $container->findByType($serviceType); + + foreach ($foundServiceNames as $serviceName) { + $this->replaceContainerService($serviceName, $serviceMock); + } + } + + /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws Error + */ + protected function getContainer(): Nette\DI\Container + { + if ($this->container === null) { + $this->container = $this->createContainer(); + } + + return $this->container; + } + + /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws Error + */ + private function createContainer(): Nette\DI\Container + { + $rootDir = __DIR__ . '/../..'; + $vendorDir = defined('FB_VENDOR_DIR') ? constant('FB_VENDOR_DIR') : $rootDir . '/../vendor'; + + $config = ApplicationBoot\Bootstrap::boot(); + $config->setForceReloadContainer(); + $config->setTempDirectory(FB_TEMP_DIR); + + $config->addStaticParameters( + ['container' => ['class' => 'SystemContainer_' . getmypid() . md5((string) time())]], + ); + $config->addStaticParameters(['appDir' => $rootDir, 'wwwDir' => $rootDir, 'vendorDir' => $vendorDir]); + + $config->addConfig(__DIR__ . '/../../common.neon'); + + foreach ($this->neonFiles as $neonFile) { + $config->addConfig($neonFile); + } + + $config->setTimeZone('Europe/Prague'); + + DI\ToolsExtension::register($config); + + $this->container = $config->createContainer(); + + return $this->container; + } + + /** + * @throws ApplicationExceptions\InvalidArgument + * @throws ApplicationExceptions\InvalidState + * @throws Error + */ + private function replaceContainerService(string $serviceName, object $service): void + { + $container = $this->getContainer(); + + $container->removeService($serviceName); + $container->addService($serviceName, $service); + } + + protected function registerNeonConfigurationFile(string $file): void + { + if (!in_array($file, $this->neonFiles, true)) { + $this->neonFiles[] = $file; + } + } + + protected function tearDown(): void + { + $this->container = null; // Fatal error: Cannot redeclare class SystemContainer + + parent::tearDown(); + } + +} diff --git a/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php b/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php new file mode 100644 index 000000000..524879661 --- /dev/null +++ b/src/FastyBird/Core/Tools/tests/cases/unit/DI/ToolsExtensionTest.php @@ -0,0 +1,30 @@ +getContainer(); + + self::assertNotNull($container->getByType(Helpers\Database::class, false)); + + self::assertNotNull($container->getByType(Schemas\Validator::class, false)); + } + +} diff --git a/src/FastyBird/Library/Metadata/tests/cases/unit/Formats/CombinedEnumFormatTest.php b/src/FastyBird/Core/Tools/tests/cases/unit/Formats/CombinedEnumFormatTest.php similarity index 75% rename from src/FastyBird/Library/Metadata/tests/cases/unit/Formats/CombinedEnumFormatTest.php rename to src/FastyBird/Core/Tools/tests/cases/unit/Formats/CombinedEnumFormatTest.php index acebe2315..267babb98 100644 --- a/src/FastyBird/Library/Metadata/tests/cases/unit/Formats/CombinedEnumFormatTest.php +++ b/src/FastyBird/Core/Tools/tests/cases/unit/Formats/CombinedEnumFormatTest.php @@ -1,16 +1,16 @@ toArray()); self::assertCount(3, $items); self::assertTrue($items[1][0] instanceof Formats\CombinedEnumItem); - self::assertTrue($items[1][0]->getDataType() instanceof Types\DataTypeShort); - self::assertSame(Types\DataTypeShort::SWITCH, $items[1][0]->getDataType()); - self::assertTrue($items[1][0]->getValue() instanceof Types\Payloads\Switcher); - self::assertSame(Types\Payloads\Switcher::ON, $items[1][0]->getValue()); + self::assertTrue($items[1][0]->getDataType() instanceof MetadataTypes\DataTypeShort); + self::assertSame(MetadataTypes\DataTypeShort::SWITCH, $items[1][0]->getDataType()); + self::assertTrue($items[1][0]->getValue() instanceof MetadataTypes\Payloads\Switcher); + self::assertSame(MetadataTypes\Payloads\Switcher::ON, $items[1][0]->getValue()); self::assertEquals('one::,sw|switch_on:1000:s|on,sw|switch_off:2000:s|off', strval($valueObject)); $valueObject = new Formats\CombinedEnum('sw|switch_on:1000:s|on,sw|switch_off:2000:s|off'); diff --git a/src/FastyBird/Library/Metadata/tests/cases/unit/Formats/NumberRangeFormatTest.php b/src/FastyBird/Core/Tools/tests/cases/unit/Formats/NumberRangeFormatTest.php similarity index 91% rename from src/FastyBird/Library/Metadata/tests/cases/unit/Formats/NumberRangeFormatTest.php rename to src/FastyBird/Core/Tools/tests/cases/unit/Formats/NumberRangeFormatTest.php index efb85f927..7252163ae 100644 --- a/src/FastyBird/Library/Metadata/tests/cases/unit/Formats/NumberRangeFormatTest.php +++ b/src/FastyBird/Core/Tools/tests/cases/unit/Formats/NumberRangeFormatTest.php @@ -1,15 +1,15 @@ > - * @throws TypeError - * @throws ValueError * * @throws Exceptions\InvalidArgument + * @throws TypeError + * @throws ValueError */ public static function normalizeValue(): array { return [ 'integer_1' => [ - Types\DataType::CHAR, + MetadataTypes\DataType::CHAR, '10', null, null, @@ -62,23 +63,23 @@ public static function normalizeValue(): array false, ], 'integer_2' => [ - Types\DataType::CHAR, + MetadataTypes\DataType::CHAR, '9', - new Formats\NumberRange([10, 20]), + new ToolsFormats\NumberRange([10, 20]), null, null, true, ], 'integer_3' => [ - Types\DataType::CHAR, + MetadataTypes\DataType::CHAR, '30', - new Formats\NumberRange([10, 20]), + new ToolsFormats\NumberRange([10, 20]), null, null, true, ], 'float_1' => [ - Types\DataType::FLOAT, + MetadataTypes\DataType::FLOAT, '30.3', null, null, diff --git a/src/FastyBird/Core/Tools/tests/common.neon b/src/FastyBird/Core/Tools/tests/common.neon new file mode 100644 index 000000000..8cabea6ec --- /dev/null +++ b/src/FastyBird/Core/Tools/tests/common.neon @@ -0,0 +1,18 @@ +# +# Tools DI configuration +# +# @license More in LICENSE.md +# @copyright https://www.fastybird.com +# @author Adam Kadlec +# @package FastyBird:Tools! +# @subpackage config +# @since 1.0.0 +# +# @date 04.06.22 + +php: + date.timezone: Europe/Prague + +fbApplication: + documents: + mapping: [] \ No newline at end of file diff --git a/src/FastyBird/Library/Metadata/tests/fixtures/Schemas/validator.schema.json b/src/FastyBird/Core/Tools/tests/fixtures/Schemas/validator.schema.json similarity index 100% rename from src/FastyBird/Library/Metadata/tests/fixtures/Schemas/validator.schema.json rename to src/FastyBird/Core/Tools/tests/fixtures/Schemas/validator.schema.json diff --git a/src/FastyBird/Library/Exchange/tools/.coveralls.yml b/src/FastyBird/Core/Tools/tools/.coveralls.yml similarity index 100% rename from src/FastyBird/Library/Exchange/tools/.coveralls.yml rename to src/FastyBird/Core/Tools/tools/.coveralls.yml diff --git a/src/FastyBird/Library/Exchange/tools/infection.json b/src/FastyBird/Core/Tools/tools/infection.json similarity index 100% rename from src/FastyBird/Library/Exchange/tools/infection.json rename to src/FastyBird/Core/Tools/tools/infection.json diff --git a/src/FastyBird/Library/Exchange/tools/phpcs.xml b/src/FastyBird/Core/Tools/tools/phpcs.xml similarity index 90% rename from src/FastyBird/Library/Exchange/tools/phpcs.xml rename to src/FastyBird/Core/Tools/tools/phpcs.xml index a62b0ac82..e62732deb 100644 --- a/src/FastyBird/Library/Exchange/tools/phpcs.xml +++ b/src/FastyBird/Core/Tools/tools/phpcs.xml @@ -17,8 +17,8 @@ - - + + diff --git a/src/FastyBird/Library/Tools/tools/phpstan-bootstrap.php b/src/FastyBird/Core/Tools/tools/phpstan-bootstrap.php similarity index 100% rename from src/FastyBird/Library/Tools/tools/phpstan-bootstrap.php rename to src/FastyBird/Core/Tools/tools/phpstan-bootstrap.php diff --git a/src/FastyBird/Library/Exchange/tools/phpstan.base.neon b/src/FastyBird/Core/Tools/tools/phpstan.base.neon similarity index 100% rename from src/FastyBird/Library/Exchange/tools/phpstan.base.neon rename to src/FastyBird/Core/Tools/tools/phpstan.base.neon diff --git a/src/FastyBird/Library/Tools/tools/phpstan.config.src.neon b/src/FastyBird/Core/Tools/tools/phpstan.config.src.neon similarity index 100% rename from src/FastyBird/Library/Tools/tools/phpstan.config.src.neon rename to src/FastyBird/Core/Tools/tools/phpstan.config.src.neon diff --git a/src/FastyBird/Library/Exchange/tools/phpstan.config.tests.neon b/src/FastyBird/Core/Tools/tools/phpstan.config.tests.neon similarity index 100% rename from src/FastyBird/Library/Exchange/tools/phpstan.config.tests.neon rename to src/FastyBird/Core/Tools/tools/phpstan.config.tests.neon diff --git a/src/FastyBird/Library/Exchange/tools/phpstan.src.neon b/src/FastyBird/Core/Tools/tools/phpstan.src.neon similarity index 100% rename from src/FastyBird/Library/Exchange/tools/phpstan.src.neon rename to src/FastyBird/Core/Tools/tools/phpstan.src.neon diff --git a/src/FastyBird/Library/Exchange/tools/phpstan.tests.neon b/src/FastyBird/Core/Tools/tools/phpstan.tests.neon similarity index 100% rename from src/FastyBird/Library/Exchange/tools/phpstan.tests.neon rename to src/FastyBird/Core/Tools/tools/phpstan.tests.neon diff --git a/src/FastyBird/Library/Tools/tools/phpunit-bootstrap.php b/src/FastyBird/Core/Tools/tools/phpunit-bootstrap.php similarity index 100% rename from src/FastyBird/Library/Tools/tools/phpunit-bootstrap.php rename to src/FastyBird/Core/Tools/tools/phpunit-bootstrap.php diff --git a/src/FastyBird/Library/Exchange/tools/phpunit.xml b/src/FastyBird/Core/Tools/tools/phpunit.xml similarity index 100% rename from src/FastyBird/Library/Exchange/tools/phpunit.xml rename to src/FastyBird/Core/Tools/tools/phpunit.xml diff --git a/src/FastyBird/Core/Tools/tsconfig.json b/src/FastyBird/Core/Tools/tsconfig.json new file mode 100644 index 000000000..2cdf9136f --- /dev/null +++ b/src/FastyBird/Core/Tools/tsconfig.json @@ -0,0 +1,40 @@ +{ + "compilerOptions": { + "composite": true, + "target": "esnext", + "module": "esnext", + "strict": true, + "declaration": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "importHelpers": true, + "moduleResolution": "node", + "experimentalDecorators": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "sourceMap": true, + "baseUrl": "assets", + "skipLibCheck": true, + "types": [ + "@fastybird/metadata-library", + "node", + "pinia", + "vue", + "vue-i18n", + "vue-router" + ], + "lib": [ + "esnext", + "dom", + "dom.iterable" + ] + }, + "include": [ + "assets/**/*.ts", + "assets/**/*.d.ts" + ], + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/src/FastyBird/Core/Tools/vite.config.ts b/src/FastyBird/Core/Tools/vite.config.ts new file mode 100644 index 000000000..e44f5c996 --- /dev/null +++ b/src/FastyBird/Core/Tools/vite.config.ts @@ -0,0 +1,47 @@ +import { resolve } from 'path'; +import del from 'rollup-plugin-delete'; +import { defineConfig } from 'vite'; +import dts from 'vite-plugin-dts'; + +import eslint from '@nabla/vite-plugin-eslint'; +import vue from '@vitejs/plugin-vue'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + eslint(), + dts({ + outDir: 'dist', + staticImport: true, + insertTypesEntry: true, + rollupTypes: true, + }), + ], + build: { + lib: { + entry: resolve(__dirname, './assets/entry.ts'), + name: 'tools', + fileName: (format) => `tools.${format}.js`, + }, + rollupOptions: { + plugins: [ + // @ts-ignore + del({ + targets: ['dist/types', 'dist/entry.ts'], + hook: 'generateBundle', + }), + ], + external: ['@fastybird/metadata-library', '@vueuse/core', 'axios', 'element-plus', 'pinia', 'vue', 'vue-i18n', 'vue-router'], + output: { + // Provide global variables to use in the UMD build + // for externalized deps + globals: { + vue: 'Vue', + }, + }, + }, + sourcemap: true, + target: 'esnext', + }, +}); diff --git a/src/FastyBird/Library/Application/README.md b/src/FastyBird/Library/Application/README.md deleted file mode 100644 index 331da2e60..000000000 --- a/src/FastyBird/Library/Application/README.md +++ /dev/null @@ -1,91 +0,0 @@ -

- FastyBird -

- -# FastyBird application library - -[![Build Status](https://flat.badgen.net/github/checks/FastyBird/application-library/main?cache=300&style=flat-square)](https://github.com/FastyBird/application-library/actions) -[![Licence](https://flat.badgen.net/github/license/FastyBird/application-library?cache=300&style=flat-square)](https://github.com/FastyBird/application-library/blob/main/LICENSE.md) -[![Code coverage](https://flat.badgen.net/coveralls/c/github/FastyBird/application-library?cache=300&style=flat-square)](https://coveralls.io/r/FastyBird/application-library) -[![Mutation testing](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FFastyBird%2Fapplication-library%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/FastyBird/application-library/main) - -![PHP](https://flat.badgen.net/packagist/php/FastyBird/application-library?cache=300&style=flat-square) -[![Latest stable](https://flat.badgen.net/packagist/v/FastyBird/application-library/latest?cache=300&style=flat-square)](https://packagist.org/packages/FastyBird/application-library) -[![Downloads total](https://flat.badgen.net/packagist/dt/FastyBird/application-library?cache=300&style=flat-square)](https://packagist.org/packages/FastyBird/application-library) -[![PHPStan](https://flat.badgen.net/static/PHPStan/enabled/green?cache=300&style=flat-square)](https://github.com/phpstan/phpstan) - -*** - -## What is FastyBird application library? - -This extension is an integral part of the [FastyBird](https://www.fastybird.com) application, offering essential core services within -the [Nette framework](https://nette.org). It provides a robust foundation that ensures seamless integration and optimal functionality -for various components within the application architecture. - -Application library is a distributed extension that is developed in [PHP](https://www.php.net), built on the [Nette](https://nette.org) and [Symfony](https://symfony.com) frameworks, -and is licensed under [Apache2](http://www.apache.org/licenses/LICENSE-2.0). - -## Requirements - -Application library is tested against PHP 8.2. - -## Installation - -This extension is part of the [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem and is installed by default. -In case you want to create you own distribution of [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem you could install this extension with [Composer](http://getcomposer.org/): - -```sh -composer require fastybird/application-library -``` - -## Documentation - -:book: Learn how to create FastyBird application in [documentation](https://github.com/FastyBird/application-library/wiki). - -# FastyBird - -

- FastyBird -

- -FastyBird is an Open Source IOT solution built from decoupled components with powerful API and the highest quality code. Read more on [fastybird.com.com](https://www.fastybird.com). - -## Documentation - -:book: Documentation is available on [docs.fastybird.com](https://docs.fastybird.com). - -## Contributing - -The sources of this package are contained in the [FastyBird monorepo](https://github.com/FastyBird/fastybird). We welcome -contributions for this package on [FastyBird/fastybird](https://github.com/FastyBird/). - -## Feedback - -Use the [issue tracker](https://github.com/FastyBird/fastybird/issues) for bugs reporting or send an [mail](mailto:code@fastybird.com) -to us or you could reach us on [X newtwork](https://x.com/fastybird) for any idea that can improve the project. - -Thank you for testing, reporting and contributing. - -## Changelog - -For release info check [release page](https://github.com/FastyBird/fastybird/releases). - -## Maintainers - - - - - - - -
- - akadlec - -
- Adam Kadlec -
- -*** -Homepage [https://www.fastybird.com](https://www.fastybird.com) and -repository [https://github.com/FastyBird/application](https://github.com/FastyBird/application). diff --git a/src/FastyBird/Library/Application/src/Exceptions/InvalidArgument.php b/src/FastyBird/Library/Application/src/Exceptions/InvalidArgument.php deleted file mode 100644 index 7042d6836..000000000 --- a/src/FastyBird/Library/Application/src/Exceptions/InvalidArgument.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @package FastyBird:ApplicationLibrary! - * @subpackage Exceptions - * @since 1.0.0 - * - * @date 08.03.20 - */ - -namespace FastyBird\Library\Application\Exceptions; - -use InvalidArgumentException as PHPInvalidArgumentException; - -class InvalidArgument extends PHPInvalidArgumentException implements Exception -{ - -} diff --git a/src/FastyBird/Library/Application/src/Router/AppRouter.php b/src/FastyBird/Library/Application/src/Router/AppRouter.php deleted file mode 100644 index 31cc4c68a..000000000 --- a/src/FastyBird/Library/Application/src/Router/AppRouter.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @package FastyBird:ApplicationLibrary! - * @subpackage Router - * @since 1.0.0 - * - * @date 23.22.24 - */ - -namespace FastyBird\Library\Application\Router; - -use Nette\Application; - -/** - * Application router - * - * @package FastyBird:Application! - * @subpackage Router - * - * @author Adam Kadlec - */ -final class AppRouter extends Application\Routers\RouteList -{ - -} diff --git a/src/FastyBird/Library/Application/tests/cases/unit/DI/ExtensionTest.php b/src/FastyBird/Library/Application/tests/cases/unit/DI/ExtensionTest.php deleted file mode 100644 index ccefb6725..000000000 --- a/src/FastyBird/Library/Application/tests/cases/unit/DI/ExtensionTest.php +++ /dev/null @@ -1,33 +0,0 @@ -createContainer(); - - self::assertNotNull($container->getByType(Monolog\Handler\RotatingFileHandler::class, false)); - self::assertNull($container->getByType(SymfonyMonolog\Handler\ConsoleHandler::class, false)); - - self::assertNotNull($container->getByType(Helpers\Database::class, false)); - } - -} diff --git a/src/FastyBird/Library/Application/tools/phpcs.xml b/src/FastyBird/Library/Application/tools/phpcs.xml deleted file mode 100644 index 9255717fa..000000000 --- a/src/FastyBird/Library/Application/tools/phpcs.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/FastyBird/Library/Exchange/.gitignore b/src/FastyBird/Library/Exchange/.gitignore deleted file mode 100644 index f8573dfe8..000000000 --- a/src/FastyBird/Library/Exchange/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.idea -/vendor -/var -composer.lock -.DS_Store diff --git a/src/FastyBird/Library/Exchange/CHANGELOG-1.0.md b/src/FastyBird/Library/Exchange/CHANGELOG-1.0.md deleted file mode 100644 index 58facc18c..000000000 --- a/src/FastyBird/Library/Exchange/CHANGELOG-1.0.md +++ /dev/null @@ -1,7 +0,0 @@ -# CHANGELOG FOR `1.0.X` - -## v1.0.0 (2022-11-16) - -#### TL;DR - -- Just put it in stable version diff --git a/src/FastyBird/Library/Exchange/tools/phpstan-bootstrap.php b/src/FastyBird/Library/Exchange/tools/phpstan-bootstrap.php deleted file mode 100644 index 8ec328951..000000000 --- a/src/FastyBird/Library/Exchange/tools/phpstan-bootstrap.php +++ /dev/null @@ -1,25 +0,0 @@ -= 84 -edge >= 84 -firefox >= 78 -safari >= 13.1 diff --git a/src/FastyBird/Library/Metadata/.gitattributes b/src/FastyBird/Library/Metadata/.gitattributes index 1f6f7cf99..cc79ff0b7 100644 --- a/src/FastyBird/Library/Metadata/.gitattributes +++ b/src/FastyBird/Library/Metadata/.gitattributes @@ -4,9 +4,10 @@ /tests export-ignore /tools export-ignore .editorconfig export-ignore -.eslintrc export-ignore .gitattributes export-ignore .gitignore export-ignore .npmignore export-ignore -babel.config.js export-ignore +.prettierrc export-ignore +commitlint.config.mjs export-ignore +eslint.config.mjs export-ignore Makefile export-ignore diff --git a/src/FastyBird/Library/Metadata/.gitignore b/src/FastyBird/Library/Metadata/.gitignore index a64b9804b..efa58cf83 100644 --- a/src/FastyBird/Library/Metadata/.gitignore +++ b/src/FastyBird/Library/Metadata/.gitignore @@ -3,7 +3,12 @@ /node_modules /vendor /var +.editorconfig .DS_Store +.gitattributes +.gitignore +.npmignore composer.lock yarn.lock tsconfig.tsbuildinfo +Makefile diff --git a/src/FastyBird/Library/Metadata/.npmignore b/src/FastyBird/Library/Metadata/.npmignore index c279d29d5..43f2f1d0f 100644 --- a/src/FastyBird/Library/Metadata/.npmignore +++ b/src/FastyBird/Library/Metadata/.npmignore @@ -1,7 +1,14 @@ -src +.idea +/node_modules +/src +/vendor +/var .editorconfig -.eslintrc +.DS_Store .gitattributes .gitignore -.npmignore export-ignore +.npmignore +composer.lock +yarn.lock +tsconfig.tsbuildinfo Makefile export-ignore diff --git a/src/FastyBird/Library/Metadata/.prettierrc b/src/FastyBird/Library/Metadata/.prettierrc deleted file mode 100644 index f48e792e4..000000000 --- a/src/FastyBird/Library/Metadata/.prettierrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "printWidth": 150, - "tabWidth": 2, - "useTabs": true, - "semi": true, - "singleQuote": true, - "quoteProps": "as-needed", - "jsxSingleQuote": false, - "trailingComma": "es5", - "bracketSpacing": true, - "arrowParens": "always", - "requirePragma": false, - "insertPragma": false, - "proseWrap": "preserve", - "htmlWhitespaceSensitivity": "css", - "vueIndentScriptAndStyle": false, - "endOfLine": "auto" -} diff --git a/src/FastyBird/Library/Metadata/README.md b/src/FastyBird/Library/Metadata/README.md index a9d7db0bf..f29b76752 100644 --- a/src/FastyBird/Library/Metadata/README.md +++ b/src/FastyBird/Library/Metadata/README.md @@ -23,9 +23,7 @@ ## What is FastyBird metadata library? -This is library for [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem which is -implementing [json schemas](https://json-schema.org) data validation helpers and is central place for application -constants. +This is library for [FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) ecosystem which is a place for application constants and shared values. ## Installation diff --git a/src/FastyBird/Library/Metadata/assets/entry.ts b/src/FastyBird/Library/Metadata/assets/entry.ts index 8a4e9ca6e..9c8c1d3ee 100644 --- a/src/FastyBird/Library/Metadata/assets/entry.ts +++ b/src/FastyBird/Library/Metadata/assets/entry.ts @@ -1,3 +1,2 @@ -// Re-export plugin typing -export * from '@/types/metadata-library'; -export * from '@/utilities'; +// Re-export library types +export * from './types'; diff --git a/src/FastyBird/Library/Metadata/assets/types/accounts-module.ts b/src/FastyBird/Library/Metadata/assets/types/accounts-module.ts deleted file mode 100644 index 22fae5437..000000000 --- a/src/FastyBird/Library/Metadata/assets/types/accounts-module.ts +++ /dev/null @@ -1,59 +0,0 @@ -export enum AccountState { - ACTIVE = 'active', - BLOCKED = 'blocked', - DELETED = 'deleted', - NOT_ACTIVATED = 'not_activated', - APPROVAL_WAITING = 'approval_waiting', -} - -export enum IdentityState { - ACTIVE = 'active', - BLOCKED = 'blocked', - DELETED = 'deleted', - INVALID = 'invalid', -} - -export interface AccountDocument { - id: string; - source: string; - first_name: string; - last_name: string; - middle_name: string; - state: AccountState; - registered: string | null; - last_visit: string | null; - email: string; - language: string; - roles: string[]; -} - -export interface EmailDocument { - id: string; - source: string; - address: string; - default: boolean; - verified: boolean; - private: boolean; - public: boolean; - account: string; -} - -export interface IdentityDocument { - id: string; - source: string; - state: IdentityState; - uid: string; - password?: string; - account: string; -} - -export interface RoleDocument { - id: string; - source: string; - name: string; - description: string; - anonymous: boolean; - authenticated: boolean; - administrator: boolean; - parent: string | null; -} diff --git a/src/FastyBird/Library/Metadata/assets/types/dataType.ts b/src/FastyBird/Library/Metadata/assets/types/dataType.ts new file mode 100644 index 000000000..9efe77d52 --- /dev/null +++ b/src/FastyBird/Library/Metadata/assets/types/dataType.ts @@ -0,0 +1,36 @@ +export enum DataType { + CHAR = 'char', + UCHAR = 'uchar', + SHORT = 'short', + USHORT = 'ushort', + INT = 'int', + UINT = 'uint', + FLOAT = 'float', + BOOLEAN = 'bool', + STRING = 'string', + ENUM = 'enum', + DATE = 'date', + TIME = 'time', + DATETIME = 'datetime', + COLOR = 'color', + BUTTON = 'button', + SWITCH = 'switch', + COVER = 'cover', + UNKNOWN = 'unknown', +} + +export enum ShortDataType { + CHAR = 'i8', + UCHAR = 'u8', + SHORT = 'i16', + USHORT = 'u16', + INT = 'i32', + UINT = 'u32', + FLOAT = 'f', + BOOLEAN = 'b', + STRING = 's', + ENUM = 'e', + DATE = 'd', + TIME = 't', + DATETIME = 'dt', +} diff --git a/src/FastyBird/Library/Metadata/assets/types/devices-module.ts b/src/FastyBird/Library/Metadata/assets/types/devices-module.ts deleted file mode 100644 index 415a548ae..000000000 --- a/src/FastyBird/Library/Metadata/assets/types/devices-module.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { ButtonPayload, CoverPayload, DataType, SwitchPayload } from '@/types/types'; - -export enum ConnectionState { - CONNECTED = 'connected', - DISCONNECTED = 'disconnected', - INIT = 'init', - READY = 'ready', - RUNNING = 'running', - SLEEPING = 'sleeping', - STOPPED = 'stopped', - LOST = 'lost', - ALERT = 'alert', - UNKNOWN = 'unknown', -} - -export enum ConnectorCategory { - GENERIC = 'generic', -} - -export enum DeviceCategory { - GENERIC = 'generic', -} - -export enum ChannelCategory { - GENERIC = 'generic', -} - -export enum PropertyCategory { - GENERIC = 'generic', -} - -export interface ConnectorDocument { - id: string; - type: string; - source: string; - category: ConnectorCategory; - identifier: string; - name: string; - comment: string | null; - enabled: boolean; - properties: string[]; - controls: string[]; - devices: string[]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface ConnectorPropertyDocument { - id: string; - type: 'dynamic' | 'variable'; - source: string; - category: PropertyCategory; - identifier: string; - name: string | null; - settable: boolean; - queryable: boolean; - data_type: DataType; - unit: string | null; - format: string[] | (string | null)[][] | (number | null)[] | string | null; - invalid: string | number | boolean | null; - scale: number | null; - step: number | null; - value_transformer: string | null; - default?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - actual_value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - expected_value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - pending?: boolean | Date; - is_valid?: boolean; - connector: string; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface ConnectorControlDocument { - id: string; - type: string; - source: string; - name: string; - connector: string; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface DeviceDocument { - id: string; - type: string; - source: string; - category: DeviceCategory; - identifier: string; - name: string | null; - comment: string | null; - connector: string; - parents: string[]; - children: string[]; - properties: string[]; - controls: string[]; - channels: string[]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface DevicePropertyDocument { - id: string; - type: 'dynamic' | 'variable' | 'mapped'; - source: string; - category: PropertyCategory; - identifier: string; - name: string | null; - settable: boolean; - queryable: boolean; - data_type: DataType; - unit: string | null; - format: string[] | (string | null)[][] | (number | null)[] | string | null; - invalid: string | number | boolean | null; - scale: number | null; - step: number | null; - value_transformer: string | null; - default?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - actual_value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - expected_value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - pending?: boolean | Date; - is_valid?: boolean; - device: string; - parent?: string; - children: string[]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface DeviceControlDocument { - id: string; - type: string; - source: string; - name: string; - device: string; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface ChannelDocument { - id: string; - type: string; - source: string; - category: ChannelCategory; - identifier: string; - name: string | null; - comment: string | null; - device: string; - properties: string[]; - controls: string[]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface ChannelPropertyDocument { - id: string; - type: 'dynamic' | 'variable' | 'mapped'; - source: string; - category: PropertyCategory; - identifier: string; - name: string | null; - settable: boolean; - queryable: boolean; - data_type: DataType; - unit: string | null; - format: string[] | (string | null)[][] | (number | null)[] | string | null; - invalid: string | number | boolean | null; - scale: number | null; - step: number | null; - value_transformer: string | null; - default?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - actual_value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - expected_value?: string | number | boolean | ButtonPayload | CoverPayload | SwitchPayload | Date | null; - pending?: boolean | Date; - is_valid?: boolean; - channel: string; - parent?: string; - children: string[]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface ChannelControlDocument { - id: string; - type: string; - source: string; - name: string; - channel: string; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} diff --git a/src/FastyBird/Library/Metadata/assets/types/index.ts b/src/FastyBird/Library/Metadata/assets/types/index.ts new file mode 100644 index 000000000..65105f442 --- /dev/null +++ b/src/FastyBird/Library/Metadata/assets/types/index.ts @@ -0,0 +1,10 @@ +export * from './dataType'; +export * from './payload'; +export * from './source'; + +export enum ModulePrefix { + ACCOUNTS = 'accounts-module', + DEVICES = 'devices-module', + TRIGGERS = 'triggers-module', + UI = 'ui-module', +} diff --git a/src/FastyBird/Library/Metadata/assets/types/metadata-library.ts b/src/FastyBird/Library/Metadata/assets/types/metadata-library.ts deleted file mode 100644 index 4919e9ef3..000000000 --- a/src/FastyBird/Library/Metadata/assets/types/metadata-library.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Re-export library types -export * from '@/types/types'; -export * from '@/types/routing'; -export * from '@/types/accounts-module'; -export * from '@/types/devices-module'; -export * from '@/types/triggers-module'; -export * from '@/types/ui-module'; diff --git a/src/FastyBird/Library/Metadata/assets/types/payload.ts b/src/FastyBird/Library/Metadata/assets/types/payload.ts new file mode 100644 index 000000000..27096d44a --- /dev/null +++ b/src/FastyBird/Library/Metadata/assets/types/payload.ts @@ -0,0 +1,28 @@ +export enum SwitchPayload { + ON = 'switch_on', + OFF = 'switch_off', + TOGGLE = 'switch_toggle', +} + +export enum CoverPayload { + OPEN = 'cover_open', + OPENING = 'cover_opening', + OPENED = 'cover_opened', + CLOSE = 'cover_close', + CLOSING = 'cover_closing', + CLOSED = 'cover_closed', + STOP = 'cover_stop', + STOPPED = 'cover_stopped', + CALIBRATE = 'cover_calibrate', + CALIBRATING = 'cover_calibrating', +} + +export enum ButtonPayload { + PRESSED = 'btn_pressed', + RELEASED = 'btn_released', + CLICKED = 'btn_clicked', + DOUBLE_CLICKED = 'btn_double_clicked', + TRIPLE_CLICKED = 'btn_triple_clicked', + LONG_CLICKED = 'btn_long_clicked', + EXTRA_LONG_CLICKED = 'btn_extra_long_clicked', +} diff --git a/src/FastyBird/Library/Metadata/assets/types/routing.ts b/src/FastyBird/Library/Metadata/assets/types/routing.ts deleted file mode 100644 index 0c46f5eba..000000000 --- a/src/FastyBird/Library/Metadata/assets/types/routing.ts +++ /dev/null @@ -1,169 +0,0 @@ -export enum ActionRoutes { - CONNECTOR_CONTROL = 'fb.exchange.action.connector.control', - CONNECTOR_PROPERTY = 'fb.exchange.action.connector.property', - DEVICE_CONTROL = 'fb.exchange.action.device.control', - DEVICE_PROPERTY = 'fb.exchange.action.device.property', - CHANNEL_CONTROL = 'fb.exchange.action.channel.control', - CHANNEL_PROPERTY = 'fb.exchange.action.channel.property', - TRIGGER_CONTROL = 'fb.exchange.action.trigger.control', - WIDGET_DATA_SOURCE = 'fb.exchange.action.widget.data-source', -} - -export enum MessageRoutes { - MODULE = 'fb.exchange.message.module', - PLUGIN = 'fb.exchange.message.plugin', - CONNECTOR = 'fb.exchange.message.connector', - AUTOMATOR = 'fb.exchange.message.automator', -} - -export enum AccountsModuleRoutes { - // Accounts - ACCOUNT_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.account', - ACCOUNT_DOCUMENT_CREATED = 'fb.exchange.module.document.created.account', - ACCOUNT_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.account', - ACCOUNT_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.account', - - // Emails - EMAIL_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.email', - EMAIL_DOCUMENT_CREATED = 'fb.exchange.module.document.created.email', - EMAIL_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.email', - EMAIL_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.email', - - // Identities - IDENTITY_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.identity', - IDENTITY_DOCUMENT_CREATED = 'fb.exchange.module.document.created.identity', - IDENTITY_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.identity', - IDENTITY_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.identity', - - // Roles - ROLE_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.role', - ROLE_DOCUMENT_CREATED = 'fb.exchange.module.document.created.role', - ROLE_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.role', - ROLE_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.role', -} - -export enum DevicesModuleRoutes { - // Devices - DEVICE_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.device', - DEVICE_DOCUMENT_CREATED = 'fb.exchange.module.document.created.device', - DEVICE_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.device', - DEVICE_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.device', - - // Device's properties - DEVICE_PROPERTY_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.device.property', - DEVICE_PROPERTY_DOCUMENT_CREATED = 'fb.exchange.module.document.created.device.property', - DEVICE_PROPERTY_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.device.property', - DEVICE_PROPERTY_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.device.property', - - // Device's control - DEVICE_CONTROL_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.device.control', - DEVICE_CONTROL_DOCUMENT_CREATED = 'fb.exchange.module.document.created.device.control', - DEVICE_CONTROL_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.device.control', - DEVICE_CONTROL_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.device.control', - - // Channels - CHANNEL_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.channel', - CHANNEL_DOCUMENT_CREATED = 'fb.exchange.module.document.created.channel', - CHANNEL_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.channel', - CHANNEL_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.channel', - - // Channel's properties - CHANNEL_PROPERTY_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.channel.property', - CHANNEL_PROPERTY_DOCUMENT_CREATED = 'fb.exchange.module.document.created.channel.property', - CHANNEL_PROPERTY_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.channel.property', - CHANNEL_PROPERTY_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.channel.property', - - // Channel's control - CHANNEL_CONTROL_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.channel.control', - CHANNEL_CONTROL_DOCUMENT_CREATED = 'fb.exchange.module.document.created.channel.control', - CHANNEL_CONTROL_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.channel.control', - CHANNEL_CONTROL_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.channel.control', - - // Connectors - CONNECTOR_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.connector', - CONNECTOR_DOCUMENT_CREATED = 'fb.exchange.module.document.created.connector', - CONNECTOR_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.connector', - CONNECTOR_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.connector', - - // Connector's properties - CONNECTOR_PROPERTY_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.connector.property', - CONNECTOR_PROPERTY_DOCUMENT_CREATED = 'fb.exchange.module.document.created.connector.property', - CONNECTOR_PROPERTY_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.connector.property', - CONNECTOR_PROPERTY_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.connector.property', - - // Connector's control - CONNECTOR_CONTROL_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.connector.control', - CONNECTOR_CONTROL_DOCUMENT_CREATED = 'fb.exchange.module.document.created.connector.control', - CONNECTOR_CONTROL_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.connector.control', - CONNECTOR_CONTROL_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.connector.control', -} - -export enum TriggersModuleRoutes { - // Triggers - TRIGGER_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.trigger', - TRIGGER_DOCUMENT_CREATED = 'fb.exchange.module.document.created.trigger', - TRIGGER_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.trigger', - TRIGGER_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.trigger', - - // Trigger's control - TRIGGER_CONTROL_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.trigger.control', - TRIGGER_CONTROL_DOCUMENT_CREATED = 'fb.exchange.module.document.created.trigger.control', - TRIGGER_CONTROL_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.trigger.control', - TRIGGER_CONTROL_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.trigger.control', - - // Actions - TRIGGER_ACTION_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.trigger.action', - TRIGGER_ACTION_DOCUMENT_CREATED = 'fb.exchange.module.document.created.trigger.action', - TRIGGER_ACTION_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.trigger.action', - TRIGGER_ACTION_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.trigger.action', - - // Notifications - TRIGGER_NOTIFICATION_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.trigger.notification', - TRIGGER_NOTIFICATION_DOCUMENT_CREATED = 'fb.exchange.module.document.created.trigger.notification', - TRIGGER_NOTIFICATION_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.trigger.notification', - TRIGGER_NOTIFICATION_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.trigger.notification', - - // Conditions - TRIGGER_CONDITION_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.trigger.condition', - TRIGGER_CONDITION_DOCUMENT_CREATED = 'fb.exchange.module.document.created.trigger.condition', - TRIGGER_CONDITION_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.trigger.condition', - TRIGGER_CONDITION_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.trigger.condition', -} - -export enum UiModuleRoutes { - // Dashboards - DASHBOARD_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.dashboard', - DASHBOARD_DOCUMENT_CREATED = 'fb.exchange.module.document.created.dashboard', - DASHBOARD_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.dashboard', - DASHBOARD_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.dashboard', - - // Tabs - TAB_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.tab', - TAB_DOCUMENT_CREATED = 'fb.exchange.module.document.created.tab', - TAB_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.tab', - TAB_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.tab', - - // Groups - GROUP_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.group', - GROUP_DOCUMENT_CREATED = 'fb.exchange.module.document.created.group', - GROUP_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.group', - GROUP_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.group', - - // Widgets - WIDGET_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.widget', - WIDGET_DOCUMENT_CREATED = 'fb.exchange.module.document.created.widget', - WIDGET_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.widget', - WIDGET_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.widget', - - // Widget's display - WIDGET_DISPLAY_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.widget.display', - WIDGET_DISPLAY_DOCUMENT_CREATED = 'fb.exchange.module.document.created.widget.display', - WIDGET_DISPLAY_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.widget.display', - WIDGET_DISPLAY_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.widget.display', - - // Widget's data sources - WIDGET_DATA_SOURCE_DOCUMENT_REPORTED = 'fb.exchange.module.document.reported.widget.data-source', - WIDGET_DATA_SOURCE_DOCUMENT_CREATED = 'fb.exchange.module.document.created.widget.data-source', - WIDGET_DATA_SOURCE_DOCUMENT_UPDATED = 'fb.exchange.module.document.updated.widget.data-source', - WIDGET_DATA_SOURCE_DOCUMENT_DELETED = 'fb.exchange.module.document.deleted.widget.data-source', -} diff --git a/src/FastyBird/Library/Metadata/assets/types/types.ts b/src/FastyBird/Library/Metadata/assets/types/source.ts similarity index 52% rename from src/FastyBird/Library/Metadata/assets/types/types.ts rename to src/FastyBird/Library/Metadata/assets/types/source.ts index 862d1275c..dfc724d65 100644 --- a/src/FastyBird/Library/Metadata/assets/types/types.ts +++ b/src/FastyBird/Library/Metadata/assets/types/source.ts @@ -1,10 +1,3 @@ -export enum ModulePrefix { - ACCOUNTS = 'accounts-module', - DEVICES = 'devices-module', - TRIGGERS = 'triggers-module', - UI = 'ui-module', -} - export enum ModuleSource { NOT_SPECIFIED = '*', ACCOUNTS = 'com.fastybird.accounts-module', @@ -55,92 +48,7 @@ export enum BridgeSource { DEVICES_MODULE_UI_MODULE = 'com.fastybird.devices-module-ui-module-bridge', } -export enum DataType { - CHAR = 'char', - UCHAR = 'uchar', - SHORT = 'short', - USHORT = 'ushort', - INT = 'int', - UINT = 'uint', - FLOAT = 'float', - BOOLEAN = 'bool', - STRING = 'string', - ENUM = 'enum', - DATE = 'date', - TIME = 'time', - DATETIME = 'datetime', - COLOR = 'color', - BUTTON = 'button', - SWITCH = 'switch', - COVER = 'cover', - UNKNOWN = 'unknown', -} - -export enum ShortDataType { - CHAR = 'i8', - UCHAR = 'u8', - SHORT = 'i16', - USHORT = 'u16', - INT = 'i32', - UINT = 'u32', - FLOAT = 'f', - BOOLEAN = 'b', - STRING = 's', - ENUM = 'e', - DATE = 'd', - TIME = 't', - DATETIME = 'dt', -} - -export enum SwitchPayload { - ON = 'switch_on', - OFF = 'switch_off', - TOGGLE = 'switch_toggle', -} - -export enum CoverPayload { - OPEN = 'cover_open', - OPENING = 'cover_opening', - OPENED = 'cover_opened', - CLOSE = 'cover_close', - CLOSING = 'cover_closing', - CLOSED = 'cover_closed', - STOP = 'cover_stop', - STOPPED = 'cover_stopped', - CALIBRATE = 'cover_calibrate', - CALIBRATING = 'cover_calibrating', -} - -export enum ButtonPayload { - PRESSED = 'btn_pressed', - RELEASED = 'btn_released', - CLICKED = 'btn_clicked', - DOUBLE_CLICKED = 'btn_double_clicked', - TRIPLE_CLICKED = 'btn_triple_clicked', - LONG_CLICKED = 'btn_long_clicked', - EXTRA_LONG_CLICKED = 'btn_extra_long_clicked', -} - -export enum ControlName { - CONFIGURE = 'configure', - RESET = 'reset', - FACTORY_RESET = 'factory_reset', - REBOOT = 'reboot', - TRIGGER = 'trigger', -} - -export enum PropertyAction { - SET = 'set', - GET = 'get', - REPORT = 'report', -} - -export enum ControlAction { - SET = 'set', -} - -export enum ExchangeCommand { - SET = 'set', - GET = 'get', - REPORT = 'report', +export enum AddonSource { + NOT_SPECIFIED = '*', + VIRTUAL_THERMOSTAT = 'com.fastybird.virtual-thermostat-addon', } diff --git a/src/FastyBird/Library/Metadata/assets/types/triggers-module.ts b/src/FastyBird/Library/Metadata/assets/types/triggers-module.ts deleted file mode 100644 index 9a9a20ecc..000000000 --- a/src/FastyBird/Library/Metadata/assets/types/triggers-module.ts +++ /dev/null @@ -1,87 +0,0 @@ -export enum TriggerType { - MANUAL = 'manual', - AUTOMATIC = 'automatic', -} - -export enum ActionType { - DUMMY = 'dummy', - DEVICE_PROPERTY = 'device_property', - CHANNEL_PROPERTY = 'channel_property', -} - -export enum ConditionType { - DUMMY = 'dummy', - CHANNEL_PROPERTY = 'channel_property', - DEVICE_PROPERTY = 'device_property', - TIME = 'time', - DATE = 'date', -} - -export enum NotificationType { - EMAIL = 'email', - SMS = 'sms', -} - -export enum ConditionOperator { - EQUAL = 'eq', - ABOVE = 'above', - BELOW = 'below', -} - -export interface TriggerDocument { - id: string; - type: TriggerType; - name: string; - comment: string | null; - enabled: boolean; - owner: string | null; - is_triggered?: boolean | null; - is_fulfilled?: boolean | null; -} - -export interface TriggerControlDocument { - id: string; - name: string; - trigger: string; - owner: string | null; -} - -export interface ActionDocument { - id: string; - type: ActionType; - enabled: boolean; - trigger: string; - device?: string; - channel?: string; - property?: string; - value?: string; - owner: string | null; - is_triggered?: boolean | null; -} - -export interface ConditionDocument { - id: string; - type: ConditionType; - enabled: boolean; - trigger: string; - device?: string; - channel?: string; - property?: string; - operand?: string; - operator?: ConditionOperator; - time?: string; - days?: number[]; - date?: string; - owner: string | null; - is_fulfilled?: boolean | null; -} - -export interface NotificationDocument { - id: string; - type: NotificationType; - enabled: boolean; - trigger: string; - email?: string; - phone?: string; - owner: string | null; -} diff --git a/src/FastyBird/Library/Metadata/assets/types/ui-module.ts b/src/FastyBird/Library/Metadata/assets/types/ui-module.ts deleted file mode 100644 index 9bcacb9b2..000000000 --- a/src/FastyBird/Library/Metadata/assets/types/ui-module.ts +++ /dev/null @@ -1,79 +0,0 @@ -export interface DashboardDocument { - id: string; - source: string; - identifier: string; - name: string | null; - comment: string | null; - priority: number; - tabs: TabDocument['id'][]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface TabDocument { - id: string; - source: string; - identifier: string; - name: string | null; - comment: string | null; - priority: number; - dashboard: DashboardDocument['id']; - widgets: WidgetDocument['id'][]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface GroupDocument { - id: string; - source: string; - identifier: string; - name: string | null; - comment: string | null; - priority: number; - widgets: WidgetDocument['id'][]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface WidgetDocument { - id: string; - type: string; - source: string; - identifier: string; - name: string | null; - comment: string | null; - display: WidgetDisplayDocument['id']; - data_sources: WidgetDataSourceDocument['id'][]; - tabs: TabDocument['id'][]; - groups: GroupDocument['id'][]; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface WidgetDisplayDocument { - id: string; - type: string; - source: string; - identifier: string; - params: object; - widget: WidgetDocument['id']; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} - -export interface WidgetDataSourceDocument { - id: string; - type: string; - source: string; - identifier: string; - params: object; - widget: WidgetDocument['id']; - owner: string | null; - createdAt: Date | null; - updatedAt: Date | null; -} diff --git a/src/FastyBird/Library/Metadata/commitlint.config.js b/src/FastyBird/Library/Metadata/commitlint.config.js deleted file mode 100644 index 3e16e7f1b..000000000 --- a/src/FastyBird/Library/Metadata/commitlint.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], -} diff --git a/src/FastyBird/Library/Metadata/commitlint.config.mjs b/src/FastyBird/Library/Metadata/commitlint.config.mjs new file mode 100644 index 000000000..acf7912f0 --- /dev/null +++ b/src/FastyBird/Library/Metadata/commitlint.config.mjs @@ -0,0 +1,5 @@ +import conventional from '@commitlint/config-conventional'; + +export default { + extends: [conventional], +}; diff --git a/src/FastyBird/Library/Metadata/composer.json b/src/FastyBird/Library/Metadata/composer.json index 9fb0f071c..aba30eebe 100644 --- a/src/FastyBird/Library/Metadata/composer.json +++ b/src/FastyBird/Library/Metadata/composer.json @@ -31,16 +31,7 @@ "source": "https://github.com/FastyBird/metadata-library" }, "require": { - "php": ">=8.2.0", - "fastybird/application-library": "dev-main", - "ipub/phone": "^2.3", - "nette/bootstrap": "^3.1", - "nette/di": "^3.0", - "nette/utils": "^4.0", - "opis/json-schema": "^2.3", - "phpdocumentor/reflection": "^5.3", - "phpdocumentor/reflection-common": "^2.2", - "ramsey/uuid": "^4.5" + "php": ">=8.2.0" }, "require-dev": { "brianium/paratest": "^7.3", @@ -67,9 +58,7 @@ }, "autoload-dev": { "psr-4": { - "FastyBird\\Library\\Metadata\\Tests\\Cases\\Unit\\": "tests/cases/unit", - "FastyBird\\Library\\Metadata\\Tests\\Fixtures\\": "tests/fixtures", - "FastyBird\\Library\\Metadata\\Tests\\Fixtures\\Dummy\\": "tests/fixtures/dummy" + "FastyBird\\Library\\Metadata\\Tests\\Cases\\Unit\\": "tests/cases/unit" } }, "config": { diff --git a/src/FastyBird/Library/Metadata/eslint.config.mjs b/src/FastyBird/Library/Metadata/eslint.config.mjs new file mode 100644 index 000000000..c482c6463 --- /dev/null +++ b/src/FastyBird/Library/Metadata/eslint.config.mjs @@ -0,0 +1,37 @@ +import js from '@eslint/js'; +import pluginPrettier from 'eslint-plugin-prettier'; +import ts from 'typescript-eslint'; + +export default [ + // Base configuration + js.configs.recommended, + ...ts.configs.recommended, + { + plugins: { + prettier: pluginPrettier, + }, + languageOptions: { + parserOptions: { + parser: '@typescript-eslint/parser', // Use the TypeScript parser + }, + globals: { + GlobalEventHandlers: 'readonly', + ScrollToOptions: 'readonly', + }, + }, + rules: { + 'lines-between-class-members': [ + 'error', + 'always', + { + exceptAfterSingleLine: true, + }, + ], + 'no-useless-computed-key': 'off', + '@typescript-eslint/explicit-function-return-type': ['error'], + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'prettier/prettier': ['error'], + }, + }, +]; diff --git a/src/FastyBird/Library/Metadata/package.json b/src/FastyBird/Library/Metadata/package.json index ff5ad40f4..ace7f4ce2 100644 --- a/src/FastyBird/Library/Metadata/package.json +++ b/src/FastyBird/Library/Metadata/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/metadata-library", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FastyBird IoT metadata reader & validator", "keywords": [ @@ -44,41 +44,31 @@ "build:dev": "vue-tsc --noEmit --composite false && vite build --watch --mode development", "build:only": "yarn clean && vite build", "types": "vue-tsc --noEmit --composite false", - "lint:js": "eslint --ext .js,.ts,.vue --ignore-path .gitignore assets", - "lint:js:fix": "eslint --ext .js,.ts,.vue --ignore-path .gitignore assets --fix", + "lint:js": "eslint assets", + "lint:js:fix": "eslint assets --fix", "pretty": "yarn pretty:write && yarn pretty:check", "pretty:check": "prettier assets --check", "pretty:write": "prettier assets --write" }, "devDependencies": { - "@babel/core": "^7.23", - "@babel/plugin-proposal-class-properties": "^7.18", - "@babel/preset-env": "^7.23", - "@babel/preset-typescript": "^7.23", - "@commitlint/cli": "^19.0", - "@commitlint/config-conventional": "^19.0", + "@commitlint/cli": "^19.6", + "@commitlint/config-conventional": "^19.6", + "@eslint/js": "^9.15", "@nabla/vite-plugin-eslint": "^2.0", - "@types/node": "^20.11", - "@typescript-eslint/eslint-plugin": "^7.1", - "@typescript-eslint/parser": "^7.1", - "@vitejs/plugin-vue": "^5.0", - "@vue/eslint-config-prettier": "^9.0", - "@vue/eslint-config-typescript": "^12.0", - "babel-loader": "^9.1", - "eslint": "^8.57", + "@types/node": "^20.17", + "@typescript-eslint/eslint-plugin": "^8.15", + "@typescript-eslint/parser": "^8.15", + "eslint": "^9.15", "eslint-config-prettier": "^9.1", - "eslint-plugin-markdown": "^3.0", - "eslint-plugin-prettier": "^5.1", - "eslint-plugin-vue": "^9.22", - "prettier": "^3.2", - "rimraf": "^5.0", - "rollup-plugin-delete": "^2.0", - "typescript": "^5.3", - "vite": "^5.1", - "vite-plugin-dts": "^3.7", - "vue": "^3.4", - "vue-loader": "^17.4", - "vue-tsc": "^2.0" + "eslint-plugin-prettier": "^5.2", + "prettier": "^3.3", + "rimraf": "^6.0", + "rollup-plugin-delete": "^2.1", + "typescript": "5.6.2", + "typescript-eslint": "^8.15", + "vite": "^5.4", + "vite-plugin-dts": "^4.3", + "vue-tsc": "^2.1" }, "engines": { "node": ">=20" diff --git a/src/FastyBird/Library/Metadata/prettier.config.mjs b/src/FastyBird/Library/Metadata/prettier.config.mjs new file mode 100644 index 000000000..96f817978 --- /dev/null +++ b/src/FastyBird/Library/Metadata/prettier.config.mjs @@ -0,0 +1,22 @@ +import pluginSortImports from '@trivago/prettier-plugin-sort-imports'; + +export default { + plugins: [pluginSortImports], + printWidth: 150, + tabWidth: 2, + useTabs: true, + semi: true, + singleQuote: true, + quoteProps: 'as-needed', + jsxSingleQuote: false, + trailingComma: 'es5', + bracketSpacing: true, + arrowParens: 'always', + requirePragma: false, + insertPragma: false, + proseWrap: 'preserve', + htmlWhitespaceSensitivity: 'css', + vueIndentScriptAndStyle: false, + endOfLine: 'auto', + singleAttributePerLine: true, +}; diff --git a/src/FastyBird/Library/Metadata/resources/application.json b/src/FastyBird/Library/Metadata/resources/application.json deleted file mode 100644 index 9e53475a8..000000000 --- a/src/FastyBird/Library/Metadata/resources/application.json +++ /dev/null @@ -1,727 +0,0 @@ -{ - "modules" : { - "com.fastybird.accounts-module" : [ - { - "version" : "*", - "metadata" : { - "exchange" : [ - ], - "routes" : [ - { - "name" : "Get session info", - "path" : "/v1/session", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create new session", - "path" : "/v1/session", - "method" : "post", - "headers" : [] - }, - { - "name" : "Refresh session", - "path" : "/v1/session", - "method" : "patch", - "headers" : [] - }, - { - "name" : "Destroy session", - "path" : "/v1/session", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get session relationship", - "path" : "/v1/session/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Read user profile", - "path" : "/v1/me", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update user profile", - "path" : "/v1/me", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Close user account", - "path" : "/v1/me", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get profile relationship", - "path" : "/v1/me/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all profile emails", - "path" : "/v1/me/emails", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all profile email", - "path" : "/v1/me/emails/{email}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create new profile email", - "path" : "/v1/me/emails", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update existing profile email", - "path" : "/v1/me/emails/{email}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete existing profile email", - "path" : "/v1/me/emails/{email}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get profile email relationship", - "path" : "/v1/me/emails/{email}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all profile identities", - "path" : "/v1/me/identities", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all profile identity", - "path" : "/v1/me/identities/{identity}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update existing profile identity", - "path" : "/v1/me/identities/{identity}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get profile identity relationship", - "path" : "/v1/me/identities/{identity}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all accounts", - "path" : "/v1/accounts", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get account", - "path" : "/v1/accounts/{account}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get account children", - "path" : "/v1/accounts/{account}/children", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create new account", - "path" : "/v1/accounts", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update account", - "path" : "/v1/accounts/{account}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete account", - "path" : "/v1/accounts/{account}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get account relationship", - "path" : "/v1/accounts/{account}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all emails", - "path" : "/v1/accounts/{account}/emails", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get email", - "path" : "/v1/accounts/{account}/emails/{email}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create new email", - "path" : "/v1/accounts/{account}/emails", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update email", - "path" : "/v1/accounts/{account}/emails/{email}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete email", - "path" : "/v1/accounts/{account}/emails/{email}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get email relationship", - "path" : "/v1/accounts/{account}/emails/{email}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get all identities", - "path" : "/v1/accounts/{account}/identities", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get identity", - "path" : "/v1/accounts/{account}/identities/{identity}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create new identity", - "path" : "/v1/accounts/{account}/identities", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update identity", - "path" : "/v1/accounts/{account}/identities/{identity}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get identity relationship", - "path" : "/v1/accounts/{account}/identities/{identity}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get access roles", - "path" : "/v1/roles", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get access role", - "path" : "/v1/roles/{role}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get access role children", - "path" : "/v1/roles/{role}/children", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update access role", - "path" : "/v1/roles/{role}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get access role relationship", - "path" : "/v1/roles/{role}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "VerneMQ authentication", - "path" : "/v1/authenticate/vernemq", - "method" : "post", - "headers" : [] - } - ] - } - } - ], - "com.fastybird.devices-module" : [ - { - "version" : "*", - "metadata" : { - "exchange" : [ - "fb.exchange.action.device", - "fb.exchange.action.device.*", - "fb.exchange.action.channel", - "fb.exchange.action.channel.*", - "fb.exchange.action.connector", - "fb.exchange.action.connector.*" - ], - "routes" : [ - { - "name" : "Get devices", - "path" : "/v1/devices", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device", - "path" : "/v1/devices/{device}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create device", - "path" : "/v1/devices", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update device", - "path" : "/v1/devices/{device}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device relationship", - "path" : "/v1/devices/{device}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device children", - "path" : "/v1/devices/{device}/children", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device properties", - "path" : "/v1/devices/{device}/properties", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device property", - "path" : "/v1/devices/{device}/properties/{property}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device property relationship", - "path" : "/v1/devices/{device}/properties/{property}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device channels", - "path" : "/v1/devices/{device}/channels", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device channel", - "path" : "/v1/devices/{device}/channels/{channel}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update device channel", - "path" : "/v1/devices/{device}/channels/{channel}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device channel relationship", - "path" : "/v1/devices/{device}/channels/{channel}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device channel properties", - "path" : "/v1/devices/{device}/channels/{channel}/properties", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device channel property", - "path" : "/v1/devices/{device}/channels/{channel}/properties/{property}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get device channel property relationship", - "path" : "/v1/devices/{device}/channels/{channel}/properties/{property}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - } - ] - } - } - ], - "com.fastybird.triggers-module" : [ - { - "version" : "*", - "metadata" : { - "exchange" : [ - "fb.exchange.module.document.deleted.channel", - "fb.exchange.module.document.*.channel.property", - "fb.exchange.module.document.deleted.device", - "fb.exchange.module.document.*.device.property" - ], - "routes" : [ - { - "name" : "Get triggers", - "path" : "/v1/triggers", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger", - "path" : "/v1/triggers/{trigger}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create trigger", - "path" : "/v1/triggers", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update trigger", - "path" : "/v1/triggers/{trigger}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete trigger", - "path" : "/v1/triggers/{trigger}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger relationship", - "path" : "/v1/triggers/{trigger}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger actions", - "path" : "/v1/triggers/{trigger}/actions", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger action", - "path" : "/v1/triggers/{trigger}/actions/{action}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create trigger action", - "path" : "/v1/triggers/{trigger}/actions", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update trigger action", - "path" : "/v1/triggers/{trigger}/actions/{action}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete trigger action", - "path" : "/v1/triggers/{trigger}/actions/{action}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger action relationship", - "path" : "/v1/triggers/{trigger}/actions/{action}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger notifications", - "path" : "/v1/triggers/{trigger}/notifications", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger notification", - "path" : "/v1/triggers/{trigger}/notifications/{notification}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create trigger notification", - "path" : "/v1/triggers/{trigger}/notifications", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update trigger notification", - "path" : "/v1/triggers/{trigger}/notifications/{notification}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete trigger notification", - "path" : "/v1/triggers/{trigger}/notifications/{notification}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger notification relationship", - "path" : "/v1/triggers/{trigger}/notifications/{notification}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger conditions", - "path" : "/v1/triggers/{trigger}/conditions", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger condition", - "path" : "/v1/triggers/{trigger}/conditions/{condition}", - "method" : "get", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Create trigger condition", - "path" : "/v1/triggers/{trigger}/conditions", - "method" : "post", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Update trigger condition", - "path" : "/v1/triggers/{trigger}/conditions/{condition}", - "method" : "patch", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Delete trigger condition", - "path" : "/v1/triggers/{trigger}/conditions/{condition}", - "method" : "delete", - "headers" : [ - "authorization" - ] - }, - { - "name" : "Get trigger condition relationship", - "path" : "/v1/triggers/{trigger}/conditions/{condition}/relationships/{relation}", - "method" : "get", - "headers" : [ - "authorization" - ] - } - ] - } - } - ], - "com.fastybird.ui-module" : [ - { - "version" : "*", - "metadata" : { - "exchange" : [ - "fb.exchange.module.document.*.device", - "fb.exchange.module.document.*.device.*", - "fb.exchange.module.document.*.channel", - "fb.exchange.module.document.*.channel.*", - "fb.exchange.module.document.*.account", - "fb.exchange.module.document.*.email", - "fb.exchange.module.document.*.identity", - "fb.exchange.module.document.*.trigger", - "fb.exchange.module.document.*.trigger.*" - ] - } - } - ] - }, - "plugins" : { - }, - "connectors" : { - } -} diff --git a/src/FastyBird/Library/Metadata/resources/schemas/application.json b/src/FastyBird/Library/Metadata/resources/schemas/application.json deleted file mode 100644 index 14d63c4d1..000000000 --- a/src/FastyBird/Library/Metadata/resources/schemas/application.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "$schema" : "https://json-schema.org/draft/2020-12/schema", - "type" : "object", - "properties" : { - "modules" : { - "type" : "object", - "additionalProperties" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "object", - "properties" : { - "version" : { - "type" : "string", - "description" : "Module version definition" - }, - "metadata" : { - "type" : "object", - "properties" : { - "exchange" : { - "type" : "array", - "description" : "Module exchange routing keys", - "uniqueItems" : true, - "items" : { - "type" : "string" - } - }, - "routes" : { - "type" : "array", - "description" : "Module api routes", - "uniqueItems" : true, - "items" : { - "type" : "object", - "properties" : { - "name" : { - "type" : "string" - }, - "path" : { - "type" : "string" - }, - "method" : { - "type" : "string", - "enum" : [ - "get", - "post", - "patch", - "delete" - ] - }, - "headers" : { - "type" : "array", - "description" : "API call required headers", - "uniqueItems" : true, - "items" : { - "type" : "string" - } - } - } - } - } - } - } - }, - "required" : [ - "version", - "metadata" - ] - } - } - }, - "plugins" : { - "type" : "object", - "additionalProperties" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "object", - "properties" : { - "version" : { - "type" : "string", - "description" : "Plugin version definition" - } - } - } - } - }, - "connectors" : { - "type" : "object", - "additionalProperties" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "object", - "properties" : { - "version" : { - "type" : "string", - "description" : "Connector version definition" - } - } - } - } - } - }, - "required" : [ - "modules", - "plugins", - "connectors" - ] -} diff --git a/src/FastyBird/Library/Metadata/src/Constants.php b/src/FastyBird/Library/Metadata/src/Constants.php index 450c9ec7d..26c791fab 100644 --- a/src/FastyBird/Library/Metadata/src/Constants.php +++ b/src/FastyBird/Library/Metadata/src/Constants.php @@ -26,8 +26,6 @@ final class Constants { - public const RESOURCES_FOLDER = __DIR__ . '/../resources'; - public const EXCHANGE_CHANNEL_NAME = 'fb_exchange'; public const VALUE_NOT_SET = 'N/A'; diff --git a/src/FastyBird/Library/Metadata/src/DI/MetadataExtension.php b/src/FastyBird/Library/Metadata/src/DI/MetadataExtension.php deleted file mode 100644 index 9e65adeea..000000000 --- a/src/FastyBird/Library/Metadata/src/DI/MetadataExtension.php +++ /dev/null @@ -1,131 +0,0 @@ - - * @package FastyBird:MetadataLibrary! - * @subpackage DI - * @since 1.0.0 - * - * @date 24.06.20 - */ - -namespace FastyBird\Library\Metadata\DI; - -use FastyBird\Library\Application\Boot as ApplicationBoot; -use FastyBird\Library\Metadata\Documents; -use FastyBird\Library\Metadata\Exceptions; -use FastyBird\Library\Metadata\Schemas; -use Nette\Bootstrap; -use Nette\Caching; -use Nette\DI; -use Nette\Schema; -use stdClass; -use function array_values; -use function assert; -use function is_dir; -use function sprintf; - -/** - * Metadata extension container - * - * @package FastyBird:MetadataLibrary! - * @subpackage DI - * - * @author Adam Kadlec - */ -class MetadataExtension extends DI\CompilerExtension -{ - - public const DRIVER_TAG = 'fastybird.metadata.attribute.driver'; - - public static function register( - ApplicationBoot\Configurator $config, - string $extensionName = 'fbMetadataLibrary', - ): void - { - $config->onCompile[] = static function ( - Bootstrap\Configurator $config, - DI\Compiler $compiler, - ) use ($extensionName): void { - $compiler->addExtension($extensionName, new self()); - }; - } - - public function getConfigSchema(): Schema\Schema - { - return Schema\Expect::structure([ - 'documents' => Schema\Expect::structure([ - 'mapping' => Schema\Expect::arrayOf(Schema\Expect::string(), Schema\Expect::string())->required(), - 'excludePaths' => Schema\Expect::arrayOf(Schema\Expect::string(), Schema\Expect::string()), - ]), - ]); - } - - /** - * @throws Exceptions\InvalidState - */ - public function loadConfiguration(): void - { - $builder = $this->getContainerBuilder(); - $configuration = $this->getConfig(); - assert($configuration instanceof stdClass); - - $builder->addDefinition('schema.validator', new DI\Definitions\ServiceDefinition()) - ->setType(Schemas\Validator::class); - - /** - * DOCUMENTS SERVICES - */ - - $metadataCache = $builder->addDefinition( - $this->prefix('document.cache'), - new DI\Definitions\ServiceDefinition(), - ) - ->setType(Caching\Cache::class) - ->setArguments([ - 'namespace' => 'metadata_class_metadata', - ]) - ->setAutowired(false); - - $builder->addDefinition('document.factory', new DI\Definitions\ServiceDefinition()) - ->setType(Documents\DocumentFactory::class); - - $attributeDriver = $builder->addDefinition( - 'document.mapping.attributeDriver', - new DI\Definitions\ServiceDefinition(), - ) - ->setType(Documents\Mapping\Driver\AttributeDriver::class) - ->setArguments([ - 'paths' => array_values($configuration->documents->mapping), - ]) - ->addSetup('addExcludePaths', [$configuration->documents->excludePaths]) - ->addTag(self::DRIVER_TAG) - ->setAutowired(false); - - $mappingDriver = $builder->addDefinition( - 'document.mapping.mappingDriver', - new DI\Definitions\ServiceDefinition(), - ) - ->setType(Documents\Mapping\Driver\MappingDriverChain::class); - - $builder->addDefinition('document.mapping.classMetadataFactory', new DI\Definitions\ServiceDefinition()) - ->setType(Documents\Mapping\ClassMetadataFactory::class) - ->setArguments([ - 'driver' => $mappingDriver, - 'cache' => $metadataCache, - ]); - - foreach ($configuration->documents->mapping as $namespace => $path) { - if (!is_dir($path)) { - throw new Exceptions\InvalidState(sprintf('Given mapping path "%s" does not exist', $path)); - } - - $mappingDriver->addSetup('addDriver', [$attributeDriver, $namespace]); - } - } - -} diff --git a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidArgument.php b/src/FastyBird/Library/Metadata/src/Exceptions/InvalidArgument.php deleted file mode 100644 index 74bb20668..000000000 --- a/src/FastyBird/Library/Metadata/src/Exceptions/InvalidArgument.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @package FastyBird:MetadataLibrary! - * @subpackage Exceptions - * @since 1.0.0 - * - * @date 19.12.20 - */ - -namespace FastyBird\Library\Metadata\Exceptions; - -use InvalidArgumentException as PHPInvalidArgumentException; - -class InvalidArgument extends PHPInvalidArgumentException implements Exception -{ - -} diff --git a/src/FastyBird/Library/Metadata/tests/cases/unit/BaseTestCase.php b/src/FastyBird/Library/Metadata/tests/cases/unit/BaseTestCase.php deleted file mode 100644 index 80371b550..000000000 --- a/src/FastyBird/Library/Metadata/tests/cases/unit/BaseTestCase.php +++ /dev/null @@ -1,86 +0,0 @@ -container = $this->createContainer(); - } - - /** - * @throws ApplicationExceptions\InvalidArgument - * @throws ApplicationExceptions\InvalidState - * @throws Error - */ - protected function createContainer(string|null $additionalConfig = null): Nette\DI\Container - { - $rootDir = __DIR__ . '/../..'; - $vendorDir = defined('FB_VENDOR_DIR') ? constant('FB_VENDOR_DIR') : $rootDir . '/../vendor'; - - $config = ApplicationBoot\Bootstrap::boot(); - $config->setForceReloadContainer(); - $config->setTempDirectory(FB_TEMP_DIR); - - $config->addStaticParameters( - ['container' => ['class' => 'SystemContainer_' . getmypid() . md5((string) time())]], - ); - $config->addStaticParameters(['appDir' => $rootDir, 'wwwDir' => $rootDir, 'vendorDir' => $vendorDir]); - - $config->addConfig(__DIR__ . '/../../common.neon'); - - if ($additionalConfig !== null && file_exists($additionalConfig)) { - $config->addConfig($additionalConfig); - } - - $config->setTimeZone('Europe/Prague'); - - Metadata\DI\MetadataExtension::register($config); - - return $config->createContainer(); - } - - protected function mockContainerService( - string $serviceType, - object $serviceMock, - ): void - { - $foundServiceNames = $this->container->findByType($serviceType); - - foreach ($foundServiceNames as $serviceName) { - $this->replaceContainerService($serviceName, $serviceMock); - } - } - - private function replaceContainerService(string $serviceName, object $service): void - { - $this->container->removeService($serviceName); - $this->container->addService($serviceName, $service); - } - -} diff --git a/src/FastyBird/Library/Metadata/tests/cases/unit/Common/ConstantsTest.php b/src/FastyBird/Library/Metadata/tests/cases/unit/Common/ConstantsTest.php index 18602c184..c4439e050 100644 --- a/src/FastyBird/Library/Metadata/tests/cases/unit/Common/ConstantsTest.php +++ b/src/FastyBird/Library/Metadata/tests/cases/unit/Common/ConstantsTest.php @@ -3,10 +3,10 @@ namespace FastyBird\Library\Metadata\Tests\Cases\Unit\Common; use FastyBird\Library\Metadata; -use FastyBird\Library\Metadata\Tests; +use PHPUnit\Framework\TestCase; use function preg_match; -final class ConstantsTest extends Tests\Cases\Unit\BaseTestCase +final class ConstantsTest extends TestCase { public function testValueFormatStringEnum(): void diff --git a/src/FastyBird/Library/Metadata/tests/cases/unit/DI/MetadataExtensionTest.php b/src/FastyBird/Library/Metadata/tests/cases/unit/DI/MetadataExtensionTest.php deleted file mode 100644 index dc768fec4..000000000 --- a/src/FastyBird/Library/Metadata/tests/cases/unit/DI/MetadataExtensionTest.php +++ /dev/null @@ -1,23 +0,0 @@ -container->getByType(Documents\DocumentFactory::class, false)); - - self::assertNotNull($this->container->getByType(Schemas\Validator::class, false)); - } - -} diff --git a/src/FastyBird/Library/Metadata/tests/common.neon b/src/FastyBird/Library/Metadata/tests/common.neon deleted file mode 100644 index 591573308..000000000 --- a/src/FastyBird/Library/Metadata/tests/common.neon +++ /dev/null @@ -1,24 +0,0 @@ -# -# Library DI configuration -# -# @license More in LICENSE.md -# @copyright https://www.fastybird.com -# @author Adam Kadlec -# @package FastyBird:MetadataLibrary! -# @subpackage config -# @since 1.0.0 -# -# @date 04.06.22 - -php: - date.timezone: Europe/Prague - -extensions: - ipubPhone : IPub\Phone\DI\PhoneExtension - contributteEvents : Contributte\EventDispatcher\DI\EventDispatcherExtension - -fbMetadataLibrary: - documents: - mapping: [ - FastyBird\Library\Metadata\Tests\Fixtures\Dummy: %appDir%/fixtures/dummy - ] diff --git a/src/FastyBird/Library/Metadata/tests/fixtures/dummy/DummyOneDocument.php b/src/FastyBird/Library/Metadata/tests/fixtures/dummy/DummyOneDocument.php deleted file mode 100644 index 5b6e2c379..000000000 --- a/src/FastyBird/Library/Metadata/tests/fixtures/dummy/DummyOneDocument.php +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/src/FastyBird/Library/Metadata/tsconfig.json b/src/FastyBird/Library/Metadata/tsconfig.json index 14be4309c..7a7ab55d9 100644 --- a/src/FastyBird/Library/Metadata/tsconfig.json +++ b/src/FastyBird/Library/Metadata/tsconfig.json @@ -14,19 +14,14 @@ "allowSyntheticDefaultImports": true, "sourceMap": true, "baseUrl": "assets", + "skipLibCheck": true, "types": [ "node" ], - "paths": { - "@/*": [ - "*" - ] - }, "lib": [ "esnext", "dom", - "dom.iterable", - "scripthost" + "dom.iterable" ] }, "include": [ diff --git a/src/FastyBird/Library/Metadata/vite.config.ts b/src/FastyBird/Library/Metadata/vite.config.ts index 0fda6b466..e2f2ccf34 100644 --- a/src/FastyBird/Library/Metadata/vite.config.ts +++ b/src/FastyBird/Library/Metadata/vite.config.ts @@ -1,26 +1,21 @@ import { resolve } from 'path'; import { defineConfig } from 'vite'; -import vue from '@vitejs/plugin-vue'; -import eslint from '@nabla/vite-plugin-eslint'; import dts from 'vite-plugin-dts'; import del from 'rollup-plugin-delete'; +import eslint from '@nabla/vite-plugin-eslint'; + // https://vitejs.dev/config/ export default defineConfig({ plugins: [ - vue(), eslint(), dts({ outDir: 'dist', staticImport: true, insertTypesEntry: true, + rollupTypes: true, }), ], - resolve: { - alias: { - '@': resolve(__dirname, './assets'), - }, - }, build: { lib: { entry: resolve(__dirname, './assets/entry.ts'), @@ -35,14 +30,6 @@ export default defineConfig({ hook: 'generateBundle', }), ], - external: ['vue'], - output: { - // Provide global variables to use in the UMD build - // for externalized deps - globals: { - vue: 'Vue', - }, - }, }, sourcemap: true, target: 'esnext', diff --git a/src/FastyBird/Library/Tools/.editorconfig b/src/FastyBird/Library/Tools/.editorconfig deleted file mode 100644 index e60c66682..000000000 --- a/src/FastyBird/Library/Tools/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -# EditorConfig is awesome: http://EditorConfig.org - -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -indent_style = space -indent_size = 4 -tab_width = 4 -max_line_length = 150 - -[{*.json,*.yml,*.yaml,*.md}] -indent_style = space -indent_size = 2 diff --git a/src/FastyBird/Library/Tools/.gitattributes b/src/FastyBird/Library/Tools/.gitattributes deleted file mode 100644 index 646311297..000000000 --- a/src/FastyBird/Library/Tools/.gitattributes +++ /dev/null @@ -1,9 +0,0 @@ -# Not archived -/.github export-ignore -/docs export-ignore -/tests export-ignore -/tools export-ignore -.editorconfig export-ignore -.gitattributes export-ignore -.gitignore export-ignore -Makefile export-ignore diff --git a/src/FastyBird/Library/Tools/.gitignore b/src/FastyBird/Library/Tools/.gitignore deleted file mode 100644 index f8573dfe8..000000000 --- a/src/FastyBird/Library/Tools/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.idea -/vendor -/var -composer.lock -.DS_Store diff --git a/src/FastyBird/Library/Tools/LICENSE.md b/src/FastyBird/Library/Tools/LICENSE.md deleted file mode 100644 index 9c8f3ea08..000000000 --- a/src/FastyBird/Library/Tools/LICENSE.md +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/src/FastyBird/Library/Tools/Makefile b/src/FastyBird/Library/Tools/Makefile deleted file mode 100644 index 29a3e7268..000000000 --- a/src/FastyBird/Library/Tools/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -_: list - -# Config - -PHPCS_CONFIG=tools/phpcs.xml -PHPSTAN_SRC_CONFIG=tools/phpstan.src.neon -PHPSTAN_TESTS_CONFIG=tools/phpstan.tests.neon -PHPUNIT_CONFIG=tools/phpunit.xml -INFECTION_CONFIG=tools/infection.json - -# QA - -qa: ## Check code quality - coding style and static analysis - make cs & make phpstan - -cs: ## Check PHP files coding style - mkdir -p var/tools/PHP_CodeSniffer - $(PRE_PHP) "vendor/bin/phpcs" src tests --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS) - -csf: ## Fix PHP files coding style - mkdir -p var/tools/PHP_CodeSniffer - $(PRE_PHP) "vendor/bin/phpcbf" src tests --standard=$(PHPCS_CONFIG) --parallel=$(LOGICAL_CORES) $(ARGS) - -lint: - $(PRE_PHP) "vendor/bin/parallel-lint" src tests --exclude .git --exclude vendor - -phpstan: ## Analyse code with PHPStan - mkdir -p var/tools - $(PRE_PHP) "vendor/bin/phpstan" analyse -c $(PHPSTAN_SRC_CONFIG) $(ARGS) - $(PRE_PHP) "vendor/bin/phpstan" analyse -c $(PHPSTAN_TESTS_CONFIG) $(ARGS) - -# Tests - -.PHONY: tests -tests: ## Run all tests - $(PRE_PHP) $(PARATEST_COMMAND) $(ARGS) - -tests-simple: ## Run all tests - $(PRE_PHP) $(PHPUNIT_COMMAND) $(ARGS) - -coverage-clover: ## Generate code coverage in XML format - $(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-clover=var/coverage/clover.xml $(ARGS) - -coverage-html: ## Generate code coverage in HTML format - $(PRE_PHP) $(PHPUNIT_COVERAGE) --coverage-html=var/coverage/html $(ARGS) - -mutations: ## Check code for mutants - make mutations-tests - make mutations-infection - -mutations-tests: - mkdir -p var/coverage - $(PRE_PHP) $(PHPUNIT_MUTATIONS) --coverage-xml=var/coverage/xml --log-junit=var/coverage/junit.xml - -mutations-infection: - $(PRE_PHP) vendor/bin/infection \ - --configuration=$(INFECTION_CONFIG) \ - --threads=$(LOGICAL_CORES) \ - --coverage=../var/coverage \ - --skip-initial-tests \ - $(ARGS) - -# Utilities - -.SILENT: $(shell grep -h -E '^[a-zA-Z_-]+:.*?$$' $(MAKEFILE_LIST) | sort -u | awk 'BEGIN {FS = ":.*?"}; {printf "%s ", $$1}') - -LIST_PAD=20 -list: - awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m\033[0m\n\nTargets:\n"}' - grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -u | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-$(LIST_PAD)s\033[0m %s\n", $$1, $$2}' - -PRE_PHP=XDEBUG_MODE=off - -PARATEST_COMMAND="vendor/bin/paratest" -c $(PHPUNIT_CONFIG) --runner=WrapperRunner -p$(LOGICAL_CORES) -PHPUNIT_COMMAND="vendor/bin/phpunit" -c $(PHPUNIT_CONFIG) -PHPUNIT_COVERAGE=php -d pcov.enabled=1 -d pcov.directory=./src $(PARATEST_COMMAND) -PHPUNIT_MUTATIONS=php -d pcov.enabled=1 -d pcov.directory=./src $(PARATEST_COMMAND) - -LOGICAL_CORES=$(shell nproc || sysctl -n hw.logicalcpu || echo 4) \ No newline at end of file diff --git a/src/FastyBird/Library/Tools/tools/.coveralls.yml b/src/FastyBird/Library/Tools/tools/.coveralls.yml deleted file mode 100644 index 1448fe653..000000000 --- a/src/FastyBird/Library/Tools/tools/.coveralls.yml +++ /dev/null @@ -1,4 +0,0 @@ -# for php-coveralls -service_name : github-ci -coverage_clover: var/coverage/clover.xml -json_path: var/coverage/coveralls-upload.json \ No newline at end of file diff --git a/src/FastyBird/Library/Tools/tools/infection.json b/src/FastyBird/Library/Tools/tools/infection.json deleted file mode 100644 index 3b8dbe8fa..000000000 --- a/src/FastyBird/Library/Tools/tools/infection.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "../vendor/infection/infection/resources/schema.json", - "source": { - "directories": [ - "src" - ] - }, - "logs": { - "html": "../var/coverage/mutations/infection.html", - "text": "../var/coverage/mutations/infection.log", - "stryker": { - "report": "main" - } - }, - "tmpDir": "../var/tools/Infection", - "mutators": { - "@default": true - } -} \ No newline at end of file diff --git a/src/FastyBird/Library/Tools/tools/phpstan.base.neon b/src/FastyBird/Library/Tools/tools/phpstan.base.neon deleted file mode 100644 index 797ec8c39..000000000 --- a/src/FastyBird/Library/Tools/tools/phpstan.base.neon +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - tmpDir: ../var/tools/PHPStan - - exceptions: - check: - missingCheckedExceptionInThrows: true - tooWideThrowType: true - - checkMissingCallableSignature: true - checkTooWideReturnTypesInProtectedAndPublicMethods: true - checkInternalClassCaseSensitivity: true diff --git a/src/FastyBird/Library/Tools/tools/phpstan.config.tests.neon b/src/FastyBird/Library/Tools/tools/phpstan.config.tests.neon deleted file mode 100644 index f98956243..000000000 --- a/src/FastyBird/Library/Tools/tools/phpstan.config.tests.neon +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - level: max - - paths: - - ../tests/cases/ - - bootstrapFiles: - - phpstan-bootstrap.php - - scanDirectories: - - ../src diff --git a/src/FastyBird/Library/Tools/tools/phpstan.src.neon b/src/FastyBird/Library/Tools/tools/phpstan.src.neon deleted file mode 100644 index be4166927..000000000 --- a/src/FastyBird/Library/Tools/tools/phpstan.src.neon +++ /dev/null @@ -1,6 +0,0 @@ -includes: - - phpstan.base.neon - - phpstan.config.src.neon - -parameters: - resultCachePath: %currentWorkingDirectory%/var/tools/PHPStan/resultCache.src.php diff --git a/src/FastyBird/Library/Tools/tools/phpstan.tests.neon b/src/FastyBird/Library/Tools/tools/phpstan.tests.neon deleted file mode 100644 index 9f5a95a0c..000000000 --- a/src/FastyBird/Library/Tools/tools/phpstan.tests.neon +++ /dev/null @@ -1,6 +0,0 @@ -includes: - - phpstan.base.neon - - phpstan.config.tests.neon - -parameters: - resultCachePath: %currentWorkingDirectory%/var/tools/PHPStan/resultCache.tests.php diff --git a/src/FastyBird/Library/Tools/tools/phpunit.xml b/src/FastyBird/Library/Tools/tools/phpunit.xml deleted file mode 100644 index 0c8433e1b..000000000 --- a/src/FastyBird/Library/Tools/tools/phpunit.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - ../tests/cases/ - - - - - ../src - - - diff --git a/src/FastyBird/Library/WebUi/docs/package.json b/src/FastyBird/Library/WebUi/docs/package.json index c535f18d5..338873756 100644 --- a/src/FastyBird/Library/WebUi/docs/package.json +++ b/src/FastyBird/Library/WebUi/docs/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/web-ui-docs", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "description": "Documentation for FastyBird IoT application theme", "bugs": "https://github.com/FastyBird/fastybird#issues", "license": "Apache-2.0", @@ -25,47 +25,47 @@ "pretty:write": "prettier src --write" }, "dependencies": { - "@fastybird/web-ui-components": "1.0.0-dev.23", - "@fastybird/web-ui-icons": "1.0.0-dev.23", - "@fastybird/web-ui-theme-chalk": "1.0.0-dev.23", - "element-plus": "^2.7" + "@fastybird/web-ui-components": "1.0.0-dev.24", + "@fastybird/web-ui-icons": "1.0.0-dev.24", + "@fastybird/web-ui-theme-chalk": "1.0.0-dev.24", + "element-plus": "^2.8" }, "devDependencies": { - "@chromatic-com/storybook": "^1.2", - "@eslint/js": "^9.1", - "@storybook/addon-a11y": "^8.0", - "@storybook/addon-actions": "^8.0", - "@storybook/addon-docs": "^8.0", - "@storybook/addon-essentials": "^8.0", - "@storybook/addon-interactions": "^8.0", - "@storybook/addon-links": "^8.0", - "@storybook/blocks": "^8.0", + "@chromatic-com/storybook": "^3.2", + "@eslint/js": "^9.15", + "@storybook/addon-a11y": "^8.4", + "@storybook/addon-actions": "^8.4", + "@storybook/addon-docs": "^8.4", + "@storybook/addon-essentials": "^8.4", + "@storybook/addon-interactions": "^8.4", + "@storybook/addon-links": "^8.4", + "@storybook/blocks": "^8.4", "@storybook/storybook-deployer": "^2.8", - "@storybook/manager-api": "^8.0", - "@storybook/test": "^8.0", - "@storybook/vue3": "^8.0", - "@storybook/vue3-vite": "^8.0", - "@typescript-eslint/eslint-plugin": "^7.8", - "@typescript-eslint/parser": "^7.8", - "@vitejs/plugin-vue": "^5.0", - "@vue/eslint-config-prettier": "^9.0", - "@vue/eslint-config-typescript": "^13.0", - "eslint": "^9.1", + "@storybook/manager-api": "^8.4", + "@storybook/test": "^8.4", + "@storybook/vue3": "^8.4", + "@storybook/vue3-vite": "^8.4", + "@typescript-eslint/eslint-plugin": "^8.15", + "@typescript-eslint/parser": "^8.15", + "@vitejs/plugin-vue": "^5.2", + "@vue/eslint-config-prettier": "^10.1", + "@vue/eslint-config-typescript": "^14.1", + "eslint": "^9.15", "eslint-config-prettier": "^9.1", - "eslint-plugin-prettier": "^5.1", - "eslint-plugin-vue": "^9.25", - "prettier": "^3.2", + "eslint-plugin-prettier": "^5.2", + "eslint-plugin-vue": "^9.31", + "prettier": "^3.3", "remark-gfm": "^4.0", - "rimraf": "^5.0", - "sass": "^1.76", - "sass-loader": "^14.2", - "storybook": "^8.0", + "rimraf": "^6.0", + "sass": "^1.81", + "sass-loader": "^16.0", + "storybook": "^8.4", "storybook-dark-mode": "^4.0", - "typescript": "^5.4", - "typescript-eslint": "^7.8", - "vite": "^5.2", - "vue-component-meta": "^2.0", - "vue-tsc": "^2.0", + "typescript": "5.6.2", + "typescript-eslint": "^8.15", + "vite": "^5.4", + "vue-component-meta": "^2.1", + "vue-tsc": "^2.1", "vite-svg-loader": "^5.1" } } diff --git a/src/FastyBird/Library/WebUi/docs/src/stories/intro.mdx b/src/FastyBird/Library/WebUi/docs/src/stories/intro.mdx index e12ebedc5..6f48ce808 100644 --- a/src/FastyBird/Library/WebUi/docs/src/stories/intro.mdx +++ b/src/FastyBird/Library/WebUi/docs/src/stories/intro.mdx @@ -15,5 +15,5 @@ yarn add @fastybird/web-ui-library Import the FastyBird UI main style sheet in your application: ``` -@import "~@fastybird/web-ui-library/web-ui-library.css"; +@use "~@fastybird/web-ui-library/web-ui-library.css"; ``` diff --git a/src/FastyBird/Library/WebUi/lerna.json b/src/FastyBird/Library/WebUi/lerna.json index 7d7b195ec..126c01b66 100644 --- a/src/FastyBird/Library/WebUi/lerna.json +++ b/src/FastyBird/Library/WebUi/lerna.json @@ -1,7 +1,7 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "npmClient": "yarn", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "command": { "version": { "allowBranch": "main", diff --git a/src/FastyBird/Library/WebUi/package.json b/src/FastyBird/Library/WebUi/package.json index c866fed7e..84b1a3fe1 100644 --- a/src/FastyBird/Library/WebUi/package.json +++ b/src/FastyBird/Library/WebUi/package.json @@ -1,7 +1,7 @@ { "name": "@fastybird/web-ui", "private": true, - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "description": "FastyBird IoT application theme library", "keywords": [ "fastybird", diff --git a/src/FastyBird/Library/WebUi/packages/components/package.json b/src/FastyBird/Library/WebUi/packages/components/package.json index 446d54ba0..b3da49b70 100644 --- a/src/FastyBird/Library/WebUi/packages/components/package.json +++ b/src/FastyBird/Library/WebUi/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/web-ui-components", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FastyBird IoT application UI components", "homepage": "https://www.fastybird.com", @@ -42,9 +42,9 @@ "dependencies": { "@ctrl/tinycolor": "^4.0", "@element-plus/icons-vue": "^2.3", - "@fastybird/web-ui-icons": "1.0.0-dev.23", - "@fastybird/web-ui-theme-chalk": "1.0.0-dev.23", - "@fastybird/web-ui-utils": "1.0.0-dev.23", + "@fastybird/web-ui-icons": "1.0.0-dev.24", + "@fastybird/web-ui-theme-chalk": "1.0.0-dev.24", + "@fastybird/web-ui-utils": "1.0.0-dev.24", "@popperjs/core": "^2.11", "@vueuse/core": "^10.9", "async-validator": "^4.2", @@ -70,7 +70,7 @@ "prettier": "^3.2", "rimraf": "^5.0", "rollup-plugin-delete": "^2.0", - "typescript": "^5.4", + "typescript": "5.6.2", "typescript-eslint": "^7.8", "vite": "^5.2", "vite-plugin-dts": "^3.9", diff --git a/src/FastyBird/Library/WebUi/packages/icons/package.json b/src/FastyBird/Library/WebUi/packages/icons/package.json index ea59cbcef..4084a1131 100644 --- a/src/FastyBird/Library/WebUi/packages/icons/package.json +++ b/src/FastyBird/Library/WebUi/packages/icons/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/web-ui-icons", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FontAwesome icons for FastyBird IoT application theme", "keywords": [ @@ -86,7 +86,7 @@ "prettier": "^3.2", "svgo": "^3.2", "tsx": "^4.9", - "typescript": "^5.4", + "typescript": "5.6.2", "typescript-eslint": "^7.8", "unplugin-vue": "^5.0", "url": "^0.11", diff --git a/src/FastyBird/Library/WebUi/packages/theme-chalk/package.json b/src/FastyBird/Library/WebUi/packages/theme-chalk/package.json index 9f56ab2d5..dda6cc005 100644 --- a/src/FastyBird/Library/WebUi/packages/theme-chalk/package.json +++ b/src/FastyBird/Library/WebUi/packages/theme-chalk/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/web-ui-theme-chalk", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FastyBird IoT application UI components chalk theme", "keywords": [ diff --git a/src/FastyBird/Library/WebUi/packages/utils/package.json b/src/FastyBird/Library/WebUi/packages/utils/package.json index 7d00bce39..694b20eea 100644 --- a/src/FastyBird/Library/WebUi/packages/utils/package.json +++ b/src/FastyBird/Library/WebUi/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/web-ui-utils", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FastyBird IoT application UI utilities", "homepage": "https://www.fastybird.com", @@ -60,7 +60,7 @@ "prettier": "^3.2", "rimraf": "^5.0", "rollup-plugin-delete": "^2.0", - "typescript": "^5.4", + "typescript": "5.6.2", "typescript-eslint": "^7.8", "type-fest": "^4.18", "vite": "^5.2", diff --git a/src/FastyBird/Library/WebUi/web-ui-library/package.json b/src/FastyBird/Library/WebUi/web-ui-library/package.json index 5693e9958..eb708c58f 100644 --- a/src/FastyBird/Library/WebUi/web-ui-library/package.json +++ b/src/FastyBird/Library/WebUi/web-ui-library/package.json @@ -1,6 +1,6 @@ { "name": "@fastybird/web-ui-library", - "version": "1.0.0-dev.23", + "version": "1.0.0-dev.24", "type": "module", "description": "FastyBird IoT application UI components & utilities", "homepage": "https://www.fastybird.com", @@ -40,7 +40,7 @@ }, "dependencies": { "@ctrl/tinycolor": "^4.0", - "@fastybird/web-ui-theme-chalk": "1.0.0-dev.23", + "@fastybird/web-ui-theme-chalk": "1.0.0-dev.24", "@popperjs/core": "^2.11", "@vueuse/core": "^10.9", "async-validator": "^4.2", @@ -51,9 +51,9 @@ }, "devDependencies": { "@eslint/js": "^9.1", - "@fastybird/web-ui-components": "1.0.0-dev.23", - "@fastybird/web-ui-icons": "1.0.0-dev.23", - "@fastybird/web-ui-theme-chalk": "1.0.0-dev.23", + "@fastybird/web-ui-components": "1.0.0-dev.24", + "@fastybird/web-ui-icons": "1.0.0-dev.24", + "@fastybird/web-ui-theme-chalk": "1.0.0-dev.24", "@nabla/vite-plugin-eslint": "^2.0", "@types/lodash": "^4.17", "@types/node": "^20.12", @@ -72,7 +72,7 @@ "rollup-plugin-delete": "^2.0", "tsx": "^4.9", "type-fest": "^4.18", - "typescript": "^5.4", + "typescript": "5.6.2", "typescript-eslint": "^7.8", "vite": "^5.2", "vite-plugin-dts": "^3.9", diff --git a/src/FastyBird/Module/Accounts/.prettierrc b/src/FastyBird/Module/Accounts/.prettierrc deleted file mode 100644 index c579f3b24..000000000 --- a/src/FastyBird/Module/Accounts/.prettierrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "printWidth": 150, - "tabWidth": 2, - "useTabs": true, - "semi": true, - "singleQuote": true, - "quoteProps": "as-needed", - "jsxSingleQuote": false, - "trailingComma": "es5", - "bracketSpacing": true, - "arrowParens": "always", - "requirePragma": false, - "insertPragma": false, - "proseWrap": "preserve", - "htmlWhitespaceSensitivity": "css", - "vueIndentScriptAndStyle": false, - "endOfLine": "auto", - "singleAttributePerLine": true -} diff --git a/src/FastyBird/Module/Accounts/.stylelintrc.json b/src/FastyBird/Module/Accounts/.stylelintrc.json index 5821ace8c..c598b289b 100644 --- a/src/FastyBird/Module/Accounts/.stylelintrc.json +++ b/src/FastyBird/Module/Accounts/.stylelintrc.json @@ -12,6 +12,12 @@ "at-rule-no-unknown": null, "scss/at-rule-no-unknown": true, "no-empty-source": null, - "prettier/prettier": [true, {"singleQuote": true, "tabWidth": 2}] + "prettier/prettier": [true, {"singleQuote": true, "tabWidth": 2}], + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": ["deep"] + } + ] } } diff --git a/src/FastyBird/Module/Accounts/assets/components/layout/sign-box.vue b/src/FastyBird/Module/Accounts/assets/components/layout/sign-box.vue index 0bc2893f3..ec7c02b2e 100644 --- a/src/FastyBird/Module/Accounts/assets/components/layout/sign-box.vue +++ b/src/FastyBird/Module/Accounts/assets/components/layout/sign-box.vue @@ -2,7 +2,7 @@
- {{ t('buttons.signIn.title') }} + + {{ t('accountsModule.buttons.signIn.title') }} + - {{ t('buttons.signUp.title') }} + + {{ t('accountsModule.buttons.signUp.title') }} +
@@ -108,18 +112,18 @@ diff --git a/src/FastyBird/Module/Accounts/assets/components/settings/settings-account-dialog.vue b/src/FastyBird/Module/Accounts/assets/components/settings/settings-account-dialog.vue index b907d0197..cc60c20c3 100644 --- a/src/FastyBird/Module/Accounts/assets/components/settings/settings-account-dialog.vue +++ b/src/FastyBird/Module/Accounts/assets/components/settings/settings-account-dialog.vue @@ -3,19 +3,19 @@ ref="dialogRef" v-model="dialogVisible" :show-close="false" - :fullscreen="isExtraSmallDevice" - :draggable="!isExtraSmallDevice" + :fullscreen="isXSDevice" + :draggable="!isXSDevice" @close="onClose" > @@ -93,12 +95,13 @@ diff --git a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.types.ts b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.types.ts index 64ab0f898..23e3275fd 100644 --- a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.types.ts +++ b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.types.ts @@ -1,4 +1,4 @@ -import { IDebugLog, IBridge, IConnectorData, IConnectorPlugin } from '../../types'; +import { IBridge, IConnectorData, IConnectorPlugin, IDebugLog } from '../../types'; export interface IPluginsPluginStatsProps { plugin: IConnectorPlugin; diff --git a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.vue b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.vue index ba8f4bad2..68b81d6dc 100644 --- a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.vue +++ b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-plugin-stats.vue @@ -205,9 +205,11 @@ diff --git a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.types.ts b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.types.ts index cf67db418..518549214 100644 --- a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.types.ts +++ b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.types.ts @@ -1,4 +1,4 @@ -import { IConnectorPlugin, IConnector } from '../../types'; +import { IConnector, IConnectorPlugin } from '../../types'; export interface IPluginsPreviewInfoProps { items: { plugin: IConnectorPlugin; connectors: IConnector[] }[]; diff --git a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.vue b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.vue index 99246a947..f91e1261d 100644 --- a/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.vue +++ b/src/FastyBird/Module/Devices/assets/components/plugins/plugins-preview-info.vue @@ -91,9 +91,10 @@