{"version":3,"sources":["../src/model/validation/channel-ti.ts","../src/model/validation/configuration-ti.ts","../src/model/validation/device-ti.ts","../src/model/validation/device-list-ti.ts","../src/model/validation/device-response-ti.ts","../src/model/validation/devices-ti.ts","../src/model/validation/error-ti.ts","../src/model/validation/floors-ti.ts","../src/model/validation/get-data-point-response-ti.ts","../src/model/validation/in-out-put-ti.ts","../src/model/validation/rooms-ti.ts","../src/model/validation/scenes-triggered-ti.ts","../src/model/validation/set-data-point-response-ti.ts","../src/model/validation/sys-ap-ti.ts","../src/model/validation/users-ti.ts","../src/model/validation/virtual-device-ti.ts","../src/model/validation/virtual-device-response-ti.ts","../src/model/validation/websocket-message-ti.ts","../src/model/validator.ts","../src/model/virtual-device.ts","../src/system-access-point.ts"],"sourcesContent":["import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey, opt } from \"ts-interface-checker\";\n\nconst Channel = iface([], {\n  displayName: opt(\"string\"),\n  functionID: opt(\"string\"),\n  room: opt(\"string\"),\n  floor: opt(\"string\"),\n  inputs: opt(\n    iface([], {\n      [indexKey]: \"InOutPut\",\n    })\n  ),\n  outputs: opt(\n    iface([], {\n      [indexKey]: \"InOutPut\",\n    })\n  ),\n  parameters: opt(\n    iface([], {\n      [indexKey]: \"string\",\n    })\n  ),\n  type: opt(\"string\"),\n});\n\nexport const ChannelTypeSuite: ITypeSuite = {\n  Channel,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst Configuration = iface([], {\n  [indexKey]: \"SysAP\",\n});\n\nexport const ConfigurationTypeSuite: ITypeSuite = {\n  Configuration,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey, opt } from \"ts-interface-checker\";\n\nconst Device = iface([], {\n  displayName: opt(\"string\"),\n  room: opt(\"string\"),\n  floor: opt(\"string\"),\n  interface: opt(\"string\"),\n  nativeId: opt(\"string\"),\n  channels: opt(\n    iface([], {\n      [indexKey]: \"Channel\",\n    })\n  ),\n  parameters: opt(\n    iface([], {\n      [indexKey]: \"string\",\n    })\n  ),\n});\n\nexport const DeviceTypeSuite: ITypeSuite = {\n  Device,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { array, iface, indexKey } from \"ts-interface-checker\";\n\nconst DeviceList = iface([], {\n  [indexKey]: array(\"string\"),\n});\n\nexport const DeviceListTypeSuite: ITypeSuite = {\n  DeviceList,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst DeviceResponse = iface([], {\n  [indexKey]: iface([], {\n    devices: \"Devices\",\n  }),\n});\n\nexport const DeviceResponseTypeSuite: ITypeSuite = {\n  DeviceResponse,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst Devices = iface([], {\n  [indexKey]: \"Device\",\n});\n\nexport const DevicesTypeSuite: ITypeSuite = {\n  Devices,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface } from \"ts-interface-checker\";\n\nconst ErrorType = iface([], {\n  code: \"string\",\n  detail: \"string\",\n  title: \"string\",\n});\n\nexport const ErrorTypeSuite: ITypeSuite = {\n  Error: ErrorType,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst Floors = iface([], {\n  [indexKey]: iface([], {\n    name: \"string\",\n    rooms: \"Rooms\",\n  }),\n});\n\nexport const FloorsTypeSuite: ITypeSuite = {\n  Floors,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { array, iface, indexKey } from \"ts-interface-checker\";\n\nconst GetDataPointResponse = iface([], {\n  [indexKey]: iface([], {\n    values: array(\"string\"),\n  }),\n});\n\nexport const GetDataPointResponseTypeSuite: ITypeSuite = {\n  GetDataPointResponse,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, opt } from \"ts-interface-checker\";\n\nconst InOutPut = iface([], {\n  value: opt(\"string\"),\n  pairingID: opt(\"number\"),\n});\n\nexport const InOutPutTypeSuite: ITypeSuite = {\n  InOutPut,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst Rooms = iface([], {\n  [indexKey]: iface([], {\n    name: \"string\",\n  }),\n});\n\nexport const RoomsTypeSuite: ITypeSuite = {\n  Rooms,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst ScenesTriggered = iface([], {\n  [indexKey]: iface([], {\n    channels: iface([], {\n      [indexKey]: iface([], {\n        outputs: iface([], {\n          [indexKey]: iface([], {\n            value: \"string\",\n            pairingID: \"number\",\n          }),\n        }),\n      }),\n    }),\n  }),\n});\n\nexport const ScenesTriggeredTypeSuite: ITypeSuite = {\n  ScenesTriggered,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst SetDataPointResponse = iface([], {\n  [indexKey]: iface([], {\n    [indexKey]: \"string\",\n  }),\n});\n\nexport const SetDataPointResponseTypeSuite: ITypeSuite = {\n  SetDataPointResponse,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, opt } from \"ts-interface-checker\";\n\nconst SysAP = iface([], {\n  devices: \"Devices\",\n  floorplan: iface([], {\n    floors: \"Floors\",\n  }),\n  sysapName: \"string\",\n  users: \"Users\",\n  error: opt(\"Error\"),\n});\n\nexport const SysApTypeSuite: ITypeSuite = {\n  SysAP,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { array, iface, indexKey } from \"ts-interface-checker\";\n\nconst Users = iface([], {\n  [indexKey]: iface([], {\n    enabled: \"boolean\",\n    flags: array(\"string\"),\n    grantedPermissions: array(\"string\"),\n    jid: \"string\",\n    name: \"string\",\n    requestedPermissions: array(\"string\"),\n    role: \"string\",\n  }),\n});\n\nexport const UsersTypeSuite: ITypeSuite = {\n  Users,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { array, enumtype, iface, opt } from \"ts-interface-checker\";\n\nconst VirtualDevice = iface([], {\n  type: \"VirtualDeviceType\",\n  properties: opt(\n    iface([], {\n      ttl: opt(\"string\"),\n      displayname: opt(\"string\"),\n      flavor: opt(\"string\"),\n      capabilities: opt(array(\"number\")),\n    })\n  ),\n});\n\nexport const VirtualDeviceType = enumtype({\n  BinarySensor: \"BinarySensor\",\n  BlindActuator: \"BlindActuator\",\n  SwitchingActuator: \"SwitchingActuator\",\n  CeilingFanActuator: \"CeilingFanActuator\",\n  RTC: \"RTC\",\n  DimActuator: \"DimActuator\",\n  EVCharging: \"evcharging\",\n  WindowSensor: \"WindowSensor\",\n  SimpleDoorlock: \"simple_doorlock\",\n  ShutterActuator: \"ShutterActuator\",\n  WeatherStation: \"WeatherStation\",\n  WeatherTemperatureSensor: \"Weather-TemperatureSensor\",\n  WeatherWindSensor: \"Weather-WindSensor\",\n  WeatherBrightnessSensor: \"Weather-BrightnessSensor\",\n  WeatherRainSensor: \"Weather-RainSensor\",\n  WindowActuator: \"WindowActuator\",\n  CODetector: \"CODetector\",\n  FireDetector: \"FireDetector\",\n  KNXSwitchSensor: \"KNX-SwitchSensor\",\n  MediaPlayer: \"MediaPlayer\",\n  EnergyBattery: \"EnergyBattery\",\n  EnergyInverter: \"EnergyInverter\",\n  EnergyMeter: \"EnergyMeter\",\n  EnergyInverterBattery: \"EnergyInverterBattery\",\n  EnergyInverterMeter: \"EnergyInverterMeter\",\n  EnergyInverterMeterBattery: \"EnergyInverterMeterBattery\",\n  EnergyMeterBattery: \"EnergyMeterBattery\",\n  AirQualityCO2: \"AirQualityCO2\",\n  AirQualityCO: \"AirQualityCO\",\n  AirQualityFull: \"AirQualityFull\",\n  AirQualityHumidity: \"AirQualityHumidity\",\n  AirQualityNO2: \"AirQualityNO2\",\n  AirQualityO3: \"AirQualityO3\",\n  AirQualityPM10: \"AirQualityPM10\",\n  AirQualityPM25: \"AirQualityPM25\",\n  AirQualityPressure: \"AirQualityPressure\",\n  AirQualityTemperature: \"AirQualityTemperature\",\n  AirQualityVOC: \"AirQualityVOC\",\n  EnergyMeterV2: \"EnergyMeterv2\",\n  HomeApplianceLaundry: \"HomeAppliance-Laundry\",\n  HVAC: \"HVAC\",\n  SplitUnit: \"SplitUnit\",\n});\n\nexport const VirtualDeviceTypeSuite: ITypeSuite = {\n  VirtualDevice,\n  VirtualDeviceType,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { iface, indexKey } from \"ts-interface-checker\";\n\nconst VirtualDeviceResponse = iface([], {\n  [indexKey]: iface([], {\n    devices: iface([], {\n      [indexKey]: iface([], {\n        serial: \"string\",\n      }),\n    }),\n  }),\n});\n\nexport const VirtualDeviceResponseTypeSuite: ITypeSuite = {\n  VirtualDeviceResponse,\n};\n","import type { ITypeSuite } from \"ts-interface-checker\";\nimport { array, iface, indexKey, opt } from \"ts-interface-checker\";\n\nconst WebSocketMessage = iface([], {\n  [indexKey]: iface([], {\n    datapoints: iface([], {\n      [indexKey]: \"string\",\n    }),\n    devices: \"Devices\",\n    devicesAdded: array(\"string\"),\n    devicesRemoved: array(\"string\"),\n    scenesTriggered: \"ScenesTriggered\",\n    parameters: opt(\n      iface([], {\n        [indexKey]: \"string\",\n      })\n    ),\n  }),\n});\n\nexport const WebSocketMessageTypeSuite: ITypeSuite = {\n  WebSocketMessage,\n};\n","import {\n  ChannelTypeSuite,\n  DeviceTypeSuite,\n  DevicesTypeSuite,\n  InOutPutTypeSuite,\n  ScenesTriggeredTypeSuite,\n  WebSocketMessageTypeSuite,\n  DeviceListTypeSuite,\n  SetDataPointResponseTypeSuite,\n  GetDataPointResponseTypeSuite,\n  ConfigurationTypeSuite,\n  FloorsTypeSuite,\n  RoomsTypeSuite,\n  SysApTypeSuite,\n  UsersTypeSuite,\n  ErrorTypeSuite,\n  DeviceResponseTypeSuite,\n  VirtualDeviceTypeSuite,\n  VirtualDeviceResponseTypeSuite,\n} from \"./validation\";\nimport type { Checker } from \"ts-interface-checker\";\nimport { createCheckers } from \"ts-interface-checker\";\nimport { type WebSocketMessage as Message } from \"./websocket-message\";\nimport { type Configuration as Config } from \"./configuration\";\nimport { type Channel as Chan } from \"./channel\";\nimport { type Device as Dev } from \"./device\";\nimport { type DeviceList as DevList } from \"./device-list\";\nimport { type DeviceResponse as DevResponse } from \"./device-response\";\nimport { type GetDataPointResponse as GetResponse } from \"./get-data-point-response\";\nimport { type SetDataPointResponse as SetResponse } from \"./set-data-point-response\";\nimport { type VirtualDeviceResponse as VDeviceResponse } from \"./virtual-device-response\";\nimport { type VirtualDevice as VDevice } from \"./virtual-device\";\nimport { type Logger } from \"./logger\";\n\nconst { Channel } = createCheckers(ChannelTypeSuite, InOutPutTypeSuite);\n\nconst { Configuration } = createCheckers(\n  ConfigurationTypeSuite,\n  DevicesTypeSuite,\n  DeviceTypeSuite,\n  ChannelTypeSuite,\n  InOutPutTypeSuite,\n  FloorsTypeSuite,\n  RoomsTypeSuite,\n  SysApTypeSuite,\n  UsersTypeSuite,\n  ErrorTypeSuite\n);\n\nconst { Device } = createCheckers(\n  DeviceTypeSuite,\n  ChannelTypeSuite,\n  InOutPutTypeSuite\n);\n\nconst { DeviceList } = createCheckers(DeviceListTypeSuite);\n\nconst { DeviceResponse } = createCheckers(\n  DeviceResponseTypeSuite,\n  DevicesTypeSuite,\n  DeviceTypeSuite,\n  ChannelTypeSuite,\n  InOutPutTypeSuite\n);\n\nconst { GetDataPointResponse } = createCheckers(GetDataPointResponseTypeSuite);\n\nconst { SetDataPointResponse } = createCheckers(SetDataPointResponseTypeSuite);\n\nconst { VirtualDevice } = createCheckers(VirtualDeviceTypeSuite);\n\nconst { VirtualDeviceResponse } = createCheckers(\n  VirtualDeviceResponseTypeSuite\n);\n\nconst { WebSocketMessage } = createCheckers(\n  WebSocketMessageTypeSuite,\n  DevicesTypeSuite,\n  DeviceTypeSuite,\n  ChannelTypeSuite,\n  InOutPutTypeSuite,\n  ScenesTriggeredTypeSuite\n);\n\nfunction check(\n  obj: unknown,\n  checker: Checker,\n  logger: Logger,\n  verbose: boolean\n): boolean {\n  if (verbose) {\n    try {\n      checker.check(obj);\n      return true;\n    } catch (error) {\n      logger.error(\"Object validation failed!\", error);\n      return false;\n    }\n  }\n\n  return checker.test(obj);\n}\n\n/**\n * Determines whether the specified object is a web socket message.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a web socket message.\n */\nexport function isWebSocketMessage(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is Message {\n  return check(obj, WebSocketMessage, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a configuration.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a configuration.\n */\nexport function isConfiguration(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is Config {\n  return check(obj, Configuration, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a device list.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a device list.\n */\nexport function isDeviceList(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is DevList {\n  return check(obj, DeviceList, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a device response.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a device response.\n */\nexport function isDeviceResponse(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is DevResponse {\n  return check(obj, DeviceResponse, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a valid response to a get data point request.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a response to a get data point request.\n */\nexport function isGetDataPointResponse(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is GetResponse {\n  return check(obj, GetDataPointResponse, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a valid response to a set data point request.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a response to a set data point request.\n */\nexport function isSetDataPointResponse(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is SetResponse {\n  return check(obj, SetDataPointResponse, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a virtual device.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a virtual device.\n */\nexport function isVirtualDevice(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is VDevice {\n  return check(obj, VirtualDevice, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a virtual device response.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a response to a virtual device request.\n */\nexport function isVirtualDeviceResponse(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is VDeviceResponse {\n  return check(obj, VirtualDeviceResponse, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a channel.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a channel.\n */\nexport function isChannel(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is Chan {\n  return check(obj, Channel, logger, verbose);\n}\n\n/**\n * Determines whether the specified object is a device.\n * @param obj {object} The object to be tested\n * @param logger {Logger} The logger instance to be used.\n * @param verbose {boolean} Determines whether validation errors shall be logged. Default value is false.\n * @returns {boolean} A value indicating whether the specified object is a device.\n */\nexport function isDevice(\n  obj: unknown,\n  logger: Logger,\n  verbose = false\n): obj is Dev {\n  return check(obj, Device, logger, verbose);\n}\n","/** Defines a virtual device. */\nexport interface VirtualDevice {\n  /** The virtual device type. */\n  type: VirtualDeviceType;\n  /** The virtual device properties */\n  properties?: {\n    /** The time to live value indicates the number of seconds the system access point will wait for a message before it assumes the device to be unresponsive. */\n    ttl?: string;\n    /** The display name for the virtual device. */\n    displayname?: string;\n    /** The virtual device flavor. */\n    flavor?: string;\n    /** The virtual device capabilities. */\n    capabilities?: Array<number>;\n  };\n}\n\n/** Defines the possible types of virtual devices. */\nexport enum VirtualDeviceType {\n  /** A binary sensor */\n  BinarySensor = \"BinarySensor\",\n  /** A blind actuator */\n  BlindActuator = \"BlindActuator\",\n  /** A switching actuator */\n  SwitchingActuator = \"SwitchingActuator\",\n  /** A ceiling fan actuator */\n  CeilingFanActuator = \"CeilingFanActuator\",\n  /** A real time clock */\n  RTC = \"RTC\",\n  /** A dimmer actuator */\n  DimActuator = \"DimActuator\",\n  /** A charger for an electronic vehicle */\n  EVCharging = \"evcharging\",\n  /** A window sensor */\n  WindowSensor = \"WindowSensor\",\n  /** A simple door lock */\n  SimpleDoorlock = \"simple_doorlock\",\n  /** A shutter actuator */\n  ShutterActuator = \"ShutterActuator\",\n  /** A weather station */\n  WeatherStation = \"WeatherStation\",\n  /** A temperature sensor */\n  WeatherTemperatureSensor = \"Weather-TemperatureSensor\",\n  /** A wind sensor */\n  WeatherWindSensor = \"Weather-WindSensor\",\n  /** A brightness sensor */\n  WeatherBrightnessSensor = \"Weather-BrightnessSensor\",\n  /** A rain sensor */\n  WeatherRainSensor = \"Weather-RainSensor\",\n  /** A window actuator */\n  WindowActuator = \"WindowActuator\",\n  /** A detector for carbon monoxide (CO) */\n  CODetector = \"CODetector\",\n  /** A fire detector */\n  FireDetector = \"FireDetector\",\n  /** A KNX switch sensor */\n  KNXSwitchSensor = \"KNX-SwitchSensor\",\n  /** A media player */\n  MediaPlayer = \"MediaPlayer\",\n  /** A battery */\n  EnergyBattery = \"EnergyBattery\",\n  /** An inverter */\n  EnergyInverter = \"EnergyInverter\",\n  /** An energy meter */\n  EnergyMeter = \"EnergyMeter\",\n  /** A device combining inverter and battery characteristics */\n  EnergyInverterBattery = \"EnergyInverterBattery\",\n  /** A device combining inverter and energy meter characteristics */\n  EnergyInverterMeter = \"EnergyInverterMeter\",\n  /** A device combining inverter, battery and energy meter characteristics */\n  EnergyInverterMeterBattery = \"EnergyInverterMeterBattery\",\n  /** A device combining battery and energy meter characteristics */\n  EnergyMeterBattery = \"EnergyMeterBattery\",\n  /** An air quality sensor measuring carbon dioxide (CO2) */\n  AirQualityCO2 = \"AirQualityCO2\",\n  /** An air quality sensor measuring carbon monoxide (CO) */\n  AirQualityCO = \"AirQualityCO\",\n  /** An full air quality sensor */\n  AirQualityFull = \"AirQualityFull\",\n  /** An air quality sensor measuring humidity */\n  AirQualityHumidity = \"AirQualityHumidity\",\n  /** An air quality sensor measuring nitrogen dioxide (NO2) */\n  AirQualityNO2 = \"AirQualityNO2\",\n  /** An air quality sensor measuring ozone (O3) */\n  AirQualityO3 = \"AirQualityO3\",\n  /** An air quality sensor measuring coarse particulate matter with in the 10 micron scale */\n  AirQualityPM10 = \"AirQualityPM10\",\n  /** An air quality sensor measuring coarse particulate matter with in the 25 micron scale */\n  AirQualityPM25 = \"AirQualityPM25\",\n  /** An air quality sensor measuring barometric pressure */\n  AirQualityPressure = \"AirQualityPressure\",\n  /** An air quality sensor measuring temperature */\n  AirQualityTemperature = \"AirQualityTemperature\",\n  /** An air quality sensor measuring volatile organic compounds */\n  AirQualityVOC = \"AirQualityVOC\",\n  /** A version 2 energy meter */\n  EnergyMeterV2 = \"EnergyMeterv2\",\n  HomeApplianceLaundry = \"HomeAppliance-Laundry\",\n  HVAC = \"HVAC\",\n  SplitUnit = \"SplitUnit\",\n}\n","import { EventEmitter } from \"node:events\";\nimport {\n  interval,\n  type Observable,\n  type SchedulerLike,\n  Subject,\n  type Subscription,\n  switchMap,\n  takeUntil,\n} from \"rxjs\";\nimport { type ClientOptions, type RawData, WebSocket } from \"ws\";\nimport {\n  type Configuration,\n  type DeviceList,\n  type DeviceResponse,\n  type GetDataPointResponse,\n  isConfiguration,\n  isDeviceList,\n  isDeviceResponse,\n  isGetDataPointResponse,\n  isSetDataPointResponse,\n  isWebSocketMessage,\n  type Logger,\n  type SetDataPointResponse,\n  type VirtualDevice,\n  type VirtualDeviceResponse,\n  type WebSocketMessage,\n} from \"./model\";\nimport { isVirtualDeviceResponse } from \"./model/validator\";\n\n/** The HTTP request method */\ntype HttpRequestMethod = \"GET\" | \"POST\" | \"DELETE\" | \"PATCH\" | \"PUT\";\n\n/** The class representing a System Access Point. */\nexport class SystemAccessPoint extends EventEmitter {\n  /** The basic authentication key used for requests. */\n  public readonly basicAuthKey: string;\n  private webSocket?: WebSocket;\n  private readonly webSocketMessageSubject = new Subject<WebSocketMessage>();\n  private readonly webSocketKeepaliveTimerReset$ = new Subject<void>();\n  private readonly webSocketKeepaliveTimer$ =\n    this.webSocketKeepaliveTimerReset$.pipe(\n      switchMap(() =>\n        interval(30000, this.scheduler).pipe(\n          takeUntil(this.webSocketKeepaliveTimerReset$)\n        )\n      )\n    );\n  private webSocketKeepaliveSubscription?: Subscription;\n\n  /**\n   * Constructs a new SystemAccessPoint instance\n   *\n   * @constructor\n   * @param hostName {string} The system access point host name.\n   * @param userName {string} The user name that shall be used to authenticate with the system access point.\n   * @param password {string} The password that shall be used to authenticate with the system access point.\n   * @param tlsEnabled {boolean} Determines whether the communication with the system access point shall be protected by TLS.\n   * @param verboseErrors {boolean} Determines whether verbose error messages shall be used, for example for message validation.\n   * @param logger {Logger} The logger instance to be used. If no explicit implementation is provided, the this.logger will be used for logging.\n   */\n  constructor(\n    private readonly hostName: string,\n    readonly userName: string,\n    readonly password: string,\n    private readonly tlsEnabled = true,\n    private readonly verboseErrors = false,\n    private readonly logger: Logger = console,\n    readonly scheduler?: SchedulerLike\n  ) {\n    super();\n\n    // Create Basic Authentication key\n    this.basicAuthKey = Buffer.from(`${userName}:${password}`, \"utf8\").toString(\n      \"base64\"\n    );\n  }\n\n  /**\n   * Connects to the System Access Point web socket.\n   * @param certificateVerification {boolean} Determines whether the TLS certificate presented by the server will be verified.\n   */\n  public connectWebSocket(certificateVerification: boolean = true): void {\n    if (this.webSocket?.readyState === WebSocket.OPEN) {\n      throw new Error(\"Web socket is already connected\");\n    }\n\n    this.webSocket = this.createWebSocket(certificateVerification);\n    // (Re-)create the web socket keepalive timer\n    this.webSocketKeepaliveSubscription?.unsubscribe();\n    this.webSocketKeepaliveSubscription = undefined;\n    this.webSocketKeepaliveSubscription =\n      this.webSocketKeepaliveTimer$.subscribe(() => {\n        if (this.webSocket?.readyState !== WebSocket.OPEN) return;\n\n        this.logger.log(\"keepalive timer expired, sending ping message...\");\n        this.webSocket.ping();\n      });\n    this.webSocketKeepaliveTimerReset$.next();\n  }\n\n  /**\n   * Creates a new virtual device.\n   * @param sysApUuid {string} The UUID identifying the system access point.\n   * @param deviceSerial {string} The serial number to be assigned to the device.\n   * @param virtualDevice {VirtualDevice} The virtual device to be created.\n   * @returns {Promise.<VirtualDeviceResponse>} The response to the virtual device request.\n   */\n  public async createVirtualDevice(\n    sysApUuid: string,\n    deviceSerial: string,\n    virtualDevice: VirtualDevice\n  ): Promise<VirtualDeviceResponse> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"PUT\",\n      `virtualdevice/${sysApUuid}/${deviceSerial}`,\n      JSON.stringify(virtualDevice)\n    );\n\n    // Process response\n    return this.processRestResponse(response, isVirtualDeviceResponse);\n  }\n\n  private createWebSocket(certificateVerification: boolean): WebSocket {\n    // Disabling certificate verification is discouraged, issue a warning\n    if (this.tlsEnabled && !certificateVerification) {\n      this.logger.warn(\n        \"TLS certificate verification is disabled! This poses a security risk, activating certificate verification is strictly recommended.\"\n      );\n    }\n\n    const url = `${this.tlsEnabled ? \"wss\" : \"ws\"}://${\n      this.hostName\n    }/fhapi/v1/api/ws`;\n    const options: ClientOptions = {\n      rejectUnauthorized: this.tlsEnabled && certificateVerification,\n      headers: {\n        Authorization: `Basic ${this.basicAuthKey}`,\n      },\n    };\n    const webSocket = new WebSocket(url, options);\n    webSocket.on(\"error\", (error: Error) => {\n      this.emit(\"websocket-error\", error);\n      this.logger.error(\"Error received\", error);\n    });\n    webSocket.on(\"ping\", (data: Buffer) => {\n      this.emit(\"websocket-ping\", data);\n      this.logger.debug(\"Ping received\", data.toString(\"ascii\"));\n      this.webSocketKeepaliveTimerReset$.next();\n      webSocket.pong(data);\n      this.logger.debug(\"Pong sent\", data.toString(\"ascii\"));\n    });\n    webSocket.on(\"pong\", (data: Buffer) => {\n      this.emit(\"websocket-pong\", data);\n      this.logger.debug(\"Pong received\", data.toString(\"ascii\"));\n    });\n    webSocket.on(\"unexpected-response\", (request, response) => {\n      this.emit(\"websocket-unexpected-response\", request, response);\n      this.logger.error(\"Unexpected response received\");\n    });\n    webSocket.on(\"upgrade\", (request) => {\n      this.emit(\"websocket-upgrade\", request);\n      this.logger.debug(\"Upgrade request received\");\n    });\n    webSocket.on(\"open\", () => {\n      this.emit(\"websocket-open\");\n      this.logger.log(\"Connection opened\");\n    });\n    webSocket.on(\"close\", (code, reason) => {\n      this.emit(\"websocket-close\", code, reason);\n      this.logger.log(\"Connection closed\");\n      this.webSocketKeepaliveSubscription?.unsubscribe();\n      this.webSocketKeepaliveSubscription = undefined;\n    });\n    webSocket.on(\"message\", (data: RawData, isBinary: boolean) => {\n      this.emit(\"websocket-message\", data, isBinary);\n      this.webSocketKeepaliveTimerReset$.next();\n      this.processWebSocketMessage(data, isBinary);\n    });\n    return webSocket;\n  }\n\n  /**\n   * Disconnects from the System Access Point web socket.\n   * @param force {boolean} Determines whether or not the connection will be closed forcibly.\n   */\n  public disconnectWebSocket(force: boolean = false): void {\n    if (!this.webSocket || this.webSocket.readyState === WebSocket.CLOSED) {\n      throw new Error(\"Web socket is not open\");\n    }\n\n    if (force) {\n      this.webSocket.terminate();\n    } else {\n      this.webSocket.close();\n    }\n  }\n\n  /**\n   * Gets the configuration from the system access point.\n   * @returns {Promise.<Configuration>} The system access point configuration.\n   */\n  public async getConfiguration(): Promise<Configuration> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"GET\",\n      \"configuration\"\n    );\n\n    // Process response\n    return this.processRestResponse(response, isConfiguration);\n  }\n\n  /**\n   * Gets the device list from the system access point.\n   * @returns {Promise.<DeviceList>} The requested device list.\n   */\n  public async getDeviceList(): Promise<DeviceList> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\"GET\", \"devicelist\");\n\n    // Process response\n    return this.processRestResponse(response, isDeviceList);\n  }\n\n  /**\n   * Gets the specified device from the system access point.\n   * @param sysApUuid {string} The UUID identifying the system access point.\n   * @param deviceSerial {string} The device serial number.\n   * @returns {Promise.<DeviceResponse>} The response to the device request.\n   */\n  public async getDevice(\n    sysApUuid: string,\n    deviceSerial: string\n  ): Promise<DeviceResponse> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"GET\",\n      `device/${sysApUuid}/${deviceSerial}`\n    );\n\n    // Process response\n    return this.processRestResponse(response, isDeviceResponse);\n  }\n\n  /**\n   * Gets the specified data point from the system access point.\n   * @param sysApUuid {string} The UUID idenfifying the system access point.\n   * @param deviceSerial {string} The device serial number.\n   * @param channel {string} The channel identifier.\n   * @param dataPoint {string} The datapoint identifier.\n   * @returns {Promise.<GetDataPointResponse>} The response to the get data point request.\n   */\n  public async getDatapoint(\n    sysApUuid: string,\n    deviceSerial: string,\n    channel: string,\n    dataPoint: string\n  ): Promise<GetDataPointResponse> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"GET\",\n      `datapoint/${sysApUuid}/${deviceSerial}.${channel}.${dataPoint}`\n    );\n\n    // Process response\n    return this.processRestResponse(response, isGetDataPointResponse);\n  }\n\n  /**\n   * Gets the web socket messages.\n   * @returns {Observable.<WebSocketMessage>} An observable that is updated with the messages received from the web socket.\n   */\n  public getWebSocketMessages(): Observable<WebSocketMessage> {\n    return this.webSocketMessageSubject.asObservable();\n  }\n\n  /**\n   * Sets a new value for the specificed data point.\n   * @param sysApUuid {string} The UUID idenfifying the system access point.\n   * @param deviceSerial {string} The device serial number.\n   * @param channel {string} The channel identifier.\n   * @param dataPoint {string} The datapoint identifier.\n   * @param value {string} The new value to be set.\n   * @returns {Promise.<SetDataPointResponse>} The response to the set data point request.\n   */\n  public async setDatapoint(\n    sysApUuid: string,\n    deviceSerial: string,\n    channel: string,\n    dataPoint: string,\n    value: string\n  ): Promise<SetDataPointResponse> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"PUT\",\n      `datapoint/${sysApUuid}/${deviceSerial}.${channel}.${dataPoint}`,\n      value\n    );\n\n    // Process response\n    return this.processRestResponse(response, isSetDataPointResponse);\n  }\n\n  /**\n   * Triggeres the given action for the specified proxy device. Please note that this method is part of the experimental API!\n   * @param sysApUuid {string} The UUID idenfifying the system access point.\n   * @param deviceClass {string} The device class.\n   * @param deviceSerial {string} The device serial number.\n   * @param action {string} The action to be triggered.\n   * @returns {Promise.<DeviceResponse>} The response to the request.\n   */\n  public async triggerProxyDevice(\n    sysApUuid: string,\n    deviceClass: string,\n    deviceSerial: string,\n    action: string\n  ): Promise<DeviceResponse> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"GET\",\n      `proxydevice/${sysApUuid}/${deviceClass}/${deviceSerial}/action/${action}`\n    );\n\n    // Process response\n    return this.processRestResponse(response, isDeviceResponse);\n  }\n\n  /**\n   * Sets the given value for the specified proxy device. Please note that this method is part of the experimental API!\n   * @param sysApUuid {string} The UUID idenfifying the system access point.\n   * @param deviceClass {string} The device class.\n   * @param deviceSerial {string} The device serial number.\n   * @param value {string} The value to be set.\n   * @returns {Promise.<DeviceResponse>} The response to the request.\n   */\n  public async setProxyDeviceValue(\n    sysApUuid: string,\n    deviceClass: string,\n    deviceSerial: string,\n    value: string\n  ): Promise<DeviceResponse> {\n    // Get response from system access point\n    const response: Response = await this.fetchDataViaRest(\n      \"PUT\",\n      `proxydevice/${sysApUuid}/${deviceClass}/${deviceSerial}/value/${value}`\n    );\n\n    // Process response\n    return this.processRestResponse(response, isDeviceResponse);\n  }\n\n  private async fetchDataViaRest(\n    method: HttpRequestMethod,\n    route: string,\n    body?: RequestInit[\"body\"]\n  ): Promise<Response> {\n    // Set up request info\n    const info = `${this.tlsEnabled ? \"https\" : \"http\"}://${\n      this.hostName\n    }/fhapi/v1/api/rest/${route}`;\n\n    // Set up request init\n    const init: RequestInit = {\n      method: method,\n      headers: {\n        Authorization: `Basic ${this.basicAuthKey}`,\n      },\n      body: body,\n    };\n\n    // Get response from system access point\n    return fetch(info, init);\n  }\n\n  private async processRestResponse<TResponse>(\n    response: Response,\n    typeGuard: (\n      obj: unknown,\n      logger: Logger,\n      verbose: boolean\n    ) => obj is TResponse\n  ): Promise<TResponse> {\n    let body: unknown;\n    let message: string;\n\n    // Process response\n    switch (response.status) {\n      case 200:\n        body = await response.json();\n        if (!typeGuard(body, this.logger, this.verboseErrors)) {\n          message = \"Received message has an unexpected type!\";\n          this.logger.error(message, body);\n          throw new Error(message);\n        }\n\n        return body;\n      case 401:\n        message = \"Authentication information is missing or invalid.\";\n        this.logger.error(message);\n        throw new Error(message);\n      case 502:\n        message = await response.text();\n        this.logger.error(message);\n        throw new Error(message);\n      default:\n        message = `Received HTTP ${\n          response.status\n        } status code unexpectedly: ${await response.text()}`;\n        this.logger.error(message);\n        throw new Error(message);\n    }\n  }\n\n  private processWebSocketMessage(data: RawData, isBinary: boolean): void {\n    // Do not process binary messages\n    if (isBinary) {\n      this.logger.warn(\n        \"Binary message received. Binary messages are not processed.\"\n      );\n      return;\n    }\n\n    this.logger.debug(\"Message received\");\n    /*\n     * Deserialize the message.\n     * The message is expected to be deserializable as a web socket message.\n     * If that is not the case, that's an error case.\n     */\n    // eslint-disable-next-line @typescript-eslint/no-base-to-string\n    const serialized = data.toString();\n    const message: unknown = JSON.parse(serialized);\n\n    if (isWebSocketMessage(message, this.logger, this.verboseErrors)) {\n      this.webSocketMessageSubject.next(message);\n      return;\n    }\n\n    this.logger.error(\"Received message has an unexpected type!\", serialized);\n  }\n}\n"],"mappings":"AACA,OAAS,SAAAA,EAAO,YAAAC,EAAU,OAAAC,MAAW,uBAErC,IAAMC,GAAUH,EAAM,CAAC,EAAG,CACxB,YAAaE,EAAI,QAAQ,EACzB,WAAYA,EAAI,QAAQ,EACxB,KAAMA,EAAI,QAAQ,EAClB,MAAOA,EAAI,QAAQ,EACnB,OAAQA,EACNF,EAAM,CAAC,EAAG,CACR,CAACC,CAAQ,EAAG,UACd,CAAC,CACH,EACA,QAASC,EACPF,EAAM,CAAC,EAAG,CACR,CAACC,CAAQ,EAAG,UACd,CAAC,CACH,EACA,WAAYC,EACVF,EAAM,CAAC,EAAG,CACR,CAACC,CAAQ,EAAG,QACd,CAAC,CACH,EACA,KAAMC,EAAI,QAAQ,CACpB,CAAC,EAEYE,EAA+B,CAC1C,QAAAD,EACF,EC3BA,OAAS,SAAAE,GAAO,YAAAC,OAAgB,uBAEhC,IAAMC,GAAgBF,GAAM,CAAC,EAAG,CAC9B,CAACC,EAAQ,EAAG,OACd,CAAC,EAEYE,EAAqC,CAChD,cAAAD,EACF,ECRA,OAAS,SAAAE,EAAO,YAAAC,EAAU,OAAAC,MAAW,uBAErC,IAAMC,GAASH,EAAM,CAAC,EAAG,CACvB,YAAaE,EAAI,QAAQ,EACzB,KAAMA,EAAI,QAAQ,EAClB,MAAOA,EAAI,QAAQ,EACnB,UAAWA,EAAI,QAAQ,EACvB,SAAUA,EAAI,QAAQ,EACtB,SAAUA,EACRF,EAAM,C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tB,EAAeI,EAAyB,CAEtE,GAAIA,EAAU,CACZ,KAAK,OAAO,KACV,6DACF,EACA,MACF,CAEA,KAAK,OAAO,MAAM,kBAAkB,EAOpC,IAAMmB,EAAavB,EAAK,SAAS,EAC3BsB,EAAmB,KAAK,MAAMC,CAAU,EAE9C,GAAIC,EAAmBF,EAAS,KAAK,OAAQ,KAAK,aAAa,EAAG,CAChE,KAAK,wBAAwB,KAAKA,CAAO,EACzC,MACF,CAEA,KAAK,OAAO,MAAM,2CAA4CC,CAAU,CAC1E,CACF","names":["iface","indexKey","opt","Channel","ChannelTypeSuite","iface","indexKey","Configuration","ConfigurationTypeSuite","iface","indexKey","opt","Device","DeviceTypeSuite","array","iface","indexKey","DeviceList","DeviceListTypeSuite","iface","indexKey","DeviceResponse","DeviceResponseTypeSuite","iface","indexKey","Devices","DevicesTypeSuite","iface","ErrorType","ErrorTypeSuite","iface","indexKey","Floors","FloorsTypeSuite","array","iface","indexKey","GetDataPointResponse","GetDataPointResponseTypeSuite","iface","opt","InOutPut","InOutPutTypeSuite","iface","indexKey","Rooms","RoomsTypeSuite","iface","indexKey","ScenesTriggered","ScenesTriggeredTypeSuite","iface","indexKey","SetDataPointResponse","SetDataPointResponseTypeSuite","iface","opt","SysAP","SysApTypeSuite","array","iface","indexKey","Users","UsersTypeSuite","array","enumtype","iface","opt","VirtualDevice","VirtualDeviceType","VirtualDeviceTypeSuite","iface","indexKey","VirtualDeviceResponse","VirtualDeviceResponseTypeSuite","array","iface","indexKey","opt","WebSocketMessage","WebSocketMessageTypeSuite","createCheckers","VirtualDeviceType","Channel","createCheckers","ChannelTypeSuite","InOutPutTypeSuite","Configuration","ConfigurationTypeSuite","DevicesTypeSuite","DeviceTypeSuite","FloorsTypeSuite","RoomsTypeSuite","SysApTypeSuite","UsersTypeSuite","ErrorTypeSuite","Device","DeviceList","DeviceListTypeSuite","DeviceResponse","DeviceResponseTypeSuite","GetDataPointResponse","GetDataPointResponseTypeSuite","SetDataPointResponse","SetDataPointResponseTypeSuite","VirtualDevice","VirtualDeviceTypeSuite","VirtualDeviceResponse","VirtualDeviceResponseTypeSuite","WebSocketMessage","WebSocketMessageTypeSuite","ScenesTriggeredTypeSuite","check","obj","checker","logger","verbose","error","isWebSocketMessage","isConfiguration","isDeviceList","isDeviceResponse","isGetDataPointResponse","isSetDataPointResponse","isVirtualDevice","isVirtualDeviceResponse","isChannel","isDevice","EventEmitter","interval","Subject","switchMap","takeUntil","WebSocket","SystemAccessPoint","EventEmitter","hostName","userName","password","tlsEnabled","verboseErrors","logger","scheduler","Subject","switchMap","interval","takeUntil","certificateVerification","WebSocket","sysApUuid","deviceSerial","virtualDevice","response","isVirtualDeviceResponse","url","options","webSocket","error","data","request","code","reason","isBinary","force","isConfiguration","isDeviceList","isDeviceResponse","channel","dataPoint","isGetDataPointResponse","value","isSetDataPointResponse","deviceClass","action","method","route","body","info","init","typeGuard","message","serialized","isWebSocketMessage"]}