@ledgerhq/device-management-kit 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -8
- package/lib/cjs/package.json +23 -23
- package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
- package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
- package/lib/cjs/src/api/DmkConfig.js +1 -1
- package/lib/cjs/src/api/DmkConfig.js.map +1 -1
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js +2 -0
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +1 -1
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
- package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
- package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
- package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
- package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
- package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
- package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
- package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +2 -2
- package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +3 -3
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +3 -3
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +2 -0
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +2 -0
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
- package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.test.js.map +2 -2
- package/lib/cjs/src/api/transport/model/DeviceApduSender.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceApduSender.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DeviceConnection.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnection.js.map +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
- package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
- package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
- package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
- package/lib/cjs/src/api/types.js +1 -1
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +2 -2
- package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +1 -1
- package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
- package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
- package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/Frame.js +1 -1
- package/lib/cjs/src/internal/device-session/model/Frame.js.map +3 -3
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/service/MutexService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/MutexService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/MutexService.test.js +2 -0
- package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/RefresherService.js +1 -1
- package/lib/cjs/src/internal/device-session/service/RefresherService.js.map +3 -3
- package/lib/cjs/src/internal/device-session/service/RefresherService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/RefresherService.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
- package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/model/Language.js +2 -0
- package/lib/cjs/src/internal/manager-api/model/Language.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/model/Params.js +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Params.js.map +1 -1
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.js.map +3 -3
- package/lib/cjs/src/internal/transport/service/TransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/TransportService.js.map +1 -1
- package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
- package/lib/esm/package.json +23 -23
- package/lib/esm/src/api/DeviceManagementKit.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
- package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
- package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
- package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +2 -0
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +1 -1
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +3 -3
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/os/Errors.js +1 -1
- package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
- package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
- package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
- package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
- package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
- package/lib/esm/src/api/device-session/DeviceSessionState.js +1 -1
- package/lib/esm/src/api/device-session/DeviceSessionState.js.map +2 -2
- package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +3 -3
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js +1 -0
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js +1 -0
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
- package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.test.js.map +2 -2
- package/lib/esm/src/api/transport/model/DeviceApduSender.js +1 -0
- package/lib/esm/src/api/transport/model/DeviceApduSender.js.map +7 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
- package/lib/esm/src/api/transport/model/Errors.js +1 -1
- package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
- package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
- package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +1 -1
- package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
- package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
- package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DevicePinger.js +2 -0
- package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +2 -0
- package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/Frame.js +1 -1
- package/lib/esm/src/internal/device-session/model/Frame.js.map +3 -3
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/service/MutexService.js +2 -0
- package/lib/esm/src/internal/device-session/service/MutexService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/MutexService.test.js +2 -0
- package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/RefresherService.js +1 -1
- package/lib/esm/src/internal/device-session/service/RefresherService.js.map +3 -3
- package/lib/esm/src/internal/device-session/service/RefresherService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/RefresherService.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
- package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js +1 -1
- package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
- package/lib/esm/src/internal/manager-api/model/Application.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
- package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
- package/lib/esm/src/internal/manager-api/model/Language.js +1 -0
- package/lib/esm/src/internal/manager-api/model/Language.js.map +7 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/esm/src/internal/transport/service/DefaultTransportService.js +1 -1
- package/lib/esm/src/internal/transport/service/DefaultTransportService.js.map +3 -3
- package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
- package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
- package/lib/types/src/api/DeviceManagementKit.d.ts +16 -2
- package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
- package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
- package/lib/types/src/api/DmkConfig.d.ts +2 -0
- package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +16 -0
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +30 -2
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +24 -0
- package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts +5 -1
- package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +1 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts +3 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +9 -0
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
- package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts +58 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +27 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +64 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +25 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -0
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts +31 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +18 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
- package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
- package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
- package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts +93 -0
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +8 -1
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts +3 -3
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts +1 -0
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts +8 -0
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +44 -0
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -0
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts +3 -3
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts +1 -0
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +1 -3
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts +8 -0
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +41 -0
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DeviceApduSender.d.ts +17 -0
- package/lib/types/src/api/transport/model/DeviceApduSender.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DeviceConnection.d.ts +2 -1
- package/lib/types/src/api/transport/model/DeviceConnection.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +62 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +1 -1
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Errors.d.ts +22 -3
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
- package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +8 -2
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts +1 -0
- package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts +6 -1
- package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +18 -0
- package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts +2 -0
- package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +21 -12
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +2 -2
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +35 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts +2 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +17 -79
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +20 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts +2 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/Frame.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/MutexService.d.ts +6 -0
- package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +2 -0
- package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/service/RefresherService.d.ts +7 -2
- package/lib/types/src/internal/device-session/service/RefresherService.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts +3 -1
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts +3 -0
- package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +8 -1
- package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts +1 -1
- package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +4 -2
- package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +24 -5
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +51 -6
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +104 -18
- package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +7 -0
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts +1 -0
- package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Application.d.ts +12 -12
- package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Const.d.ts +2 -0
- package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts +17 -3
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Language.d.ts +12 -0
- package/lib/types/src/internal/manager-api/model/Language.d.ts.map +1 -0
- package/lib/types/src/internal/manager-api/model/Params.d.ts +20 -6
- package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +9 -3
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +42 -7
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +13 -0
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -0
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/model/Params.d.ts +3 -5
- package/lib/types/src/internal/secure-channel/model/Params.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +7 -7
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +41 -7
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts +2 -0
- package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/TransportService.d.ts +3 -1
- package/lib/types/src/internal/transport/service/TransportService.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +1 -0
- package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +15 -15
@@ -0,0 +1,2 @@
|
|
1
|
+
import{DeviceModelId as c}from"../../../api/device/DeviceModel";import{GetAppAndVersionCommand as a,GetOsVersionCommand as m}from"../../../api/index";import{PINGER_TIMEOUT as o}from"../../device-session/data/ApduResponseConst";import{DEVICE_SESSION_REFRESHER_POLLING_INTERVAL as p}from"../../device-session/data/DeviceSessionRefresherConst";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";class D{constructor(e,t,r,n){this.connectedDevice=t;this._sessionEventDispatcher=r;this._sendCommandFunction=n,this._logger=e("device-pinger"),this._subscription=this._sessionEventDispatcher.listen().subscribe(async s=>await this.mapEventAction(s))}_sendCommandFunction;_subscription;_logger;async ping(){try{return await this.mapDevicePingAction(this.connectedDevice.deviceModel.id)}catch(e){throw this._logger.error("Error while pinging device",{data:{error:e}}),e}}mapEventAction=async e=>{switch(e.eventName){case i.REFRESH_NEEDED:return await this.ping();default:return null}};async mapDevicePingAction(e){switch(e){case c.NANO_S:{const t=async()=>{const s=await this._sendCommandFunction(new a,o);return this._sendCommandFunction(new m,o),s},r=new Promise(s=>{setTimeout(()=>s(null),p*2+100)}),n=await Promise.race([t(),r]);return n?this._sessionEventDispatcher.dispatch({eventName:i.COMMAND_SUCCEEDED,eventData:n}):this._sessionEventDispatcher.dispatch({eventName:i.DEVICE_STATE_UPDATE_LOCKED}),n}default:{const t=await this._sendCommandFunction(new a,o);return this._sessionEventDispatcher.dispatch({eventName:i.COMMAND_SUCCEEDED,eventData:t}),t}}}unsubscribe(){this._subscription.unsubscribe()}}export{D as DevicePinger};
|
2
|
+
//# sourceMappingURL=DevicePinger.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/internal/device-session/model/DevicePinger.ts"],
|
4
|
+
"sourcesContent": ["import { type Subscription } from \"rxjs\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n GetOsVersionCommand,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport {\n type Command,\n type CommandResult,\n type LoggerPublisherService,\n} from \"@api/types\";\nimport { PINGER_TIMEOUT } from \"@internal/device-session/data/ApduResponseConst\";\nimport { DEVICE_SESSION_REFRESHER_POLLING_INTERVAL } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\ntype SendCommandFunction = <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n\nexport class DevicePinger {\n private readonly _sendCommandFunction: SendCommandFunction;\n private _subscription: Subscription;\n private _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private connectedDevice: TransportConnectedDevice,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n sendCommandFunction: SendCommandFunction,\n ) {\n this._sendCommandFunction = sendCommandFunction;\n this._logger = loggerModuleFactory(\"device-pinger\");\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe(async (event) => await this.mapEventAction(event));\n }\n\n public async ping(): Promise<CommandResult<GetAppAndVersionResponse> | null> {\n try {\n const result = await this.mapDevicePingAction(\n this.connectedDevice.deviceModel.id,\n );\n return result;\n } catch (error) {\n this._logger.error(\"Error while pinging device\", {\n data: {\n error,\n },\n });\n throw error;\n }\n }\n\n private mapEventAction = async (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.REFRESH_NEEDED:\n return await this.ping();\n default:\n return null;\n }\n };\n\n private async mapDevicePingAction(deviceModelId: DeviceModelId) {\n switch (deviceModelId) {\n case DeviceModelId.NANO_S: {\n const chainPromise: () => Promise<\n CommandResult<GetAppAndVersionResponse>\n > = async () => {\n const appVersionResult = await this._sendCommandFunction(\n new GetAppAndVersionCommand(),\n PINGER_TIMEOUT,\n );\n\n this._sendCommandFunction(new GetOsVersionCommand(), PINGER_TIMEOUT);\n return appVersionResult;\n };\n\n const timeoutPromise: Promise<null> = new Promise((resolve) => {\n setTimeout(\n () => resolve(null),\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL * 2 + 100,\n );\n });\n\n const resultOrTimeout: CommandResult<GetAppAndVersionResponse> | null =\n await Promise.race([chainPromise(), timeoutPromise]);\n\n if (!resultOrTimeout) {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n } else {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n eventData: resultOrTimeout,\n });\n }\n return resultOrTimeout;\n }\n default: {\n const result = await this._sendCommandFunction(\n new GetAppAndVersionCommand(),\n PINGER_TIMEOUT,\n );\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n eventData: result,\n });\n return result;\n }\n }\n }\n\n public unsubscribe(): void {\n this._subscription.unsubscribe();\n }\n}\n"],
|
5
|
+
"mappings": "AAEA,OAAS,iBAAAA,MAAqB,0BAC9B,OACE,2BAAAC,EAEA,uBAAAC,MAEK,aAMP,OAAS,kBAAAC,MAAsB,kDAC/B,OAAS,6CAAAC,MAAiD,4DAC1D,OAGE,iBAAAC,MACK,8DAOA,MAAMC,CAAa,CAKxB,YACEC,EACQC,EACAC,EACRC,EACA,CAHQ,qBAAAF,EACA,6BAAAC,EAGR,KAAK,qBAAuBC,EAC5B,KAAK,QAAUH,EAAoB,eAAe,EAClD,KAAK,cAAgB,KAAK,wBACvB,OAAO,EACP,UAAU,MAAOI,GAAU,MAAM,KAAK,eAAeA,CAAK,CAAC,CAChE,CAfiB,qBACT,cACA,QAeR,MAAa,MAAgE,CAC3E,GAAI,CAIF,OAHe,MAAM,KAAK,oBACxB,KAAK,gBAAgB,YAAY,EACnC,CAEF,OAASC,EAAO,CACd,WAAK,QAAQ,MAAM,6BAA8B,CAC/C,KAAM,CACJ,MAAAA,CACF,CACF,CAAC,EACKA,CACR,CACF,CAEQ,eAAiB,MAAOD,GAAoB,CAClD,OAAQA,EAAM,UAAW,CACvB,KAAKN,EAAc,eACjB,OAAO,MAAM,KAAK,KAAK,EACzB,QACE,OAAO,IACX,CACF,EAEA,MAAc,oBAAoBQ,EAA8B,CAC9D,OAAQA,EAAe,CACrB,KAAKb,EAAc,OAAQ,CACzB,MAAMc,EAEF,SAAY,CACd,MAAMC,EAAmB,MAAM,KAAK,qBAClC,IAAId,EACJE,CACF,EAEA,YAAK,qBAAqB,IAAID,EAAuBC,CAAc,EAC5DY,CACT,EAEMC,EAAgC,IAAI,QAASC,GAAY,CAC7D,WACE,IAAMA,EAAQ,IAAI,EAClBb,EAA4C,EAAI,GAClD,CACF,CAAC,EAEKc,EACJ,MAAM,QAAQ,KAAK,CAACJ,EAAa,EAAGE,CAAc,CAAC,EAErD,OAAKE,EAKH,KAAK,wBAAwB,SAAS,CACpC,UAAWb,EAAc,kBACzB,UAAWa,CACb,CAAC,EAPD,KAAK,wBAAwB,SAAS,CACpC,UAAWb,EAAc,0BAC3B,CAAC,EAOIa,CACT,CACA,QAAS,CACP,MAAMC,EAAS,MAAM,KAAK,qBACxB,IAAIlB,EACJE,CACF,EACA,YAAK,wBAAwB,SAAS,CACpC,UAAWE,EAAc,kBACzB,UAAWc,CACb,CAAC,EACMA,CACT,CACF,CACF,CAEO,aAAoB,CACzB,KAAK,cAAc,YAAY,CACjC,CACF",
|
6
|
+
"names": ["DeviceModelId", "GetAppAndVersionCommand", "GetOsVersionCommand", "PINGER_TIMEOUT", "DEVICE_SESSION_REFRESHER_POLLING_INTERVAL", "SessionEvents", "DevicePinger", "loggerModuleFactory", "connectedDevice", "_sessionEventDispatcher", "sendCommandFunction", "event", "error", "deviceModelId", "chainPromise", "appVersionResult", "timeoutPromise", "resolve", "resultOrTimeout", "result"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Subject as D}from"rxjs";import{afterEach as f,beforeEach as C,describe as N,expect as n,it as r,vi as t}from"vitest";import{DeviceModelId as E}from"../../../api/device/DeviceModel";import{GetAppAndVersionCommand as S}from"../../../api/index";import{DEVICE_SESSION_REFRESHER_POLLING_INTERVAL as g}from"../../device-session/data/DeviceSessionRefresherConst";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";import{DevicePinger as p}from"./DevicePinger";N("DevicePinger",()=>{let e,u;const v=t.fn(()=>u);let c,a,l,s;C(()=>{c=new D,a={listen:()=>c.asObservable(),dispatch:t.fn()},e=t.fn(),u={info:t.fn(),warn:t.fn(),error:t.fn(),debug:t.fn(),subscribers:[]},l={deviceModel:{id:E.NANO_X}},s=new p(v,l,a,e)}),f(()=>{s.unsubscribe(),t.restoreAllMocks()}),r("should call sendCommandFunction and dispatch COMMAND_SUCCEEDED event on successful ping for non-NANO_S",async()=>{const o={status:"success",data:{foo:"bar"}};e.mockResolvedValue(o);const d=await s.ping();n(e).toHaveBeenCalledTimes(1);const m=e.mock.calls[0][0];n(m).toBeInstanceOf(S),n(a.dispatch).toHaveBeenCalledWith({eventName:i.COMMAND_SUCCEEDED,eventData:o}),n(d).toEqual(o)}),r("should log error and throw error on ping failure",async()=>{const o=new Error("ping failed");e.mockRejectedValue(o),await n(s.ping()).rejects.toThrow("ping failed"),n(e).toHaveBeenCalledTimes(1)}),r("should dispatch DEVICE_STATE_UPDATE_LOCKED and return null on timeout for NANO_S",async()=>{l.deviceModel.id=E.NANO_S,s.unsubscribe(),s=new p(v,l,a,e);const o=new Promise(()=>{});e.mockReturnValueOnce(o),t.useFakeTimers();const d=s.ping();t.advanceTimersByTime(g*4);const m=await d;n(m).toBeNull(),n(a.dispatch).toHaveBeenCalledWith({eventName:i.DEVICE_STATE_UPDATE_LOCKED}),n(e).toHaveBeenCalledTimes(1),t.useRealTimers()}),r("should call ping on REFRESH_NEEDED event",async()=>{const o={status:"success",data:{foo:"bar"}};e.mockResolvedValue(o),c.next({eventName:i.REFRESH_NEEDED,eventData:void 0}),await Promise.resolve(),n(e).toHaveBeenCalled(),n(a.dispatch).toHaveBeenCalledWith({eventName:i.COMMAND_SUCCEEDED,eventData:o})}),r("should not process events after unsubscribe is called",async()=>{s.unsubscribe(),e.mockClear(),c.next({eventName:i.REFRESH_NEEDED,eventData:void 0}),await Promise.resolve(),n(e).not.toHaveBeenCalled()})});
|
2
|
+
//# sourceMappingURL=DevicePinger.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/internal/device-session/model/DevicePinger.test.ts"],
|
4
|
+
"sourcesContent": ["import { Subject } from \"rxjs\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n GetAppAndVersionCommand,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport type { LoggerPublisherService } from \"@api/types\";\nimport { DEVICE_SESSION_REFRESHER_POLLING_INTERVAL } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport { DevicePinger } from \"./DevicePinger\";\n\ndescribe(\"DevicePinger\", () => {\n let dummySendCommandFunction: ReturnType<typeof vi.fn>;\n let mockLogger: LoggerPublisherService & {\n info: ReturnType<typeof vi.fn>;\n warn: ReturnType<typeof vi.fn>;\n error: ReturnType<typeof vi.fn>;\n };\n const mockedLoggerModuleFactory = vi.fn(() => mockLogger);\n let eventSubject: Subject<NewEvent>;\n let mockSessionEventDispatcher: DeviceSessionEventDispatcher;\n let dummyConnectedDevice: TransportConnectedDevice;\n let devicePinger: DevicePinger;\n\n beforeEach(() => {\n eventSubject = new Subject<NewEvent>();\n mockSessionEventDispatcher = {\n listen: () => eventSubject.asObservable(),\n dispatch: vi.fn(),\n } as unknown as DeviceSessionEventDispatcher;\n\n dummySendCommandFunction = vi.fn();\n mockLogger = {\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n debug: vi.fn(),\n subscribers: [],\n };\n\n dummyConnectedDevice = {\n deviceModel: {\n id: DeviceModelId.NANO_X,\n },\n } as unknown as TransportConnectedDevice;\n\n devicePinger = new DevicePinger(\n mockedLoggerModuleFactory,\n dummyConnectedDevice,\n mockSessionEventDispatcher,\n dummySendCommandFunction,\n );\n });\n\n afterEach(() => {\n devicePinger.unsubscribe();\n vi.restoreAllMocks();\n });\n\n it(\"should call sendCommandFunction and dispatch COMMAND_SUCCEEDED event on successful ping for non-NANO_S\", async () => {\n // given\n const dummyResult = {\n status: \"success\",\n data: { foo: \"bar\" },\n };\n dummySendCommandFunction.mockResolvedValue(dummyResult);\n\n // when\n const result = await devicePinger.ping();\n\n // then\n expect(dummySendCommandFunction).toHaveBeenCalledTimes(1);\n const commandArg = dummySendCommandFunction.mock\n .calls[0]![0] as GetAppAndVersionCommand;\n expect(commandArg).toBeInstanceOf(GetAppAndVersionCommand);\n expect(mockSessionEventDispatcher.dispatch).toHaveBeenCalledWith({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n eventData: dummyResult,\n });\n expect(result).toEqual(dummyResult);\n });\n\n it(\"should log error and throw error on ping failure\", async () => {\n // given\n const dummyError = new Error(\"ping failed\");\n dummySendCommandFunction.mockRejectedValue(dummyError);\n\n // then\n await expect(devicePinger.ping()).rejects.toThrow(\"ping failed\");\n expect(dummySendCommandFunction).toHaveBeenCalledTimes(1);\n });\n\n it(\"should dispatch DEVICE_STATE_UPDATE_LOCKED and return null on timeout for NANO_S\", async () => {\n // given\n dummyConnectedDevice.deviceModel.id = DeviceModelId.NANO_S;\n devicePinger.unsubscribe();\n devicePinger = new DevicePinger(\n mockedLoggerModuleFactory,\n dummyConnectedDevice,\n mockSessionEventDispatcher,\n dummySendCommandFunction,\n );\n const neverResolvingPromise = new Promise(() => {});\n dummySendCommandFunction.mockReturnValueOnce(neverResolvingPromise);\n vi.useFakeTimers();\n\n // when\n const pingPromise = devicePinger.ping();\n vi.advanceTimersByTime(DEVICE_SESSION_REFRESHER_POLLING_INTERVAL * 4);\n\n const result = await pingPromise;\n\n // then\n expect(result).toBeNull();\n expect(mockSessionEventDispatcher.dispatch).toHaveBeenCalledWith({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n expect(dummySendCommandFunction).toHaveBeenCalledTimes(1);\n\n vi.useRealTimers();\n });\n\n it(\"should call ping on REFRESH_NEEDED event\", async () => {\n // given\n const dummyResult = {\n status: \"success\",\n data: { foo: \"bar\" },\n };\n dummySendCommandFunction.mockResolvedValue(dummyResult);\n\n // when\n eventSubject.next({\n eventName: SessionEvents.REFRESH_NEEDED,\n eventData: undefined,\n });\n await Promise.resolve();\n\n // then\n expect(dummySendCommandFunction).toHaveBeenCalled();\n expect(mockSessionEventDispatcher.dispatch).toHaveBeenCalledWith({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n eventData: dummyResult,\n });\n });\n\n it(\"should not process events after unsubscribe is called\", async () => {\n // given\n devicePinger.unsubscribe();\n dummySendCommandFunction.mockClear();\n\n // when\n eventSubject.next({\n eventName: SessionEvents.REFRESH_NEEDED,\n eventData: undefined,\n });\n await Promise.resolve();\n\n // then\n expect(dummySendCommandFunction).not.toHaveBeenCalled();\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,OACxB,OAAS,aAAAC,EAAW,cAAAC,EAAY,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAAC,MAAU,SAEhE,OAAS,iBAAAC,MAAqB,0BAC9B,OACE,2BAAAC,MAEK,aAEP,OAAS,6CAAAC,MAAiD,4DAC1D,OAGE,iBAAAC,MACK,8DAEP,OAAS,gBAAAC,MAAoB,iBAE7BR,EAAS,eAAgB,IAAM,CAC7B,IAAIS,EACAC,EAKJ,MAAMC,EAA4BR,EAAG,GAAG,IAAMO,CAAU,EACxD,IAAIE,EACAC,EACAC,EACAC,EAEJhB,EAAW,IAAM,CACfa,EAAe,IAAIf,EACnBgB,EAA6B,CAC3B,OAAQ,IAAMD,EAAa,aAAa,EACxC,SAAUT,EAAG,GAAG,CAClB,EAEAM,EAA2BN,EAAG,GAAG,EACjCO,EAAa,CACX,KAAMP,EAAG,GAAG,EACZ,KAAMA,EAAG,GAAG,EACZ,MAAOA,EAAG,GAAG,EACb,MAAOA,EAAG,GAAG,EACb,YAAa,CAAC,CAChB,EAEAW,EAAuB,CACrB,YAAa,CACX,GAAIV,EAAc,MACpB,CACF,EAEAW,EAAe,IAAIP,EACjBG,EACAG,EACAD,EACAJ,CACF,CACF,CAAC,EAEDX,EAAU,IAAM,CACdiB,EAAa,YAAY,E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,EAEDD,EAAG,2CAA4C,SAAY,CAEzD,MAAMc,EAAc,CAClB,OAAQ,UACR,KAAM,CAAE,IAAK,KAAM,CACrB,EACAP,EAAyB,kBAAkBO,CAAW,EAGtDJ,EAAa,KAAK,CAChB,UAAWL,EAAc,eACzB,UAAW,MACb,CAAC,EACD,MAAM,QAAQ,QAAQ,EAGtBN,EAAOQ,CAAwB,EAAE,iBAAiB,EAClDR,EAAOY,EAA2B,QAAQ,EAAE,qBAAqB,CAC/D,UAAWN,EAAc,kBACzB,UAAWS,CACb,CAAC,CACH,CAAC,EAEDd,EAAG,wDAAyD,SAAY,CAEtEa,EAAa,YAAY,EACzBN,EAAyB,UAAU,EAGnCG,EAAa,KAAK,CAChB,UAAWL,EAAc,eACzB,UAAW,MACb,CAAC,EACD,MAAM,QAAQ,QAAQ,EAGtBN,EAAOQ,CAAwB,EAAE,IAAI,iBAAiB,CACxD,CAAC,CACH,CAAC",
|
6
|
+
"names": ["Subject", "afterEach", "beforeEach", "describe", "expect", "it", "vi", "DeviceModelId", "GetAppAndVersionCommand", "DEVICE_SESSION_REFRESHER_POLLING_INTERVAL", "SessionEvents", "DevicePinger", "dummySendCommandFunction", "mockLogger", "mockedLoggerModuleFactory", "eventSubject", "mockSessionEventDispatcher", "dummyConnectedDevice", "devicePinger", "dummyResult", "result", "commandArg", "dummyError", "neverResolvingPromise", "pingPromise"]
|
7
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{
|
1
|
+
import{BehaviorSubject as v}from"rxjs";import{v4 as d}from"uuid";import{CommandUtils as h}from"../../../api/command/utils/CommandUtils";import{DeviceStatus as c}from"../../../api/device/DeviceStatus";import{DeviceSessionStateType as S}from"../../../api/device-session/DeviceSessionState";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as u}from"../../device-session/data/DeviceSessionRefresherConst";import{MutexService as m}from"../../device-session/service/MutexService";import{RefresherService as D}from"../../device-session/service/RefresherService";import{DevicePinger as l}from"./DevicePinger";import{DeviceSessionEventDispatcher as _,SessionEvents as n}from"./DeviceSessionEventDispatcher";import{DeviceSessionRefresher as f}from"./DeviceSessionRefresher";import{DeviceSessionStateHandler as g}from"./DeviceSessionStateHandler";class V{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new m;_sessionEventDispatcher=new _;constructor({connectedDevice:e,id:s=d()},t,i,r,a){this._id=s,this._connectedDevice=e,this._logger=t("device-session"),this._managerApiService=i,this._secureChannelService=r,this._refresherOptions={...u,...a},this._deviceState=new v({sessionStateType:S.Connected,deviceStatus:c.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new l(t,e,this._sessionEventDispatcher,(o,p)=>this.sendCommand(o,p)),this._deviceSessionRefresher=new f(t,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new g(t,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,o=>this.setDeviceSessionState(o)),this._refresherService=new D(t,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{await this._pinger.ping()}catch(e){throw this._logger.error("Error while initialising session",{data:{error:e}}),e}finally{this._refresherOptions.isRefresherDisabled||this._deviceSessionRefresher.startRefresher()}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(e){this._deviceState.next(e)}async sendApdu(e,s={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const t=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_BUSY});const i=await this._connectedDevice.sendApdu(e,s.triggersDisconnection,s.abortTimeout);return i.ifRight(r=>{h.isLockedDeviceResponse(r)?this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_CONNECTED})}),i}finally{t()}}async sendCommand(e,s){const t=e.getApdu();return(await this.sendApdu(t.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:s})).caseOf({Left:r=>{throw r},Right:r=>e.parseResponse(r,this._connectedDevice.deviceModel.id)})}executeDeviceAction(e){const{observable:s,cancel:t}=e._execute({sendApdu:async i=>this.sendApdu(i),sendCommand:async(i,r)=>this.sendCommand(i,r),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:i=>(this.setDeviceSessionState(i),this._deviceState.getValue()),disableRefresher:i=>this._refresherService.disableRefresher(i),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService});return{observable:s,cancel:t}}close(){this._updateDeviceStatus(c.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const s=this._deviceState.getValue();this._deviceState.next({...s,deviceStatus:e})}}export{V as DeviceSession};
|
2
2
|
//# sourceMappingURL=DeviceSession.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/model/DeviceSession.ts"],
|
4
|
-
"sourcesContent": ["import { type Either
|
5
|
-
"mappings": "
|
6
|
-
"names": ["
|
4
|
+
"sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { BehaviorSubject, type Observable } from \"rxjs\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { MutexService } from \"@internal/device-session/service/MutexService\";\nimport { RefresherService } from \"@internal/device-session/service/RefresherService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DevicePinger } from \"./DevicePinger\";\nimport {\n DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"./DeviceSessionEventDispatcher\";\nimport { DeviceSessionRefresher } from \"./DeviceSessionRefresher\";\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\nexport type SessionConstructorArgs = {\n connectedDevice: TransportConnectedDevice;\n id?: DeviceSessionId;\n};\n\nexport type DeviceSessionRefresherOptions = {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n};\n\ntype SendApduOptions = {\n isPolling?: boolean;\n triggersDisconnection?: boolean;\n abortTimeout?: number;\n};\n\n/**\n * Represents a session with a device.\n */\nexport class DeviceSession {\n private readonly _id: DeviceSessionId;\n private readonly _connectedDevice: TransportConnectedDevice;\n private readonly _deviceState: BehaviorSubject<DeviceSessionState>;\n private readonly _managerApiService: ManagerApiService;\n private readonly _secureChannelService: SecureChannelService;\n private readonly _logger: LoggerPublisherService;\n private readonly _refresherOptions: DeviceSessionRefresherOptions;\n private _pinger: DevicePinger;\n private _deviceSessionRefresher: DeviceSessionRefresher;\n private readonly _refresherService: RefresherService;\n private _commandMutex = new MutexService();\n private _sessionEventDispatcher = new DeviceSessionEventDispatcher();\n\n constructor(\n { connectedDevice, id = uuidv4() }: SessionConstructorArgs,\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n managerApiService: ManagerApiService,\n secureChannelService: SecureChannelService,\n deviceSessionRefresherOptions: DeviceSessionRefresherOptions | undefined,\n ) {\n this._id = id;\n this._connectedDevice = connectedDevice;\n this._logger = loggerModuleFactory(\"device-session\");\n this._managerApiService = managerApiService;\n this._secureChannelService = secureChannelService;\n this._refresherOptions = {\n ...DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n ...deviceSessionRefresherOptions,\n };\n this._deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: this._connectedDevice.deviceModel.id,\n });\n\n this._pinger = new DevicePinger(\n loggerModuleFactory,\n connectedDevice,\n this._sessionEventDispatcher,\n (command, abortTimeout) => this.sendCommand(command, abortTimeout),\n );\n this._deviceSessionRefresher = new DeviceSessionRefresher(\n loggerModuleFactory,\n this._refresherOptions,\n this._sessionEventDispatcher,\n this._connectedDevice,\n );\n new DeviceSessionStateHandler(\n loggerModuleFactory,\n this._sessionEventDispatcher,\n this._connectedDevice,\n this._deviceState,\n (state) => this.setDeviceSessionState(state),\n );\n\n this._refresherService = new RefresherService(loggerModuleFactory, {\n start: () => this._deviceSessionRefresher.restartRefresher(),\n stop: () => this._deviceSessionRefresher.stopRefresher(),\n });\n }\n\n public async initialiseSession(): Promise<void> {\n try {\n await this._pinger.ping();\n } catch (error) {\n this._logger.error(\"Error while initialising session\", {\n data: { error },\n });\n throw error;\n } finally {\n if (!this._refresherOptions.isRefresherDisabled) {\n this._deviceSessionRefresher.startRefresher();\n }\n }\n }\n\n public get id(): DeviceSessionId {\n return this._id;\n }\n\n public get connectedDevice(): TransportConnectedDevice {\n return this._connectedDevice;\n }\n\n public get state(): Observable<DeviceSessionState> {\n return this._deviceState.asObservable();\n }\n\n public getDeviceSessionState(): DeviceSessionState {\n return this._deviceState.getValue();\n }\n\n public setDeviceSessionState(state: DeviceSessionState): void {\n this._deviceState.next(state);\n }\n\n public async sendApdu(\n rawApdu: Uint8Array,\n options: SendApduOptions = {\n isPolling: false,\n triggersDisconnection: false,\n abortTimeout: undefined,\n },\n ): Promise<Either<DmkError, ApduResponse>> {\n const release = await this._commandMutex.lock();\n\n try {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n const result = await this._connectedDevice.sendApdu(\n rawApdu,\n options.triggersDisconnection,\n options.abortTimeout,\n );\n\n result\n .ifRight((response: ApduResponse) => {\n if (CommandUtils.isLockedDeviceResponse(response)) {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n } else {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n }\n })\n .ifLeft(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n });\n return result;\n } finally {\n release();\n }\n }\n\n public async sendCommand<Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ): Promise<CommandResult<Response, ErrorStatusCodes>> {\n const apdu = command.getApdu();\n\n const response = await this.sendApdu(apdu.getRawApdu(), {\n isPolling: false,\n triggersDisconnection: command.triggersDisconnection ?? false,\n abortTimeout,\n });\n\n return response.caseOf({\n Left: (err) => {\n throw err;\n },\n Right: (r) =>\n command.parseResponse(r, this._connectedDevice.deviceModel.id),\n });\n }\n\n public executeDeviceAction<\n Output,\n Input,\n E extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n deviceAction: DeviceAction<Output, Input, E, IntermediateValue>,\n ): ExecuteDeviceActionReturnType<Output, E, IntermediateValue> {\n const { observable, cancel } = deviceAction._execute({\n sendApdu: async (apdu: Uint8Array) => this.sendApdu(apdu),\n sendCommand: async <Response, ErrorStatusCodes, Args>(\n command: Command<Response, ErrorStatusCodes, Args>,\n abortTimeout?: number,\n ) => this.sendCommand(command, abortTimeout),\n getDeviceModel: () => this._connectedDevice.deviceModel,\n getDeviceSessionState: () => this._deviceState.getValue(),\n getDeviceSessionStateObservable: () => this.state,\n setDeviceSessionState: (state: DeviceSessionState) => {\n this.setDeviceSessionState(state);\n return this._deviceState.getValue();\n },\n disableRefresher: (blockerId: string) =>\n this._refresherService.disableRefresher(blockerId),\n getManagerApiService: () => this._managerApiService,\n getSecureChannelService: () => this._secureChannelService,\n });\n return { observable, cancel };\n }\n\n public close(): void {\n this._updateDeviceStatus(DeviceStatus.NOT_CONNECTED);\n this._deviceState.complete();\n this._deviceSessionRefresher.stopRefresher();\n }\n\n public disableRefresher(id: string): () => void {\n return this._refresherService.disableRefresher(id);\n }\n\n private _updateDeviceStatus(deviceStatus: DeviceStatus): void {\n const state = this._deviceState.getValue();\n this._deviceState.next({ ...state, deviceStatus });\n }\n}\n"],
|
5
|
+
"mappings": "AACA,OAAS,mBAAAA,MAAwC,OACjD,OAAS,MAAMC,MAAc,OAI7B,OAAS,gBAAAC,MAAoB,kCAC7B,OAAS,gBAAAC,MAAoB,2BAO7B,OAEE,0BAAAC,MACK,yCAKP,OAAS,4CAAAC,MAAgD,4DACzD,OAAS,gBAAAC,MAAoB,gDAC7B,OAAS,oBAAAC,MAAwB,oDAIjC,OAAS,gBAAAC,MAAoB,iBAC7B,OACE,gCAAAC,EACA,iBAAAC,MACK,iCACP,OAAS,0BAAAC,MAA8B,2BACvC,OAAS,6BAAAC,MAAiC,8BAqBnC,MAAMC,CAAc,CACR,IACA,iBACA,aACA,mBACA,sBACA,QACA,kBACT,QACA,wBACS,kBACT,cAAgB,IAAIP,EACpB,wBAA0B,IAAIG,EAEtC,YACE,CAAE,gBAAAK,EAAiB,GAAAC,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wBC,IACtB,KAAK,sBAAsBA,CAAK,EACzB,KAAK,aAAa,SAAS,GAEpC,iBAAmBY,GACjB,KAAK,kBAAkB,iBAAiBA,CAAS,EACnD,qBAAsB,IAAM,KAAK,mBACjC,wBAAyB,IAAM,KAAK,qBACtC,CAAC,EACD,MAAO,CAAE,WAAAF,EAAY,OAAAC,CAAO,CAC9B,CAEO,OAAc,CACnB,KAAK,oBAAoB9B,EAAa,aAAa,EACnD,KAAK,aAAa,SAAS,EAC3B,KAAK,wBAAwB,cAAc,CAC7C,CAEO,iBAAiBY,EAAwB,CAC9C,OAAO,KAAK,kBAAkB,iBAAiBA,CAAE,CACnD,CAEQ,oBAAoBoB,EAAkC,CAC5D,MAAMb,EAAQ,KAAK,aAAa,SAAS,EACzC,KAAK,aAAa,KAAK,CAAE,GAAGA,EAAO,aAAAa,CAAa,CAAC,CACnD,CACF",
|
6
|
+
"names": ["BehaviorSubject", "uuidv4", "CommandUtils", "DeviceStatus", "DeviceSessionStateType", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "MutexService", "RefresherService", "DevicePinger", "DeviceSessionEventDispatcher", "SessionEvents", "DeviceSessionRefresher", "DeviceSessionStateHandler", "DeviceSession", "connectedDevice", "id", "loggerModuleFactory", "managerApiService", "secureChannelService", "deviceSessionRefresherOptions", "command", "abortTimeout", "state", "error", "rawApdu", "options", "release", "result", "response", "apdu", "err", "deviceAction", "observable", "cancel", "blockerId", "deviceStatus"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{connectedDeviceStubBuilder as
|
1
|
+
import{connectedDeviceStubBuilder as s}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DeviceSession as t}from"../../device-session/model/DeviceSession";const p=(e={},r,i,o,n)=>new t({connectedDevice:s(),id:"fakeSessionId",...e},r,i,o,n);export{p as deviceSessionStubBuilder};
|
2
2
|
//# sourceMappingURL=DeviceSession.stub.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/model/DeviceSession.stub.ts"],
|
4
|
-
"sourcesContent": ["import { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport {\n DeviceSession,\n type SessionConstructorArgs,\n} from \"@internal/device-session/model/DeviceSession\";\nimport type { ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nexport const deviceSessionStubBuilder = (\n props: Partial<SessionConstructorArgs> = {},\n loggerFactory: (tag: string) => LoggerPublisherService,\n managerApi: ManagerApiService,\n secureChannel: SecureChannelService,\n) =>\n new DeviceSession(\n {\n connectedDevice: connectedDeviceStubBuilder(),\n id: \"fakeSessionId\",\n ...props,\n },\n loggerFactory,\n managerApi,\n secureChannel,\n );\n"],
|
5
|
-
"mappings": "AACA,OAAS,8BAAAA,MAAkC,qDAC3C,OACE,iBAAAC,
|
6
|
-
"names": ["connectedDeviceStubBuilder", "DeviceSession", "deviceSessionStubBuilder", "props", "loggerFactory", "managerApi", "secureChannel"]
|
4
|
+
"sourcesContent": ["import { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport {\n DeviceSession,\n type DeviceSessionRefresherOptions,\n type SessionConstructorArgs,\n} from \"@internal/device-session/model/DeviceSession\";\nimport type { ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nexport const deviceSessionStubBuilder = (\n props: Partial<SessionConstructorArgs> = {},\n loggerFactory: (tag: string) => LoggerPublisherService,\n managerApi: ManagerApiService,\n secureChannel: SecureChannelService,\n deviceSessionRefresherOptions: DeviceSessionRefresherOptions,\n) =>\n new DeviceSession(\n {\n connectedDevice: connectedDeviceStubBuilder(),\n id: \"fakeSessionId\",\n ...props,\n },\n loggerFactory,\n managerApi,\n secureChannel,\n deviceSessionRefresherOptions,\n );\n"],
|
5
|
+
"mappings": "AACA,OAAS,8BAAAA,MAAkC,qDAC3C,OACE,iBAAAC,MAGK,+CAIA,MAAMC,EAA2B,CACtCC,EAAyC,CAAC,EAC1CC,EACAC,EACAC,EACAC,IAEA,IAAIN,EACF,CACE,gBAAiBD,EAA2B,EAC5C,GAAI,gBACJ,GAAGG,CACL,EACAC,EACAC,EACAC,EACAC,CACF",
|
6
|
+
"names": ["connectedDeviceStubBuilder", "DeviceSession", "deviceSessionStubBuilder", "props", "loggerFactory", "managerApi", "secureChannel", "deviceSessionRefresherOptions"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Subject as n}from"rxjs";var t=(e=>(e.NEW_STATE="NEW_STATE",e.REFRESH_NEEDED="REFRESH_NEEDED",e.COMMAND_SUCCEEDED="COMMAND_SUCCEEDED",e.DEVICE_STATE_UPDATE_BUSY="DEVICE_STATE_UPDATE_BUSY",e.DEVICE_STATE_UPDATE_LOCKED="DEVICE_STATE_UPDATE_LOCKED",e.DEVICE_STATE_UPDATE_CONNECTED="DEVICE_STATE_UPDATE_CONNECTED",e))(t||{});class s{_eventEmitter=new n;listen(){return this._eventEmitter.asObservable()}dispatch(E){this._eventEmitter.next(E)}}export{s as DeviceSessionEventDispatcher,t as SessionEvents};
|
2
|
+
//# sourceMappingURL=DeviceSessionEventDispatcher.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/internal/device-session/model/DeviceSessionEventDispatcher.ts"],
|
4
|
+
"sourcesContent": ["import { type Observable, Subject } from \"rxjs\";\n\nimport { type GetAppAndVersionResponse } from \"@api/index\";\nimport { type CommandResult } from \"@api/types\";\n\nexport enum SessionEvents {\n NEW_STATE = \"NEW_STATE\",\n REFRESH_NEEDED = \"REFRESH_NEEDED\",\n COMMAND_SUCCEEDED = \"COMMAND_SUCCEEDED\",\n DEVICE_STATE_UPDATE_BUSY = \"DEVICE_STATE_UPDATE_BUSY\",\n DEVICE_STATE_UPDATE_LOCKED = \"DEVICE_STATE_UPDATE_LOCKED\",\n DEVICE_STATE_UPDATE_CONNECTED = \"DEVICE_STATE_UPDATE_CONNECTED\",\n}\n\ninterface SessionEventPayloads {\n [SessionEvents.NEW_STATE]: undefined;\n [SessionEvents.REFRESH_NEEDED]: undefined;\n [SessionEvents.DEVICE_STATE_UPDATE_BUSY]: undefined;\n [SessionEvents.DEVICE_STATE_UPDATE_LOCKED]: undefined;\n [SessionEvents.DEVICE_STATE_UPDATE_CONNECTED]: undefined;\n [SessionEvents.COMMAND_SUCCEEDED]: CommandResult<GetAppAndVersionResponse>;\n}\n\nexport type NewEvent = {\n [K in SessionEvents]: SessionEventPayloads[K] extends undefined\n ? { eventName: K; eventData?: undefined }\n : { eventName: K; eventData: SessionEventPayloads[K] };\n}[SessionEvents];\n\nexport class DeviceSessionEventDispatcher {\n private _eventEmitter: Subject<NewEvent> = new Subject();\n\n public listen(): Observable<NewEvent> {\n return this._eventEmitter.asObservable();\n }\n\n public dispatch(event: NewEvent): void {\n this._eventEmitter.next(event);\n }\n}\n"],
|
5
|
+
"mappings": "AAAA,OAA0B,WAAAA,MAAe,OAKlC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBACpBA,EAAA,yBAA2B,2BAC3BA,EAAA,2BAA6B,6BAC7BA,EAAA,8BAAgC,gCANtBA,OAAA,IAwBL,MAAMC,CAA6B,CAChC,cAAmC,IAAIF,EAExC,QAA+B,CACpC,OAAO,KAAK,cAAc,aAAa,CACzC,CAEO,SAASG,EAAuB,CACrC,KAAK,cAAc,KAAKA,CAAK,CAC/B,CACF",
|
6
|
+
"names": ["Subject", "SessionEvents", "DeviceSessionEventDispatcher", "event"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{describe as u,expect as E,it as d}from"vitest";import{DeviceSessionEventDispatcher as p,SessionEvents as c}from"./DeviceSessionEventDispatcher";u("DeviceSessionEventDispatcher",()=>{let s;beforeEach(()=>{s=new p}),d("should dispatch and receive an event without payload",()=>new Promise((i,a)=>{const e={eventName:c.REFRESH_NEEDED,eventData:void 0},t=s.listen().subscribe(o=>{try{E(o).toEqual(e),i(void 0)}catch(n){a(n)}finally{t.unsubscribe()}});s.dispatch(e)})),d("should dispatch and receive a COMMAND_SUCCEEDED event with payload",()=>new Promise((i,a)=>{const e={status:"success",data:{someField:"dummyValue"}},t={eventName:c.COMMAND_SUCCEEDED,eventData:e},o=s.listen().subscribe(n=>{if(n.eventName===c.COMMAND_SUCCEEDED)try{E(n).toEqual(t),i(void 0)}catch(r){a(r)}finally{o.unsubscribe()}});s.dispatch(t)})),d("should dispatch multiple events",()=>new Promise((i,a)=>{const e=[{eventName:c.DEVICE_STATE_UPDATE_BUSY,eventData:void 0},{eventName:c.DEVICE_STATE_UPDATE_CONNECTED,eventData:void 0}],t=[],o=s.listen().subscribe(n=>{if(t.push(n),t.length===e.length)try{E(t).toEqual(e),i(void 0)}catch(r){a(r)}finally{o.unsubscribe()}});e.forEach(n=>s.dispatch(n))}))});
|
2
|
+
//# sourceMappingURL=DeviceSessionEventDispatcher.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/internal/device-session/model/DeviceSessionEventDispatcher.test.ts"],
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport { type GetAppAndVersionResponse } from \"@api/index\";\nimport type { CommandResult } from \"@api/types\";\n\nimport {\n DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"./DeviceSessionEventDispatcher\";\n\ndescribe(\"DeviceSessionEventDispatcher\", () => {\n let dispatcher: DeviceSessionEventDispatcher;\n\n beforeEach(() => {\n dispatcher = new DeviceSessionEventDispatcher();\n });\n\n it(\"should dispatch and receive an event without payload\", () =>\n new Promise((resolve, reject) => {\n // given\n const expectedEvent: NewEvent = {\n eventName: SessionEvents.REFRESH_NEEDED,\n eventData: undefined,\n };\n\n // when\n const subscription = dispatcher.listen().subscribe((event) => {\n // then\n try {\n expect(event).toEqual(expectedEvent);\n resolve(undefined);\n } catch (error) {\n reject(error);\n } finally {\n subscription.unsubscribe();\n }\n });\n\n dispatcher.dispatch(expectedEvent);\n }));\n\n it(\"should dispatch and receive a COMMAND_SUCCEEDED event with payload\", () =>\n new Promise((resolve, reject) => {\n // given\n const dummyCommandResult = {\n status: \"success\",\n data: { someField: \"dummyValue\" },\n } as unknown as CommandResult<GetAppAndVersionResponse>;\n\n const expectedEvent: NewEvent = {\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n eventData: dummyCommandResult,\n };\n\n // when\n const subscription = dispatcher.listen().subscribe((event) => {\n if (event.eventName === SessionEvents.COMMAND_SUCCEEDED) {\n // then\n try {\n expect(event).toEqual(expectedEvent);\n resolve(undefined);\n } catch (error) {\n reject(error);\n } finally {\n subscription.unsubscribe();\n }\n }\n });\n\n dispatcher.dispatch(expectedEvent);\n }));\n\n it(\"should dispatch multiple events\", () =>\n new Promise((resolve, reject) => {\n // given\n const events: NewEvent[] = [\n {\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n eventData: undefined,\n },\n {\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n eventData: undefined,\n },\n ];\n const received: NewEvent[] = [];\n\n // when\n const subscription = dispatcher.listen().subscribe((event) => {\n received.push(event);\n\n // then\n if (received.length === events.length) {\n try {\n expect(received).toEqual(events);\n resolve(undefined);\n } catch (error) {\n reject(error);\n } finally {\n subscription.unsubscribe();\n }\n }\n });\n\n events.forEach((event) => dispatcher.dispatch(event));\n }));\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,UAAAC,EAAQ,MAAAC,MAAU,SAKrC,OACE,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K,EAGfI,EAAS,SAAWD,EAAO,OAC7B,GAAI,CACFZ,EAAOa,CAAQ,EAAE,QAAQD,CAAM,EAC/BP,EAAQ,MAAS,CACnB,OAASK,EAAO,CACdJ,EAAOI,CAAK,CACd,QAAE,CACAF,EAAa,YAAY,CAC3B,CAEJ,CAAC,EAEDI,EAAO,QAASH,GAAUL,EAAW,SAASK,CAAK,CAAC,CACtD,CAAC,CAAC,CACN,CAAC",
|
6
|
+
"names": ["describe", "expect", "it", "DeviceSessionEventDispatcher", "SessionEvents", "dispatcher", "resolve", "reject", "expectedEvent", "subscription", "event", "error", "dummyCommandResult", "events", "received"]
|
7
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
import{timer as n}from"rxjs";import{DeviceModelId as c}from"../../../api/device/DeviceModel";import{DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL as t,DEVICE_SESSION_REFRESHER_POLLING_INTERVAL as o}from"../../device-session/data/DeviceSessionRefresherConst";import{SessionEvents as h}from"../../device-session/model/DeviceSessionEventDispatcher";class d{constructor(i,s,e,r){this._sessionEventDispatcher=e;this._refresherOptions=s,this._logger=i("device-session-refresher"),this._connectedDeviceID=r.deviceModel.id}_refresherSubscription;_refresherOptions;_logger;_connectedDeviceID;startRefresher(){if(this._refresherOptions.isRefresherDisabled)return;const i=this.getValidPollingInterval(this._refresherOptions,this._logger)*2;this._refresherSubscription=n(0,i).subscribe(()=>{this._sessionEventDispatcher.dispatch({eventName:h.REFRESH_NEEDED})})}stopRefresher(){this._refresherSubscription&&(this._refresherSubscription.unsubscribe(),this._refresherSubscription=void 0,this._logger.info("Refresher stopped."))}restartRefresher(){this.stopRefresher(),this.startRefresher(),this._logger.info("Refresher restarted.")}destroy(){this.stopRefresher()}getValidPollingInterval=(i,s)=>{const{pollingInterval:e}=i;switch(this._connectedDeviceID){case c.NANO_S:{const r=o*2;return e!==void 0&&e<r?(s.warn(`Polling interval of ${e} is too low, setting to minimum as ${r}`),r):e??r}default:return e!==void 0&&e<t?(s.warn(`Polling interval of ${e} is too low, setting to minimum as ${t}`),t):e??o}}}export{d as DeviceSessionRefresher};
|
2
2
|
//# sourceMappingURL=DeviceSessionRefresher.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/model/DeviceSessionRefresher.ts"],
|
4
|
-
"sourcesContent": ["import {
|
5
|
-
"mappings": "
|
6
|
-
"names": ["
|
4
|
+
"sourcesContent": ["import { type Subscription, timer } from \"rxjs\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { type LoggerPublisherService } from \"@api/types\";\nimport {\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL,\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL,\n} from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport {\n type DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport interface DeviceSessionRefresherOptions {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n}\n\nexport class DeviceSessionRefresher {\n private _refresherSubscription!: Subscription | undefined;\n private _refresherOptions: DeviceSessionRefresherOptions;\n private readonly _logger: LoggerPublisherService;\n private _connectedDeviceID: DeviceModelId;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n refresherOptions: DeviceSessionRefresherOptions,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n connectedDevice: TransportConnectedDevice,\n ) {\n this._refresherOptions = refresherOptions;\n this._logger = loggerModuleFactory(\"device-session-refresher\");\n this._connectedDeviceID = connectedDevice.deviceModel.id;\n }\n\n public startRefresher(): void {\n if (this._refresherOptions.isRefresherDisabled) return;\n\n const pollingInterval =\n this.getValidPollingInterval(this._refresherOptions, this._logger) * 2;\n\n this._refresherSubscription = timer(0, pollingInterval).subscribe(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.REFRESH_NEEDED,\n });\n });\n }\n\n public stopRefresher(): void {\n if (this._refresherSubscription) {\n this._refresherSubscription.unsubscribe();\n this._refresherSubscription = undefined;\n this._logger.info(\"Refresher stopped.\");\n }\n }\n\n public restartRefresher(): void {\n this.stopRefresher();\n this.startRefresher();\n this._logger.info(\"Refresher restarted.\");\n }\n\n public destroy(): void {\n this.stopRefresher();\n }\n\n private getValidPollingInterval = (\n refresherOptions: DeviceSessionRefresherOptions,\n logger: LoggerPublisherService,\n ): number => {\n const { pollingInterval } = refresherOptions;\n switch (this._connectedDeviceID) {\n case DeviceModelId.NANO_S: {\n const defaultNanoPollingInterval =\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL * 2;\n if (\n pollingInterval !== undefined &&\n pollingInterval < defaultNanoPollingInterval\n ) {\n logger.warn(\n `Polling interval of ${pollingInterval} is too low, setting to minimum as ${defaultNanoPollingInterval}`,\n );\n return defaultNanoPollingInterval;\n }\n return pollingInterval ?? defaultNanoPollingInterval;\n }\n default:\n if (\n pollingInterval !== undefined &&\n pollingInterval < DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL\n ) {\n logger.warn(\n `Polling interval of ${pollingInterval} is too low, setting to minimum as ${DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL}`,\n );\n return DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL;\n }\n\n return pollingInterval ?? DEVICE_SESSION_REFRESHER_POLLING_INTERVAL;\n }\n };\n}\n"],
|
5
|
+
"mappings": "AAAA,OAA4B,SAAAA,MAAa,OAEzC,OAAS,iBAAAC,MAAqB,0BAG9B,OACE,qDAAAC,EACA,6CAAAC,MACK,4DACP,OAEE,iBAAAC,MACK,8DAOA,MAAMC,CAAuB,CAMlC,YACEC,EACAC,EACQC,EACRC,EACA,CAFQ,6BAAAD,EAGR,KAAK,kBAAoBD,EACzB,KAAK,QAAUD,EAAoB,0BAA0B,EAC7D,KAAK,mBAAqBG,EAAgB,YAAY,EACxD,CAdQ,uBACA,kBACS,QACT,mBAaD,gBAAuB,CAC5B,GAAI,KAAK,kBAAkB,oBAAqB,OAEhD,MAAMC,EACJ,KAAK,wBAAwB,KAAK,kBAAmB,KAAK,OAAO,EAAI,EAEvE,KAAK,uBAAyBV,EAAM,EAAGU,CAAe,EAAE,UAAU,IAAM,CACtE,KAAK,wBAAwB,SAAS,CACpC,UAAWN,EAAc,cAC3B,CAAC,CACH,CAAC,CACH,CAEO,eAAsB,CACvB,KAAK,yBACP,KAAK,uBAAuB,YAAY,EACxC,KAAK,uBAAyB,OAC9B,KAAK,QAAQ,KAAK,oBAAoB,EAE1C,CAEO,kBAAyB,CAC9B,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,KAAK,sBAAsB,CAC1C,CAEO,SAAgB,CACrB,KAAK,cAAc,CACrB,CAEQ,wBAA0B,CAChCG,EACAI,IACW,CACX,KAAM,CAAE,gBAAAD,CAAgB,EAAIH,EAC5B,OAAQ,KAAK,mBAAoB,CAC/B,KAAKN,EAAc,OAAQ,CACzB,MAAMW,EACJT,EAA4C,EAC9C,OACEO,IAAoB,QACpBA,EAAkBE,GAElBD,EAAO,KACL,uBAAuBD,CAAe,sCAAsCE,CAA0B,EACxG,EACOA,GAEFF,GAAmBE,CAC5B,CACA,QACE,OACEF,IAAoB,QACpBA,EAAkBR,GAElBS,EAAO,KACL,uBAAuBD,CAAe,sCAAsCR,CAAiD,EAC/H,EACOA,GAGFQ,GAAmBP,CAC9B,CACF,CACF",
|
6
|
+
"names": ["timer", "DeviceModelId", "DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL", "DEVICE_SESSION_REFRESHER_POLLING_INTERVAL", "SessionEvents", "DeviceSessionRefresher", "loggerModuleFactory", "refresherOptions", "_sessionEventDispatcher", "connectedDevice", "pollingInterval", "logger", "defaultNanoPollingInterval"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{
|
1
|
+
import{Subject as u}from"rxjs";import{afterEach as D,beforeEach as S,describe as y,expect as n,it as l,vi as t}from"vitest";import{DeviceModelId as h}from"../../../api/device/DeviceModel";import{DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL as p,DEVICE_SESSION_REFRESHER_POLLING_INTERVAL as E}from"../../device-session/data/DeviceSessionRefresherConst";import{SessionEvents as w}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionRefresher as c}from"./DeviceSessionRefresher";y("DeviceSessionRefresher",()=>{let d,s,o;const f={deviceModel:{id:h.FLEX}},m={deviceModel:{id:h.NANO_S}},i=t.fn(()=>o);let e;S(()=>{t.useFakeTimers(),d=new u,s={listen:()=>d.asObservable(),dispatch:t.fn()},o={info:t.fn(),warn:t.fn(),error:t.fn(),debug:t.fn(),subscribers:[]}}),D(()=>{e?.destroy(),t.useRealTimers(),t.restoreAllMocks()}),l("should not start refresher if disabled",()=>{const r={isRefresherDisabled:!0,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),t.advanceTimersByTime(2e3),n(s.dispatch).not.toHaveBeenCalled()}),l("should warn and use minimum polling interval for default device when provided interval is too low",()=>{const r=p-100,a={isRefresherDisabled:!1,pollingInterval:r};e=new c(i,a,s,f),e.startRefresher();const v=`Polling interval of ${r} is too low, setting to minimum as ${p}`;n(o.warn).toHaveBeenCalledWith(v)}),l("should warn and use minimum polling interval for NANO_S device when provided interval is too low",()=>{const r=E*2,a=r-100,v={isRefresherDisabled:!1,pollingInterval:a};e=new c(i,v,s,m),e.startRefresher();const R=`Polling interval of ${a} is too low, setting to minimum as ${r}`;n(o.warn).toHaveBeenCalledWith(R)}),l("should not warn when provided polling interval is valid for default device",()=>{const a={isRefresherDisabled:!1,pollingInterval:p+100};e=new c(i,a,s,f),e.startRefresher(),n(o.warn).not.toHaveBeenCalled()}),l("should dispatch refresh event on timer ticks",()=>{const r=p+100,a={isRefresherDisabled:!1,pollingInterval:r};e=new c(i,a,s,f),e.startRefresher();const v=r*2;t.advanceTimersByTime(v*3),n(s.dispatch.mock.calls.length).toBe(4),n(s.dispatch.mock.calls[0][0]).toEqual({eventName:w.REFRESH_NEEDED})}),l("should stop refresher",()=>{const r={isRefresherDisabled:!1,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),s.dispatch.mockClear(),e.stopRefresher(),t.advanceTimersByTime(2e3),n(s.dispatch).not.toHaveBeenCalled(),n(o.info).toHaveBeenCalledWith("Refresher stopped.")}),l("should restart refresher",()=>{const r={isRefresherDisabled:!1,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),s.dispatch.mockClear(),t.clearAllTimers(),e.restartRefresher(),n(o.info).toHaveBeenCalledWith("Refresher stopped."),n(o.info).toHaveBeenCalledWith("Refresher restarted."),t.advanceTimersByTime(2e3),n(s.dispatch.mock.calls.length).toBeGreaterThan(0)}),l("should destroy refresher",()=>{const r={isRefresherDisabled:!1,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),e.destroy(),t.advanceTimersByTime(2e3),n(s.dispatch).not.toHaveBeenCalled()})});
|
2
2
|
//# sourceMappingURL=DeviceSessionRefresher.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/model/DeviceSessionRefresher.test.ts"],
|
4
|
-
"sourcesContent": ["import {
|
5
|
-
"mappings": "AAAA,OAAS,
|
6
|
-
"names": ["
|
4
|
+
"sourcesContent": ["import { Subject } from \"rxjs\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport type { LoggerPublisherService } from \"@api/types\";\nimport {\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL,\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL,\n} from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport type {\n DeviceSessionEventDispatcher,\n NewEvent,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\nimport { SessionEvents } from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport {\n DeviceSessionRefresher,\n type DeviceSessionRefresherOptions,\n} from \"./DeviceSessionRefresher\";\n\ndescribe(\"DeviceSessionRefresher\", () => {\n let subject: Subject<NewEvent>;\n let mockSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: LoggerPublisherService & {\n info: ReturnType<typeof vi.fn>;\n warn: ReturnType<typeof vi.fn>;\n error: ReturnType<typeof vi.fn>;\n debug: ReturnType<typeof vi.fn>;\n subscribers?: unknown[];\n };\n\n const stubDefaultDevice = {\n deviceModel: {\n id: DeviceModelId.FLEX,\n },\n } as TransportConnectedDevice;\n\n const stubNanoSDevice = {\n deviceModel: {\n id: DeviceModelId.NANO_S,\n },\n } as TransportConnectedDevice;\n\n const mockedLoggerModuleFactory = vi.fn(() => mockLogger);\n let refresher: DeviceSessionRefresher;\n\n beforeEach(() => {\n vi.useFakeTimers();\n subject = new Subject<NewEvent>();\n mockSessionEventDispatcher = {\n listen: () => subject.asObservable(),\n dispatch: vi.fn(),\n } as unknown as DeviceSessionEventDispatcher;\n mockLogger = {\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n debug: vi.fn(),\n subscribers: [],\n };\n });\n\n afterEach(() => {\n refresher?.destroy();\n vi.useRealTimers();\n vi.restoreAllMocks();\n });\n\n it(\"should not start refresher if disabled\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: true,\n pollingInterval: 1000,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n vi.advanceTimersByTime(2000);\n\n expect(mockSessionEventDispatcher.dispatch).not.toHaveBeenCalled();\n });\n\n it(\"should warn and use minimum polling interval for default device when provided interval is too low\", () => {\n const lowInterval = DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL - 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: lowInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n const expectedMessage = `Polling interval of ${lowInterval} is too low, setting to minimum as ${DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL}`;\n expect(mockLogger.warn).toHaveBeenCalledWith(expectedMessage);\n });\n\n it(\"should warn and use minimum polling interval for NANO_S device when provided interval is too low\", () => {\n const defaultNanoPollingInterval =\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL * 2;\n const lowInterval = defaultNanoPollingInterval - 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: lowInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubNanoSDevice,\n );\n refresher.startRefresher();\n\n const expectedMessage = `Polling interval of ${lowInterval} is too low, setting to minimum as ${defaultNanoPollingInterval}`;\n expect(mockLogger.warn).toHaveBeenCalledWith(expectedMessage);\n });\n\n it(\"should not warn when provided polling interval is valid for default device\", () => {\n const validInterval =\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL + 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: validInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n expect(mockLogger.warn).not.toHaveBeenCalled();\n });\n\n it(\"should dispatch refresh event on timer ticks\", () => {\n const validInterval =\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL + 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: validInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n const timerInterval = validInterval * 2;\n\n vi.advanceTimersByTime(timerInterval * 3);\n\n expect(\n (mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>).mock\n .calls.length,\n ).toBe(4);\n expect(\n (mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>).mock\n .calls[0]![0],\n ).toEqual({\n eventName: SessionEvents.REFRESH_NEEDED,\n });\n });\n\n it(\"should stop refresher\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: 1000,\n };\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n (\n mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>\n ).mockClear();\n\n refresher.stopRefresher();\n vi.advanceTimersByTime(2000);\n\n expect(mockSessionEventDispatcher.dispatch).not.toHaveBeenCalled();\n expect(mockLogger.info).toHaveBeenCalledWith(\"Refresher stopped.\");\n });\n\n it(\"should restart refresher\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: 1000,\n };\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n (\n mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>\n ).mockClear();\n vi.clearAllTimers();\n\n refresher.restartRefresher();\n expect(mockLogger.info).toHaveBeenCalledWith(\"Refresher stopped.\");\n expect(mockLogger.info).toHaveBeenCalledWith(\"Refresher restarted.\");\n\n vi.advanceTimersByTime(2000);\n expect(\n (mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>).mock\n .calls.length,\n ).toBeGreaterThan(0);\n });\n\n it(\"should destroy refresher\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: 1000,\n };\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n refresher.destroy();\n vi.advanceTimersByTime(2000);\n\n expect(mockSessionEventDispatcher.dispatch).not.toHaveBeenCalled();\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,OACxB,OAAS,aAAAC,EAAW,cAAAC,EAAY,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAAC,MAAU,SAEhE,OAAS,iBAAAC,MAAqB,0BAG9B,OACE,qDAAAC,EACA,6CAAAC,MACK,4DAKP,OAAS,iBAAAC,MAAqB,8DAE9B,OACE,0BAAAC,MAEK,2BAEPR,EAAS,yBAA0B,IAAM,CACvC,IAAIS,EACAC,EACAC,EAQJ,MAAMC,EAAoB,CACxB,YAAa,CACX,GAAIR,EAAc,IACpB,CACF,EAEMS,EAAkB,CACtB,YAAa,CACX,GAAIT,EAAc,MACpB,CACF,EAEMU,EAA4BX,EAAG,GAAG,IAAMQ,CAAU,EACxD,IAAII,EAEJhB,EAAW,IAAM,CACfI,EAAG,cAAc,EACjBM,EAAU,IAAIZ,EACda,EAA6B,CAC3B,OAAQ,IAAMD,EAAQ,aAAa,EACnC,SAAUN,EAAG,GAAG,CAClB,EACAQ,EAAa,CACX,KAAMR,EAAG,GAAG,EACZ,KAAMA,EAAG,GAAG,EACZ,MAAOA,EAAG,GAAG,EACb,MAAOA,EAAG,GAAG,EACb,YAAa,CAAC,CAChB,CACF,CAAC,EAEDL,EAAU,IAAM,CACdiB,GAAW,QAAQ,EACnBZ,EAAG,cAAc,EACjBA,EAAG,gBAAgB,CACrB,CAAC,EAEDD,EAAG,yCAA0C,IAAM,CACjD,MAAMc,EAAyC,CAC7C,oBAAqB,GACrB,gBAAiB,GACnB,EAEAD,EAAY,IAAIP,EACdM,EACAE,EACA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describe", "expect", "it", "vi", "DeviceModelId", "DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL", "DEVICE_SESSION_REFRESHER_POLLING_INTERVAL", "SessionEvents", "DeviceSessionRefresher", "subject", "mockSessionEventDispatcher", "mockLogger", "stubDefaultDevice", "stubNanoSDevice", "mockedLoggerModuleFactory", "refresher", "options", "lowInterval", "expectedMessage", "defaultNanoPollingInterval", "validInterval", "timerInterval"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{DeviceSessionStateType as o,DeviceStatus as i,isSuccessCommandResult as v}from"../../../api/index";import{SessionEvents as s}from"../../device-session/model/DeviceSessionEventDispatcher";class d{constructor(e,n,a,c,r){this._sessionEventDispatcher=n;this._connectedDevice=a;this._deviceState=c;this.setDeviceSessionState=r;this._subscription=this._sessionEventDispatcher.listen().subscribe(t=>this.mapEventAction(t)),this._logger=e("device-session-state-handler")}_subscription;_logger;_updateDeviceState(e){const n=this._parseDeviceStatus(e);if(n){const{sessionStateType:a,deviceStatus:c,currentApp:r}=n,t=this._deviceState.getValue();t.sessionStateType===o.Connected?this.setDeviceSessionState({sessionStateType:a,deviceStatus:c,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:r,installedApps:[],isSecureConnectionAllowed:!1}):this.setDeviceSessionState({...t,sessionStateType:a,deviceStatus:c,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:r})}}mapEventAction=e=>{switch(e.eventName){case s.COMMAND_SUCCEEDED:return this._updateDeviceState(e.eventData);case s.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:i.BUSY});case s.DEVICE_STATE_UPDATE_LOCKED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:i.LOCKED});case s.DEVICE_STATE_UPDATE_CONNECTED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:i.CONNECTED});default:return null}};_parseDeviceStatus(e){return v(e)?{sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:e.data.name,version:e.data.version}}:(this._logger.debug("Error while parsing APDU response",{data:{parsedResponse:e}}),null)}unsubscribe(){this._subscription.unsubscribe()}}export{d as DeviceSessionStateHandler};
|
2
|
+
//# sourceMappingURL=DeviceSessionStateHandler.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.ts"],
|
4
|
+
"sourcesContent": ["import { type BehaviorSubject, type Subscription } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n DeviceSessionStateType,\n DeviceStatus,\n type GetAppAndVersionResponse,\n isSuccessCommandResult,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport { type CommandResult, type LoggerPublisherService } from \"@api/types\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport type SetDeviceSessionStateFn = (state: DeviceSessionState) => void;\n\ntype NewDeviceStatus = {\n sessionStateType: DeviceSessionStateType;\n deviceStatus: DeviceStatus;\n currentApp: {\n name: string;\n version: string;\n };\n};\n\nexport class DeviceSessionStateHandler {\n private _subscription: Subscription;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n private _connectedDevice: TransportConnectedDevice,\n private _deviceState: BehaviorSubject<DeviceSessionState>,\n private setDeviceSessionState: SetDeviceSessionStateFn,\n ) {\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe((event) => this.mapEventAction(event));\n this._logger = loggerModuleFactory(\"device-session-state-handler\");\n }\n\n private _updateDeviceState(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): void {\n const newDeviceStatus = this._parseDeviceStatus(parsedResponse);\n\n if (newDeviceStatus) {\n const { sessionStateType, deviceStatus, currentApp } = newDeviceStatus;\n const state = this._deviceState.getValue();\n if (state.sessionStateType === DeviceSessionStateType.Connected) {\n // When device is connected, initialize fields to default values\n this.setDeviceSessionState({\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n } else {\n // When device is ready, keep un-modified state fields\n this.setDeviceSessionState({\n ...state,\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n });\n }\n }\n }\n\n private mapEventAction = (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.COMMAND_SUCCEEDED:\n return this._updateDeviceState(event.eventData);\n case SessionEvents.DEVICE_STATE_UPDATE_BUSY:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.BUSY,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_LOCKED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.LOCKED,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_CONNECTED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.CONNECTED,\n });\n default:\n return null;\n }\n };\n\n private _parseDeviceStatus(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): NewDeviceStatus | null {\n if (isSuccessCommandResult(parsedResponse)) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: parsedResponse.data.name,\n version: parsedResponse.data.version,\n },\n };\n } else {\n this._logger.debug(\"Error while parsing APDU response\", {\n data: { parsedResponse },\n });\n return null;\n }\n }\n\n public unsubscribe(): void {\n this._subscription.unsubscribe();\n }\n}\n"],
|
5
|
+
"mappings": "AAGA,OACE,0BAAAA,EACA,gBAAAC,EAEA,0BAAAC,MAEK,aAEP,OAGE,iBAAAC,MACK,8DAaA,MAA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C,CACL,iBAAkBX,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,WAAY,CACV,KAAMU,EAAe,KAAK,KAC1B,QAASA,EAAe,KAAK,OAC/B,CACF,GAEA,KAAK,QAAQ,MAAM,oCAAqC,CACtD,KAAM,CAAE,eAAAA,CAAe,CACzB,CAAC,EACM,KAEX,CAEO,aAAoB,CACzB,KAAK,cAAc,YAAY,CACjC,CACF",
|
6
|
+
"names": ["DeviceSessionStateType", "DeviceStatus", "isSuccessCommandResult", "SessionEvents", "DeviceSessionStateHandler", "loggerModuleFactory", "_sessionEventDispatcher", "_connectedDevice", "_deviceState", "setDeviceSessionState", "event", "parsedResponse", "newDeviceStatus", "sessionStateType", "deviceStatus", "currentApp", "state"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{BehaviorSubject as p,Subject as C}from"rxjs";import{expect as e}from"vitest";import{CommandResultStatus as u,DeviceModelId as S,DeviceSessionStateType as r,DeviceStatus as a}from"../../../api/index";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionStateHandler as D}from"./DeviceSessionStateHandler";describe("DeviceSessionStateHandler",()=>{let t,v,c;const E=vi.fn(()=>c);let l,d,n,o;beforeEach(()=>{t=new C,v={listen:()=>t,dispatch:vi.fn()},c={error:vi.fn(),debug:vi.fn()},l={deviceModel:{id:"device-model-1"}},d=new p({sessionStateType:r.Connected,deviceStatus:a.CONNECTED,deviceModelId:S.NANO_X}),n=vi.fn(),o=new D(E,v,l,d,n)}),afterEach(()=>{o&&typeof o.unsubscribe=="function"&&o.unsubscribe()}),it("updates device state on COMMAND_SUCCEEDED event with a successful response",()=>{const s={data:{name:"TestApp",version:"1.0.0"},status:u.Success};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(n).toHaveBeenCalledWith({sessionStateType:r.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1})}),it("updates device state on COMMAND_SUCCEEDED event when device is ready",()=>{d.next({sessionStateType:r.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,deviceModelId:S.NANO_X,currentApp:{name:"",version:""},installedApps:["Bitcoin","Ethereum"],isSecureConnectionAllowed:!0});const s={data:{name:"TestApp",version:"1.0.0"},status:u.Success};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(n).toHaveBeenCalledWith({sessionStateType:r.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:["Bitcoin","Ethereum"],isSecureConnectionAllowed:!0})}),it("updates device state on DEVICE_STATE_UPDATE_BUSY event",()=>{t.next({eventName:i.DEVICE_STATE_UPDATE_BUSY}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:a.BUSY}))}),it("updates device state on DEVICE_STATE_UPDATE_CONNECTED event",()=>{t.next({eventName:i.DEVICE_STATE_UPDATE_CONNECTED}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:a.CONNECTED}))}),it("logs error and does not update state if command result is unsuccessful",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(c.debug).toHaveBeenCalledWith("Error while parsing APDU response",{data:{parsedResponse:s}}),e(n).not.toHaveBeenCalled()}),it("does not update state if command result is not a success",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(n).not.toHaveBeenCalled()})});
|
2
|
+
//# sourceMappingURL=DeviceSessionStateHandler.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.test.ts"],
|
4
|
+
"sourcesContent": ["import { BehaviorSubject, Subject } from \"rxjs\";\nimport { expect, type Mock } from \"vitest\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n CommandResultStatus,\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@api/index\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\n\nimport {\n DeviceSessionStateHandler,\n type SetDeviceSessionStateFn,\n} from \"./DeviceSessionStateHandler\";\n\ndescribe(\"DeviceSessionStateHandler\", () => {\n let fakeEventSubject: Subject<NewEvent>;\n let fakeSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: {\n error: (message: string, meta?: Record<string, unknown>) => void;\n debug: (message: string, meta?: Record<string, unknown>) => void;\n };\n const mockLoggerModuleFactory = vi.fn(() => mockLogger);\n let fakeConnectedDevice: { deviceModel: { id: string } };\n let deviceState: BehaviorSubject<DeviceSessionState>;\n let setDeviceSessionState: Mock<SetDeviceSessionStateFn>;\n let handler: DeviceSessionStateHandler;\n\n beforeEach(() => {\n fakeEventSubject = new Subject<NewEvent>();\n //@ts-expect-error mock\n fakeSessionEventDispatcher = {\n listen: () => fakeEventSubject,\n dispatch: vi.fn(),\n };\n\n mockLogger = {\n error: vi.fn(),\n debug: vi.fn(),\n };\n\n fakeConnectedDevice = {\n deviceModel: {\n id: \"device-model-1\",\n },\n };\n\n deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n });\n\n setDeviceSessionState = vi.fn();\n\n handler = new DeviceSessionStateHandler(\n //@ts-expect-error mock\n mockLoggerModuleFactory,\n fakeSessionEventDispatcher,\n fakeConnectedDevice,\n deviceState,\n setDeviceSessionState,\n );\n });\n\n afterEach(() => {\n if (handler && typeof handler.unsubscribe === \"function\") {\n handler.unsubscribe();\n }\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event with a successful response\", () => {\n // Given\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event when device is ready\", () => {\n // Given\n deviceState.next({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n currentApp: { name: \"\", version: \"\" },\n installedApps: [\"Bitcoin\", \"Ethereum\"] as unknown as Application[],\n isSecureConnectionAllowed: true,\n });\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [\"Bitcoin\", \"Ethereum\"] as unknown as Application[],\n isSecureConnectionAllowed: true,\n });\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_BUSY event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.BUSY }),\n );\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_CONNECTED event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.CONNECTED }),\n );\n });\n\n it(\"logs error and does not update state if command result is unsuccessful\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(mockLogger.debug).toHaveBeenCalledWith(\n \"Error while parsing APDU response\",\n { data: { parsedResponse: fakeErrorCommandResult } },\n );\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n\n it(\"does not update state if command result is not a success\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,EAAiB,WAAAC,MAAe,OACzC,OAAS,UAAAC,MAAyB,SAGlC,OACE,uBAAAC,EACA,iBAAAC,EACA,0BAAAC,EACA,gBAAAC,MACK,aACP,OAGE,iBAAAC,MACK,8DAGP,OACE,6BAAAC,MAEK,8BAEP,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EACAC,EACAC,EAIJ,MAAMC,EAA0B,GAAG,GAAG,IAAMD,CAAU,EACtD,IAAIE,EACAC,EACAC,EACAC,EAEJ,WAAW,IAAM,CACfP,EAAmB,IAAIR,EAEvBS,EAA6B,CAC3B,OAAQ,IAAMD,EACd,SAAU,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AAe,iBACf,WAAY,CAAE,KAAM,UAAW,QAAS,OAAQ,EAChD,cAAe,CAAC,UAAW,UAAU,EACrC,0BAA2B,EAC7B,CAAC,CACH,CAAC,EAED,GAAG,yDAA0D,IAAM,CAEjEG,EAAiB,KAAK,CACpB,UAAWF,EAAc,wBAC3B,CAAC,EAGDL,EAAOa,CAAqB,EAAE,qBAC5Bb,EAAO,iBAAiB,CAAE,aAAcI,EAAa,IAAK,CAAC,CAC7D,CACF,CAAC,EAED,GAAG,8DAA+D,IAAM,CAEtEG,EAAiB,KAAK,CACpB,UAAWF,EAAc,6BAC3B,CAAC,EAGDL,EAAOa,CAAqB,EAAE,qBAC5Bb,EAAO,iBAAiB,CAAE,aAAcI,EAAa,SAAU,CAAC,CAClE,CACF,CAAC,EAED,GAAG,yEAA0E,IAAM,CAEjF,MAAMY,EAAyB,CAC7B,KAAM,KACN,MAAO,CAAE,KAAM,gBAAiB,CAClC,EAGAT,EAAiB,KAAK,CACpB,UAAWF,EAAc,kBAEzB,UAAWW,CACb,CAAC,EAGDhB,EAAOS,EAAW,KAAK,EAAE,qBACvB,oCACA,CAAE,KAAM,CAAE,eAAgBO,CAAuB,CAAE,CACrD,EACAhB,EAAOa,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,EAED,GAAG,2DAA4D,IAAM,CAEnE,MAAMG,EAAyB,CAC7B,KAAM,KACN,MAAO,CAAE,KAAM,gBAAiB,CAClC,EAGAT,EAAiB,KAAK,CACpB,UAAWF,EAAc,kBAEzB,UAAWW,CACb,CAAC,EAGDhB,EAAOa,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,CACH,CAAC",
|
6
|
+
"names": ["BehaviorSubject", "Subject", "expect", "CommandResultStatus", "DeviceModelId", "DeviceSessionStateType", "DeviceStatus", "SessionEvents", "DeviceSessionStateHandler", "fakeEventSubject", "fakeSessionEventDispatcher", "mockLogger", "mockLoggerModuleFactory", "fakeConnectedDevice", "deviceState", "setDeviceSessionState", "handler", "fakeCommandResult", "fakeErrorCommandResult"]
|
7
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class
|
1
|
+
import{bufferToHexaString as e}from"../../../api/index";class d{_header;_data;constructor({header:t,data:r}){this._header=t,this._data=r}toString(){return JSON.stringify({header:this._header.toString(),data:e(this._data)},null,2)}getRawData(){const t=this._header.getRawData(),r=new Uint8Array(t.length+this._data.length);return r.set(t,0),r.set(this._data,t.length),r}getHeader(){return this._header}getData(){return this._data}}export{d as Frame};
|
2
2
|
//# sourceMappingURL=Frame.js.map
|