From 153f553601fa301c07a6984354a39769846af75d Mon Sep 17 00:00:00 2001 From: Mateusz Matloch Date: Thu, 31 Aug 2023 21:08:41 +0000 Subject: [PATCH] fix(frontend): remove redundant .d.ts files --- .../entities/deviceFeatureTypes.d.ts | 31 -------- .../src/definitions/entities/deviceTypes.d.ts | 67 ---------------- .../entities/eventInstanceTypes.d.ts | 36 --------- .../src/definitions/entities/eventTypes.d.ts | 76 ------------------- .../definitions/entities/sensorDataTypes.d.ts | 5 -- .../src/definitions/entities/userTypes.d.ts | 19 ----- 6 files changed, 234 deletions(-) delete mode 100644 packages/frontend/src/definitions/entities/deviceFeatureTypes.d.ts delete mode 100644 packages/frontend/src/definitions/entities/deviceTypes.d.ts delete mode 100644 packages/frontend/src/definitions/entities/eventInstanceTypes.d.ts delete mode 100644 packages/frontend/src/definitions/entities/eventTypes.d.ts delete mode 100644 packages/frontend/src/definitions/entities/sensorDataTypes.d.ts delete mode 100644 packages/frontend/src/definitions/entities/userTypes.d.ts diff --git a/packages/frontend/src/definitions/entities/deviceFeatureTypes.d.ts b/packages/frontend/src/definitions/entities/deviceFeatureTypes.d.ts deleted file mode 100644 index 848ca1ec..00000000 --- a/packages/frontend/src/definitions/entities/deviceFeatureTypes.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export declare enum DeviceFeatureType { - Numeric = "NUMERIC", - Binary = "BINARY", - Text = "TEXT", - Enum = "ENUM" -} -interface GenericDeviceFeature { - unit: string | null; - description: string; -} -export interface TextDeviceFeature extends GenericDeviceFeature { - type: DeviceFeatureType.Text; -} -export interface NumericDeviceFeature extends GenericDeviceFeature { - type: DeviceFeatureType.Numeric; - valueMin?: number; - valueMax?: number; - valueStep?: number; -} -export interface EnumDeviceFeature extends GenericDeviceFeature { - type: DeviceFeatureType.Enum; - values?: unknown[]; -} -export interface BinaryDeviceFeature extends GenericDeviceFeature { - type: DeviceFeatureType.Binary; - valueOn: unknown; - valueOff: unknown; - valueToggle?: unknown; -} -export type DeviceFeatureEntry = BinaryDeviceFeature | EnumDeviceFeature | NumericDeviceFeature | TextDeviceFeature; -export {}; diff --git a/packages/frontend/src/definitions/entities/deviceTypes.d.ts b/packages/frontend/src/definitions/entities/deviceTypes.d.ts deleted file mode 100644 index 0d5b3f3a..00000000 --- a/packages/frontend/src/definitions/entities/deviceTypes.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { SearchQuery, SearchResponse } from '@definitions/searchTypes'; -import type { GenericEntity } from '../commonTypes'; -import { DeviceFeatureEntry } from './deviceFeatureTypes'; -import type { User } from './userTypes'; -export declare enum DeviceType { - Unknown = "UNKNOWN", - Coordinator = "COORDINATOR", - EndDevice = "END_DEVICE", - Router = "ROUTER", - Virtual = "VIRTUAL" -} -export declare enum DevicePowerSource { - Unknown = "UNKNOWN", - Battery = "BATTERY", - MainsSinglePhase = "MAINS_SINGLE_PHASE", - MainsThreePhase = "MAINS_THREE_PHASE", - EmergencyMains = "EMERGENCY_MAINS", - Dc = "DC", - Virtual = "VIRTUAL" -} -export declare enum DeviceProtocol { - Zigbee = "ZIGBEE", - Virtual = "VIRTUAL" -} -export declare enum DeviceState { - Active = "ACTIVE", - Inactive = "INACTIVE", - Interviewing = "INTERVIEWING", - Error = "ERROR", - New = "NEW" -} -export declare enum DeviceDeactivatedByType { - Bridge = "BRIDGE", - User = "USER" -} -export type DeviceDeactivatedBy = { - type: DeviceDeactivatedByType.Bridge; - name: string; -} | { - type: DeviceDeactivatedByType.User; - userId: number; - _user: User; -}; -interface DeviceFeatureStateEntry { - value: string | number | boolean; - updatedAt: string; -} -type DeviceFeatureState = Record; -type DeviceFeatures = Record; -export interface Device extends GenericEntity { - displayName: string; - model: string; - vendor: string; - manufacturer: string; - description: string; - ieeeAddress: string; - powerSource: DevicePowerSource; - type: DeviceType; - protocol: DeviceProtocol; - state: DeviceState; - deactivatedBy: DeviceDeactivatedBy | null; - features: DeviceFeatures; - featureState: DeviceFeatureState; -} -export type DevicesSearchQuery = SearchQuery; -export type DevicesSearchResponse = SearchResponse; -export {}; diff --git a/packages/frontend/src/definitions/entities/eventInstanceTypes.d.ts b/packages/frontend/src/definitions/entities/eventInstanceTypes.d.ts deleted file mode 100644 index 505fbf8a..00000000 --- a/packages/frontend/src/definitions/entities/eventInstanceTypes.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { GenericEntity, StructuredError } from '@definitions/commonTypes'; -import type { SearchQuery, SearchResponse } from '@definitions/searchTypes'; -import type { Event } from './eventTypes'; -export declare enum EventInstanceState { - UnknownError = "UNKNOWN_ERROR", - FailedOnCondition = "FAILED_ON_CONDITION", - FailedOnAction = "FAILED_ON_ACTION", - Success = "SUCCESS", - ConditionNotMet = "CONDITION_NOT_MET" -} -interface PerformanceMetricsStep { - name: string; - executionStartDate: string; - executionEndDate: string; - executionDuration: number; -} -interface PerformanceMetrics { - executionStartDate: string; - executionEndDate: string; - executionDuration: number; - steps: PerformanceMetricsStep[]; -} -export interface EventInstance extends GenericEntity { - eventId: number; - event: Event; - parentEventId: number | null; - triggerContext: Record; - state: EventInstanceState; - error: StructuredError; - performanceMetrics: PerformanceMetrics; - eventRunId: string; -} -type VirtualSearchFields = 'deviceId'; -export type EventInstancesSearchQuery = SearchQuery; -export type EventInstancesSearchResponse = SearchResponse; -export {}; diff --git a/packages/frontend/src/definitions/entities/eventTypes.d.ts b/packages/frontend/src/definitions/entities/eventTypes.d.ts deleted file mode 100644 index ac2bf103..00000000 --- a/packages/frontend/src/definitions/entities/eventTypes.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -import type { GenericEntity } from '../commonTypes'; -import type { SearchQuery, SearchResponse } from '../searchTypes'; -export declare enum EventTriggerType { - Api = "API", - IncomingDeviceData = "INCOMING_DEVICE_DATA", - OutgoingDeviceData = "OUTGOING_DEVICE_DATA", - Scheduler = "SCHEDULER" -} -export declare enum EventState { - Active = "ACTIVE", - Inactive = "INACTIVE", - Completed = "COMPLETED" -} -export declare enum EventMetadataType { - Scheduler = "SCHEDULER" -} -export declare enum EventMetadataTaskType { - StaticCron = "STATIC_CRON", - RelativeCron = "RELATIVE_CRON", - StaticInterval = "STATIC_INTERVAL", - RelativeInterval = "RELATIVE_INTERVAL" -} -export declare enum EventMetadataOnMultipleInstances { - Replace = "REPLACE", - Create = "CREATE", - Skip = "SKIP" -} -export declare enum EventActionOnInactive { - Skip = "SKIP", - Error = "ERROR", - Continue = "CONTINUE" -} -interface EventSchedulerCronMetadata { - cronExpression: string; -} -interface EventSchedulerIntervalMetadata { - interval: number; -} -interface EventSchedulerStaticMetadata { -} -interface EventSchedulerRelativeMetadata { - runAfterEvent: Pick; -} -export interface EventScheduleGenericMetadata { - type: EventMetadataType.Scheduler; - retryImmediatelyAfterBoot: boolean; - recurring: boolean; - onMultipleInstances: EventMetadataOnMultipleInstances; -} -export interface EventSchedulerRelativeCronMetadata extends EventScheduleGenericMetadata, EventSchedulerCronMetadata, EventSchedulerRelativeMetadata { - taskType: EventMetadataTaskType.RelativeCron; -} -export interface EventSchedulerRelativeIntervalMetadata extends EventScheduleGenericMetadata, EventSchedulerIntervalMetadata, EventSchedulerRelativeMetadata { - taskType: EventMetadataTaskType.RelativeInterval; -} -export interface EventSchedulerStaticCronMetadata extends EventScheduleGenericMetadata, EventSchedulerCronMetadata, EventSchedulerStaticMetadata { - taskType: EventMetadataTaskType.StaticCron; -} -export interface EventSchedulerStaticIntervalMetadata extends EventScheduleGenericMetadata, EventSchedulerIntervalMetadata, EventSchedulerStaticMetadata { - taskType: EventMetadataTaskType.StaticInterval; -} -export type EventMetadata = EventSchedulerRelativeCronMetadata | EventSchedulerRelativeIntervalMetadata | EventSchedulerStaticCronMetadata | EventSchedulerStaticIntervalMetadata; -export interface EventDto { - displayName: string; - triggerType: EventTriggerType; - triggerFilters: Record; - conditionDefinition: string; - actionDefinition: string; - state: EventState; - metadata: EventMetadata | null; -} -export type Event = EventDto & GenericEntity; -type VirtualSearchFields = 'deviceId'; -export type EventsSearchQuery = SearchQuery; -export type EventsSearchResponse = SearchResponse; -export {}; diff --git a/packages/frontend/src/definitions/entities/sensorDataTypes.d.ts b/packages/frontend/src/definitions/entities/sensorDataTypes.d.ts deleted file mode 100644 index 6b589bb7..00000000 --- a/packages/frontend/src/definitions/entities/sensorDataTypes.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { GenericEntity } from '@definitions/commonTypes'; -export interface SensorData extends GenericEntity { - deviceId: number; - data: Record; -} diff --git a/packages/frontend/src/definitions/entities/userTypes.d.ts b/packages/frontend/src/definitions/entities/userTypes.d.ts deleted file mode 100644 index 274257ed..00000000 --- a/packages/frontend/src/definitions/entities/userTypes.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { GenericEntity } from '../commonTypes'; -export declare enum UserRole { - Admin = "ADMIN", - User = "USER" -} -export declare enum UserState { - Active = "ACTIVE", - Inactive = "INACTIVE", - PendingApproval = "PENDING_APPROVAL" -} -export interface User extends GenericEntity { - name: string; - firstName: string; - lastName: string; - avatarUrl: string; - email: string; - role: UserRole; - state: UserState; -}